Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi
I use creo 11.0.4.0.
In relations dosnt work formula
MASA=PRO_MP_MASS
errorInvalid data type combination at right side of expression.
What is wrong.
In Creo 7 works perfect.
Regards T
Solved! Go to Solution.
@TP_10167633 wrote:
Hi,
Yes, this works.
How can I correct it to show only one decimal place, for example: 7.1 kg?
Regards T
Hi,
MASA=rtos(ceil(PRO_MP_MASS,1))
Same issue - "Mass attribute relations": https://community.ptc.com/t5/Customization/Mass-attribute-relations/td-p/585728
What kind of parameter is MASA? Maybe you can try using MASA=MP_MASS(""), assuming the output should be a string? I'd also recommend putting this relation in post regen to avoid the double regeneration after switching materials.
Creo 11.0 documentation:
If the RHS (right hand side) of the equation is a double you have to make sure that the LHS has the same type, you can have a miss match if the parameter exist before you have used this one in a relation. Just comment the relation, delete the MASA parameter and finally get rid of the comment.
Hi
MASA in string parameter.
I have same relation in CREO 7 . But there is no problem.
I try also MASA=MP_MASS(""),
Dosn't work.
Hi
MASA in string parameter.
I have same relation in CREO 7 . But there is no problem.
I try also MASA=MP_MASS(""),
Dosn't work.
Hi,
use following relation.
masa=rtos(PRO_MP_MASS)
rtos ... real number to string conversion
Hi,
Yes, this works.
How can I correct it to show only one decimal place, for example: 7.1 kg?
Regards T
@TP_10167633 wrote:
Hi,
Yes, this works.
How can I correct it to show only one decimal place, for example: 7.1 kg?
Regards T
Hi,
MASA=rtos(ceil(PRO_MP_MASS,1))
ceil is not the same as rounding.
For example
ceil ( 7.12, 1 ) = 7.2
Creo doesn't have a rounding function, it only gives us floor and ceil. To round, i.e. in the first decimal place, you need to use the floor function like this
floor ( ( 7.12 + 0.05 ), 1 )
I'm still on Creo 10.
Out of curiosity, does the rtos function implemented in Creo 11 do the rounding or truncating? And if it is rounding, then is it the IEEE 754 "banker's rule" - i.e. where the number ending with 0.5 would be rounded towards the even integer. E.g. both 23.5 and 24.5 would be rounded to 24?
I'm on Creo 9, so even further in the past than you. I don't know what the rounding behavior of RTOS is..
Someone with a version of Creo that implements this function could maybe do a quick test. Whenever I've needed rounding I've used something like
numRounded = floor ( numRaw + 0.5 )
in other words I've rounded the same regardless of whether a number is even or odd. Never understood why it matters if a number is even or odd...I've always preferred "regular" rounding.