Rounding Model Variables to Fractions

Rounding Model Variables to Fractions

Sometimes you need to round model variables to a specific fraction.
For example cut stock may come in 1/8 or 1/4 or any other inch increment.

I recently had a case here I needed to get a 1/4 in rounded value that included a precise distance + extra for removal during machining.

To do this we need to create some user parameters and use an often overlooked function in Fusion 360's parameters.

First, lets create create a parameter for PartLength. Make it 1in.

Next, lets make a parameter called Extra. We will make it 0.05in.

We want to control if Fusion 360 rounds to .125, .25, .5 or 1.0in increments so we create a parameter called Round and make it .25in.

Now for the tricky part. Fusion 360 has two functions called Ceiling and Floor. These functions take any decimal and round up to the nearest integer, in the case of Ceiling. Or, round down to the nearest integer, in the case of Floor.

To call these functions use the following in your equations:

Ceiling = ceil()
Floor = floor()

These functions are unitless so watch out for unit stacking when creating equations.

To start we want PartLength + Extra.

We need this in the increnet set by round so we will devide the above by Round. After we round up we will * by Round again.

So our equation will look like this:

(ceil((PartLength + Extra)/Round))*Round

This results in 1.25! Exactly what we needed.

If we change Round we can get any increment we want easily. For example we change Round to 1/32 and we get 1.063.

Ceiling and Floor can be very usefully once you understand their function and can help create smarter models that change and update with engineering design intent.

Once open start the edit paramaters command and edit PartLength favorite parameter.