- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am looking to have a modified version of the code below to retrieve the item numbers of the parts that are in my sub assemblies and make custom iproperties that lists those item numbers. I will explain below.
So I have my main assembly with a number of subassemblies. Each of those subassemlies is composed of two parts - called "Flange" and "Pipe". I would like a "Flange Item" and "Pipe Item" custom iproperty created in each of the subassemblies (not the parts). The values of these will be equal to the item number of the part as listed in the Parts Only BOM view of the main assembly.
For example, in the screenshot of my model tree below, the W06-065375 ROOF NOZZLE N3 component has components "Flange" and "ROOF NOZZLE PIPE". I am trying to create custom iproperties in the W06-065375 ROOF NOZZLE N3 subassemly with the item numbers of the two parts with values from the Parts Only BOM View.
Dim oAsm As AssemblyDocument = ThisDoc.Document Dim oDef As AssemblyComponentDefinition = oAsm.ComponentDefinition Dim oBOM As BOM = oDef.BOM oBOM.StructuredViewEnabled = True Dim oBOMView As BOMView = oBOM.BOMViews(2) 'Structured View For Each oRow As BOMRow In oBOMView.BOMRows For Each rDef As ComponentDefinition In oRow.ComponentDefinitions If TypeOf (rDef) Is VirtualComponentDefinition Then Continue For Try rDef.Document.PropertySets("Inventor User Defined Properties")("ItemNumber").Value = oRow.ItemNumber.ToString() Catch rDef.Document.PropertySets("Inventor User Defined Properties").Add(oRow.ItemNumber.ToString, "ItemNumber") End Try Next Next
Solved! Go to Solution.