Inventor General Discussion

Inventor General Discussion

Reply
Active Member
ifsi
Posts: 10
Registered: ‎10-31-2009
Message 1 of 8 (2,621 Views)

iLogic to Sort BOM, Renumber and sort Parts list

2621 Views, 7 Replies
06-13-2011 01:39 AM

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.

*Expert Elite*
Curtis_Waguespack
Posts: 2,930
Registered: ‎03-08-2006
Message 2 of 8 (2,585 Views)

Re: iLogic to Sort BOM, Renumber and sort Parts list

06-14-2011 08:17 AM in reply to: ifsi

Hi ifsi,

 

You can find an example of how to do this at this link:

http://inventortrenches.blogspot.com/2011/02/ilogic-code-for-parts-lists-title.html

 

Note that in the example there are three lines as such:

 

oPartsList1.Sort("PART NUMBER")
'oPartsList1.Renumber
'oPartsList1.SaveItemOverridesToBOM



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/

  

 



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





Active Member
ifsi
Posts: 10
Registered: ‎10-31-2009
Message 3 of 8 (2,563 Views)

Re: iLogic to Sort BOM, Renumber and sort Parts list

06-14-2011 05:47 PM in reply to: Curtis_Waguespack

Pure gold! Thank you Curtis

Member
SPrice33
Posts: 5
Registered: ‎04-05-2011
Message 4 of 8 (2,459 Views)

Re: iLogic to Sort BOM, Renumber and sort Parts list

08-24-2011 08:00 AM in reply to: ifsi

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

 

 

*Expert Elite*
Curtis_Waguespack
Posts: 2,930
Registered: ‎03-08-2006
Message 5 of 8 (2,454 Views)

Re: iLogic to Sort BOM, Renumber and sort Parts list

08-24-2011 08:44 AM in reply to: SPrice33

Hi SpencerPrice33,

 

If you need to sort a parts list by multiple columns you can use something like this:

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)
 


I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com


  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





Member
SPrice33
Posts: 5
Registered: ‎04-05-2011
Message 6 of 8 (2,436 Views)

Re: iLogic to Sort BOM, Renumber and sort Parts list

08-24-2011 10:06 AM in reply to: Curtis_Waguespack

Great!  Thank you so much!  I thought I had tried that earlier and it didn't work - must have missed something tiny...

Active Contributor
vishgon
Posts: 36
Registered: ‎02-28-2007
Message 7 of 8 (1,748 Views)

Re: iLogic to Sort BOM, Renumber and sort Parts list

12-04-2012 08:01 PM in reply to: Curtis_Waguespack

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

New Member
Jennifer5640
Posts: 1
Registered: ‎02-18-2013
Message 8 of 8 (1,577 Views)

Re: iLogic to Sort BOM, Renumber and sort Parts list

02-18-2013 02:12 PM in reply to: Curtis_Waguespack

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.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.