Edit text in dimension

Edit text in dimension

Anonymous
Not applicable
608 Views
4 Replies
Message 1 of 5

Edit text in dimension

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

Thanks,

Tri
0 Likes
609 Views
4 Replies
Replies (4)
Message 2 of 5

Hallex
Advisor
Advisor
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
0 Likes
Message 3 of 5

Anonymous
Not applicable
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
0 Likes
Message 4 of 5

Hallex
Advisor
Advisor
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
0 Likes
Message 5 of 5

Anonymous
Not applicable
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
0 Likes