P&ID - Component & route as Main or Called

Introduction

A given component can be represented in multiple sheets inside the same P&ID Layout or in another P&ID.

You must indicate which P&ID sheet is responsible of the definition of this component and which P&ID sheet is just representing the component to connect to but is not the owner the this component. 

In 3D experience there is an attribute on the symbol (when compenent is placed in a diagram view) named "Representation Mode" with possible 2 values "Main" or "Called

This will allow to distinguish , if the same component is placed in 2 diferent P&ID Sheet, which one is the "master"

In most of the case the "Main" is the symbol that is represented into a Sheet that belong to the same Parent than the Component itseft ; in other word it meens that the component belong to the same system than the sheet in which it is represented 

but it can also happens that the component is represented in 2 differents sheet of the same P&ID and you want to specify which sheet is the owner for the definition of the component

Automation

Automatically set the Representation mode "Main" or "Called"

Business rule to set the representation mode Main or Called (Datasetup App)

The "Rule to Define if a Representation is Main or Called" (Schematic_GetRepresentationMode) Business Rule lets you decide whether the symbol or the route placed in view for a logical object is the main or called representation.

Use case1:

In the bellow rule we are checking if the sheet and the component are sharing the same Object_System (Parent). if yes then the set the symbol attribute to "Main"

Video

 

Code

/* Rule to Define if a Representation is Main or Called (Schematic_GetRepresentationMode) */
/* ThisObject: LogicalOccurrence */

let output_Is_Main(Boolean)
set output_Is_Main = true
let SheetSystemOcc(LogicalOccurrence)
let ObjectSystem(Feature)
set SheetSystemOcc = Parameters.GetAttributeObject("Sheet_System")
set ObjectSystem = Parameters.GetAttributeObject("Object_System")
if(SheetSystemOcc.Name <> ObjectSystem.Name)
{
    set output_Is_Main = false
}
Parameters.SetAttributeBoolean("Is_Main", output_Is_Main)

 

Automatically set the graphic reprentation according "Main" or Called"

Business Rule to set graphic properties based on Main or called  (Datasetup App)

Additionally to the previous BR, Schematic_GetSymbol_GraphicAttr_FromRepMode BR allows to set graphic properties on the Symbols or routes based on the main and called representations' graphics properties :

Use case1:

In the bellow rule if the component is "Main" then it color depends on the lineID Fluid value else if it is "Called" then object will be in grey dash line

Video

Code

/* Rule to apply graphic properties on the Symbols or routes 
  Rule to Choose a Representation (Schematic_GetSymbol_GraphicAttr_FromRepMode)
  INPUT : ThisObject (LogicalOccurrence) */
let logPipeOcc(PipLogicalPipeOcc)
let LineList(List)
let LineOcc(LogicalOccurrence)
let LineRef(RFLVPMLogicalReference)
let NameFluidLine(String)
let Rvalue, Gvalue, Bvalue, LineType, LineThickness(Integer)
let RGBvalueString(String)
let LGraphicAttrValues(List)
let LRGB(List)
let LGraphicAttrNames(List)
LGraphicAttrNames.Append("Sch_LineColor")
LGraphicAttrNames.Append("Sch_LineThickness")
LGraphicAttrNames.Append("Sch_LineType")
Let bIsMain(Boolean)
set bIsMain = Parameters.GetAttributeBoolean("Is_Main")
if(true == bIsMain)
{
    //Notify("Is_Main")
    if(ThisObject.IsASortOf("PipLogicalPipeOcc"))
    {
        //Notify("Schematic_GetSymbol_GraphicAttr_FromRepMode Color Pipe")
        // Found line id of the pipe
        set logPipeOcc=ThisObject
        ListLogicalLineFromMember (logPipeOcc,LineList)
        
        if(LineList.Size() > 0)
        {
            set LineOcc = LineList.GetItem(1)
            set LineRef = LineOcc.Reference
            NameFluidLine=LineRef->GetAttributeString("V_Fluid")
        }
        
        if(NameFluidLine <> "")
        {
            //Notify("NameFluidLine : -#-", NameFluidLine)
            
            let FluidList, FluidColorList(List)
            let icolor(Integer)
            FluidList = List("Cooling Water","Waste Water","Fire Water","Potable Water","Bilge Water","Sewage Water","Fresh Cold Water","Fresh Hot Water","Condensate","Sea Water","Utility Water","Compressed Air","Ventilation Air","Air Conditionning","Bleed Air","Warm Air","Cold Air","Dry Steam","Wet Steam","Steam","Effluent Gas","Refinery Gas","Hydrogen","Hydraulic Oil","Lubricating Oil","Hydrocarbon","Fuel Oil","Residuals","Crude Oil","Naphtha","Gasoline","Kerosene","Gas Oil","Chlorine","Acid","Caustic")
            FluidColorList = List("0;191;255","139;69;19","255;50;50","0;0;255","105;105;105","165;42;42","153;204;0","0;128;0","173;216;230","0;85;148","0;191;255","240;248;255","255;255;255","224;255;255","255;228;196","255;165;0","173;216;230","211;211;211","169;169;169","211;211;211","128;128;128","255;215;0","255;255;224","139;69;19","255;215;0","0;0;0","165;42;42","85;107;47","0;0;0","255;222;173","255;215;0","255;165;0","165;42;42","144;238;144","255;0;0","0;0;255")
            
            icolor = FluidList.IndexOf(NameFluidLine, 1)
            
            //Notify("icolor : #", icolor)
            
            if(icolor > 0)
            {
                let iR, iG, Lcolor (Integer)
                let RvalueString, GvalueString, BvalueString(String)
                RGBvalueString = FluidColorList[icolor]
                
                //Notify("RGBvalueString : #", RGBvalueString)
                
                Lcolor = RGBvalueString->Length()
                iR = RGBvalueString->Search(";") 
                RvalueString = RGBvalueString->Extract(0,iR)
                iG = RGBvalueString->Search(";",iR+1) 
                GvalueString = RGBvalueString->Extract(iR+1,iG-iR-1)
                BvalueString = RGBvalueString->Extract(iG+1,Lcolor-iG-1)
                
                /* Find Color from Table */
                Rvalue=int(RvalueString->ToReal())
                Gvalue=int(GvalueString->ToReal())
                Bvalue=int(BvalueString->ToReal())
                LineType=1
                LineThickness=2
                LRGB.Append(Rvalue)
                LRGB.Append(Gvalue)
                LRGB.Append(Bvalue)
                LGraphicAttrValues.Append(LRGB)
                LGraphicAttrValues.Append(LineThickness)
                LGraphicAttrValues.Append(LineType)
                        
                Parameters.SetAttributeObject("List_Visualization_Attr_Names", LGraphicAttrNames)
                Parameters.SetAttributeObject("List_Visualization_Attr_Values" , LGraphicAttrValues)
            }
        }
    }
}
else
{
    //Notify("Is_Called")
    // Grey and dotted
    LRGB.Append(190)
    LRGB.Append(190)
    LRGB.Append(190)
    LGraphicAttrValues.Append(LRGB)
    LGraphicAttrValues.Append(2)
    LGraphicAttrValues.Append(2)
    
    Parameters.SetAttributeObject("List_Visualization_Attr_Names", LGraphicAttrNames)
    Parameters.SetAttributeObject("List_Visualization_Attr_Values" , LGraphicAttrValues)
}