DimensionStyle.Spacing Property How to set its value

DimensionStyle.Spacing Property How to set its value

inulobo
Advocate Advocate
590 Views
2 Replies
Message 1 of 3

DimensionStyle.Spacing Property How to set its value

inulobo
Advocate
Advocate

Self-explanatory. How do I access this property and set it? I cannot seem to figure it out.

 

inulobo_2-1604442051523.png

 

0 Likes
Accepted solutions (1)
591 Views
2 Replies
Replies (2)
Message 2 of 3

dgreatice
Collaborator
Collaborator

You can find at DimensionStyle Object.

 

dgreatice_0-1604477631016.png

 

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes
Message 3 of 3

DRoam
Mentor
Mentor
Accepted solution

Hi @inulobo, I recommend bookmarking this page in the Inventor API documentation: Inventor API Reference Manual: Objects. After going to that page, you can hit Ctrl+F and search for any type of object.

 

In this case, searching for "DimensionStyle" takes you to the DimensionStyle object. Scrolling down to the bottom, you can see the "Accessed From" to see the various ways you can get to the DimensionStyle object. In this case there are several (usually there's only one or two).

 

Which one to use depends on what you're trying to do, which you weren't very specific on. However, assuming you want to change the style for all "normal" dimensions in your drawing, you would want to access whatever the default "LinearGeneralDimension" style is for your drawing. If that's the case, this is how I would read or change the "Spacing" value for your drawing:

 

' Get active Drawing.
Dim drawDoc As DrawingDocument = ThisDoc.Document

' Get default DimensionStyle for general dimensions.
Dim defaultDimStyle As DimensionStyle = drawDoc.StylesManager.ActiveStandardStyle.ActiveObjectDefaults.LinearDimensionStyle

' To read the current spacing:
Dim currentSpacing As Double = defaultDimStyle.Spacing

' To change the spacing:
defaultDimStyle.Spacing = 0.25 * 2.54 ' (Multiply by 2.54 because Inventor API works in centimeters)

 

However, if you have more than one Dimension Style that you use, you may want to change the Spacing value for those as well. But we would need more details about what you're wanting to do.

0 Likes