NX二次开发源码分享: 在绝对坐标系和视图上点映射
NX二次开发源码分享: 在绝对坐标系和视图上点映射
Function MapView2Abs(ByVal aView As View, ByVal coords As Point3d)
Dim vmx As Matrix3x3 = aView.Matrix
Dim vw() As Double = {0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}
Dim abs() As Double = {0, 0, 0, 1, 0, 0, 0, 1, 0}
Dim mx(11) As Double
Dim irc As Integer
Dim c() As Double = {coords.X, coords.Y, coords.Z}
ufs.Trns.CreateCsysMappingMatrix(vw, abs, mx, irc)
ufs.Trns.MapPosition(c, mx)
MapView2Abs = New Point3d(c(0), c(1), c(2))
End Function
Function MapAbs2View(ByVal aView As View, ByVal coords As Point3d)
Dim vmx As Matrix3x3 = aView.Matrix
Dim vw() As Double = {0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}
Dim abs() As Double = {0, 0, 0, 1, 0, 0, 0, 1, 0}
Dim mx(11) As Double
Dim irc As Integer
Dim c() As Double = {coords.X, coords.Y, coords.Z}
ufs.Trns.CreateCsysMappingMatrix(abs, vw, mx, irc)
ufs.Trns.MapPosition(c, mx)
MapAbs2View = New Point3d(c(0), c(1), c(2))
End Function
页:
[1]