Join online Course on AutoCAD VBA Programming
Following is the VBA code to extract Area of Circles in AutoCAD drawing
Sub ExtractAreaOfCircles_1() Open “E:DetailsOfCircles.txt” For Output As 1 Dim XLnCADObject As AcadObject Dim XLnCADCircle As AcadCircle For Each XLnCADObject In ThisDrawing.ModelSpace If XLnCADObject.ObjectName = “AcDbCircle” Then Set XLnCADCircle = XLnCADObject X = XLnCADCircle.Center(0) Y = XLnCADCircle.Center(1) Print #1, “X,Y-” & X; “,” & Y Print #1, “Area-” & XLnCADCircle.Area; “” End If Next Close (1) Dim retval As Variant retval = Shell(“Notepad.exe ” & “E:DetailsOfCircles.txt”, vbNormalFocus) End Sub