EKL - BL to get symbol and graphic attributes

Introduction

Usage : drives the symbol to be used during the placement and also apply graphic properties on the Symbols or routes based on the main and called representations' graphics properties. Main and Called Representations can have different graphic properties

Datasetup Resource Set : 

  • Diagram Resource

Datasetup Resource : Rule to get symbol and graphic attributes

 

Rule Example 1 - Change symbol rep from attribute value

Description

The rule retrieve the value of the V_PredefinedPartType attribute set on the component instance and select the symbol to be displayed with same name

Pre-req and context

this example was made to have an unique Generic logical component for any valve with multiple symbol

the valve symbol to be display is driven by the BL; it can be based :

  • on the Logical Reference Logical Part Subtype attribute
  • or like here on the Logical instance Predefined physical Part subtype 

Need to have multiple symbol with names that match with the values in the Part subtype techno table list 

Rule

/* ThisObject : LogicalOccurrence */

Let SymbolRep(String)
Let ThisInstance (RFLVPMLogicalInstance)
set ThisInstance = ThisObject.Instance

//Get monitored attribute/attributes 
if (ThisInstance.HasAttribute("V_PredefinedPartType") == true )
{

  SymbolRep = ThisInstance.GetAttributeString("V_PredefinedPartType")
}

 Parameters->SetAttributeString("Symbol_Name", SymbolRep)

3DXML

 

Rule Example 2 - Change Symbol Rep id Main or Called

Description

 the rule returns a different symbol name and graphic attributes for main and called representations

  • for MainSymbol : color=0,255,0 ; linethickness=2 ; linetype=1
  • for CalledSymbol : color=255,0,0 ; linethickness=5 ; linetype=3

Pre-req

Component must have 2 different symbols with name = "MainSymbol" and  "CalledSymbol"

Rule

Let sSymbolName(string)
Let LGraphicAttrNames(list)
LGraphicAttrNames.Append("Sch_LineColor")
LGraphicAttrNames.Append("Sch_LineThickness")
LGraphicAttrNames.Append("Sch_LineType")
Let LGraphicAttrValues(list)
Let LRGB(list)
Let bIsMain(Boolean)
set bIsMain = Parameters.GetAttributeBoolean("Is_Main")
if(true == bIsMain)
{
                set sSymbolName="MainSymbol"
                LRGB.Append(0)
                LRGB.Append(255)
                LRGB.Append(0)
                LGraphicAttrValues.Append(LRGB)
                LGraphicAttrValues.Append(2)
                LGraphicAttrValues.Append(1)
}
else if(false == bIsMain)
{
                set sSymbolName="CalledSymbol"
                LRGB.Append(255)
                LRGB.Append(0)
                LRGB.Append(0)
                LGraphicAttrValues.Append(LRGB)
                LGraphicAttrValues.Append(5)
                LGraphicAttrValues.Append(3)
}
Parameters.SetAttributeString("Symbol_Name", sSymbolName)
Parameters.SetAttributeObject("List_Visualization_Attr_Names", LGraphicAttrNames)
Parameters.SetAttributeObject("List_Visualization_Attr_Values" , LGraphicAttrValues)

 

Rule Example 3 - Color pipe line according LineID fluid

Description

Set LineType / color / of logical route  .. based on parent LineID Fluid

logical pipe can be attached to a piping LineID or/and a instrument LineID

Pre-Req

Fluid values in the BR must respect the Fluid techno table values  

Rule

// ThisObject --> LogicalOccurence

let Inst(Piping_Logical_Pipe_Inst)
let Occ(PipLogicalPipeOcc)
let Ref(Piping_Logical_Pipe)
let LineList(List)
let Line1Name(string)
let Line2Name(string)
let LineOcc(LogicalOccurrence)
let LineRef(RFLVPMLogicalReference)
let LineID1Fluid(String)
let LineID2Fluid(String)

// set Inst=ThisObject.Instance
set Occ=ThisObject
set Ref=ThisObject.Reference

