AutoCAD 2004/2005/2006

Valued Contributor
Posts: 55
Registered: ‎11-22-2005
Message 1 of 2 (219 Views)
Accepted Solution

Create new button for DIMGAP

219 Views, 1 Replies
09-04-2008 11:28 AM
I want to create a custom button to modify a dimension.

I want to change the DIMGAP value of only a selected dimension.

What I'm doing now is I open the properties window (ctrl+1), I select the dimension I want changed in the drawing, and I change the value of "text offset" ("text offset" is the same as the system variable DIMGAP). What I want is to select the dimension, click the button, and enter the new DIMGAP value.

Does anyone know the line of macro that would be in the custom button. Is this possible? I don't want to change the default DIMGAP value for the whole drawing, only a selected few.
Posts: 14
Registered: ‎07-03-2008
Message 2 of 2 (219 Views)

Re: Create new button for DIMGAP

09-05-2008 11:45 AM in reply to: Hypoluxa
Do you know any thing about VBA?

Here's a post on how to run a VBA macro from a toolbar button:

Here's the code:

Public Sub DimTxtGap()

Dim ssPick As AcadSelectionSet
Dim FilterType(0) As Integer
Dim FilterData(0) As Variant
Dim dblinput As Double
Dim ssObj As AcadEntity

With ThisDrawing.Utility
Set ssPick = ThisDrawing.SelectionSets.Add("DimObjs")
.Prompt vbCrLf & "Select Dimension(s) :"
FilterType(0) = 0: FilterData(0) = "DIMENSION"
ssPick.SelectOnScreen FilterType, FilterData
ssPick.Highlight True
.Prompt vbCr & ssPick.Count & " entities selected"
dblinput = .GetReal(vbCrLf & "Text offset value: ")
For Each ssObj In ssPick
ssObj.TextGap = dblinput
Next ssObj
End With
ssPick.Highlight False
If Not ssPick Is Nothing Then
End If

End Sub

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community

Connect with AutoCAD