General InformationThis opening ID is invoked when using the Piping Spool Isometrics or the Piping Orthogonal Drawings command. During the creation of the bend data table, for each bent pipe in the spool, a business rule is called for that bent 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: CAAAITACPipeBendingBusinessRules1 */ /* */ /* Sample rule for retrieving the bending process parameters on a bent pipe */ /* Input Arguments */ /* ThisObject = FactType ProductOccurrence */ /* */ /* Input Parameters */ /* ObjectAtStart = Occurrence connected at start */ /* ObjectAtEnd = Occurrence connected at end */ /* */ /* Output Parameters (all lengths to be in mm) */ /* BendingMachineName = string, name of machine that can bend the pipe */ /* BendingDirection = integer 0 = pipe can not be bent */ /* 1 = pipe is to be bent if FWD direction */ /* 2 = pipe is to be bent in BWD direction */ /* BendClampLength = real, length of the bending clamp of the machine */ /* the bend clamp is the clamp that is rotating */ /* HoldClampLength = real, length of the holding clamp of the machine */ /* the hold clamp is the clamp that is not rotating */ /* 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 N>1) */ /* this length is optional (typically 0.0) */ /* FabricationLength = real, total length including extra length for */ /* hold clamp, bend clamp, extra 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 if BendingDirection = 1 */ /* Extra1 = MAX(0.0 , BendClampLength - TangentLength of 1st Segment) */ /* Extra2 = MAX(0.0 , HoldClampLength - TangentLength of last Segment) */ /* */ /* FabricationLength if BendingDirection = 2 */ /* Extra1 = MAX(0.0 , BendClampLength - TangentLength of last Segment) */ /* Extra2 = MAX(0.0 , HoldClampLength - TangentLength of 1st Segment) */ /* */ /* FabricationLength = DesignLength + MAX( FieldLengthStart, Extra1) */ /* + MAX( FieldLengthEnd , Extra2) */ /* */ /* */ /* Data may be read from attributes on the pipe reference or by accessing*/ /* the pipe bending machine resource table and finding the values */ /* dynamically in that table. */ /*--------------------------------------------------------------------------*/ Let PipeOcc(ProductOccurrence) Let PipeRef(VPMReference) Let PipeIns(VPMInstance) /* pipe reference data */ Let strMachine(String) Let strFabRemarkStart(String) Let strFabRemarkEnd(String) Let intDirection(Integer) Let dblFieldLengthStart(Real) Let dblFieldLengthEnd(Real) Let dblFabricationLength(Real) Let dblDesignLength(Real) 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) /* bending machine data */ Let dblBendClamp(Real) Let dblHoldClamp(Real) /* work variables */ Let dblFabLengthCheck(Real) Let strFeedDirection(String) /* initialize */ PipeOcc=NULL PipeRef=NULL PipeIns=NULL strMachine= "Machine1" strFabRemarkStart="" strFabRemarkEnd="" intDirection=0 dblBendClamp=0.0 dblHoldClamp=0.0 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) */ // strMachine=PipeRef.GetAttributeString("BendingMachineName") // dblFieldLengthStart=PipeRef.GetAttributeReal("FieldLengthStart") // dblFieldLengthEnd=PipeRef.GetAttributeReal("FieldLengthEnd") // dblFabricationLength=PipeRef.GetAttributeReal("FabricationLength") // // strFeedDirection=PipeRef.GetAttributeString("BendDirection") // if(strFeedDirection=="FWD"){ // intDirection=1 // } // else if(strFeedDirection="BWD"){ // intDirection=2 // } // else { // intDirection=0 // } /* And access the bend machine resource table to get the */ /* BendClampLength and HoldClampLength */ // Get the Pipe Outside Diameter // dblPipeDiameter=PipeRef.GetAttributeReal("V_OutsideDiameter") // Get the Wall Thickness // dblPipeWallThickness=PipeRef.GetAttributeReal("V_WallThickness") // Get the material // strPipeMaterial=PipeRef.GetAttributestring("V_MaterialName") // Access the setup resource table now and find the right row... /* // override field and clamp lengths with values from MPO // a list of bends from a table Let InputListOfBend(List) // a list of filed nad clamp lengths to be overriden in table Let ExtraFieldLenghtValues(List) Let ExtraClampLenghtValues(List) // retrieve a list of bends from bend table Set InputListOfBend = Parameters ->GetAttributeObject("InputListOfBend") if ( InputListOfBend <> NULL) { let i(Integer) for i = 0 while i < InputListOfBend.Size() { Let BendAngle(Real) let ii(Integer) ii = i +1 BendAngle = InputListOfBend->GetItem(ii) // validate first and last node if (i == 0 or i == InputListOfBend.Size() -1) { // retrieve a new extra length information and add it to a lists ExtraFieldLenghtValues.AddItem(0,ii) ExtraClampLenghtValues.AddItem(0,ii) } else { // retrieve a new extra length for bend nodes information and add it to a lists ExtraFieldLenghtValues.AddItem(0,ii) ExtraClampLenghtValues.AddItem(0,ii) } } } // list size needs to be equal to input list size (same as number of rows in bend table) Parameters ->SetAttributeObject("ExtraFieldLenghtValues",ExtraFieldLenghtValues) Parameters ->SetAttributeObject("ExtraClampLenghtValues",ExtraClampLenghtValues) // override a new total length dblFabricationLength=200 */ // Output the result back to the calling code Parameters -> SetAttributeString("BendingMachineName" , strMachine) Parameters -> SetAttributeInteger("BendingDirection" , intDirection) Parameters -> SetAttributeReal("BendClampLength" , dblBendClamp) Parameters -> SetAttributeReal("HoldClampLength" , dblHoldClamp) Parameters -> SetAttributeReal("FieldLengthStart" , dblFieldLengthStart) Parameters -> SetAttributeString("FabricationRemarkStart", strFabRemarkStart) Parameters -> SetAttributeReal("FieldLengthEnd" , dblFieldLengthEnd) Parameters -> SetAttributeString("FabricationRemarkEnd" , strFabRemarkEnd) Parameters -> SetAttributeReal("FabricationLength" , dblFabricationLength) /* end */ |