- 积分
- 613
- 明经币
- 个
- 注册时间
- 2002-7-2
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
有如下怪问题:
下面的程序是选取封闭区域的一点,有boundary()函数找出其边界
而后对得到的多义线进行编辑。(boundary()函数在明经取得)
怪问题出现:在IDE编辑器中运行正常,可在点取宏菜单中的运行宏时
提示出错?不知何故,请斑竹指点,
Public Sub test()
Dim point As Variant
point = ThisDrawing.Utility.GetPoint(, "select a point:")
Dim mypline As AcadLWPolyline
Dim coordpoint As Variant
Set mypline = Boundary(point)
mypline.layer = "qbz"
coordpoint = mypline.Coordinates
End Sub
Public Function Boundary(ByVal point As Variant) As AcadLWPolyline
On Error Resume Next
Dim PrevTotal As Long
PrevTotal = ThisDrawing.ModelSpace.count
ThisDrawing.SetVariable "NOMUTT", 1
ThisDrawing.SendCommand "_-boundary" & vbCr & point(0) & "," & point(1) & vbCr & vbCr
ThisDrawing.SetVariable "NOMUTT", 0
If ThisDrawing.ModelSpace.count > PrevTotal Then
Set Boundary = ThisDrawing.ModelSpace.Item(ThisDrawing.ModelSpace.count - 1)
End If
End Function |
|