如题:
图示:
源码:
Private Sub huatu()
Dim p1 As Variant
Dim p2 As Variant
On Error GoTo 10000
p1 = ThisDrawing.Utility.GetPoint(, "指定第一点:")
p2 = ThisDrawing.Utility.GetPoint(p1, vbCr & "指定第二点:")
cd = GetDistance(p1, p2)
ce = GetPointhengkuandu(p1, p2)
ThisDrawing.Utility.GetReal ("距离=" & cd & Chr(13) & "X轴增量=" & ce )
Exit Sub
10000: 'MsgBox Error()
End Sub
'计算两点之间距离
Public Function GetDistance(ptSt As Variant, ptEn As Variant) As Double
Dim x As Double
Dim y As Double
Dim z As Double
x = ptSt(0) - ptEn(0)
y = ptSt(1) - ptEn(1)
z = ptSt(2) - ptEn(2)
GetDistance = Sqr((Sqr((x ^ 2) + (y ^ 2)) ^ 2) + (z ^ 2))
End Function
Public Function GetPointhengkuandu(pts1 As Variant, pts2 As Variant) As Double
GetPointhengkuandu = pts2(0) - pts1(0)
End Function
相关文章
- 2021-08-01Visual Basic与AutoCAD二次开发PDF下载
- 2021-08-01Mastering AutoCAD Civil 3D 2010PDF下载
- 2016-02-22VisualBasic与AutoCAD二次开发教程下载
- 2012-02-25某污水厂全套施工图(CASS工艺)
- 2011-12-19ZLP14-4D引射式气箱脉冲除尘器
- 2011-07-01FDP128-2X8气箱脉冲袋式除尘器
- 2011-07-01FDP128-9气箱脉冲袋式除尘器
- 2011-04-14长距离斗提机总装套图7张
- 2011-04-13KD150As灰库库底卸料器
- 2011-03-11灰库底双侧卸料器KD150As