PartsListStyle.AddColumn() - How to add VOLUME property?

PartsListStyle.AddColumn() - How to add VOLUME property?

Anonymous
Not applicable
764 Views
3 Replies
Message 1 of 4

PartsListStyle.AddColumn() - How to add VOLUME property?

Anonymous
Not applicable

I am trying to write an add-in that imports a PartsListStyle from an existing .styxml file. Since the direct import is not possible within the API (in contrast to the UI), the add-in will copy an existing style and then adjust everything to the style to be imported, reading from the .styxml file.

 

When adding the columns, I managed to add every possible column except for VOLUME. This is not possible because the PartsListStyle.AddColumn() method does not except the PropertyType although the required PropertyTypeEnum has a value kVolumePartsListProperty which obviously corresponds to the property VOLUME (all the others don't - I checked).

The documentation of the API (https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-086A1432-BA39-4C8C-B7E1-FD2D1B9B2F09) excludes this parameter.

 

But why is this not possible? And how can I add the property VOLUME via API?

Accepted solutions (1)
765 Views
3 Replies
Replies (3)
Message 2 of 4

WCrihfield
Mentor
Mentor

Hi @Anonymous.  Interesting & odd problem.  Seems like it may be a bug.  I don't have the answer you are looking for, but as a workaround, would suggest using the custom property type for now.  Then, if needed, implement a code that will process all Inventor files in a directory (with certain filters in place), that copies the document's Volume to the custom iProperty it creates, and make sure to specify the PropID.  The custom property can even have the same name "Volume", as long as its PropID is different.  Then you can use still specify "Volume" in the 'PropertyIdentifier' input variable of that 'AddColumn' method you are using.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 4

Anonymous
Not applicable

Thank you very much for your answer.

The idea for the workaroud looks really good. I guess I will try that.

 

Interestingly, in the meantime I found out that it's possible to add a column to an existing PartsList with the exact same parameter for VOLUME via PartsListColumns.Add(PropertyTypeEnum.kVolumePartsListProperty). But it seems that it's not possible to save or assign that column to a PartsListStyle.

Message 4 of 4

Anonymous
Not applicable
Accepted solution

I have to make a little correction. It looks like I haven't checked the PropertyTypes for VOLUME properly.

 

It's possible to add the column VOLUME using PropertyTypeEnum.kFileProperty. When you asign the created PartsListStyle to a parts list, this parts list lists that specific column as PropertyTypeEnum.kVolumePartsListProperty and correctly shows the volume of the part. So Inventor seems to be able to assign the correct PropertyType and get the VOLUME property.

I guess it's a bug in the API.