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
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
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.
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
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!
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
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.
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!
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!
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
Can't find what you're looking for? Ask the community or share your knowledge.