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 ----------------

No comments:

Post a Comment