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: 

Insert BOM Filter to ilogic

4 REPLIES 4
Reply
Message 1 of 5
autopdmc15
373 Views, 4 Replies

Insert BOM Filter to ilogic

Hello ,

 

is there an ilogic code for filtering BOM on assigned part lists like this:

 

Fabrication part list table :

Filter - NO purchase item

          - NO standard content

 

Purchased  part list table :

Filter - Purchase Item ONLY

          - NO standard content

 

Bolt & Nut part list table:

Filter - Standard content ONLY

4 REPLIES 4
Message 2 of 5
WCrihfield
in reply to: autopdmc15

Hi @autopdmc15.  Up until the 2024.1 version of Inventor, that was impossible to do by code, because we did not have access to the filter setting of a PartsList by code...only manually.  But now we appear to have similar access to the same filtering capability that you see when manually editing the PartsList, and click on the Filter button.  Through the PartsList.FilterSettings property, that is a ReadOnly property which returns a PartsListFilterSettings object.  It looks like you would first have to set that object's Enabled property to True.  Then you would use its PartsListFilterSettings.Add method to add a main type of filter as a variation of the PartsListFilterItemTypeEnum, along with a NameValueMap, which would include any further details of how that filter should work, and the method returns the PartsListFilterItem type object that it added.  I have not tried using the newly added Inventor API functionality yet, but I have definitely been looking forward to this functionality being added for years.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 5
autopdmc15
in reply to: autopdmc15

Ho w about for Inventor 2020? Can i access the code ?

Message 4 of 5
WCrihfield
in reply to: autopdmc15

Hi @autopdmc15.  Not exactly.  What I mean is, you will not be able to apply a traditional filter setting to the PartsList by code, the way you can manually.  But you might be able to achieve a similar looking outcome though the use of a lot of custom code, doing it all the hard way.  But if you do manage to achieve a similar looking result through iLogic rule code, the result will be sort of 'static', meaning that it may not stay updated when changes happen.  You would most likely need to run the rule on the PartsLists again after any changes have been made that effect the PartsLists, to update the effects of the code.  When filtering is done using the traditional filters that are available within the Filter dialog of the PartsList Editor dialog, it will generally stay up to date on its own, without the need for any code intervention.

 

What I mean by the hard way is that you would likely have to look at every individual row within the PartsList, then dig down through a couple layers of references to get the assembly BOMRow that it references, then inspect the model file that it represents to then somehow figure out whether it is a Purchased item or not, and figure out whether it is a standard content member or not.  Then go back to your PartsListRow object level, and either make that row Visible or not, or delete that row or not, depending on the test results.  And every PartsList would need to be identified in some way, so the code know whether it is for fabrication stuff only, purchased stuff only, or standard content only, so that the code know which process to use for that PartsList.  Like I said, it may be possible to achieve an outcome that 'looks' like what you may want by iLogic rule code, but I am not sure if the result would be worth the time & effort that may be needed to develop the code to automate it.  That sort of depends on your needs and situation.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 5
WCrihfield
in reply to: autopdmc15

Attached is a text file containing some iLogic rule code that you can copy & paste into a new, empty iLogic rule to try out.  I do not know if it will work the way you want it to or not, but at least it is something to start from.  When you run the rule, it will ask you to manually select a PartsList with your mouse, then it will try to process that selected PartsList.  I have no idea how the rule is supposed to determine which PartsList is for what purpose (fabricated stuff, purchased only, CC stuff only), so I included an If...Then block that checks for certain keywords in the Title of the PartsList.  If the title contains the keyword "FABRICATION", then turn visibility of all purchased & CC item rows off.  If title contains "PURCHASED", turn visibility of all non purchased item rows off.  If title contains "STANDARD CONTENT", then turn off all rows for non CC stuff.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

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

Post to forums  

Autodesk Design & Make Report