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: 

Exporting user text parameters to custom I properties

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
Anonymous
6955 Views, 10 Replies

Exporting user text parameters to custom I properties

I am trying to export a user parameter that is a text string to a custom I property. I am able to export other parameters to custom properties that are numarical values. I export check box is missing on the text user parameter.

 

Is there a way to acomplish this with I-logic?

 

Thanks

Mike

10 REPLIES 10
Message 2 of 11
MegaJerk
in reply to: Anonymous

Do you want to export all text parameter values to iProperties of the same name, or just a specific text Parameter to an iProperty?

If you plan on doing just a specific Parameter to an iProperty, will you need to do this across multiple parts, or is it just a onetime thing for something that you're doing. 

This will all influence the code in some way. 



If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
Message 3 of 11
Anonymous
in reply to: MegaJerk

I am planning on setting the User Text Parameters in my part template file to give the user a drop down list to pick material specifications from. Then have this user parameter exported automatically and used in the drawing BOM.

 

I want this Text Parameter to be exported when the file is saved. I have successfully exported numerical user parameters to a custom I-property, I just can't export the text parameters.

 

My goal is to give the user one place to set the plate thickness material spec. and if it is plate or sheet. Then have all that info written to the I-properties to be used in the drawing parts list.

 

Thanks for the reply.

Cheers

Mike

Message 4 of 11
MegaJerk
in reply to: Anonymous

Oh man! I must be honest. Right around the time of you posting this, work became crazy busy and I... forgot about it 😕 

 

To get a custom iProperty to autoupdate with the value of a text parameter, it could be as simple as adding a single line of iLogic code to the part : 

 

iProperties.Value("Custom", "VeryCustomProperty") = TestText 

 

 

TestText being a multivalue Text parameter contained in the template part, and VeryCustomProperty being a custom iProperty that is also in the template part. 

 

In this way you would set up your drawing part's list to pull from the custom iProperty 'VeryCustomProperty', which would display the value for the given part it was tied to. 

 

Because I'm not 100% sure if this is what you are wanting to do (only), give me some feedback and we'll continue from there. Now that things have calmed down here (due to winter time), I won't leave you out in the cold 😞 

 

Sorry! 

 

 



If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
Message 5 of 11
Anonymous
in reply to: MegaJerk

No Worries

 

Thanks for the info, I will give it a try.

 

Cheers

Mike

Message 6 of 11
Curtis_Waguespack
in reply to: Anonymous

Hi  MDS-MQ

 

Here's a quick example rule I had on hand that creates parameters and then formats them as custom iProperties. ExposedAsProperty creates the iProperty from the parameter, the rest is just formatting it.

 

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

 

 

Imports  Inventor.UnitsTypeEnum
		
Dim oParams As Parameters
oParams=ThisDoc.Document.ComponentDefinition.Parameters
				
Dim oUserParams As UserParameters
oUserParams=oParams.UserParameters     

'look for user parameter and try to set it        		
Try
oUserParams("SM_Length").Value = SheetMetal.FlatExtentsLength *2.54
Catch
' assume error means not found and create it
oUserParams.AddByValue("SM_Length", SheetMetal.FlatExtentsLength *2.54, kInchLengthUnits) 
End Try

'create list of parameters to format
Dim myArrayList As New ArrayList
myArrayList.add("SM_Length")
myArrayList.add("Thickness")

Dim oString as Object
Dim oParam As Parameter
Dim oFormat As CustomPropertyFormat

i=0
For Each oString in myArrayList
myParam = myArrayList.Item(i)
oParam = oParams(myParam)
oParam.ExposedAsProperty = True
oFormat = oParams(myParam).CustomPropertyFormat
oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kSixteenthsFractionalLengthPrecision
oFormat.ShowUnitsString = True
oFormat.Units = "in"       
i= i+1
Next

'set the description to read in the iProperties
iProperties.Value("Project", "Description") = "= SH <Thickness> x <SM_Length>"
'update the file
iLogicVb.UpdateWhenDone = True




 

Message 7 of 11
Anonymous
in reply to: Anonymous

Modified the first code you posted (slightly) to create two separate "L" and "WIDTH" custom iproperties, then attached it to a form for easy access across multiple parts. It works like a charm! Thank you.

Message 8 of 11
jspiegel3FSKX
in reply to: MegaJerk

Oh my god Oh my god you just fixed my world with that little snippet of code. I know this is an old thread but I am an old man and I don't do the happy dance very often, and to be honest no one want's to see it! it's not pretty.. thanks a million.


@MegaJerk wrote:

Oh man! I must be honest. Right around the time of you posting this, work became crazy busy and I... forgot about it 😕 

 

To get a custom iProperty to autoupdate with the value of a text parameter, it could be as simple as adding a single line of iLogic code to the part : 

 

iProperties.Value("Custom", "VeryCustomProperty") = TestText 

 

 

TestText being a multivalue Text parameter contained in the template part, and VeryCustomProperty being a custom iProperty that is also in the template part. 

 

In this way you would set up your drawing part's list to pull from the custom iProperty 'VeryCustomProperty', which would display the value for the given part it was tied to. 

 

Because I'm not 100% sure if this is what you are wanting to do (only), give me some feedback and we'll continue from there. Now that things have calmed down here (due to winter time), I won't leave you out in the cold 😞 

 

Sorry! 

 

 


 

Message 9 of 11
BLA_fpineda
in reply to: Anonymous

Finally in Inventor 2024 you can Export, Derive and Link Text Parameters!

They need 24 versions/years to solve clean this workflow...

 

Well done Autodesk!

Message 10 of 11
Lupe_Stewart
in reply to: BLA_fpineda

Where is the link text parameters at...... all I can do is send them to the custom iproperties area and that is it.... no linking text parameter from one part to the other

Message 11 of 11
Lupe_Stewart
in reply to: BLA_fpineda

disreguard..... got it!!!

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

Post to forums  

Autodesk Design & Make Report