How to get correct volume

How to get correct volume

Anonymous
Not applicable
581 Views
2 Replies
Message 1 of 3

How to get correct volume

Anonymous
Not applicable

With Inventor 2013 , user can view iProperties > Physical > Volume. After UPDATE is clicked, the application seems to recalucate and display mass information.  How do I accomplish this task with API? I tried looping through all Occurrence objects, then access MassProperties.Volume, but the numbers do not match what I got from the Inventor application.  The API seems to give me the Volume before the model construction (add parts, extrusions etc.) I need volumes after the final assembly.

 

Thank you for your help

 

0 Likes
Accepted solutions (1)
582 Views
2 Replies
Replies (2)
Message 2 of 3

tuliobarata
Advocate
Advocate

Just let me see if i get the point.

 

U'll need the "net" volume right ?

I'm having some problems trying to get gross and net weights, i guess its the same klind of problem.

With one loop in the ocurrences, i got one problem that IV doesnt open all sub assemblies to put them in the sum, so that just work in the main assy.

 

Now, if you just want the real volume (with all the features already done), i guess just it should work:

 

volume = iProperties.Volume

If there is something in common with my problem, follow the link:

http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/iLogic-How-to-sum-a-property-of-all-su...

 

 

Thanks

Túlio Barata

 

IV 2013
0 Likes
Message 3 of 3

Anonymous
Not applicable
Accepted solution

This will help you..

 

Sub Vol()

'set odoc as Asembly document or required document

 

Dim oUOM As UnitsOfMeasure
Set oUOM = ThisApplication.ActiveDocument.UnitsOfMeasure

 

Dim oMassProps As MassProperties
Set oMassProps = odoc.ComponentDefinition.MassProperties

 

Dim eLengthUnit As UnitsTypeEnum
eLengthUnit = oUOM.LengthUnits

' Get the equivalent string of the enum value.
Dim sLengthUnit As String
sLengthUnit = oUOM.GetStringFromType(eLengthUnit)

' Create a string that defines a 

volume

 using the current length unit.
Dim sVolumeUnit As String
sVolumeUnit = sLengthUnit & "^3"

 

 

 


Debug.Print "Vol  :   "; oMassProps.Volume ; sVolumeUnit

MsgBox ("Vol  :   "& oMassProps.Volume & sVolumeUnit

End Sub

 

 

This wil work for you.

 

 

Aceept as Solution

0 Likes