line wrapper

line wrapper

Anonymous
Not applicable
295 Views
0 Replies
Message 1 of 1

line wrapper

Anonymous
Not applicable

i am just getting into autocad vba and was stumped by the overhead impracticality of the addline method. every single point used has to be a declared array of doubles. 4 lines of code just to set up. i have a fairly simple parametric program, but even simple there would potentially be several hundred points involved. here is the solution. 

 

my apology if this is already posted and known.

 

W and L of course are double vars in the calling program.

 

 

Call line(0, W - 1.25, L, W - 1.25)

 

 

Sub line(p1 As Double, p2 As Double, p3 As Double, p4 As Double)

 

Dim lineobj As AcadLine
Dim pt1(0 To 2) As Double
Dim pt2(0 To 2) As Double

pt1(0) = p1: pt1(1) = p2: pt1(2) = 0
pt2(0) = p3: pt2(1) = p4: pt2(2) = 0

Set lineobj = acadApp.ActiveDocument.ModelSpace.AddLine(pt1, pt2)

 

End Sub

 

 

 

0 Likes
296 Views
0 Replies
Replies (0)