Extracting point coordinates while drawing a polyline

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Guys,
I have a code which can extract the x,y,z coordinate of a point to excel when I click on it in Autocad2016. However I would like to draw polylines from point to point while I am extracting their coordinates into my excel sheet. When I click on the polyline feature and then run the macro below I get an error. I want to draw the polyline so I can keep a check on which node I have already extracted info from.
Please see my code below
Sub Example_GetPoint()
'Connect to the AutoCAD application and drawing
Dim AcadApp As AcadApplication
Set AcadApp = GetObject(, "AutoCAD.Application")
Dim ThisDrawing As AcadDocument
Set ThisDrawing = AcadApp.ActiveDocument
Sheets("reflines").Select
' This example returns a point entered by the user.
Dim returnPnt As Variant
Dim j As Integer
Dim i As Integer
For i = 0 To 9
returnPnt = ThisDrawing.Utility.GetPoint
'MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2), , "GetPoint Example"
ActiveCell.Offset(i, 0) = returnPnt(0)
ActiveCell.Offset(i, 1) = returnPnt(1)
ActiveCell.Offset(i, 2) = returnPnt(2)
Next I
Thanks in advance, hope anyone can help me