Inventor 2025 iLogic – Inconsistent volume rounding for identical parts

Inventor 2025 iLogic – Inconsistent volume rounding for identical parts

GustavoGonzattoSchmitt
Advocate Advocate
213 Views
2 Replies
Message 1 of 3

Inventor 2025 iLogic – Inconsistent volume rounding for identical parts

GustavoGonzattoSchmitt
Advocate
Advocate

Hello,

I’m experiencing an unexpected issue in Autodesk Inventor 2025 related to volume calculation and rounding via iLogic, which is causing inconsistent results in the BOM.

Context (important)

My workflow is the following:

  • I start from a single multibody part (multiple solid bodies in the same IPT)
  • These bodies are exported as individual components into an assembly
  • The bodies are geometrically identical (modeled from the same dimensions)
  • The bodies represent wooden packaging components (see image below for reference)caixa-de-madeira-de-pinnus-3-413x255.webp

  • These bodies are exported as individual components into an assembly
  • Due to symmetry and reuse, those ~50 bodies collapse into ~10 unique BOM items
 
  • In the assembly, I use iLogic to:
    • Read the component dimensions
    • Build the Part Number from those dimensions
    • Force identical components to collapse into a single BOM line item

This works correctly for dimensions and Part Number, but fails for volume, which breaks the BOM unification.


What Inventor reports

For two components that come from identical bodies:

  • Physical Properties (for each part):
Volume: 4,500,000.000 mm³ Relative Error: 0.000000%
 
From the modeling and UI perspective, these parts are literally identical.
 
What the iLogic code does

In iLogic, I read and convert the volume like this:

Dim vol_cm3 As Double
vol_cm3 = partDoc.ComponentDefinition.MassProperties.Volume ' cm³

Dim vol_m3 As Double
vol_m3 = uom.ConvertUnits(vol_cm3, "cm^3", "m^3")
vol_m3 = Math.Round(vol_m3, 3)

 

The rounded value is stored as a custom iProperty and used in the BOM.


Unexpected result

After running the rule:

  • Component A gets 0.004 m³
  • Component B gets 0.005 m³

Even though:

  • Both parts were created from the same multibody model
  • Both show exactly the same volume in the Physical Properties tab
  • Both have zero relative error

As a result, Inventor shows *Varies* for volume in the BOM, which prevents proper item unification.

 

Why this is a problem

For this workflow:

  • These components must be treated as identical in the BOM
  • Volume consistency is critical for downstream logic (costing, logistics, reporting)
  • The inconsistency is not geometric or modeling-related, but appears to come from how volume is returned/handled by the API
Any clarification or best practice for this scenario would be greatly appreciated.
0 Likes
Accepted solutions (2)
214 Views
2 Replies
Replies (2)
Message 2 of 3

jnowel
Collaborator
Collaborator
Accepted solution

I believe this is due to floating point errors.
jnowel_0-1777951345290.png

There might be times that the computed value will be: 0.004500000000000001*
*not sure on the number of zeroes but you get the point.

You can try rounding it twice, first in, say, 8 decimal places, then next to 3 decimal places (what you need)
You use 6 (instead of 8) as 6 is the approx. number of decimal places for a "single precision", double-precision is approx. at 15decimal places

Dim vol_m3 As Double
vol_m3 = uom.ConvertUnits(vol_cm3, "cm^3", "m^3")
vol_m3 = Math.Round(vol_m3, 8)
vol_m3 = Math.Round(vol_m3, 3)

 

Message 3 of 3

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @GustavoGonzattoSchmitt 
I did some testing and managed to get two identical parts derived from the same multibody part extracting different volumes - just like you described. Even though the properties in the UI displayed the exact same value with 0% error.

I found that you get a much more accurate extracted value from the property expression, rather that extracting the value directly. My guess is that value is calculated on access for these properties and could therefore be sensitive to floating point approximation errors.

Try this way and see if it works for you 🙂

Dim uom As UnitsOfMeasure = ThisApplication.UnitsOfMeasure
For Each oOcc As ComponentOccurrence In ThisDoc.Document.ComponentDefinition.Occurrences
	Dim partDoc As PartDocument = oOcc.Definition.Document
	Logger.Info(partDoc.DisplayName)
	Dim oPropSet As PropertySet = partDoc.PropertySets.Item("Design Tracking Properties")
	Dim vol_cm3_string As String = oPropSet.Item("Volume").Expression
	Logger.Info(vol_cm3_string)
	Dim vol_cm3 As Double = uom.GetValueFromExpression(vol_cm3_string, "cm^3")
	Logger.Info(vol_cm3)
	Dim vol_m3 = uom.ConvertUnits(vol_cm3, "cm^3", "m^3")
	Logger.Info(vol_m3)
	vol_m3 = Math.Round(vol_m3, 3, MidpointRounding.AwayFromZero)
	Logger.Info(vol_m3)
	Logger.Info(vbCrLf)
Next