构造线可以放置在三维空间中的任意位置,并且可以在两个方向上无限延伸。要创建构造线,请使用 AddXLine 方法。该方法用两点法指定直线,即输入或选择两个点来定义方向;第一个点(即根)是构造线的中点。
下面的代码样例使用两个点 (5, 0, 0) 和 (1, 1, 0) 创建构造线对象。
Sub Ch3_AddXLine()
Dim xlineObj As AcadXline
Dim basePoint(0 To 2) As Double
Dim directionVec(0 To 2) As Double
' 定义构造线
basePoint(0) = 2#: basePoint(1) = 2#: basePoint(2) = 0#
directionVec(0) = 1#: directionVec(1) = 1#: directionVec(2) = 0#
' 在模型空间中创建构造线
Set xlineObj = ThisDrawing.ModelSpace.AddXLine _
(basePoint, directionVec)
ThisDrawing.Application.ZoomAll
End Sub