|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
% N4 w/ B' S7 f* P. E( T, h1 I& h
NX二次开发源码分享: 在绝对坐标系和视图上点映射/ H, y" J6 e: S, H z( V+ z- N
' w& |# Q W: }9 }/ S) p' N
9 c, C7 n# C5 T3 Z3 o[mw_shl_code=c,true]
0 K# o% m; Y2 m; d! B; x Function MapView2Abs(ByVal aView As View, ByVal coords As Point3d)* f/ m: S* e2 V) A
Dim vmx As Matrix3x3 = aView.Matrix
! @( U- Z/ x" |7 t: \$ T) m2 [0 y' g7 v Dim vw() As Double = {0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}2 `" C/ G* q) ^/ n/ D
Dim abs() As Double = {0, 0, 0, 1, 0, 0, 0, 1, 0}" e- _/ @9 G6 u' A) x
Dim mx(11) As Double2 |: D, Z" m: b0 w2 x
Dim irc As Integer, Z0 U# j; a. O% a5 e% x
Dim c() As Double = {coords.X, coords.Y, coords.Z}
/ b" Q. f# H! v5 E, f9 B7 L" u' {% w8 h
ufs.Trns.CreateCsysMappingMatrix(vw, abs, mx, irc)1 A0 {0 ?2 ~2 h4 P G
ufs.Trns.MapPosition(c, mx)
8 v0 u& D W4 J
6 [6 Q9 }" n/ ^3 ~2 s1 E MapView2Abs = New Point3d(c(0), c(1), c(2))6 ~+ N2 u9 m' ~; z" @2 L5 z
End Function
6 d* S a/ }& E. ]
$ c% [0 M% b/ Z( o! ?( q' K) A Function MapAbs2View(ByVal aView As View, ByVal coords As Point3d)
8 q* C1 L# I6 E Dim vmx As Matrix3x3 = aView.Matrix
( Z4 Q, ^5 Q+ p4 M9 N' W9 V, | Dim vw() As Double = {0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}: w/ a7 I7 M1 s. t! c
Dim abs() As Double = {0, 0, 0, 1, 0, 0, 0, 1, 0}* [7 K) a$ k& w& O3 G a
Dim mx(11) As Double
7 Q/ a1 {$ b% l- V: u/ o( K Dim irc As Integer7 e& y8 M7 }+ ~! u, \
Dim c() As Double = {coords.X, coords.Y, coords.Z}
8 b/ }1 v' _# X7 b6 u+ Q
. P$ L; x2 m/ U1 G& f- U ufs.Trns.CreateCsysMappingMatrix(abs, vw, mx, irc)
' m( ^" v$ u1 E, o2 a' H3 ^' m+ t3 t ufs.Trns.MapPosition(c, mx)
5 Q4 [8 U& g5 a4 j
, D3 f, ^2 C4 V MapAbs2View = New Point3d(c(0), c(1), c(2))
# s0 G6 B l6 C1 B) r$ x. r& r* D End Function
& y- b9 e0 f0 j[/mw_shl_code]0 l9 o7 o. b2 {) S. L% [
|
|