|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
" P9 v2 u8 m9 {9 U$ o0 `+ D
NX二次开发源码分享: 在绝对坐标系和视图上点映射( | b. B% i( s% Q- V" p
* l! Y# @6 t- D! u; `; ? Y
0 f6 k Q0 P1 `[mw_shl_code=c,true]
f/ m. q U$ g! I- p/ T3 e8 H. Q Function MapView2Abs(ByVal aView As View, ByVal coords As Point3d)
8 W3 b" a" p/ q! v3 V9 }; d Dim vmx As Matrix3x3 = aView.Matrix! x. U, w1 t1 Z) c( Q) N7 v- v
Dim vw() As Double = {0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}1 ]5 ~% P* m) r' a9 n: H
Dim abs() As Double = {0, 0, 0, 1, 0, 0, 0, 1, 0}' k5 F# Y% A2 d/ f$ a9 P1 c1 i
Dim mx(11) As Double
' O+ A- n5 K( } Dim irc As Integer
% T' l) a$ ]3 T% l: ]' J) K3 _0 x Dim c() As Double = {coords.X, coords.Y, coords.Z}
' s9 Y3 t! `* P# |; B- ~5 e7 G2 L/ v. S; E
ufs.Trns.CreateCsysMappingMatrix(vw, abs, mx, irc)5 D9 J2 A% Z2 H7 m8 `# `
ufs.Trns.MapPosition(c, mx)
- R9 v* l, _6 T2 j& R$ O* w! b& l: T6 k1 b3 Y5 K" L
MapView2Abs = New Point3d(c(0), c(1), c(2))
. Q) I! z7 \& w4 b0 J3 _ End Function. |- e; G0 E" {4 }6 V
4 ~3 x8 V5 Z6 I Function MapAbs2View(ByVal aView As View, ByVal coords As Point3d)8 {( _* l; g4 r: S' g
Dim vmx As Matrix3x3 = aView.Matrix
* Z; W/ K, X$ U9 j Dim vw() As Double = {0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}
4 l) Q) a; a( V; g* S5 o Dim abs() As Double = {0, 0, 0, 1, 0, 0, 0, 1, 0}
- t) ^$ _' a# |3 T Dim mx(11) As Double. w+ h, e: R6 e# V" j- |8 ~# K
Dim irc As Integer- u( P% d. n$ w3 m( p
Dim c() As Double = {coords.X, coords.Y, coords.Z}
1 p. `$ x% h; e5 g& E
6 k0 |- m. T d; s' w+ I ufs.Trns.CreateCsysMappingMatrix(abs, vw, mx, irc)
2 t7 N5 ~- r" f F) i ufs.Trns.MapPosition(c, mx)
% g0 @0 e H3 ^ S% o. |' _. J Z* K) o, }. E, ^ w5 E
MapAbs2View = New Point3d(c(0), c(1), c(2))
, k9 x# W! `: m0 I End Function
5 x9 C% [& `3 L2 ~[/mw_shl_code]) [# t, Q% E* i2 w
|
|