Inventor General Discussion

Inventor General Discussion

Reply
Active Member
brian
Posts: 6
Registered: ‎10-21-2011
Message 1 of 17 (2,378 Views)
Accepted Solution

ilogic - Adding User Parameters with Custom Properties Format

2378 Views, 16 Replies
05-21-2012 04:59 AM

I would like to have a rule that will add specific user parameters to a part file.  These parameters need to be formatted so the width, depth and thickness will control the description of the part.

 

IE:

Width=4

Depth=2

Thickness=3/16

 

DESCRIPTION = TS <Width>X<Depth>X<Thickness>

 

I would like to format each parameter so that the:

Format=Fractional

Precision=1/16

Unit string=False

 

This is what I have so far:

 

 oMyParameter=ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters

oParameter=oMyParameter.AddByExpression("Width", "TOP_RAIL_WIDTH", UnitsTypeEnum.kInchLengthUnits)
oParameter.ExposedAsProperty=True
oParameter.Units="in"

oParameter=oMyParameter.AddByExpression("Depth", "TOP_RAIL_DEPTH", UnitsTypeEnum.kInchLengthUnits)
oParameter.ExposedAsProperty=True
oParameter.Units="in"

oParameter=oMyParameter.AddByExpression("Thickness", "TOP_RAIL_THICKNESS", UnitsTypeEnum.kInchLengthUnits)
oParameter.ExposedAsProperty=True
oParameter.Units="in"



The TOP_RAIL parameters are from a linked file.

 

Thanks,

 

Brian

Hi brian

 

Here is some iLogic code and an example file that will format parameters and add them to the Description iProperty.

 

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

 

 

Dim oWidth, oDepth, oThickness As Parameter
Dim oFormat As CustomPropertyFormat
oWidth = Parameter.Param("Width")
oWidth.ExposedAsProperty = True
oFormat=oWidth.CustomPropertyFormat
oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kSixteenthsFractionalLengthPrecision
oFormat.Units="in"
oFormat.ShowUnitsString=False
oDepth = Parameter.Param("Depth")
oDepth.ExposedAsProperty = True
oFormat=oDepth.CustomPropertyFormat
oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kSixteenthsFractionalLengthPrecision
oFormat.Units="in"
oFormat.ShowUnitsString=False
oThickness = Parameter.Param("Thickness")
oThickness.ExposedAsProperty = True
oFormat=oThickness.CustomPropertyFormat
oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kSixteenthsFractionalLengthPrecision
oFormat.Units="in"
oFormat.ShowUnitsString=False
iProperties.Value("Project", "Description") = "= TS <Width> x <Depth> x <Thickness>"

 

*Pro
jletcher
Posts: 1,983
Registered: ‎05-18-2011
Message 2 of 17 (2,367 Views)

Re: ilogic - Adding User Parameters with Custom Properties Format

05-21-2012 06:26 AM in reply to: brian

just put a check in the export box in the parameters. for the format after you put a check mark in the export box if you go over to the equation right click you wil have new options. One is custom property format in there you can change the output.....


Please mark this response as "Accept as Solution" if it answers your question.

