|
【原创】得到sw中选择点坐标
www.dimcax.com
得到用鼠标点击物体时,鼠标所点的那个点的坐标(不是屏幕坐标)
* j5 m4 k, }/ t! e0 q( r! t lpmodeldoc2 pmodeldoc = null; % m, }+ a: d' [+ }7 f2 n
lpselectionmgr pselectmgr = null;
6 @* u+ i z% y9 c double retval[3];
q* t; h/ k8 q% h* [+ b! c/ g cstring string;
$ i! f& m" x: _6 q long nselcount = 0;
5 _0 u2 d& _1 g4 ~
; d5 t/ x4 u+ r theapplication->getswapp()->get_iactivedoc2([$pmodeldoc)]
5 k3 k" e# ]/ g: g if (!pmodeldoc) return;
k, ~: g$ o: k- `- t% f& |7 ^2 z/ k pmodeldoc->get_iselectionmanager([$pselectmgr)]
6 \( b i" b4 m e/ n/ e6 b% h if (!pselectmgr) {
: |0 d! j. }8 ]' n9 w pmodeldoc->release();
6 t3 i8 i7 i% _0 ?3 s9 r3 x; [ return;
4 r1 |- v; _8 v" y }
2 }) j1 v0 y4 u3 x pselectmgr->getselectedobjectcount([$nselcount)]
4 w4 b y/ y0 o if (nselcount != 0){ 4 b v* t* \! {* e' p) b2 x9 v
pselectmgr->igetselectionpoint (1, retval); 4 [/ @" |% |- [+ q/ [: d w5 u$ s d
} ( c# f+ i/ ?3 u/ m
string.format(_t("selected point (%.2f,%.2f,%.2f)"),retval[0], retval[1],retval[2]); ( m4 e7 s6 q. x! n( g+ a
afxmessagebox(string); 0 e0 u9 a' h+ x3 t& u/ y
pmodeldoc->release();
7 b. l7 m; _+ j j pselectmgr->release();
6 m. _& n; h( |8 o8 v2 d. { return; |
|