cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Translate the entire conversation x

Mass calculation

TP_10167633
11-Garnet

Mass calculation

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.

TP_10167633_0-1753794850609.png

 

Regards T

ACCEPTED SOLUTION

Accepted Solutions


@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))


Martin Hanák

View solution in original post

12 REPLIES 12

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:

 

Tdaugherty_0-1753801246011.png

 

RPN
17-Peridot
17-Peridot
(To:TP_10167633)

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. 

TP_10167633
11-Garnet
(To:RPN)

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


Martin Hanák

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))


Martin Hanák

note that you don't need to invoke the ceil function - rtos already does the rounding that:

 

pausob_0-1753898183304.png

 

 

 

KenFarley
21-Topaz II
(To:pausob)

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?

KenFarley
21-Topaz II
(To:pausob)

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.

Announcements

Top Tags