AutoCAD macro to Extract Coordinates of AutoCAD Points

Macro to Extract details of AutoCAD Points

Join online Course on AutoCAD VBA Programming

Following is the VBA code to extract Coordinates of Points in an AutoCAD Drawing.

Sub ExtractDetailsOfAutoCADPoints()
Open “E:ExtractedDetails.Txt” For Output As 1
Dim X, Y, Z As Double
Dim XLnCADObject As AcadObject
Dim XLnCADPoint As AcadPoint
For Each XLnCADObject In ThisDrawing.ModelSpace
If XLnCADObject.ObjectName = “AcDbPoint” Then
Set XLnCADPoint = XLnCADObject
X = XLnCADPoint.Coordinates(0)
Y = XLnCADPoint.Coordinates(1)
Z = XLnCADPoint.Coordinates(2)
Print #1, X; Y; Z; “” & XLnCADPoint.Layer
End If
Next
Close (1)
End Sub

Join online Course on Scripting in AutoCAD


Macros (VBA for AutoCAD)

Scripting in AutoCAD

Tips & Tricks in AutoCAD