Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ilogic - Adding User Parameters with Custom Properties Format

16 REPLIES 16
SOLVED
Reply
Message 1 of 17
brian
6181 Views, 16 Replies

ilogic - Adding User Parameters with Custom Properties Format

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

16 REPLIES 16
Message 2 of 17
jletcher
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.....

Message 3 of 17
jletcher
in reply to: jletcher

Oh and you don't really need ilogic..

Message 4 of 17
Curtis_Waguespack
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>"

 

Message 5 of 17
brian
in reply to: Curtis_Waguespack

Curtis,

 

It works great.

 

Thanks,

 

Brian

Message 6 of 17
Curtis_Waguespack
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>"

 

Message 7 of 17
manjunathmvbhat
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

Message 8 of 17

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

 

 

Message 9 of 17

Remove directly from iproperties.
Message 10 of 17
jmaheta
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.   

Message 11 of 17
ChristinaForest
in reply to: brian

it's possible to add a allow customvalues in the end of multivalue list???

 

oInsulationType=oUserParams.AddByValue("CHANTS", "AUCUN", kTextUnits)
MultiValue.SetList("CHANTS", "AUCUN", "1C", "1L", "1L-1C", "1L-2C", "2L", "2L-1C", "2L-2C")

 

Thanks for your help!

Message 12 of 17

Hi Curtis, 

 

Sorry to be a bother but my Inventor doesn't like that code.  I put the rule in and then try to OK it but it comes up with an error.  I've attached a screenshot of the error.  

 

If it's not too much hassle could you tell me what the problem may be?  All I did was copy and paste your code.


Dell Precision T1700
Intel(R) Xeon(R) CPU E3-1241 v3 @ 3.50GHz (4 Cores)
Windows 7 64-Bit
16.0 GB RAM
NVIDIA Quadro K2200 (12002 MB / 4096 MB)
Message 13 of 17
JazzJPH13
in reply to: JazzJPH13

I have sorted it! It just took some logical effort and deciphering what the code means at each stage.

 

 


Dell Precision T1700
Intel(R) Xeon(R) CPU E3-1241 v3 @ 3.50GHz (4 Cores)
Windows 7 64-Bit
16.0 GB RAM
NVIDIA Quadro K2200 (12002 MB / 4096 MB)
Message 14 of 17
manjunathmvbhat
in reply to: JazzJPH13

Can I get that code
Message 15 of 17
JazzJPH13
in reply to: manjunathmvbhat

What exactly do you need?  Mine is just a metric version of what Curtis has already posted earlier.


Dell Precision T1700
Intel(R) Xeon(R) CPU E3-1241 v3 @ 3.50GHz (4 Cores)
Windows 7 64-Bit
16.0 GB RAM
NVIDIA Quadro K2200 (12002 MB / 4096 MB)
Message 16 of 17
manjunathmvbhat
in reply to: JazzJPH13

OK
Know I will explain you clearly.
If I update anything In custom it has to get updated in parameters.
Know its reverse is happening, I want custom to parameters.

Example,

If the value of sheet thickness is 10 that I want to change through
assembly bom, I can call the custom I property in assembly bom there i Can
directly change directly.
So please give any soln.
Message 17 of 17
Shane_R
in reply to: manjunathmvbhat

I too am trying to use iLogic to create a multivalue parameter and also make it allow custom values.  So far I am stumped. 

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

Post to forums  

Autodesk Design & Make Report