Hi @konstantinas_kuznecovas. First of all, I may be confused about what you are actually looking for here, due to how you worded your original post.
- Are you looking for a numerical Mass value only, but a value that is in specific units?
- Are you unsure about what units the numerical Mass value you are getting are in, and want a way to figure out which units they are in?
- Are you just looking for a way to include the mass units specification (String) along with the numerical value you get for the Mass?
- Are you just looking for a way to show units specification string within the cells you see in your assembly BOM Mass column?
I was under the impression that you were looking for a way to get the Mass value in 'Document Units', instead of in 'Database Units' (numerical value only, without units specifier).
I will try to break this down a bit more for you, to simplify.
If accessing the assembly BOM by code to get Mass... The BOMRow API object (a row within the BOM API object, within an assembly) does not have a direct property for getting the 'Mass' of the items that that row represents, and there is no easy way to get it from that row, in document units. It is not as simple as it looks in the BOM dialog, because there is no 'table' we can simply navigate by code. We still must dig down into one of the referenced documents that the row represents, get its Mass from within its ComponentDefinition.MassProperties.Mass, convert that value from database units to document units, then multiply that by one of the available quantity type properties of the BOMRow.
If getting Mass from a document's iProperties, instead of from its ComponentDefinition.MassProperties.Mass, then the regular iProperty at the following location:
oDoc.PropertySets.Item("Design Tracking Properties").Item("Mass").Value
...will still be returned in 'database units', and not document units, and it is possible that this iProperty's value may not be up to date in certain conditions. That means of accessing that iProperty that I just mentioned is going through the Inventor API system.
However, there is also an iLogic API related way to access Mass, which also seems to be going through the iProperties, but will return the value in document units directly, instead of in database units. There are multiple ways to use this line of code, and I do not know in which context you would be using it, so I do not know which variation of it would be best for you. If you used it like the following:
iProperties.Mass
https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=4da3c892-51fa-b527-88d1-b7a84d8075a9
...then, as you can see, there is no indication of which document it will be targeting, and very little documentation about that aspect of how it functions. It says that it will target the part or assembly that contains this rule, but that only applies to when it is used within an 'internal' rule, because those are saved within an Inventor document. But what about when it is used in an external rule, or elsewhere...no mention of how it would work there. Then there is a second way to use this line of code, which requires some additional input, but specifically what input is required is another detail that is not documented very well. If used in a rule while an assembly is active, and you wanted to get the mass of a single, specific assembly component, then you can input the name of that component, as seen in the model browser.
iProperties.Mass("Part1:1")
https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=f4341525-6d90-8881-d4f7-2b17d1172432
Or, instead of the name of an assembly component, you can specify the name of a document. But it does not tell you what portion of its name (include path ?, name only ? , include file extension?). Usually we can use the value we get from Document.DisplayName property, but that is a Read/Write property, sometimes including file extension, sometimes not, and it can also be overwritten, so...
We can use that line of code to 'Get' a value, or to 'Set' a value, and as mentioned, its value is in document units.
Wesley Crihfield

(Not an Autodesk Employee)