Skip to main content
15-Moonstone
December 18, 2018
Solved

Mass attribute relations

  • December 18, 2018
  • 1 reply
  • 11371 views

I am investigating using Mass properties from Creo in Windchill, at the start of a project we want to use the calculated mass, then as we get real parts and weigh them, we want to enter this into the Alternate Mass PRO_MP_ALT_MASS and use that in Windchill, but we don't want to have 2 different mass attributes on each CAD document as we want to compare CAD mass (calculated or alternate) to an target mass attribute in the WT part.

 

So I have created a new parameter called "MASS" and I want this parameter to equal the value of PRO_MP_MASS or the value of PRO_MP_ALT_MASS but only if it does not equal zero.

I struggling to write this and get it to work in Relations, can anyone help?

Best answer by BenLoosli

This worked for me:

 

if pro_mp_alt_mass <> 0
weight = pro_mp_alt_mass
else
weight=pro_mp_mass
endif

 

The key is to have the pro_mp_alt_mass value entered for your part. If it is blank, then the relations fail.

Add pro_mp_alt_mass to your model tree and then enter the value. I tested it with both a 0.0 and a positive value, 7.25, for my test part.

 

1 reply

KenFarley
21-Topaz II
December 18, 2018

I don't know if you're having difficulties because you're trying to use built-in things like PRO_MP_MASS, but the relations code should be relatively simple, something like:

MASS = PRO_MP_MASS
IF PRO_MP_ALT_MASS > 0.0
 MASS = PRO_MP_ALT_MASS
ENDIF
15-Moonstone
December 19, 2018

If I try to verify with neither parameters having a value I get the following errors:

MASS = PRO_MP_MASS
errorInvalid data type combination at right side of expression
IF PRO_MP_ALT_MASS > 0.0
errorLeft and right sides are incompatible
  MASS = PRO_MP_ALT_MASS
ENDIF

Does it need to check the parameters are not null before the If statement? 

23-Emerald IV
December 19, 2018