General InformationThis opening ID is invoked when using the Piping Spool Isometrics or the Piping Orthogonal Drawings command. During the creation of the drawing, for each straight pipe in the spool, a BR is called for that straight pipe to retrieve the following customer data:
The business rule provides the following as input parameters:
Input ObjectsInput objects must be of the following types:
SampleThe following sample describes the input parameters and output parameters. Use the sample to define the business rule in the resource set. As input to the BR will be provided: VPMOccurrence of the Rigid Pipe.
/*--------------------------------------------------------------------------*/ /* Rule name: CAAAITACPipeStraightBusinessRules1 */ /* */ /* Sample rule for retrieving the bending process parameters on a straight */ /* pipe. */ /* */ /* Input Arguments */ /* ThisObject = FactType ProductOccurrence */ /* */ /* Input Parameters */ /* ObjectAtStart = Occurrence connected at start */ /* ObjectAtEnd = Occurrence connected at end */ /* */ /* Output Paremeters (all lengths to be in mm) */ /* FieldLengthStart = real, extra length needed for field assembly */ /* at the start of the pipe (at node 1) */ /* this length is optional (typically 0.0) */ /* FieldLengthEnd = real, extra length needed for field assembly */ /* at the end of the pipe (at last node 2) */ /* this length is optional (typically 0.0) */ /* FabricationLength = real, total length including extra length for */ /* field lengths. */ /* If 0.0 is returned, software will compute it */ /* using formula below */ /* FabricationRemarkStart = string, remark to appear on the drawing at */ /* start of the pipe. e.g. "FW" if field weld */ /* or "EXTRA=" to indicate extra length. */ /* FabricationRemarkEnd = string, remark to appear on the drawing at */ /* end of the pipe. e.g. "FW" if field weld */ /* or "EXTRA=" to indicate extra length. */ /* The remarks are appended automatically with */ /* the amount if non zero. */ /* */ /* */ /* FabricationLength = DesignLength + FieldLengthStart + FieldLengthEnd */ /* */ /* */ /* Data may be read from attributes on the pipe reference or by accessing*/ /* customer specific knowledge resource table dynamically. */ /*--------------------------------------------------------------------------*/ Let PipeOcc(ProductOccurrence) Let PipeRef(VPMReference) Let PipeIns(VPMInstance) /* pipe reference data */ Let dblFieldLengthStart(Real) Let dblFieldLengthEnd(Real) Let dblFabricationLength(Real) Let dblDesignLength(Real) Let strFabRemarkStart(String) Let strFabRemarkEnd(String) /* ports of the pipe */ Let Ports(List) Let MyFeature(Feature) Let Port1(Piping_PipeXPort) Let Port2(Piping_PipeXPort) Let i (Integer) /* parts connected at end1 and end2 */ Let PipeOccStart(ProductOccurrence) Let PipeRefStart(VPMReference) Let PipeInsStart(VPMInstance) Let PipeOccEnd(ProductOccurrence) Let PipeRefEnd(VPMReference) Let PipeInsEnd(VPMInstance) /* initialize */ PipeOcc=NULL PipeRef=NULL PipeIns=NULL strFabRemarkStart="" strFabRemarkEnd="" dblFieldLengthStart=0.0 dblFieldLengthEnd=0.0 dblFabricationLength=0.0 dblDesignLength=0.0 /* ThisObject information */ Trace(1,"ThisObject : " + ThisObject.Name) /* Get the pipe occurrence */ Set PipeOcc = ThisObject Trace(1,"Pipe Occurrence : " + PipeOcc.Name) /* Get the pipe instance */ Set PipeIns = PipeOcc Trace(1,"Pipe Instance : " + PipeIns.Name) /* Get the pipe reference */ Set PipeRef = PipeIns.Reference Trace(1,"Pipe Reference: " + PipeRef.Name) /* Read the ports to get their manufacturing endstyle */ Set Ports=PipeRef->Children Trace( 2, "Children for PipeOcc :", Ports.Size() ) i=1 for i while i <= Ports.Size() { set MyFeature = Ports->GetItem(i) if( MyFeature<>NULL) { Trace( 2, "Feature exists at ",i) Trace( 2, "Port1 primary type: ", MyFeature.PrimaryType.Name) if (MyFeature.IsSupporting("Piping_PipeXPort") == TRUE) { Trace( 2, "Feature seems a piping port...") if(Port1==NULL){ Set Port1 = MyFeature if( Port1<>NULL ){ Trace(2, "Port1 EndStyle = ", Port1.GetAttributeString("V_EndStyle") ) } else { Trace(2, "Port1 does not exist...") } } else { Set Port2 = MyFeature if( Port2<>NULL ){ Trace(2, "Port2 EndStyle = ", Port2.GetAttributeString("V_EndStyle") ) } else { Trace(2, "Port2 does not exist...") } } } } } /* get objects connected at End1 and End2 */ Let PartAtStart(Piping_PartV2) Let PartAtEnd(Piping_PartV2) Let PartSubTypeStart(String) Let PartSubTypeEnd(String) Set PartAtStart = NULL Set PartAtEnd = NULL Set PartSubTypeStart="" Set PartSubTypeEnd ="" PipeOccStart=Parameters->GetAttributeObject("ObjectAtStart") PipeOccEnd =Parameters->GetAttributeObject("ObjectAtEnd") if(PipeOccStart<>NULL ){ Trace(2, "Connected part at Start = ",PipeOccStart.Name) Set PartAtStart = PipeOccStart.Reference if(PartAtStart <> NULL ){ PartSubTypeStart = PartAtStart.V_SubPartType } } else { Trace(2, "Connected part at Start = NONE") } if(PipeOccEnd<>NULL ){ Trace(2, "Connected part at End = ",PipeOccEnd.Name) Set PartAtEnd = PipeOccEnd.Reference if(PartAtEnd <> NULL ){ PartSubTypeEnd = PartAtEnd.V_SubPartType } } else { Trace(2, "Connected part at End = NONE") } /* Read the design length of the pipe */ dblDesignLength=PipeRef.GetAttributeReal("V_Length") * 1000.0 /* Read the attributes from the pipe (sample, customer dependent) */ // dblFieldLengthStart=PipeRef.GetAttributeReal("FieldLengthStart") // dblFieldLengthEnd=PipeRef.GetAttributeReal("FieldLengthEnd") // dblFabricationLength=PipeRef.GetAttributeReal("FabricationLength") // Get the Pipe Outside Diameter in mm // dblPipeDiameter=PipeRef.GetAttributeReal("V_OutsideDiameter") * 1000.0 // Get the Wall Thickness // dblPipeWallThickness=PipeRef.GetAttributeReal("V_WallThickness") * 1000.0 // Get the material // strPipeMaterial=PipeRef.GetAttributestring("V_MaterialName") // // Access the setup resource table now and find the right row... /* determine the extra lengths and the fabrication remarks */ if( PartSubTypeStart == "XXXXXXX") { dblFieldLengthStart=50.0 } if( PartSubTypeEnd == "XXXXXXX") { dblFieldLengthEnd=50.0 } dblFabricationLength=dblDesignLength + dblFieldLengthStart + dblFieldLengthEnd // Output the result back to the calling code Parameters -> SetAttributeReal("FieldLengthStart" , dblFieldLengthStart) Parameters -> SetAttributeString("FabricationRemarkStart", strFabRemarkStart) Parameters -> SetAttributeReal("FieldLengthEnd" , dblFieldLengthEnd) Parameters -> SetAttributeString("FabricationRemarkEnd" , strFabRemarkEnd) Parameters -> SetAttributeReal("FabricationLength" , dblFabricationLength) /* end */ |