Getting density for parts

Valued Contributor
Valued Contributor

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

Pioneer
Pioneer

Guan,

 

I get the density from the variable table:

 

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

density = objDimQuery.Item(1).value

 

Brian

 

Re: Getting density for parts

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

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

Valued Contributor
Valued Contributor

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

Re: Getting density for parts

Valued Contributor
Valued Contributor
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