General InformationThis opening ID is invoked during the creation of a Piping or a HVAC BOM table template. It computes the weight using the Declared Weight of the spool, or using the weight of all the parts and pipes in the spool. Customizing this rule lets you to implement another way to compute the weight of spools. Sample
Result = NULL //Trace(2,"Spool weight EKL code...") let PipingSpoolObject(Piping_Spool) let PipingPipeObject(Piping_Pipe) let ChildOcc(ProductOccurrence) let ChildRef(VPMReference) let ChildrenList(List) let i(Integer) let TotalWeight(Real) let ComputedWeight(WCGEquivalentComputedExt) let DeclaredWeight(WCGEquivalentDeclaredWeightExt) set PipingSpoolObject = ThisObject.Reference if (PipingSpoolObject <> NULL) { //Trace(2,"Spool name = ",PipingSpoolObject.V_Name) } else { //Trace(2,"Spool name = ","NOT A SPOOL") } TotalWeight = 0.0 set ComputedWeight = ThisObject.Reference if (ComputedWeight <> NULL) { TotalWeight = ComputedWeight.V_WCG_Mass } else { set DeclaredWeight = ThisObject.Reference if (DeclaredWeight <> NULL) { TotalWeight = DeclaredWeight.V_WCG_Declared_Mass } } if( TotalWeight == 0.0 ) { ChildrenList = ThisObject.Children //Trace(2,"Spool has children: ",ChildrenList.Size() ) i=1 for i while i < ChildrenList.Size() { set ChildOcc = ChildrenList->GetItem(i) if(ChildOcc <> NULL){ set ChildRef=ChildOcc.Reference //Trace(2,"Processing part ",i," in spool : ", ChildRef.Name ) set ComputedWeight = ChildOcc.Reference if (ComputedWeight <> NULL) { TotalWeight = TotalWeight + ComputedWeight.V_WCG_Mass //Trace(2,"Part has computed weight") } else { //Trace(2,"Part has no computed weight") set DeclaredWeight = ChildOcc.Reference if (DeclaredWeight <> NULL) { TotalWeight = TotalWeight + DeclaredWeight.V_WCG_Declared_Mass //Trace(2,"Part has declared weight") } else { //Trace(2,"Part in spool does not have weight: ", ChildRef.Name ) set PipingPipeObject = ChildOcc.Reference if (PipingPipeObject <> NULL) { //Trace(2,"Pipe, compute the weight from linear weight") if(PipingPipeObject.V_Linearweight==0.0) { //Trace(2,"Pipe does not have a linear weight: ", ChildRef.Name) } else { TotalWeight = TotalWeight + PipingPipeObject.V_Length * PipingPipeObject.V_Linearweight } } } } } } } Result = TotalWeight //Message("Result spool weight: ", Result) //Trace(2, "Result spool weight: ", Result) |