If you have parameters for the dimensions you want to extract, you can expose them as iProperties and then right a formula in another iProperty that references them, which gets automatically updated. If you reuse parts, the parameters will stay exposed as you copy them to new files.
Now there isn't any way to manually expose a parameter, but this rule will help you get them exposed:
Sub Main
If ThisApplication.ActiveDocument.DocumentType <> kPartDocumentObject Then Exit Sub
Dim openDoc As PartDocument = ThisApplication.ActiveDocument
'Option 1 load parameters into list to pick from.
Dim ParamsList As New List(Of String)
For Each p As Parameter In openDoc.ComponentDefinition.Parameters
ParamsList.Add(p.Name)
Next
If ParamsList.Count < 1 Then Exit Sub
'User selects a parameter to expose
UserInput = InputListBox("Select a Parameter to Expose As iProperty", ParamsList, ParamsList.Item(1), Title := "Expose a Paramter", ListName := "Available Paramters")
If IsNothing(UserInput) Then Exit Sub
Call Formatting(openDoc, UserInput)
iLogicVb.UpdateWhenDone = True
End Sub
Sub Formatting(oDoc As PartDocument, oParam As String)
Dim oP As Parameter= oDoc.ComponentDefinition.Parameters.Item(oParam)
oP.ExposedAsProperty = True
'Custom Property Formtting Options:
oFormat=oP.CustomPropertyFormat
oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
oFormat.Units = oP.Units
' oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kTwoDecimalPlacesPrecision
' oFormat.ShowUnitsString = False
' oFormat.ShowLeadingZeros = False
' oFormat.ShowTrailingZeros = True
oDoc.Rebuild
End Sub
Exposed Parameters will appear in the Custom tab of the iProperties, and in the Parameters list there will be an extra option when right clicked: "Custom Property Format" [which can be set from the rule above with the commented out options or manually after exposing].
Then it as easy as writing an equation in the desired iProperty that references the custom ones.
Example:
Parameters that were exposed: "OD", "ID", "Thickness"
Description iProperty: "=Plate at <Thickness> has Diameters: <OD> & <ID>"