Piping ISO/ORTHO Spool Business Rules - Fabrication Data of Bent Pipes (CAAAITACPipeBendingBusinessRules1)

An opening ID is an entry point used to customize business logic. The Piping ISO/ORTHO Spool business rule - Fabrication data of bent pipes opening ID is used to list the fabrication data for bent pipes.

Note: For more information about customization by business rules, see Installation and Setup: Customize: Behavior: Data Setup: Customization by Business Rules.

This page discusses:

General Information

This 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:

  • Name of the bending machine (if pipe can be bend by a customer bending machine).
  • Bending direction of the pipe (Forward or Backward) depending on bending machine characteristics, such as clash or different in length between holding clamp and bending clamp.
  • Length of the holding clamp and the bending (=rotating) clamp.
  • Extra length at start of the pipe (node 1) and end of the pipe (node N) for field installation. Meaning extra material that will be cut after field measuring. For example, 75mm or 3".
  • The field length and clamp length values for start and end nodes can be overridden. You can also override the extra clamp length values for the intermediate bend nodes.

  • An extra geometry can be represented in the view interactively or through a batch. A coordinate annotation is placed by specifying the definition and direction of the represented shape (lines) within the template.
  • Total fabrication length (incl. length for clamping and extra material for field installation). If not returned, Drafting Template Design calculates it based on provided parameters.
  • Remark to place at the start of the pipe, and end of the pipe. For example, remark that there is a field weld or specific fabrication operation. This can be computed from the manufacturing endstyle of the pipe and/or from the type of the connected element at start or end.

The business rule provides the following as input parameters:

  • Occurrence of the straight pipe
  • Occurrence of the connected part/pipe at the start of the straight pipe
  • Occurrence of the connected part/pipe at the end of the straight pipe.

Input Objects

Input objects must be of the following types:

  • ThisObject: FactType ProductOccurrence
  • Parameters corresponds to the context object.
    • ObjectAtStart = Occurrence connected at start
    • ObjectAtEnd = Occurrence connected at end

Sample

The 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   */