Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The code below is run from the main assembly and allows us to write the BOM # and BOM quantity to each part in the main assembly. This used to work for all parts in the assembly (custom parts, standard content center parts & part library parts).
As of Inventor 2018 this no longer works. I believe the code was exploiting a bug that allowed us to write custom variables to read-only parts. This has been fixed so our iLogic code no longer works.
How can I modify this code so that it checks if a part is read-only(ie. standard content center parts, part library parts) and if it is, it's skips those parts?
doc = ThisDoc.Document Dim oAssyDef As AssemblyComponentDefinition = doc.ComponentDefinition Dim oBOM As BOM = oAssyDef.BOM oBOM.PartsOnlyViewEnabled = True Dim oBOMView As BOMView = oBOM.BOMViews.Item("Parts Only") Dim oBOMRow As BOMRow For Each oBOMRow In oBOMView.BOMRows 'Set a reference to the primary ComponentDefinition of the row Dim oCompDef As ComponentDefinition oCompDef = oBOMRow.ComponentDefinitions.Item(1) Dim CompFullDocumentName As String = oCompDef.Document.FullDocumentName Dim CompFileNameOnly As String Dim index As Integer = CompFullDocumentName.lastindexof("\") CompFileNameOnly = CompFullDocumentName.substring(index+1) 'MessageBox.Show(CompFileNameOnly) Dim Qty As String Qty = oBOMRow.ItemQuantity iProperties.Value(CompFileNameOnly, "Custom", "BOMQTY") = Qty Next
Solved! Go to Solution.