Published on Wednesday, 06 February 2008 19:40
We are going to start by creating a little piece of code to create a simple line object. Open the editor with ALT & F11 and create the following text in the thisdrawing object.
You could see this code as a alternative LINE command. You follow the same steps as when you do this manually. You first provide the start coordinates then the end coordinates and finally you order VBA to place the line between those two tutorials
'Code from by VisibleVisual
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(8) = 50: Points(9) = 150
Points(10) = 100: Points(11) = 100
Points(12) = 100: Points(13) = 0
Points(14) = 100: Points(15) = 100
The code above creates the same drawing as show below.
After creating a polyline its possible to continue the code and to add extrusions or subtractions to it. See the tutorial list for more tutorials on this
Download AutoCAD VBA sample below (registered users only: