- UID
- 219903
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2005-2-25
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
Sub vba3()
'画直线
Dim sp As Variant, ep As Variant, op As Variant
sp = ThisDrawing.Utility.GetPoint(, "请输入三角形的第一点:")
ep = ThisDrawing.Utility.GetPoint(sp, "请输入三角形的第二点:")
Dim L1 As AcadLine
Set L1 = ThisDrawing.ModelSpace.AddLine(sp, ep) '根据"起点"和"终点"画直线
op = ThisDrawing.Utility.GetPoint(ep, "请输入三角形的第三点:")
Dim L2 As AcadLine
Set L2 = ThisDrawing.ModelSpace.AddLine(ep, op) '画直线
Dim L3 As AcadLine
Set L3 = ThisDrawing.ModelSpace.AddLine(op, sp) '画直线
Dim x1(2) As Double, x2(2) As Double, x3(2) As Double
x1(0) = (sp(0) + ep(0)) / 2: x1(1) = (sp(1) + ep(1)) / 2: x1(2) = (sp(2) + ep(2)) / 2
x2(0) = (ep(0) + op(0)) / 2: x2(1) = (ep(1) + op(1)) / 2: x2(2) = (ep(2) + op(2)) / 2
x3(0) = (op(0) + sp(0)) / 2: x3(1) = (op(1) + sp(1)) / 2: x3(2) = (op(2) + sp(2)) / 2:
Dim L4 As AcadLine
Dim L5 As AcadLine
Dim L6 As AcadLine
Set L4 = ThisDrawing.ModelSpace.AddLine(x1, x2) '画中线
Set L5 = ThisDrawing.ModelSpace.AddLine(x2, x3)
Set L6 = ThisDrawing.ModelSpace.AddLine(x3, x1)
ZoomExtents '范围缩放
End Sub |
|