I'm looking to create an iLogic rule which is run from an assembly drawing to sort and re-number the assembly file BOM and then sort the drawing Parts List by Item.
The code below works fine when editing the BOM, however the edits don't seem to propagate to the Parts List while the code is running. If I tab away from the drawing window and then back again, the Parts List Items will then be updated but it will still require a sort.
I have tried saving the assembly and the drawing with no success. Is there a method to refresh the Parts List and pull through changes made to the BOM programmatically?
Thanks all
Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument Dim oAsm As AssemblyDocument oAsm = ThisDrawing.ModelDocument ' Set a reference to the BOM Dim oBOM As BOM oBOM = oAsm.ComponentDefinition.BOM Dim oPath As String oPath = "C:\Temp\BOM Format.xml" oBOM.ImportBOMCustomization(oPath) ' Set whether first level only or all levels. oBOM.StructuredViewFirstLevelOnly = True ' Make sure that the structured view is enabled. oBOM.StructuredViewEnabled = True 'Set a reference to the "Structured" BOMView Dim oBOMView As BOMView oBOMView = oBOM.BOMViews.Item("Structured") 'Sort BOM oBOMView.Sort("Category", True,"File Path",True) 'Renumber BOM oBOMView.Renumber(1, 1)
oAsm.Save
Dim oPartsList As PartsList oPartsList = oDrawDoc.ActiveSheet.PartsLists.Item(1) Call oPartsList.Sort("ITEM")
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi @stuart.lamb
I think if you add this line to the end of your rule it will update the drawing and parts list.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
InventorVb.DocumentUpdate()
Can't find what you're looking for? Ask the community or share your knowledge.