General InformationThis opening ID is invoked during the creation of a Piping or a HVAC BOM table template. It computes the description property depending on the BOMPartDescription attribute from the drawing profile. A different drawing profile can generate a different description, for example, a different language, or more or less details. Customizing this rule lets you to implement another way to compute the description property. SampleThe following sample
Result = NULL let PartDescriptionMode(Integer) if (Parameters.HasAttribute("BOMPartDescription")) { PartDescriptionMode = Parameters.GetAttributeInteger("BOMPartDescription") } else { PartDescriptionMode = 3 } let PipingPartObject(Piping_Part) set PipingPartObject = ThisObject.Reference if (PipingPartObject <> NULL) { if (PartDescriptionMode == 1) { Result = PipingPartObject.V_description let MysteriousNewlineChar(String) MysteriousNewlineChar = TextFormat("|","") Result = ReplaceAll(Result, MysteriousNewlineChar, " - ") } if (PartDescriptionMode == 2 OR (PartDescriptionMode == 1 AND (Result == "") ) ) { // Compute SubPartType, depending wether it is a Piping_PartV1 or Piping_PartV2 let SubPartType(String) let PipingPartObjectV1(Piping_PartV1) let PipingPartObjectV2(Piping_PartV2) set PipingPartObjectV1 = ThisObject.Reference set PipingPartObjectV2 = ThisObject.Reference if (PipingPartObjectV1<>NULL) { SubPartType = ToUpper(PipingPartObjectV1.V_SubPartType) } else if (PipingPartObjectV2<>NULL) { SubPartType = ToUpper(PipingPartObjectV2.V_SubPartType) } else { SubPartType = "[V_SubPartType]" } // Compute NominalSize let NominalSize(String) if (PipingPartObject.V_NominalSize <> "") NominalSize= " - " + PipingPartObject.V_NominalSize else NominalSize = " - [V_NominalSize]" // Compute EndStyle let EndStyle(String) if (PipingPartObject.V_EndStyle <> "") EndStyle=" - " + PipingPartObject.V_EndStyle else EndStyle = "- [V_EndStyle]" // Compute Rating let Rating(String) if (PipingPartObject.V_Rating <> "") Rating=" - " + PipingPartObject.V_Rating else Rating = " - [V_Rating]" // Compute Material Name let MaterialName(String) if (PipingPartObject.V_MaterialName <> "") MaterialName = " - " + PipingPartObject.V_MaterialName else MaterialName = "- [V_MaterialName]" Result = SubPartType + NominalSize + EndStyle + Rating + MaterialName } else if (PartDescriptionMode == 3) { Result = PipingPartObject.V_Name } } //Message("Result: ", Result) |