Extracting points from a polyline

The VBA forum deals with IntelliCAD 2000 VBA (Visual Basic for Applications) issues.

Moderator: CMS Inc

Post Reply
wonton
Newbie
Posts: 4
Joined: Wed Jul 07, 2010 9:22 am

Extracting points from a polyline

Post by wonton » Thu Jul 08, 2010 12:57 am

Hi,

I am hoping someone can help me.

I am trying to extract all the points from a polyline so I can store them to reconstruct later.

I can draw the polyline but not get in the info out first.

This is doing my head in!

Thanks
Phil
JCAMPOS

Post by JCAMPOS » Thu Jul 08, 2010 4:33 am

Hello,

Here is an example on how to extract the coordinates of a polyline:

Code: Select all

Public Sub ShowLWPolylineCoordinates()

Dim doc As IntelliCAD.Document
Dim selEnt As IntelliCAD.entity
Dim pT1 As IntelliCAD.Point
Dim Ename As String

Set doc = IntelliCAD.ActiveDocument
doc.Utility.GetEntity selEnt, pT1, "Select a polyline: "
Ename = selEnt.EntityName

If Ename = "LightWeightPolyline" Then

   Dim selPL As IntelliCAD.LWPolyline
   Set selPL = selEnt

   Dim ptTmp As IntelliCAD.Point
   For Each ptTmp In selPL.Coordinates

      MsgBox ptTmp.x & "x" & ptTmp.y & "x" & ptTmp.z
   
   Next

End If

End Sub
Hope this helps!

Regards,
JCAMPOS
wonton
Newbie
Posts: 4
Joined: Wed Jul 07, 2010 9:22 am

Post by wonton » Thu Jul 08, 2010 5:58 am

It certainly does

Thanks
Post Reply