Jump to content

draw a simple polyline using vba code


warlock-993

Recommended Posts

can anyone please point me on how to draw a ployline between points.

I am using this example but the problem is that the polyline is always starts from the origin (0,0)

Dim plineObj As AcadLWPolyline
Dim Points(0 To 17) As Double

'Define the polyline Coordinates XY, XY, XY .....
Points(0) = 0: Points(1) = 100
Points(2) = 0: Points(3) = 0
Points(4) = 100: Points(5) = 0
Points(6) = 0: Points(7) = 100
Points( = 50: Points(9) = 150
Points(10) = 100: Points(11) = 100
Points(12) = 100: Points(13) = 0
Points(14) = 100: Points(15) = 100

' Create a lightweight Polyline object in model space
Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(Points)
plineObj.Closed = True
ZoomAll

if any one can help me ... i would really appreciate it :)

Link to comment
Share on other sites

thanks for your help ... I changed the declaration from (Dim Points(0 To 17) As Double) to (Dim Points(0 To 15) As Double) hen changed the coordinates and it worked :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...