Inventor General Discussion

Reply
Valued Contributor
j_berry
Posts: 68
Registered: ‎11-15-2012
Message 1 of 6 (286 Views)
Accepted Solution

Parameter Not Rounding Correctly

286 Views, 5 Replies
10-07-2013 11:08 AM

I'm getting unexpected results using "round( )" in the parameters table. File attached (Inventor 2014). Details below.

 

width = 35.125

 

end_result = round(width)

 

Nominal value for "end_result" is 35.039370. Why is this not rounding to exactly 35?

*Expert Elite*
cwhetten
Posts: 1,055
Registered: ‎09-03-2008
Message 2 of 6 (280 Views)

Re: Parameter Not Rounding Correctly

10-07-2013 11:13 AM in reply to: j_berry

It's probably a units problem.  For whatever reason, the round( ) function expects a unitless value, and returns a unitless value.  So, if width and end_result are in mm, you will have to write your function like this:

 

round( width / 1mm ) * 1mm

 

The ceil( ) and floor( ) functions suffer the same ailment.

 

Cameron Whetten
Inventor 2014

Please click "Accept as Solution" if this response answers your question.

*Expert Elite*
Curtis_Waguespack
Posts: 2,841
Registered: ‎03-08-2006
Message 3 of 6 (276 Views)

Re: Parameter Not Rounding Correctly

10-07-2013 11:16 AM in reply to: j_berry

 

Hi  j_berry,

 

See this link for further information:

http://forums.autodesk.com/t5/Autodesk-Inventor/parameter-rounding-up-to-nearest-fractional-part-of-...

 

If that helps, you might give  cwhetten a couple of kudos for the well written explanation. :smileywink:

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





New Member
brucejwheeler
Posts: 2
Registered: ‎10-16-2013
Message 4 of 6 (211 Views)

Re: Parameter Not Rounding Correctly

10-16-2013 08:02 AM in reply to: j_berry

Is there a way to "round up" or "round down"? This would give a conditional number.

If I round()*1, I may get a decimal number (less than 1). My preference would be to rounddown to recieve a lwer whole number.

Valued Contributor
mikejones
Posts: 82
Registered: ‎10-09-2007
Message 5 of 6 (205 Views)

Re: Parameter Not Rounding Correctly

10-16-2013 08:09 AM in reply to: brucejwheeler

You'll need to use FLOOR() or CEIL() to round up or down respectively

 

Mike

Autodesk Certified Professional
New Member
brucejwheeler
Posts: 2
Registered: ‎10-16-2013
Message 6 of 6 (204 Views)

Re: Parameter Not Rounding Correctly

10-16-2013 08:15 AM in reply to: mikejones
Thanks Mike this works!!

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube