Autodesk Inventor
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
iLogic to Sort BOM, Renumber and sort Parts list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I want to use iLogic to:
1.Sort an assembly BOM by Part Number.
2. Renumber Items in the BOM as sorted.
3. Sort a drawing Parts list by item number.
The background to my problem is that i have an assembly which is working beautifully turning components on and off (suppressing/activating in LOD reps) as defined by iLogic rules (iLogic is awesome). The problem is whenever a part is turned on/activated again, it shows up at the bottom of the BOM and Parts list out of order (would be nice if parts went back in the list where they came from). I can do all this manually but I have to do it often and would love to improve efficiency and I sometimes forget when in a hurry.
Any help/code for this would be greatly appreciated.
Re: iLogic to Sort BOM, Renumber and sort Parts list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi ifsi,
You can find an example of how to do this at this link:
http://inventortrenches.blogspot.com/2011/02/ilogi
Note that in the example there are three lines as such:
The Renumber and SaveItemOveridesToBOM lines are commented so, you'll want to remove the apostrophe to uncomment them and let those line become active.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com/

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: iLogic to Sort BOM, Renumber and sort Parts list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Pure gold! Thank you Curtis
Re: iLogic to Sort BOM, Renumber and sort Parts list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
That code is working great, but I was curious to see if anyone had any idea as to how to get the parts list to sort by multiple fields instead of just the Part Number. I can't seem to find what the proper API would be for the 2nd level of sorting. Ideally I would like to have the parts list sort by...
1st) "Allocation" - (Allocation will be listed as "loose" or "installed" hardware)
2nd) "Bench" - (Bench will be listed as either "B" or "-")
Re: iLogic to Sort BOM, Renumber and sort Parts list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi SpencerPrice33,
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oPartsList1 As PartsList
oPartsList1 = oDrawDoc.ActiveSheet.PartsLists.Item(1)
oPartsList1.Sort("DESCRIPTION", 1, "QTY", 1)
This results in the parts list sorting first by the DESCRIPTION column and then the QTY column in ascending order. You can use 0 for the sort Boolean to sort by descending order. For example:
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oPartsList1 As PartsList
oPartsList1 = oDrawDoc.ActiveSheet.PartsLists.Item(1)
oPartsList1.Sort("DESCRIPTION", 0, "QTY", 0)
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: iLogic to Sort BOM, Renumber and sort Parts list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Great! Thank you so much! I thought I had tried that earlier and it didn't work - must have missed something tiny...
Re: iLogic to Sort BOM, Renumber and sort Parts list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Curtis
Is it possible to sort the BOM while ignoring rows that have their item numbers locked. As an extension to that is it possible to lock the rows for selected item, e.g. select items before running ilogic rule and hence ilogic ignores those items in the BOM
Re: iLogic to Sort BOM, Renumber and sort Parts list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hello, Curtis,
I need some help. I tried to run your script, but I must not know how to set it up correctly because I can't get it to run. I am new to using scripts/iLogic. Are you availabe as a consultant? We have a need for some scripts and how to access them.
