Reply
Solved! Go to solution

Getting density for parts

Hello!

 

Is there a way to get the density for part files? GetPhysicalProperties method seems to work but it is NOT!

It will return the 'Up-to-date' results only if ComputePhysicalProperties are called firstly. Unfounately, ComputePhysicalProperties method takes density as its input (stupid design I think).

 

Does anyone have a possible solution? Please shed some light...

Thanks in advance!

 

Guan

4 REPLIES

Re: Getting density for parts

Guan,

 

I get the density from the variable table:

 

objDimQuery = ObjDoc.Variables.Query("PhysicalProperties_Density")

density = objDimQuery.Item(1).value

 

Brian

 

Solution
Solution
Accepted by topic author iceguan
‎07-13-2016 09:18 PM

Re: Getting density for parts

Hi Guan,

you can also use the method GetGlobalParameter of the PartDocument object:

 oDoc.GetGlobalParameter(sePartGlobalDensity, vValue) 

 

The call of GetPhysicalProperties() will return the density also, but there must be a valid body, a material or at least the density must be assigned and the physical property must have be calculated before.

Check the Status parameter after calling GetPhysicalProperties()

 

Regards JB

regards

JB
VS2015, SE ST10

Re: Getting density for parts

Thank you @JB, fabulous work! Accept as answer.

Re: Getting density for parts

Thank you @Brianw!

Using variable Name (even SystemName) works only when users haven't edited the so-called System Variables. One can perform 'delete' operation on 'PhysicalProperties_Density' variable and its name (as well as the system name) will change to 'Vxx'. And then this approach doesn't work anymore. See @JB's answer.@JB's answer.

Thanks,
Guan