下面这段代码能实现这个功能,只是不知道这样写是否合理,是我瞎掰的。
- <CommandMethod("t2")> _
- Public Sub t2()
- Dim pt1 As New Point3d(100, 200, 300)
- Dim pt2 As New Point3d(400, 600, 1100)
- Dim vec As Vector3d = pt2 - pt1
- Dim mt As Matrix3d = Matrix3d.PlaneToWorld(vec.GetNormal)
- Dim A As Double = Math.PI / 4
- Dim s As CoordinateSystem3d = ed.CurrentUserCoordinateSystem.CoordinateSystem3d
- Dim x As Vector3d = mt.CoordinateSystem3d.Xaxis.RotateBy(A, mt.CoordinateSystem3d.Zaxis)
- Dim y As Vector3d = mt.CoordinateSystem3d.Yaxis.RotateBy(A, mt.CoordinateSystem3d.Zaxis)
- mt = Matrix3d.AlignCoordinateSystem(s.Origin, s.Xaxis, s.Yaxis, s.Zaxis, pt1, _
- x, y, x.CrossProduct(y))
- ed.CurrentUserCoordinateSystem = mt
- End Sub
|