Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using iLogic to change parameter

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
ystrm
4367 Views, 7 Replies

Using iLogic to change parameter

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.

7 REPLIES 7
Message 2 of 8
Curtis_Waguespack
in reply to: ystrm

Hi ystrm,

 

There is an example of this at this link:

http://forums.autodesk.com/t5/Autodesk-Inventor/ilogic-Adding-User-Parameters-with-Custom-Properties...

 

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

Message 3 of 8
ystrm
in reply to: Curtis_Waguespack

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?

 

 

 

Message 4 of 8
Curtis_Waguespack
in reply to: ystrm

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

 

Message 5 of 8
ystrm
in reply to: Curtis_Waguespack

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?

Message 6 of 8
Curtis_Waguespack
in reply to: ystrm

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

Message 7 of 8
ystrm
in reply to: Curtis_Waguespack

That did it!

Thanks alot Smiley Happy

Message 8 of 8

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

Post to forums  

Autodesk Design & Make Report