Sub test()
On Error Resume Next
Dim n As Long
n = ThisDrawing.ModelSpace.Count
Dim Pt As Variant
Here:
Err = 0
Pt = ThisDrawing.Utility.GetPoint(, "请指定内部点: ")
If Err Then GoTo Here
ThisDrawing.SendCommand "_-Boundary" & vbCr & Pt(0) & "," & Pt(1) & vbCr & vbCr
Dim lwpLineObj As AcadLWPolyline
If ThisDrawing.ModelSpace.Count > n Then
Set lwpLineObj = ThisDrawing.ModelSpace.Item(ThisDrawing.ModelSpace.Count - 1)
msgbox lwpLineObj.area
Else
MsgBox "未发现有效的刃口,请检查可视区域是否闭合. "
End If
End Sub