AutoCAD:VBA怎么取一条直线的两个端点?!
2个回答
展开全部
Public Sub test()
Dim lobj As AcadObject
Dim sp As Variant
Dim ep As Variant
ThisDrawing.Utility.GetEntity lobj, ep, "请选择一直线:"
If lobj.ObjectName = "AcDbLine" Then
sp = lobj.StartPoint
ep = lobj.EndPoint
MsgBox "直线起点坐标X=" & sp(0) & " Y=" & sp(1) & vbCrLf & " 止点坐标X=" & ep(0) & " Y=" & ep(1)
Else
MsgBox "所选取的不是直线!"
End If
End Sub
Dim lobj As AcadObject
Dim sp As Variant
Dim ep As Variant
ThisDrawing.Utility.GetEntity lobj, ep, "请选择一直线:"
If lobj.ObjectName = "AcDbLine" Then
sp = lobj.StartPoint
ep = lobj.EndPoint
MsgBox "直线起点坐标X=" & sp(0) & " Y=" & sp(1) & vbCrLf & " 止点坐标X=" & ep(0) & " Y=" & ep(1)
Else
MsgBox "所选取的不是直线!"
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |