Hello
You can set these formats like this:
Dim oUserParameter As UserParameter oUserParameter = oInvApp.ActiceDocument.Parameters.UserParameters.Item(1) oUserParameter.ExposedAsProperty = True oUserParameter.CustomPropertyFormat.Precision = CustomPropertyPrecisionEnum.kDegreesAnglePrecision oUserParameter.CustomPropertyFormat.PropertyType = CustomPropertyTypeEnum.kTextPropertyType oUserParameter.CustomPropertyFormat.ShowTrailingZeros = True oUserParameter.CustomPropertyFormat.ShowUnitsString = False
Hello
Define the correct type of precision-property
Private Sub fxex() Dim oInvApp As Application Set oInvApp = ThisApplication Dim oUserParameter As UserParameter Set oUserParameter = oInvApp.ActiveDocument.ComponentDefinition.Parameters.UserParameters.Item(1) oUserParameter.ExposedAsProperty = True oUserParameter.CustomPropertyFormat.PropertyType = CustomPropertyTypeEnum.kTextPropertyType oUserParameter.CustomPropertyFormat.Precision = CustomPropertyPrecisionEnum.kSixteenthsFractionalLengthPrecision oUserParameter.CustomPropertyFormat.Units = UnitsTypeEnum.kInchLengthUnits oUserParameter.CustomPropertyFormat.ShowUnitsString = False End Sub
oooo Thanks!
Now i see what i was missing!
What is a good resource for writing these VBA macros?
Hello
Happy it works.
The best three sources are:
- Autodesk Inventor programmers help (included in pulldown menu in every inventor installation)
- Internet
- watch window in VBA-Editor to step through the object model tree
Exactly kreig,
I prefer first and third options.... VBA Help is fantastic and watch window will tell all of the info in referenced Doc.
Cheers
Can't find what you're looking for? Ask the community or share your knowledge.