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

TreeView Structure in Excel VBA

TreeView is extreamly useful in specific cases but it can be bit tricky sometimes to implement.  Last Few days I was working on a TreeView Structure and thought I will share the knowledge I gained...  This post takes you through the basic operations to create and operate a TreeView. It will be like the Folder tree window of the windows explorer.  Moreover, you can have it dynamically updated based on the data in excel.... Here we go..

Controlling LED through Octolapse for 3D print timelapse

Today's post is about one of the 3D Printing adaptation that I learned. This is specifically about how to control an LED light automatically through OctoLapse so that it is switched on only when the timelapse photo is taken. Just as a background, I have been learning to use 3D printer and its customizations options for a few months now and was a lot of learning since then. The best thing was OctoPi, a platform for controlling the 3D printer and the many plugin options that are developed by the community.  Most of them are like open source. Today we will discuss specifically about an adaptation to one such plugin, OctoLapse. OctoLapse is the plugin for taking timelapse photos, with many options for further customisations. One of the best timelapse method is taking photo after each layer is complete, by moving the head out of the way. You can use standard Pi Camera or a DSLR, which is great to get good resolution videos. One small flash back before we dive into the topic.  I keep the

Excel Function :TABLE

Its been a while since I have done some posting. This option in excel is something which I thought would be very useful for many. Its the TABLE Function in MS Excel. This is especially useful in the following scenarios.