In our BOM's we have frame generated parts that use "Part Number" to show they are the same, because they are determined by size not just the item description.
I currently use a rule that counts all the components in an assembly and puts that into a BOM field. However it only puts the value into one of them the rest are left blank.
How can I get the value to populate the other items as well? The only way I have seen is by them having the same file name but because these all have different file names I need to do it by part number.
Part number example: ANGLE 3" X 3" X 3/8" X 40' A36 C.S. X 49.742 - 002-01
Here is the rule another user posted that I modified and am currently using.
Thanks,
Class ThisRule Dim rDoc As Document, oDoc As Document Dim oQty As Integer Sub Main() On Error Resume Next Dim oAssem As AssemblyDocument = ThisDoc.Document Dim oBOM As BOM = oAssem.ComponentDefinition.BOM oBOM.StructuredViewFirstLevelOnly = False oBOM.StructuredViewEnabled = True oBOM.PartsOnlyViewEnabled = True oBOM.SetPartNumberMergeSettings(True, ) For Each oDoc In oAssem.AllReferencedDocuments oQty = 0 If oDoc.DocumentType = 12291 Then Call ListItems(oBOM.BOMViews.Item(1).BOMRows, 0, oDoc) If oDoc.DocumentType = 12290 Then Call ListItems(oBOM.BOMViews.Item(3).BOMRows, 0, oDoc) Next End Sub Sub ListItems(Rows As BOMRowsEnumerator, indent As Integer, oDoc As Document) For Each oBOMRow As BOMRow In Rows rDoc = oBOMRow.ComponentDefinitions.Item(1).Document If rDoc IsNot oDoc Then If Not oBOMRow.ChildRows Is Nothing Then Call ListItems(oBOMRow.ChildRows, indent + 1, oDoc) End If Else oQty = oQty + oBOMRow.ItemQuantity iProperties.Value(rDoc.DisplayName, "Summary", "Title") = "MASTER BOM QTY " & oQty End If Next End Sub End Class
Solved! Go to Solution.
Link copied