ListLogicalLineFromMember (Occ,LineList)
if(LineList.Size() > 0)
{
                LineOcc = LineList.GetItem(1)
                set LineRef = LineOcc.Reference
                LineID1Fluid=LineRef->GetAttributeString("V_Fluid") 
                }

// logical pipe is associated to a second lineID like an instrumentLine
ListLogicalLineFromMember (Occ,LineList)
if(LineList.Size() > 1)
                {
                LineOcc = LineList.GetItem(2)
                set LineRef = LineOcc.Reference
                LineID2Fluid=LineRef->GetAttributeString("V_Fluid") 
                }

//Set graphic Properties
Let LGraphicAttrNames(list)
LGraphicAttrNames.Append("Sch_LineColor")
LGraphicAttrNames.Append("Sch_LineThickness")
LGraphicAttrNames.Append("Sch_LineType")
Let LGraphicAttrValues(list)
Let LRGB(list)

// If (Ref->IsASortOf("Piping_Logical_Pipe"))
// {
                If (LineID1Fluid=="Cooling Water")
                {
                // Color
                LRGB.Append(0)
                LRGB.Append(0)
                LRGB.Append(255)
                LGraphicAttrValues.Append(LRGB)
                // Thickness               
                LGraphicAttrValues.Append(2)
                // Type
                LGraphicAttrValues.Append(2)
                }
                else if(LineID1Fluid=="Hot Water" or LineID2Fluid=="Hot Water")
                {
                // Color
                LRGB.Append(255)
                LRGB.Append(128)
                LRGB.Append(0)
                LGraphicAttrValues.Append(LRGB)
                // Thickness               
                LGraphicAttrValues.Append(2)
                // Type
                LGraphicAttrValues.Append(9)
                }
                else
                {
                // Color
                LRGB.Append(0)
                LRGB.Append(0)
                LRGB.Append(0)
                LGraphicAttrValues.Append(LRGB)
                // Thickness               
                LGraphicAttrValues.Append(2)
                // Type
                LGraphicAttrValues.Append(1)
                }

Parameters.SetAttributeObject("List_Visualization_Attr_Names", LGraphicAttrNames)
Parameters.SetAttributeObject("List_Visualization_Attr_Values" , LGraphicAttrValues)
//}

instead of hardcoding the fluid name in the BR , you can modify the Fluid technotable to specify graphic properties in it for Schematic. bellow exemple  done for similar but for 3D coloring 

https://r1132100503382-eu1-3dswym.3dexperience.3ds.com/community/swym:prd:R1132100503382:community:6?content=swym:prd:R1132100503382:wikitree:Gvbdu0MFQDSakANT_GH73g

 

Rule Example 4 - Color Ports if connected or not to pipe/duct

Description

ports on component will be collored in green if it is connected to a logicalpipe or logical Duct , 

if it is not connected it will be in Red

Rule

/* ThisObject = RFLVPMLogicalPort */

let Port(RFLVPMLogicalPort)

set Port = ThisObject

if(Port.IsASortOf("Piping_Logical_Port"))
{    
    /*Port is green if it is considered as a end of a pipe (End1 or End 2)*/
    if((Port.IsASortOf("Piping_Logical_Port_End1")) OR (Port.IsASortOf("Piping_Logical_Port_End2")))    
    {
        Parameters -> SetAttributeString("ContourLineColor","0|255|0")
    }
    else
    /*Port is red if it is not considered as a end of a pipe*/
    {
        Parameters -> SetAttributeString("ContourLineColor","255|0|0")
    }
}

else if(Port.IsASortOf("HVAC_Logical_Port"))
{    
    /*Port is green if it is considered as a end of a pipe (End1 or End 2)*/
    if((Port.IsASortOf("HVAC_Logical_Port_End1")) OR (Port.IsASortOf("HVAC_Logical_Port_End2")))    
    {
        Parameters -> SetAttributeString("ContourLineColor","0|255|0")
    }
    else
    /*Port is red if it is not considered as a end of a pipe*/
    {
        Parameters -> SetAttributeString("ContourLineColor","255|0|0")
    }
}