Create Construction XLines

AutoCAD ActiveX

 
Create Construction XLines
 
 
 

A construction xline can be placed anywhere in 3D space and extends to infinity in both directions. To create an xline, use the AddXLine method. This method specifies the line by the two-point method; you enter or select two points to define the orientation. The first point, the root, is considered the midpoint of the construction line.

Add a construction line

The following example code creates an XLine object using the two points (5, 0, 0) and (1, 1, 0).

Sub Ch3_AddXLine()
 Dim xlineObj As AcadXline
 Dim basePoint(0 To 2) As Double
 Dim directionVec(0 To 2) As Double
 ' Define the xline
 basePoint(0) = 2#: basePoint(1) = 2#: basePoint(2) = 0#
 directionVec(0) = 1#: directionVec(1) = 1#: directionVec(2) = 0#
 ' Create the xline in model space
 Set xlineObj = ThisDrawing.ModelSpace.AddXLine _
 (basePoint, directionVec)
 ThisDrawing.Application.ZoomAll
End Sub