|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- `) G% O2 |6 F _NX二次开发源码分享: 在绝对坐标系和视图上点映射
( U* {$ \4 y' R) s) L I& s' }9 y7 F+ F* N9 E/ v- L$ y. |( k
- J% V" K, }$ R" h[mw_shl_code=c,true]
' F, G0 w2 D/ q. u' C* u7 a Function MapView2Abs(ByVal aView As View, ByVal coords As Point3d)
3 t1 F+ s0 S2 ~0 o3 F Dim vmx As Matrix3x3 = aView.Matrix
& Y6 ~, ^; s+ B. a! w Dim vw() As Double = {0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}
, @4 N- n; t0 `+ U0 b Dim abs() As Double = {0, 0, 0, 1, 0, 0, 0, 1, 0}. H9 |4 K' e* \2 S0 s4 q
Dim mx(11) As Double
; B0 p$ H% Y2 q7 w: n; c Dim irc As Integer
- C- O- ~4 L, |5 e0 o Dim c() As Double = {coords.X, coords.Y, coords.Z}
3 l1 m$ j5 z- h4 J9 D; g( ^2 w% H# `8 Z' q1 W3 G
ufs.Trns.CreateCsysMappingMatrix(vw, abs, mx, irc)* s! Z9 n+ Z% x( ^. t- s
ufs.Trns.MapPosition(c, mx)
* u J; i4 @! w
! |0 o# e) o1 C q5 z6 M0 C MapView2Abs = New Point3d(c(0), c(1), c(2)); K6 \/ T6 ?& Y2 B4 B% @5 D
End Function
* p! F' g- x5 U$ f; K: `* \" C6 F) ^( i- c: T
Function MapAbs2View(ByVal aView As View, ByVal coords As Point3d)
) G6 w' C0 K4 U Dim vmx As Matrix3x3 = aView.Matrix5 c6 U% E5 _: |
Dim vw() As Double = {0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}
& R3 g; J3 }9 h4 ^3 E" G# g2 S Dim abs() As Double = {0, 0, 0, 1, 0, 0, 0, 1, 0}
) O6 L* T- t) A Dim mx(11) As Double2 a4 c7 g0 V# C$ J2 |3 F
Dim irc As Integer
: W/ x3 K p: E# c4 @ Dim c() As Double = {coords.X, coords.Y, coords.Z}
4 C3 K( M2 k- ~) _
0 d- P+ a2 I% R5 I ufs.Trns.CreateCsysMappingMatrix(abs, vw, mx, irc)
% i% N! R+ ?3 X/ Q$ A ufs.Trns.MapPosition(c, mx)
4 C# e$ H( A0 d# M% v3 ]; E# t# Y; ], b( i$ J- l7 n8 Z7 E: h
MapAbs2View = New Point3d(c(0), c(1), c(2))
9 Q! J, @0 ~7 ^; D) p7 f8 s5 r End Function
/ I( s/ I7 o# g0 E[/mw_shl_code]
3 c( Y+ U3 ~" A |
|