Using iLogic to change parameter

Using iLogic to change parameter

Anonymous
Not applicable
5,089 Views
7 Replies
Message 1 of 8

Using iLogic to change parameter

Anonymous
Not applicable

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.

Accepted solutions (1)
5,090 Views
7 Replies
Replies (7)
Message 2 of 8

Curtis_Waguespack
Consultant
Consultant

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

EESignature

Message 3 of 8

Anonymous
Not applicable

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?

 

 

 

0 Likes
Message 4 of 8

Curtis_Waguespack
Consultant
Consultant

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

 

EESignature

Message 5 of 8

Anonymous
Not applicable

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?

0 Likes
Message 6 of 8

Curtis_Waguespack
Consultant
Consultant
Accepted solution

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

EESignature

Message 7 of 8

Anonymous
Not applicable

That did it!

Thanks alot Smiley Happy

0 Likes