您的位置:网站首页 > CAD新闻

CAD 实用编程-获得上一次绘图的点坐标

时间:2011-01-28 11:47:32 来源:未知

多段线的起点从上一次绘图的终点开始。那么可以检索 LASTPOINT系统变量。
示例:
Dim moSpace As AcadModelSpace
Set moSpace = acadDoc.ModelSpace
Sub AddLightWeightPolyline()
Dim plineObj As AcadLWPolyline

‘ 返回上一次给图最后输入的点坐标
Dim pt as Variant
Pt=acadDoc.GetVariable(“LASTPOINT”)

Dim points(0 To 5) As Double

定义二维多段线的点
points(0) = pt(0): points(1) = pt(1)
points(2) = 4: points(3) = 2
points(4) = 6: points(5) = 4

在模型空间中创建一个优化多段线对象
Set plineObj = moSpace.AddLightWeightPolyline(points)
End Sub