Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic Refresh Parts List Items After BOM Edit

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
stuart.lamb
362 Views, 2 Replies

iLogic Refresh Parts List Items After BOM Edit

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")

 

2 REPLIES 2
Message 2 of 3

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()

 

Message 3 of 3

Excellent, thank you Curtis. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report