Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Rounding the value of a driven parameter in a par tlist.

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
dexterdweller
2822 Views, 10 Replies

Rounding the value of a driven parameter in a par tlist.

I have some driven parameters that are listed in my part list. I need these to display and round to the nearest sixteenth of an inch. My variable will display in decimals and carries over four places. I know when using fractions you set it to 1/16 and your done. Here I am at a loss...

 

Any help would be appreciated.

10 REPLIES 10
Message 2 of 11
cbenner
in reply to: dexterdweller

In your parts list where you are showing the parameter.  Right click the column header and select Format Column.  Check "Apply Units Formatting".  Set for length, Fractional (choose your fraction stack method), Precision and decide if you want to show the Unit String (in.)

 

I hope this was what you were looking for.

 

param.JPG

Message 3 of 11
dexterdweller
in reply to: cbenner

What I hope to do is set it to decimal and hold the precision to 0.1234 but at the same time I want it to round to the nearest 0.0625 or 1/16th of an inch. If I could be real picky I would prefer to round it up. I cant seem to figure out the rounding part with this precision; can I do it from within this menu?
Message 4 of 11
cbenner
in reply to: dexterdweller

That, I don not believe you can do.  If you use decimals and set the precision to 4 places that's exactly what you're going to get.  A precise decimal number to 4 places.  I think the only way you can round to a 1/16", would be to go with fractional values.

 

That said, there may be a way to do somehting like this using ilogic.  I've barely even cracked the book I have on trying to learn that so I'm afraid I'd be a bad source of advice there.  You may way to pose this to the Inventor Customization forum, there are some very talented people in there that might have some ideas.

Message 5 of 11
dexterdweller
in reply to: cbenner

10/4 I'll try and post it over there. Thanks for trying to help I do appreciate your time.

Mike
Message 6 of 11
JavaLodge
in reply to: dexterdweller

This is a bit of iLogic I found that will round a model dimension to the nearest increment that you set.

 

A couple notes, there needs to be a parameter with the same name as the one in the code.  Replace model_dimension with the name of a a dimension (d51, d14, etc) or a parameter name and the code will save the result of the rounding to parameter_name.  There is a function called ceiling which will always round a value up to the nearest whole number I think.  That might help you with your rounding up need.  I hope this helps.

 

inc = .0625

parameter_name = Round(Round(model_dimension,4) / inc) * inc 
A couple notes, there must be a parameter matching the names in the code, and you need to replace 
____________________________________________________________
Slow is good and good is fast.
Message 7 of 11
JavaLodge
in reply to: JavaLodge

Just to be clear, I found this code from a blog.  I'm certainly not smart enought to write any code for myself Smiley Very Happy

 

Here's the link to where I found it:

 

http://opendesignproject.org/2012/02/03/inventor-ilogic-rounding-decimals/

____________________________________________________________
Slow is good and good is fast.
Message 8 of 11

Hi  dexterdweller,

 

You could create a User Parameter to format your Driven/Reference Parameter. And then just use the User Parameter (named as you like) as a custom iProperty in the BOM and Parts List.

 

A formula such as this:

 

round(d8 * 16 ul / 1 in) * 1 in / 16 ul

 

Where d8 is the Reference Parameter, will round to the nearest 16th, then you would check the Export Parameter option (red arrow below) , and then right click on the parameter (green arrow), and set the user parameter's Custom Property Format to a 4 place percision.

 

Autodesk Inventor Round Parameter.png

 

 

Then you would configure your BOM and/or Parts list to see the resulting custom iProperty (post back if you need help with that part of it).

 

An alternate way that allows you change the round value easier:

Autodesk Inventor Round Parameter2.png

 

See cwhetten's posts at this link for an explanation of the equation and funky units conversion:

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

 

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

Message 9 of 11
dexterdweller
in reply to: JavaLodge

I will check out this blog and your suggestion. I hear ya I want to learn to write some code but spare time is not on my side...
Thanks!
Message 10 of 11

I have to say this never crossed my mind; but it looks like it will do what I need very well. I will give it a whirl! Thanks a bunch! Mike a.k.a. dexterdweller
Message 11 of 11

Worked like a charm!

 

Thanks again!

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report