Message 1 of 1
Ilogic to link sub components to BOM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I had a code that linked BOM Item # and Qty to sub components in an assembly so i could detail parts and have a link to the item # and Qty. It worked fine in Inventor 2024 but now is not working since i upgraded to 2025. Can anyone see the issue in my logic?
doc = ThisDoc.Document Dim oOccs As ComponentOccurrencesEnumerator oOccs = ThisDoc.Document.componentDefinition.Occurrences.AllLeafOccurrences Dim oOcc As ComponentOccurrence For Each oOcc In oOccs Call oOcc.Definition.Document.ComponentDefinition.BOMQuantity.SetBaseQuantity _ (BOMQuantityTypeEnum.kEachBOMQuantity) Next iLogicVb.UpdateWhenDone = True Dim oAssyDef As AssemblyComponentDefinition = doc.ComponentDefinition Dim oBOM As BOM = oAssyDef.BOM Dim oParams As Parameters = oAssyDef.Parameters Dim oUserParams As UserParameters = oParams.UserParameters Dim ParameterChecker As Parameter Try ParameterChecker = oParams("NUM_OF_ASSYS") Catch ParameterChecker = oUserParams.AddByValue("NUM_OF_ASSYS", 1, "ul") End Try Dim num_assys As Integer num_assys = Parameter("NUM_OF_ASSYS") 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) Dim Itm As String Itm = oBOMRow.ItemNumber () If iProperties.Value(CompFileNameOnly, "Project", "Engineer") <> Itm Then iProperties.Value(CompFileNameOnly, "Project", "Engineer") = Itm End If Dim Qty As String Qty = oBOMRow.TotalQuantity If iProperties.Value(CompFileNameOnly, "Project", "Authority") = "" Then iProperties.Value(CompFileNameOnly, "Project", "Authority") = num_assys*ItemQty End If If iProperties.Value(CompFileNameOnly, "Project", "Authority") <> num_assys * ItemQty Then iProperties.Value(CompFileNameOnly, "Project", "Authority") = num_assys * ItemQty End If Next
I have attached a screen shot of the error.