Possible to add transient data column to assembly bom?

Possible to add transient data column to assembly bom?

CadUser46
Collaborator Collaborator
384 Views
5 Replies
Message 1 of 6

Possible to add transient data column to assembly bom?

CadUser46
Collaborator
Collaborator

I'd like to have a column of data that exists only in the parent assembly, but that maps data per bom row from a database, without dirtying or modifying the child files in any way.  I'd like to do it this way so i get the benefit of bom sorting and highlighting.

 

As far as i can tell this does not appear to be possible without adding an iprop to a file.

 

Any suggestions?


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

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
0 Likes
Accepted solutions (1)
385 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

Hi @CadUser46.  I believe the short answer is no...we can not add a 'transient data' column.
However, have you ever tried adding a custom column to your BOM using the 'Add Custom iProperty Columns' tool, but then instead of choosing an existing custom iProperty, type in a unique column name, then when the new column has been created, right-click on the new column, and choose 'Create Instance Property (all instances)' option?

 

This should create an 'instance property' on all component instances within the main assembly for you by the name of the column, where that data would be stored at the assembly level, instead of down within each of the referenced documents.  But then, you would have to use some other means to write the data you want into them, because there is no built-in way to get it to pull external data in from some database file somewhere.  And you can't write database data directly into that BOM dialog's cells from an iLogic rule or VBA macro either.  So if you are planning on using a code based automation solution to help with this type of task, it would have to iterate through all component instances within the assembly, find (or create) that instance property on each instance, then write the data to its value.  Then that data should show up in that column in the BOM.

 

I do not have an example code for doing all that though, because I have never needed (or wanted) to go through all that before.  Accessing assembly component instance properties by code is not that complicated.  But when you add in accessing data in some external file, and trying to interact with whatever application that reads/edits that type of data (such as Excel), and knowing exactly how to get each specific piece of data from the correct place, and pairing that with the correct assembly component instance is a whole other level of complication, and is likely extremely unique to only you.  So, if the only use of this extra column would be for sorting the BOM, it may (or may not) be worth it.  We have more control over PartsLists in drawings than we do over BOM's in an assembly.  So maybe creating a new drawing, then creating a PartsList in it, then work with that to get it sorted, then export from there.  Its main built-in sorting methods for PartsList (PartsList.Sort & PartsList.Sort2) are pretty similar to those for the BOM, but the PartsListRow has the PartsListRow.Reposition method that can be used with a custom sorting routine.  We can not even access the columns in an assembly BOM, and its rows only offer the basic properties (not all that you see in the dialog), but a PartsList in a drawing is fully navigable by rows and columns.

 

Below are links to the two existing built-in sorting methods, just for reference.

BOMView.Sort

BOMView.Sort2

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 6

CadUser46
Collaborator
Collaborator

Hi @WCrihfield thanks for the excellent reply.

I am familiar with everything you've written here apart from the Create Instance Property.  Not something i've heard of or used before (for the same reasons you're probably already thinking of) but does sound very much like what i'm looking for in this niche problem.

 

I'm actually setup with the rest of the steps already so this will be a minor extension of the current VBA code.

I will update my post once i've had a play about with it.


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

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
0 Likes
Message 4 of 6

CadUser46
Collaborator
Collaborator

It's so close to being what i want but i cant see a way to do the 'Create Instance Property' step through the API.

All other steps are possible.


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

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
0 Likes
Message 5 of 6

WCrihfield
Mentor
Mentor
Accepted solution

Hi @CadUser46.  Even though we have the BOMRow.OccurrencePropertySets property, I do not believe we can 'initiate' new instance properties through that property, if no instance properties already exist for any of the instances being represented by that row in the BOM.  If there were already some instance properties on some of those instances, then maybe, but then that would be awkward if that BOMRow represented 10 instances of the same part, but only a few of them had an instance property, while other instances in the group did not have any...the BOMRow setting would seemingly override the individual/instance idea.  So, as I mentioned earlier, we must actually iterate the actual ComponentOccurrence objects themselves, one at a time, and set their ComponentOccurrence.OccurrencePropertySetsEnabled property value to True, then use its ComponentOccurrence.OccurrencePropertySets property go get access to the PropertySets object, then use that to create a new instance property, with the value you want.  If you insist on accessing the components through the BOM, then you would likely have to use the BOMRow.ComponentOccurrences collection as the source collection to iterate through.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 6

CadUser46
Collaborator
Collaborator

I see how it works now and it's working as intended.

Thanks for the help.


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

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
0 Likes