The next few posts I’ll be making are intended to complete my coverage of topics related to iProperties. I’ve made several recent posts that I believe cover the majority of the API functionality that will enable you to write most programs that use iProperties. However, there are a few odds and ends that I haven’t covered. Here’s the first of these last set of posts on iProperties.
In the Parameters dialog you can check the Export Parameter box for a parameter, as shown circled below. This is useful because there are quite a few areas in Inventor that provide access to property values, (text in drawings, BOM, etc.), and by exporting a parameter as a property it extends the use of the existing functionality to also be able to use parameters.
This causes a custom iProperty to be created that contains the value of that parameter. This is a one-way association. Changing the parameter will cause the iProperty to update, but changing the value of the iProperty will not cause the parameter to update. The iProperty is just a reflection of the parameter and will be updated whenever the parameter value changes.
If the Export Parameter box is checked, then you can also access the Custom Property Format… command through the context menu, as shown below.
This displays the dialog shown below where you can control the format of the iProperty that’s created for this parameter.
This all results in the iProperty shown below. The name of the iProperty is the same as the parameter. If an iProperty of that name already exists, it’s value will be overwritten to the value of the parameter. You can edit and even delete the iProperty, but Inventor will overwrite the edited value or re-create the iProperty whenever the parameter value changes.
From the API you can also set the “Export Parameter” box for a parameter. You do this by using the ExposedAsProperty property of the Parameter object. With Inventor 2010 and later you can also edit the formatting of the resulting iProperty using the CustomPropertyFormat property of the Parameter object. This is demonstrated in the code below.
Set param = partDoc.ComponentDefinition.Parameters.Item("Length")
param.ExposedAsProperty = True
param.CustomPropertyFormat.Precision = kThreeDecimalPlacesPrecision
param.CustomPropertyFormat.ShowTrailingZeros = True
param.CustomPropertyFormat.ShowUnitsString = True
param.CustomPropertyFormat.Units = "in"
iProperties created as the result of an export appear like any other property through the API. In fact, the iProperty doesn’t know it’s the result of an export. If you need to find the iProperties that were created through an export you’ll would need to look through the parameters to see if any of them have been exported.





Leave a Reply to RamyCancel reply