Tuesday, 19 May 2009

Proe Function / Relation to round the decimal places

Its strange that ProE does not have a ROUND function. At least I counldnt find it.

It has two funtions.
Ceil will always round it up.
Floor will always round it down.

I have used both to get the ROUND functionality.
here is the relation...

X is the original value.
D is the number of decimal places.
X_New is the rounded value.

X = 1.334
D = 2

X_ = X * 10^D
IF X_ - XFLOOR_ < 0.5

try and let me know if it works.


Anonymous said...

its simple & its really great

Doug Schaefer said...

A simpler trick is to ad 0.5 to the dim adn then use the FLOOR command. For example, 1.3 + .5 = 1.8. FLOOR of 1.8 is 1.0. However, 1.8 + .5 = 2.3 and FLOOR of 2.3 = 2.0.

Doug Schaefer said...

Man, my spelling/typing is bad, sorry.

Joe Varghese said...

That's pretty simple, Doug. Thanks.

Jeff Hawkins said...

Joe & Doug,

I am trying to insert a counter sink angle dimension into the same dimension as the hole. I am successful with the following,

3X dia_sym @D
c'sink_sym dia_sym &d68 X &angle

where "d68" is the diameter of the counter sink and "angle" is the relation "angle=2*d69". d69 is half angle of the countersink - and this is because the hole sketcher only allows for dimensioning between the centerline and the edge of the countersink.

The problem is that I want the "angle" dimension to be 82 and not 82.000. I tried both of your tricks and even if I use &X_NEW in the dimension it still comes out 82.000.



Doug Schaefer said...

Try adding [.0] after the dimension. This tells Pro|E to round to display the dimension to zero decimal places.

Anonymous said...

The 0.5 addition to floor function is absolutely brilliant. Thanks


Anonymous said...

I think that doesn't work if X is negative.

Anonymous said...

I think that doesn't work if X is negative.

Joe Varghese said...

hello Anonymous,
please add an if condition to the logic of adding 0.5.