Issue with a 3D polyline

Issue with a 3D polyline

Anonymous
Not applicable
738 Views
2 Replies
Message 1 of 3

Issue with a 3D polyline

Anonymous
Not applicable

Hello All:

 

I would like to draw a polyline in 3D but, when I run the program I coded in VBA, the polyline created is apparently not in 3D. I use the AddPolyline method which takes a list of 3D vertex points as argument if I am not mistaken.

 

In my case, the polyline is drawn correctly in 2D but there is no elevation whereas elevations are specified in the list. I also know that the elevations work because when I draw a line between two points included in the list of vertex, the line has an elevation.

 

Can anybody help me with that issue?

 

You can find a piece of my code below.

 

Thanks a lot in advance,

 

 

Dim polyline_1b As AcadPolyline
Dim vertices_1b(11) As Double
vertices_1b(0) = pt3(0): vertices_1b(1) = pt3(1): vertices_1b(2) = pt3(2)
vertices_1b(3) = pt4(0): vertices_1b(4) = pt4(1): vertices_1b(5) = pt4(2)
vertices_1b(6) = pt6(0): vertices_1b(7) = pt6(1): vertices_1b(8) = pt6(2)
vertices_1b(9) = pt5(0): vertices_1b(10) = pt5(1): vertices_1b(11) = pt5(2)

Set polyline_1b = ThisDrawing.ModelSpace.AddPolyline(vertices_1b)
polyline_1b.Type = acSimplePoly
polyline_1b.Closed = True
polyline_1b.Update

 

0 Likes
Accepted solutions (1)
739 Views
2 Replies
Replies (2)
Message 2 of 3

norman.yuan
Mentor
Mentor
Accepted solution

You should use ModelSpace.Add3DPoly() to create an Acad3DPolyline, instead of AcadPolyline, which has been replaced by AcadLWPolyline and only exists in AutoCAD for backward compatibility.

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 3

Anonymous
Not applicable

Thanks a lot! Your solution works great! I am learning VBA with a book published about 5 years ago... this can probably explain why I used the AcadPolyline. Anyways, thank you very much for your help!

0 Likes