Variables koleksiyonu, bir değişkenin tanımlanmış tüm sınır değerlerini içerir.
| Ortam | Kullanılabilirlik |
|---|---|
| Engineering Studio | Kullanılabilir |
| Service Engine | Kullanılabilir |
| VBA | Kullanılabilir |
| VSTA | Kullanılabilir |
C#
public void MacroLimit()
{
IVariable zenonVariable = this.Variables().Item("WIZ_VAR_10");
//Get the first limit of a specified variable
ILimit zenonLimit = zenonVariable.Limits().Item(0);
System.Diagnostics.Debug.Print("Text: " + zenonLimit.Text);
System.Diagnostics.Debug.Print("Value: " + zenonLimit.Value);
System.Diagnostics.Debug.Print("AlarmClass: " + zenonLimit.AlarmClass);
System.Diagnostics.Debug.Print("AlarmGroup: " + zenonLimit.AlarmGroup);
string[] enumDynProp = (string[])zenonLimit.get_DynPropertiesEnum("");
foreach (string item in enumDynProp)
{
string propertyName = item.Split(',')[0];
//Note: This just prints the ToString() method of each dynamic property
//If you want to use the objects you want to look up the object type and
//cast the dynamic property
System.Diagnostics.Debug.Print(propertyName +" = " +
zenonLimit.get_DynProperties(propertyName));
}
}
VB.NET
Public Sub MacroLimit()
Dim zenonVariable As IVariable = Me.Variables().Item("WIZ_VAR_10")
'Get the first limit of a specified variable
Dim zenonLimit As ILimit = zenonVariable.Limits().Item(0)
System.Diagnostics.Debug.Print("Text: " + zenonLimit.Text)
System.Diagnostics.Debug.Print("Value: " + zenonLimit.Value)
System.Diagnostics.Debug.Print("AlarmClass: " + zenonLimit.AlarmClass)
System.Diagnostics.Debug.Print("AlarmGroup: " + zenonLimit.AlarmGroup)
Dim enumDynProp As String() = DirectCast(zenonLimit.get_DynPropertiesEnum(""), String())
For Each item As String In enumDynProp
Dim propertyName As String = item.Split(","C)(0)
'Note: This just prints the ToString() method of each dynamic property
'If you want to use the objects you want to look up the object type and
'cast the dynamic property
System.Diagnostics.Debug.Print((propertyName & Convert.ToString(" = ")) + zenonLimit.get_DynProperties(propertyName))
Next
End Sub
VBA
Public Sub zenOn_Limit()
Dim zVAR As Variable
Dim zLimit As Limit
Dim vDynProps As Variant
Dim strDynProp As String
'set variable object to get the limits collection
Set zVAR = thisProject.Variables.Item("WIZ_VAR_10")
'set limit object
Set zLimit = zVAR.Limits.Item(0)
'read all Default Properties from a limit
With zLimit
'generate some output information
Debug.Print "Text: " & .Text
Debug.Print "Value: " & .Value
Debug.Print "AlarmClass: " & .AlarmClass
Debug.Print "AlarmGroup: " & .AlarmGroup
End With
'read all DynProperties from a limit
vDynProps = zLimit.DynPropertiesEnum("")
For Each strItem In vDynProps
strDynProp = Mid(strItem, 1, InStr(1, strItem, ",") - 1)
Debug.Print "--------------------"
Debug.Print strItem
Debug.Print zLimit.DynProperties(strDynProp)
Next
End SubBu konuda sorunuz mu var?SGE AI bu sayfaya ve ilgili yardım konularına dayanarak yanıtlar.
Bu bölümdeki konular
Bu sayfa, COPA-DATA zenon 16 çevrimiçi yardımının Türkçe çevirisidir. Menü ve ayar adları, programdaki gibi bulmanız için İngilizce bırakılmıştır.