James Letcher
2012 Factory Design Suite ( will not load 2013)
What happen to my Inventor :-(
*Pro
jletcher
Posts: 1,983
Registered: ‎05-18-2011
Message 3 of 17 (2,366 Views)

Re: ilogic - Adding User Parameters with Custom Properties Format

05-21-2012 06:27 AM in reply to: jletcher

Oh and you don't really need ilogic..


Please mark this response as "Accept as Solution" if it answers your question.

James Letcher
2012 Factory Design Suite ( will not load 2013)
What happen to my Inventor :-(
*Expert Elite*
Curtis_Waguespack
Posts: 2,986
Registered: ‎03-08-2006
Message 4 of 17 (2,359 Views)

Re: ilogic - Adding User Parameters with Custom Properties Format

05-21-2012 08:20 AM in reply to: brian

Hi brian

 

Here is some iLogic code and an example file that will format parameters and add them to the Description iProperty.

 

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

 

 

Dim oWidth, oDepth, oThickness  As Parameter
Dim oFormat As CustomPropertyFormat

oWidth = Parameter.Param("Width")
oWidth.ExposedAsProperty = True
oFormat=oWidth.CustomPropertyFormat
oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kSixteenthsFractionalLengthPrecision
oFormat.Units="in"
oFormat.ShowUnitsString=False

oDepth = Parameter.Param("Depth")
oDepth.ExposedAsProperty = True
oFormat=oDepth.CustomPropertyFormat
oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kSixteenthsFractionalLengthPrecision
oFormat.Units="in"
oFormat.ShowUnitsString=False

oThickness = Parameter.Param("Thickness")
oThickness.ExposedAsProperty = True
oFormat=oThickness.CustomPropertyFormat
oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kSixteenthsFractionalLengthPrecision
oFormat.Units="in"
oFormat.ShowUnitsString=False

iProperties.Value("Project", "Description") = "= TS <Width> x <Depth> x <Thickness>"

 



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





Active Member
brian
Posts: 6
Registered: ‎10-21-2011
Message 5 of 17 (2,347 Views)

Re: ilogic - Adding User Parameters with Custom Properties Format

05-21-2012 08:44 AM in reply to: Curtis_Waguespack

Curtis,

 

It works great.

 

Thanks,

 

Brian

*Expert Elite*
Curtis_Waguespack
Posts: 2,986
Registered: ‎03-08-2006
Message 6 of 17 (2,338 Views)

Re: ilogic - Adding User Parameters with Custom Properties Format

05-21-2012 09:20 AM in reply to: brian

Hi brian, 

 

I'm glad to hear that worked.

 

I noticed that I left those first two lines of the code in. They're not really needed, and don't really do anything as written because  those things get defined later in the code. They were just vestiges of my first attempt that I forgot to remove once I went a different way.  I just thought I'd mention it in case it confuses someone who happens upon this in the future.

 

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

 

 

so, this works just as well:

 

oWidth = Parameter.Param("Width")
oWidth.ExposedAsProperty = True
oFormat=oWidth.CustomPropertyFormat
oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kSixteenthsFractionalLengthPrecision
oFormat.Units="in"
oFormat.ShowUnitsString=False

oDepth = Parameter.Param("Depth")
oDepth.ExposedAsProperty = True
oFormat=oDepth.CustomPropertyFormat
oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kSixteenthsFractionalLengthPrecision
oFormat.Units="in"
oFormat.ShowUnitsString=False

oThickness = Parameter.Param("Thickness")
oThickness.ExposedAsProperty = True
oFormat=oThickness.CustomPropertyFormat
oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kSixteenthsFractionalLengthPrecision
oFormat.Units="in"
oFormat.ShowUnitsString=False

iProperties.Value("Project", "Description") = "= TS <Width> x <Depth> x <Thickness>"

 



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





Member
manjunathmvbhat
Posts: 4
Registered: ‎12-05-2012
Message 7 of 17 (2,040 Views)

Re: ilogic - Adding User Parameters with Custom Properties Format

12-05-2012 09:13 AM in reply to: brian

sir can anyone help me to update the thickness of a sheet metal,  through custom properties in BOM(Assembly level)

if i create opposite hand of a part the thickness will not getting updated please help me out update through custom properties, i want like if i update the custom properties thickness then automatically it has to get updated in parameters.

 

thanks and regards

Manjunatha

Active Member
akhidrosyidi
Posts: 7
Registered: ‎10-08-2012
Message 8 of 17 (1,980 Views)

Re: ilogic - Adding User Parameters with Custom Properties Format

12-20-2012 11:20 PM in reply to: Curtis_Waguespack

sir, can you help me create co to remove All Custom property?

i want to clearup all custom properties and add new one.

 

Thanks and regard

 

 

Member
manjunathmvbhat
Posts: 4
Registered: ‎12-05-2012
Message 9 of 17 (1,921 Views)

Re: ilogic - Adding User Parameters with Custom Properties Format

01-15-2013 06:07 PM in reply to: akhidrosyidi
Remove directly from iproperties.
Active Member
jmaheta
Posts: 8
Registered: ‎06-27-2012
Message 10 of 17 (1,883 Views)

Re: ilogic - Adding User Parameters with Custom Properties Format

01-19-2013 05:27 PM in reply to: manjunathmvbhat

Create the opposite hand using derived component. Derive a mirror part and bring the parameters of the original. This way both thicknesses will get updated.   

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!