Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
Sub editZ()
Dim ss As AcadSelectionSet
Dim objText As AcadText
Dim alignmentPoint(0 To 2) As Double
Dim intCnt As Integer
Dim intSkipped As Integer
Dim FilterType(1) As Integer
Dim FilterData(1)
FilterType(0) = 0: FilterData(0) = "TEXT" 'Object to filter
FilterType(1) = 8: FilterData(1) = "TestLayer" '<<[COLOR=red]Change Layer Name to filter[/color]
On Error Resume Next
Set ss = ThisDrawing.SelectionSets.Add("s")
If Err Then
ThisDrawing.SelectionSets.Item("s").Delete
Set ss = ThisDrawing.SelectionSets.Add("s")
Err.Clear
End If
On Error GoTo errHandler
ss.Select acSelectionSetAll, , , FilterType, FilterData
For Each objText In ss
If IsNumeric(objText.TextString) Then
Select Case objText.Alignment
Case acAlignmentLeft, acAlignmentFit, acAlignmentAligned
alignmentPoint(0) = objText.insertionPoint(0): alignmentPoint(1) = objText.insertionPoint(1): alignmentPoint(2) = CDbl(objText.TextString)
objText.insertionPoint = alignmentPoint
Case Else
alignmentPoint(0) = objText.TextAlignmentPoint(0): alignmentPoint(1) = objText.TextAlignmentPoint(1): alignmentPoint(2) = CDbl(objText.TextString)
objText.TextAlignmentPoint = alignmentPoint
End Select
intCnt = intCnt + 1
Else
intSkipped = intSkipped + 1
End If
Next
ss.Delete
MsgBox intCnt & " Object(s) edited." & vbCrLf & _
intSkipped & " Object(s) skipped."
Exit Sub
errHandler:
MsgBox "An error has occurred: " & Err.Description
End Sub