Showing posts with label unit. Show all posts
Showing posts with label unit. Show all posts

Friday, 30 October 2015

Reported Length


In one of my previous post I’ve shown you how to change length parameter format for steel shapes in Content Center (CC) so that assembly Bill of Materials (BOM) will have no trailing zeros and round up the value to a 1 mm increment.


On that post I gave you a bit of ilogic code that can change formatting of files you might have generated already which can come in hand and can be used with code injector.

At that time I didn’t realized that you might not use the assembly BOM to report your lengths but use the drawing Parts List so in this post we will look at doing just that.

If your company uses Parts Lists then you might be lucky and saved yourself a good couple of day’s work where you needed to copy all the default libraries to a custom read-write and then editing all the templates to report correct length parameters.

The Parts Lists can be formatted just like the parameter display and you can show/hide, trailing or leading zeros, units string or even change units to: in, mm, cm, m, ft, yard, mi, or microns.

Double click on your table or right click and choose “Edit Parts List...” either on the browser or graphical window.

Right click the quantity column and choose “Format Column...”. In the format column window you can specify a new name for the column, change text justification and most importantly you can change units formatting.


Click on “Apply Units Formatting” to activate the submenus. Now you can change trailing or leading zeros, change units type, units and precision. It can be configure to report a different measurement unit, to change decimal from "." to "," and you can choose if you need to have the units string displayed at all.


If you use the Materials List table style supplied with Inventor you will have to modify the Substitution tab in the format cell window. In the Substitution window you might have “Enable Value Substitution” and “When exists, use value of” PL. This is helpful for those that do Tube and Pipe where the reported parameter for pipe length is PL.


And of course there’s a catch. Your units will be rounded but you need to be careful because you can have it rounded up or rounded down. Both can cost you and rounding up an expensive material can be just as expensive as rounding down and not having enough to complete your design.


My settings will keep units to mm but will remove trailing zeros and set precision to 0 decimals. Most workshops will not need or manufacture to less than 1mm increments but this is for you to decide.

In this way you can keep the default formatting of CC and keep working with the out of the box libraries without the hassle of copying or editing them.

Later,
ADS


Thursday, 17 September 2015

Length parameter format

Those of you working with frame generator or with content center steel shapes know that in order to get the length parameter to display correctly you need to edit the parameter formatting.

So how do we change the content center steel shape template?

Now you have two options:
The first one would be to open the file from Content Center and for that you can click on the big I top left (inventor menu) and in the open flyout menu choose Open from Content Center.
The second option is to edit an already generated file or create one by using place from content center in an assembly.
Once you have the part open you can edit and format the parameter display and then you will need to update family template in content center using this new file.

Let’s detail the first option which seems a bit quicker as well. You need to copy the family first and then generate the file because otherwise Inventor will complain that the new template is not a valid file.

- To copy the content center family to a read-write library like My Library provided by default use the Content Center Editor from the Mange tab, Content Center pane and browser to the family.

- Right click the family and copy it to your library.


- Click on big I top left and from the Open fly-out menu choose Open from Content Center, then choose the family you just copied and in the member window make sure you choose Place as Custom. Length and size it's not important so choose any.


- It will then prompt you for a save location and then will open the file for you. Now you can edit the parameters removing trailing, leading, units, and change precision to suit you.


- Now you need to edit Content Center again with the Manage button and then change from Merged View to your library (THIS IS IMPORTANT) or the extra commands will not be available.

- On the contextual right-click menu choose Replace Family Template and select the file you have edited.


So how about all those files generated already?

 Unfortunately you need to open and edit each and every file individually or use code injector and run this code.

Code injector can be found here and the original ilogic code was posted on the autodesk forum by Curtis Waguespack so head over to the original post and give him kudos.


'-------------start of ilogic code ----------------

'get the parameter
oPL = Parameter.Param("G_L")
'export the paramter as an iProperty
oPL.ExposedAsProperty = True
'set the parameter as a custom property
oFormat=oPL.CustomPropertyFormat
'set the custom iProperty as a text type
oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
'set the precision
oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kThreeDecimalPlacesPrecision
'set the unit type
oFormat.Units="mm"
'set to show/not show the unit string (use True to show)
oFormat.ShowUnitsString=False
'set to show/not show the trailing zeros (use True to show)
oFormat.ShowTrailingZeros = False
'set to show/not show the leading zeros (use True to show)
oFormat.ShowLeadingZeros = False

'-------------end of ilogic code ----------------

Thursday, 17 July 2014

Rounding Inventor Parameters

The other day I was looking to round the value of a parameter. I was actually calculating distance from the floor to the top of a flange on a conical tank and the value came with billion digit precision. It's nice to have it but it doesn't look professional when dimensionsing or measuring from it.
Couple of words on rounding parameters and using functions:
Functions
The following are the supported functions as presented in the Autodesk Inventor help page.


Syntax
Returns Unit Type
Expected Unit Type
cos(expr)
unitless
angle
sin(expr)
unitless
angle
tan(expr)
unitless
angle
acos(expr)
angle
unitless
asin(expr)
angle
unitless
atan(expr)
angle
unitless
cosh(expr)
unitless
angle
tanh(expr)
unitless
angle
acosh(expr)
angle
unitless
asinh(expr)
angle
unitless
sqrt(expr)
unit^1/2
any
sign(expr)
unitless
any (Return 0 if negative, 1 if positive.)
exp(expr)
unitless
any (Return exponential power of expression: for example, return 2 for 100, 3 for 1000, and so on.)
floor(expr)
unitless
unitless (Next lowest whole number.)
ceil(expr)
unitless
unitless (Next highest whole number.)
round(expr)
unitless
unitless (Closest whole number.)
abs(expr)
any
any
max(expr1;expr2)
any
any
min(expr1;expr2)
any
any
ln(expr)
unitless
unitless
log(expr)
unitless
unitless
pow(expr1;expr2)
unit^expr2
any and unitless, respectively
random(expr)
unitless
unitless
isolate(expr;unit;unit)
any
any


The last one isolate is used to change from one unit to another and this if usefull if you need to calculate the number of holes (of type unitles ul) by dividing a linear dimension (of unit mm) by another linear dimension (of unit mm). The normal result will be of type mm and you need to convert it to unitless ul like this:
isolate((total_length / hole_dist); mm; ul)
Now I was looking to round the result of an equation to an integer but the result was surprising.

Round 1497.21 = 1500 ?!?
Ceil 1497.21 = 1500 ?!?
Floor 1497.21 = 1490 ?!?

Round 1497.00 = 1500 ?!?
Ceil 1497.00 = 1500 ?!?
Floor 1497.00 = 1490 ?!?

Round 1497.51 = 1500 ?!?
Ceil 1497.51 = 1500 ?!?
Floor 1497.51 = 1490 ?!?

So in order to get a proper rounding you need to multiply it first by a multiple of 10, then do the operation and divide again by the same 10 multiple.

Round (1497.21 * 10) /10 = 1497
Ceil (1497.21 * 10) / 10 = 1498
Floor (1497.21 * 10) / 10 = 1497

Round (1497.00 * 10) /10 = 1497
Ceil (1497.00 * 10) / 10 = 1498
Floor (1497.00 * 10) / 10 = 1497

Round (1497.51 * 10) /10 = 1498
Ceil (1497.51 * 10) / 10 = 1498
Floor (1497.51 * 10) / 10 = 1497






I am missing something and it's got to do with the unit conversion for sure, but for now this will do.

Hope it helps you as well.

EDIT 16-02-2016:
There is an update for this so come check it out here.
ADS