|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 M u2 I5 ^. E; x8 v
NX二次开发源码分享: 在绝对坐标系和视图上点映射" W$ H+ F% x; p+ x, K
! P0 z. J: J8 }$ \8 i6 C2 X$ }0 |7 P8 ?: W G
[mw_shl_code=c,true]
2 w$ @2 G$ X: f4 \+ G! ~, I7 ` Function MapView2Abs(ByVal aView As View, ByVal coords As Point3d)5 t2 C& }% T& s: {( @1 a+ {
Dim vmx As Matrix3x3 = aView.Matrix; Q# m5 {' C& x
Dim vw() As Double = {0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}
! f6 q% Y( i, y' w! J% w% N$ R Dim abs() As Double = {0, 0, 0, 1, 0, 0, 0, 1, 0}) r; m' q8 E0 A7 \
Dim mx(11) As Double
. n! f5 x) v( D: n9 e! p9 G Dim irc As Integer
+ u; F) Y: S- s. s. K Dim c() As Double = {coords.X, coords.Y, coords.Z}# }5 C9 M6 {) |3 @; R
& e) A, [, n9 R& C1 L ufs.Trns.CreateCsysMappingMatrix(vw, abs, mx, irc)
5 J7 D. N, {" a- J, R: m- d ufs.Trns.MapPosition(c, mx)
1 N5 o* I* ^: r3 D/ N; m: o
# m% g! o! R U1 i3 U: ?' M MapView2Abs = New Point3d(c(0), c(1), c(2))
5 ?9 B0 k: U" b1 f End Function
, ^8 V( }: i0 ]& ]# Z- L5 v& D! P3 O; r
Function MapAbs2View(ByVal aView As View, ByVal coords As Point3d)3 R* H/ y* u) B% P2 y; P/ v
Dim vmx As Matrix3x3 = aView.Matrix
' B, X8 W3 B e" f Dim vw() As Double = {0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}
% i4 S# U o' h& ]* W Dim abs() As Double = {0, 0, 0, 1, 0, 0, 0, 1, 0}- f! L% H; f6 M
Dim mx(11) As Double
+ _$ U" p0 @/ [; N Dim irc As Integer
8 F+ q5 X* t+ L Dim c() As Double = {coords.X, coords.Y, coords.Z}
. B% G$ J+ d1 a% j9 P' A2 w
, q0 ?3 ?0 n5 x! i ufs.Trns.CreateCsysMappingMatrix(abs, vw, mx, irc)
$ g+ I7 v b- l2 |0 o& p ufs.Trns.MapPosition(c, mx)1 z R( I( }: G; Q
5 Z7 x6 x8 W0 M$ c( z7 H6 I; u/ u MapAbs2View = New Point3d(c(0), c(1), c(2))
8 V0 w& f" h+ E End Function
2 m8 L- X# T" X[/mw_shl_code]
0 X7 ]) X. p" Z3 v# @" E2 @5 _1 K |
|