老师这是明经通道的例子, 得到的 Set lineObj 是弧度???但是弧度我转成角度为什么得到是315度呢??? 好像不对??? 生手哈 ! 数学没学好 哈 老师???- Sub Example_AngleFromXAxis()
- ' This example finds the angle, in radians, between the X axis
- ' and a line defined by two points.
- Dim jd As Double
- Dim pt1(0 To 2) As Double
- Dim pt2(0 To 2) As Double
- Dim retAngle As Double
- Const PI = 3.141592654
- pt1(0) = 2: pt1(1) = 5: pt1(2) = 0
- pt2(0) = 5: pt2(1) = 2: pt2(2) = 0
-
- retAngle = ThisDrawing.Utility.AngleFromXAxis(pt1, pt2)
- jd = retAngle * 180 / PI
- Dim lineObj As AcadLine
- Set lineObj = ThisDrawing.ModelSpace.AddLine(pt1, pt2)
- ZoomAll
- MsgBox "The angle in radians between the X axis and the line is " & retAngle, , "AngleFromXAxis 示例"
-
- End Sub
|