Although you will stumble on keywords like "ceil" and "isolate" in this post, rest assured that this post is not about house remodeling J
I just wanted to highlight the use of a couple less known functions that can be used in the Inventor Parameter dialog and by extension in any real-value edit control in other dialogs.
When you want to round parameters to the next integer value, you have several methods at your disposal.
Round()
Ceil() or Floor()
Round and ceil both round to the nearest higher integer value
Floor rounds to the next lower integer value.
The problem is that when you feed these functions a straight parameter, the values obtained don't make sense.
Take the example where you have defined a parameter
somelength = 10.8 mm
In this case our ceil function returns
ceil(somelength) = 20 mm
And our round function returns an equally bogus result
round(somelength) = 10 mm
Inventor also flags the formula in red as being incorrect.
The reason you get these wrong values is because these functions expect a unit-less value.
To obtain correct values, use the following calls instead:
ceil(somelength/1mm)*1mm = 11 mm
round(somelength/1mm)*1mm = 11 mm
Of course this will make your formulas look rather complex.
If you want to keep the formulas in a readable shape, the best solution in that case is to use the isolate function and create a unit-less parameter first.
somelength = 10.8 mm
somelength_ul = isolate(somelength;mm;ul)
somelength_rounded = ceil(somelength_ul) * 1mm
Note: replace "mm" with "inch" in above 3 lines if you work in imperial units.
In iLogic you don't have to worry about all this when using the ceiling(), floor() or round() functions.
Below function calls deliver what you would expect without juggling units.
somelength_rounded = ceiling(somelength)
somelength_rounded = Round (somelength, 0)
Interested in reading more about using equations in Inventor's Parameter dialog? Head over to our help wiki.
Cheers
Bob



Subscribe
Great work, we were playing around with these the other day. We got them to work, but didn't know about the isolate option.
Posted by: scott moyse | 11/18/2011 at 09:15 PM
Thanks Scott. You are not alone. Even after 11 years with this product I keep discovering things that I did not know before. :-)
Bob
Posted by: Bob Van der Donck | 11/21/2011 at 10:30 AM
Thanks for the tip about isolate but I just wanted to make a little correction, round() doesn't round to the nearest higher integer value, it just rounds to the nearest integer value
round(1.8) = 2 but round(1.2) = 1
Posted by: Jean-Rene Cormier | 12/09/2011 at 09:32 AM
I stand corrected. Thanks for putting the record straight Jean-rene!
Bob
Posted by: Bob Van der Donck | 12/09/2011 at 09:34 AM