|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
9 r7 c; E# p) D! p- T% l
NX二次开发源码分享: 在绝对坐标系和视图上点映射& ]- H! N9 _: l+ o7 {9 L( ]
: X* n O5 u5 b+ S5 \0 {' \
" F; H$ M7 k0 e( Y$ H
[mw_shl_code=c,true]
5 j0 f- o5 V! m; \ Function MapView2Abs(ByVal aView As View, ByVal coords As Point3d), C, N$ ?2 Z9 ^( F
Dim vmx As Matrix3x3 = aView.Matrix% N" y& i2 w2 Y$ u
Dim vw() As Double = {0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}
6 B4 {3 P. S' l: X Dim abs() As Double = {0, 0, 0, 1, 0, 0, 0, 1, 0}$ A' m5 F$ ^. K# W2 t
Dim mx(11) As Double% k' A8 Q3 y1 b( T# y
Dim irc As Integer8 ]1 y* ]! b2 V6 v k% _
Dim c() As Double = {coords.X, coords.Y, coords.Z}
! g+ b2 P8 b& C; C
: \4 @& o$ I! m' q/ W ufs.Trns.CreateCsysMappingMatrix(vw, abs, mx, irc)) O" \4 T9 k; S+ w- I
ufs.Trns.MapPosition(c, mx)$ j8 T, y* ^( t& h
& `# e* ?6 a- \5 x1 d0 ?& ]3 _: @; D/ T MapView2Abs = New Point3d(c(0), c(1), c(2))0 T: `1 ^- o0 Z7 Q: Y
End Function' ~' M. b2 v' J8 Z% }8 @
2 ]2 G ^) a2 _* L8 I: X7 l, h
Function MapAbs2View(ByVal aView As View, ByVal coords As Point3d)
6 O4 X& W% A' _ O) b Dim vmx As Matrix3x3 = aView.Matrix
9 V4 a* K7 n7 T4 ~; n0 y& s- v Dim vw() As Double = {0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}6 l5 J" T! W2 e6 K) k% J
Dim abs() As Double = {0, 0, 0, 1, 0, 0, 0, 1, 0}
# W9 H8 u; n5 y( X+ Q5 @ Dim mx(11) As Double8 R* r" c2 v) w
Dim irc As Integer5 S3 N4 k! H/ g5 [% x# j, {
Dim c() As Double = {coords.X, coords.Y, coords.Z}
/ v; {, i: V4 n; d7 W
7 A8 B/ u2 \) y9 ~2 h6 i2 `0 H ufs.Trns.CreateCsysMappingMatrix(abs, vw, mx, irc)2 ~$ a7 |) O; r8 q
ufs.Trns.MapPosition(c, mx)& ~: H1 a5 ]2 k8 _
; b9 q. [( M1 J+ A/ M7 B4 ?
MapAbs2View = New Point3d(c(0), c(1), c(2))- ?7 D! l, H( _* C
End Function" Z w1 J; S6 u7 Z4 ]9 W3 `# L
[/mw_shl_code]
; a% c+ E7 m0 i. o; G |
|