VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Edit text in dimension

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
502 Views, 4 Replies

Edit text in dimension

How can I edit text or replace text in dimension by VBA ?

Thanks,

Tri
4 REPLIES 4
Message 2 of 5
Hallex
in reply to: Anonymous

Give that a try

{code}
Option Explicit

'' based on Tony Tanzillo technic
'' request check "Break on Unhandled Errors" in Tools->Options->General options

Public Sub SelectMultypleDims()

Dim varPt As Variant
Dim oEnt As AcadEntity
Dim oDim As AcadDimension
Dim oDimAl As AcadDimAligned
Dim oDimRot As AcadDimRotated
Dim dimStr As String
Dim dblValue As Double

Do
On Error Resume Next
ThisDrawing.Utility.GetEntity oEnt, varPt, vbLf & "Select Dimension (or press Enter to Exit): "
If Err Then
Err.Clear
Exit Do
End If
On Error GoTo 0

If Not oEnt Is Nothing Then
dblValue = CDbl(InputBox("Type new dimension value: ", "Multiple Dim Override"))
If TypeOf oEnt Is AcadDimAligned Then
Set oDimAl = oEnt
dimStr = CStr(Round(dblValue, 2)) '<-- set precision here
oDimAl.TextOverride = dimStr
oDimAl.Update
ElseIf TypeOf oEnt Is AcadDimRotated Then
Set oDimRot = oEnt
dimStr = CStr(Round(dblValue, 2))
oDimRot.TextOverride = dimStr
oDimRot.Update
End If
End If
Loop
On Error GoTo 0

End Sub
{code}

~'J'~
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 5
Anonymous
in reply to: Anonymous

That's great hallex.
I appreciate your coding, help me understand the code.
I also working on in dimension constraints but I don't know how can I call out dimension constraint name (DimConstrName) then change the Value by DimConstrExpression, not by input but by the list of data.

See attach for review.

Thanks,

Tri
Message 4 of 5
Hallex
in reply to: Anonymous

I have a problem with your drawing - in the ThumbnailPreview
I have see some circles, dimensions and other little things
but in the drawing just several circles and nothing else
All layers unlocked and QSELECT shows 8 dimensions there
but there are no grips also
Very strange, sorry, I can't work with it
(I use A2008)

~'J'~
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 5 of 5
Anonymous
in reply to: Anonymous

Opps, I'm sorry.

I am working on A2010. They are constraints dimensions for parametric 2D drawing (new feature of A2010).

Appreciate your input.

Tri

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

Post to forums  

Autodesk Design & Make Report

”Boost