I am sure this is extremely simple to do but I am missing something. I am wanting to set the Description of a part in the Iproperties using values from the parameters. For instance, if the part has a length value of 10 and a width value of 5 I want the Description to say: 10 x 5 Floor Sheet
I cannot figure out how to extract the parameter values and place them into the iproperties. Here is what I have tried:
iProperties.Value("Project", "Description")="=<Length> x <Width> Floor Sheet"
This gives me the following result in my description:
x Floor Sheet
I am sure I am missing something simple so help would be appreciated. Thanks!
I figured it out for anyone interested. Here is what I did...
iProperties.Value("Project", "Description")=Floor_Sheet_Length & " x " & Floor_Sheet_Width & " Sub-Floor Sheet"
Your first bit of code will also work if you make sure your parameters are exported. Go to the parameters editor, and click the export check box for each parameter that needs to show up in the description. See below.
You can then control how the value is displayed in the description by right-clicking on the parameter (in the editor) and choosing Custom Propery Format. The results are shown below:
Cameron Whetten
Inventor 2014
Hi Ionfreefly,
To add to what cwhetten has shown, you can also export and format the parameters using code as illustrated in this example:
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>"
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Can't find what you're looking for? Ask the community or share your knowledge.