Hello! First off, pardon my bad English.
I am kind of new to iLogic and I am looking to do something in Inventor, but I cant figure out how.
When I import a part from content center, a tube in this case, I get a length parameter called <PL>.
I am using this parameter in the parts lists, so it shows "=Outer diameter x thickness x <PL>"
However I don't want trailing zeros, leading zeros or units string to be shown.
I know I can open the parameters window, right click the parameter, then click custom property format and then uncheck these boxes and its fine.
But I want to know if there is a smarter way to do this, like creating a rule to execute on all the parts?
I have around 500 pipes with the parameter <PL> that needs to be changed.
Can someone out there help me find a smarter way to do this?
All help appreciated.
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi ystrm,
There is an example of this at this link:
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Thanks for the reply
Could you explain further what I have to do with this code?
Say my parameter is PL
How should that code look like in a rule?
Hi ystrm,
It occured to me that the example I linked to didn't show everything you were after, and it used fractions for the precision. Here is another example using your parameter name.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
'get the parameter
oPL = Parameter.Param("PL")
'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)
ShowTrailingZeros = False
'set to show/not show the leading zeros (use True to show)
ShowLeadingZeros = False
'write values to the description property
iProperties.Value("Project", "Description") = "=Outer diameter x thickness x <PL>"
Hi again!
Thank you very much for the detailed information.
It did not solve everything though.
It removes the units string, but not the trailing zero's. I still get "250,000" in the parameter / custom iprop.
Any ideas?
Hi ystrm,
My applogies, I had a mistake in the previous example.
I had this:
ShowTrailingZeros = False
where it should have been this:
oFormat.ShowTrailingZeros = False
Here is the updated code:
'get the parameter oPL = Parameter.Param("PL") '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 'write values to the description property iProperties.Value("Project", "Description") = "=Outer diameter x thickness x <PL>"
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com