Rounding values

Rounding values

Anonymous
Not applicable
19,947 Views
9 Replies
Message 1 of 10

Rounding values

Anonymous
Not applicable

 

New to Fusion 360, trying to translate some old designs to this new environment.

 

I'm trying to use the rounding functions, but without much success.

 

If I create a parameter test = floor(311.781), I get an answer 311, as I expect. ceil and round also work as expected.

 

However, if I create a parameter that is the result of a calculation that returns 311.781 and floor that, I get 310. ceil and round also work to the nearest cm instead of the nearest mm.

 

FrontOfSide = ( NominalHeight - ( ( ( NominalDepth / 2 ) - MaterialThickness ) * tan(RoofAngle) ) + 0.5 mm ) = 311.781

NominalHeight = 350mm

NominalDepth = 300mm

MaterialThickness = 5.5mm

RoofAngle = 15deg

 

test = ( floor ( 311.781 ) * 1mm ) = 311mm

test2 = floor ( FrontOfSide ) = 310mm

 

I'm sure this is just something silly to do with me being a newbie, but would appreciate some help!

 

0 Likes
Accepted solutions (1)
19,948 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable

 

If I change all the quantities to be unitless by dividing the lengths by 1mm and then multiplying the result by 1mm at the end, it gives the right answer. So this must be something to do with the dimensions.

0 Likes
Message 3 of 10

NicolasXu
Autodesk
Autodesk
Accepted solution

Hi manolanFHZEC,

 

Thanks for reaching out to us. For value with unit, it seems the floor function is trying to convert other units to cm then rounding. (The underlying length unit in Fusion is cm.)

 

Please refer to the screenshots below. For expressions with units, such as “5.55mm”, “5.55cm” and “5.55dm”, the rounding is based on its corresponding cm value, i.e. floor (5.55mm) = floor (0.555cm) = 0 cm = 0 mm

Parameter.PNG

 

It might be confused, but take “test3= floor (5.55 dm)” as an example. What’s the expected result? As test3 has mm as unit, is it “floor (5.55 dm) = 5 dm = 500 mm”, “floor (5.55 dm) = floor (555 mm) = 555 mm”, or “floor (5.55 dm) = floor (55.5 cm) = 55 cm = 550 mm”? Fusion is using the last way.  

 

As you found, using unitless would be a good choice I think. You can always control the result as expected, just like the expression of user parameter test4. Does it make sense for you?

 

Best Regards,

 



Nicolas Xu
Sr. SQA Eng.
Fusion 360 Quality Assurance Team
Autodesk, Inc.
Message 4 of 10

Anonymous
Not applicable

 

Thanks for confirming that and explaining it so clearly, it makes perfect sense of what I am seeing.

 

However, I would say it is *not* the correct behaviour. Fusion shouldn't have the concept of an underlying unit of length or, if it must, I should be able to change it. But really it should respect the units of the measurement under calculation.  I would go so far as to say this is a bug.

 

M.

.

 

Message 5 of 10

NicolasXu
Autodesk
Autodesk

Hi manolanFHZEC,

 

I agree that the behavior is not so good. It would be great if the rounding respects the units of the user parameter. I have reported it to the development team and see how to improve it. (The report id is FUS-21937, for future references)

 

Thanks again for bringing this out.



Nicolas Xu
Sr. SQA Eng.
Fusion 360 Quality Assurance Team
Autodesk, Inc.
0 Likes
Message 6 of 10

bradanlane
Enthusiast
Enthusiast

I just encountered this issue.

 

Thanks for posting the work-around. I hope this is addressed in a future release.

 

I would seem logical that the ROUND, FLOOR, CEIL, etc functions should adhere to the unit measure of the parameter and not a unit measure coded internal to Fusion. The other functions will complain if the parameter units are not adhered to so it seems reasonable to expect the same for ROUND, FLOOR, CEIL, etc.

Message 7 of 10

dentontxtwu
Explorer
Explorer

I just ran into this as well... I have to agree with the last post, this is something that should be fixed as this behavior is not expected nor is it intuitive. 

Message 8 of 10

Anonymous
Not applicable

Same issue here - Glad there is a workaround, but it certainly isn't intuitive for those used to using inches instead of millimeters.

0 Likes
Message 9 of 10

MartinMajewski
Advocate
Advocate

Hi all,

 

so I ran into this problem today myself. It is an annoying behavior and I want to add a little detail to it, as it seems that it changed slightly by now.

 

Here is the number I want to round down:

 

Screen Shot 2018-01-12 at 15.40.18.png

 

The number is deducted from another variable, called DrawerHeight. I get 26.667 but want to get 26.

However, when I add the floor function, I get:

 

Screen Shot 2018-01-12 at 15.39.46.png

 

Fusion is obviously not rounding 26.xxx but 2.6xxx. Means, that it is converting the value to cm first, even when everything is in mm.

 

However, using numbers directly does not show the faulty behavior:

Screen Shot 2018-01-12 at 15.40.03.png

 

 

So I guess, that you have fixed the issue for literals by now, but not for variables OR the 40 is considered cm, even though Unit is set to mm.

 

 

Btw.: When adding pictures inside a post's editor window it is not possible to add new blank lines underneath it. You have to have some spare blank lines left and move the picture to one of the upper lines to be able to write underneath a picture.

 

 

Message 10 of 10

cps8EFYH2
Community Visitor
Community Visitor

Wait, so we still can't round values in inches, the manufacturing measurement used in the country Autodesk is based in??

0 Likes