Skip to main content

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
XFLOOR_ = FLOOR(X,D) *10^D
IF X_ - XFLOOR_ < 0.5
X_NEW = FLOOR(X,D)
ELSE
X_NEW = CEIL(X,D)
ENDIF


try and let me know if it works.

Comments

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

Suggestions?

Jeff
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

ADS
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 said…
hello Anonymous,
please add an if condition to the logic of adding 0.5.

Popular posts from this blog

PTC Creo | my Mapkeys for free

I have created a list of frequently used mapkey shortcuts for the PTC Pro Engineer Creo. This is the macro equivalent in creo.  I am copying them below.If you need them, copy paste the content to the "config.pro" file in your startup folder. My favourites are highlited and greatly improves the workflow.. For ex, to reach MEASURE. need to go to another menu and click.  Instead, maypkey from any selected menu on the ribbon will work.. Thats wonderful to me... Also, Edit Sketch (ES) is overloaded and will work for Extrusion, Revelution, Sweep etc.. So is aa, pp, zz..  really helps me a lot.. Hope you will start using them as well and get benefited! Let me know in comments, your feedback and issues.... Sketch View           > sv Show and Erase        > se Working Directory     > wd Hiddel Line View      > hi Close (quit) Window   > qw Measure        ...

Color the Excel row based on a value/status

Very often, we would like to differenciate the rows that are having certain status (or specific values in a specific column) in a different color. We can filter for the status and apply the color manually, but we can also do that dynamically or automatically with a specific tweak to the Conditional Formatting feature in Excel