Function GetLogicScheme( ByVal nRlyGrp&, ByRef nSchemeHnd& ) As Long
Purpose: Get handle of the next logic scheme in a relay group.
Works in: OneLiner only.
Parameters:
nRlyGrp [in] relay group handle.
nSchemeHnd [int/out] logic scheme handle.
Return value:
1 success
-1 already at the last scheme in the relay group
0 failure
Remarks: Set nSchemeHnd to zero to get the handle to the first scheme in the group.
Example:
Sub main()
' Get picked object number
If GetEquipment( TC_PICKED, ObjHnd ) = 0 Or EquipmentType( ObjHnd ) <> TC_RLYGROUP Then
Print "No relay group is selected."
Exit Sub
End If
schemeCount = 0
schemeHnd = 0
While GetScheme( ObjHnd, schemeHnd ) > 0
schemeCount = schemeCount + 1
If GetData( schemeHnd, LS_sID, sID$ ) = 0 Then GoTo hasError
If GetData( schemeHnd, LS_sAssetID, sAssetID$ ) = 0 Then GoTo hasError
If GetData( schemeHnd, LS_sScheme, sSchemeType$ ) = 0 Then GoTo hasError
If GetData( schemeHnd, LS_sEquation, sEquation$ ) = 0 Then GoTo hasError
If GetData( schemeHnd, LS_sVariables, sVars$ ) = 0 Then GoTo hasError
If GetData( schemeHnd, LS_nRlyGrpHnd, nRlyGroupHnd& ) = 0 Then GoTo hasError
Print "Scheme found: " & Chr(13) & _
sID & "@" & FullBranchName( nRlyGroupHnd ) & Chr(13) & _
"AssetID = " & sAssetID & Chr(13) & _
"Type = " & sSchemeType & Chr(13) & _
"Equation = " & sEquation & Chr(13) & _
sVars & Chr(13)
Wend
Print "Found total schemes: ", schemeCount
Stop
hasError:
Print "Error: " + ErrorString()
End Sub