Difference between revisions of "Lines"

From Microstation VBA Wiki
Jump to: navigation, search
(Created page with 'You can't just draw a line. Instead you have to create a line in memory and then write it to the DGN file. So in a subroutine, first you set up a variable that will hold an eleme…')
 
Line 1: Line 1:
 
You can't just draw a line. Instead you have to create a line in memory and then write it to the DGN file. So in a subroutine, first you set up a variable that will hold an element.
 
You can't just draw a line. Instead you have to create a line in memory and then write it to the DGN file. So in a subroutine, first you set up a variable that will hold an element.
 +
 +
<PRE>
 +
Dim oMyLine As Element
 +
</PRE>
  
 
Then you use a very long command to make a line (see below for more info):
 
Then you use a very long command to make a line (see below for more info):

Revision as of 15:44, 4 August 2010

You can't just draw a line. Instead you have to create a line in memory and then write it to the DGN file. So in a subroutine, first you set up a variable that will hold an element.

Dim oMyLine As Element

Then you use a very long command to make a line (see below for more info):

Then you write the line to the DGN file:

But to create the line you need a start and end point. So you have to set up variables that can hold those points. A point consists of three pieces of data for the X, Y, and Z coordinates. So once the point is set up, you have to store X and Y values in there and set Z to 0 (I'm always doing 2D, but it seems to work better with 3D points):

Dim ptStart, ptEnd as point3d

ptStart.X = 10
ptStart.Y = 10
ptStart.Z = 0
ptEnd.X = 10
ptEnd.Y = 20
ptEnd.Z = 0