- 积分
- 11897
- 明经币
- 个
- 注册时间
- 2002-4-2
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2005-4-16 15:44:00
|
显示全部楼层
本帖最后由 作者 于 2005-4-17 6:11:26 编辑
我对VBA不太熟悉,所以试着写了一个,请大家指正
Sub move_line() Dim lineobj As AcadLine Dim lineobj1 As AcadLine Dim point_1 As Variant Dim point_2 As Variant Dim length As Double Dim aa As String, bb As String
ThisDrawing.Utility.GetEntity lineobj, pt, "选择要移动的直线:" point_1 = ThisDrawing.Utility.GetPoint(, "输入基准点:") point_2 = ThisDrawing.Utility.GetPoint(, "输入第二点:") lineobj.Move point_1, point_2 aa = Str(lineobj.StartPoint(0)) + "," + Str(lineobj.StartPoint(1)) + "," + Str(lineobj.StartPoint(2)) bb = Str(lineobj.EndPoint(0)) + "," + Str(lineobj.EndPoint(1)) + "," + Str(lineobj.EndPoint(2)) ThisDrawing.Regen acAllViewports Set lineobj1 = ThisDrawing.ModelSpace.AddLine(point_1, point_2) length = lineobj.length lineobj1.Delete MsgBox "移动长度为: " & length & vbCrLf & "起点坐标为:" & aa & vbCrLf & "终点坐标为:" & bb
End Sub
|
|