Rule Example 1
Description
In the following sample, the rule compares the system name of sheet with the system name of logical object.
- The system Name of the Sheet is retrieve from the Name of the logical father reference that contain the sheet/view where the object is represented
- The system name of the placed logical object is taken from the V_description attribute of object logical instance.
- If they are identical, then it returns main representation else it returns called representation
Rule
let ThisOccObject (LogicalOccurrence)
set ThisOccObject = ThisObject
Let output_Is_Main(Boolean)
set output_Is_Main = true
// retrieve Sheet Logical Occ / Ref parent
let SheetSystemOcc(LogicalOccurrence)
set SheetSystemOcc = Parameters.GetAttributeObject ("Sheet_System")
let SystemSheetRef(RFLVPMLogicalReference)
set SystemSheetRef = SheetSystemOcc.Reference
// retrieve placed object status
Let IsMainAlreadyPlace(Boolean)
set IsMainAlreadyPlace = Parameters.GetAttributeBoolean ("Is_Main_Already_Placed")
if(NULL <> SystemSheetRef)
{
let SystemSheetName(string)
set SystemSheetName = SystemSheetRef.Name
let ObjectInstance(RFLVPMLogicalInstance)
set ObjectInstance = ThisOccObject.Instance
if(NULL <> ObjectInstance)
{
let SystemObjectName(string)
set SystemObjectName = ObjectInstance.GetAttributeString("V_description")
if(SystemObjectName == "" OR (SystemObjectName == SystemSheetName AND IsMainAlreadyPlace == FALSE))
set output_Is_Main = true
else
set output_Is_Main = false
}
}
Parameters.SetAttributeBoolean("Is_Main", output_Is_Main)
