Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can i make these custom property formats with VBA?

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
Vitornis
736 Views, 6 Replies

How can i make these custom property formats with VBA?

ScreenClip.png

6 REPLIES 6
Message 2 of 7
Ralf_Krieg
in reply to: Vitornis

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

 


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 3 of 7
Vitornis
in reply to: Ralf_Krieg

How do you change the format to fractional?

Message 4 of 7
Ralf_Krieg
in reply to: Vitornis

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

 


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 5 of 7
Vitornis
in reply to: Ralf_Krieg

oooo Thanks!

 

Now i see what i was missing!

 

What is a good resource for writing these VBA macros?

Message 6 of 7
Ralf_Krieg
in reply to: Vitornis

Hello

 

Happy it works. Smiley Happy

 

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


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 7 of 7
ADNpati
in reply to: Ralf_Krieg

 

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

Mechanical Engineer
Inventor Applications Engineer

--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -

-------------------------------------------------------------------------------------

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report