|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
选择方式包括通过mask过滤,通过type选择,或者通过选择所有的对象。% X$ o& f/ t2 J0 @6 B1 h: p: ^2 A0 \
) _. J7 g$ ^) w6 V2 ]/------------------------------------------------------------------------------
- A( ?6 H) l* R% V// Selection with mask, r& r! E2 H- ~/ [0 Q6 \
//------------------------------------------------------------------------------. R7 \( U# ?* L3 h5 n
TaggedObject* MyClass::select_by_mask()
: l; f9 \8 |6 Q{. w1 Q6 F' L ?& {) R: d
NXString message("Select an object by mask:");8 a' J* @' h1 z8 v9 n4 U7 ^% c
NXString title("Select object");5 C. |& q. n1 ]
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;7 r E3 ~& t! @2 `
Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;
3 i$ t% S8 l! B. obool include_features = 0;
& s: K9 S2 ]; c. q9 ~, s' r( {" n7 vbool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h. T2 P, }' G G9 ]+ }+ B
// Uncomment or combine the desired mask triples
; l `$ X: Y, N( Jstd::vector<Selection::MaskTriple> maskArray(1);
: {( O) R" c# m% amaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype, 0 ); // Bodies
* o' U* C+ P7 Y8 a9 u6 K/ A0 k/*
' i* W9 Q; I* M: J) m9 {' {! g6 t& dmaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE); // Faces
' p4 v! Y( @5 d8 p' \& r/ mmaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE); // Edges
9 f3 ~. X% O8 g3 G- G; S* EmaskArray[0] = Selection::MaskTriple( UF_component_type, 0, 0 ); // Components7 E* e' a0 z( Z$ [! d# a
maskArray[0] = Selection::MaskTriple( UF_line_type, 0, 0 ); // Lines6 U: ?& X0 P5 x3 ]& _: C% |0 c
maskArray[0] = Selection::MaskTriple( UF_drafting_entity_type, 0, 0 ); // Drafting objects/ z6 `0 m- ], S. o# B2 Q5 H
*/ ~( U6 X5 [9 D/ B. ?& v0 U
Point3d cursor;
4 S* ~' y. @4 e' U9 Q: w3 vTaggedObject *object; // Select objects using filter defined by maskArray triples3 O0 `) E& i# p9 E: A4 _' e+ b* W
Selection::Response res = selmgr->SelectTaggedObject(8 Q% R$ p, }+ L D) b& i. m" A
message, title, scope, action, include_features,: Z ]6 e' y# J# { p- ^$ ^
keep_highlighted, maskArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )
0 i5 j7 v0 O. x4 |1 y{! U. e, ]7 I. {! H/ j- c
return object;; x2 N& e) f1 {& L% A8 E$ g
}
0 [$ o: U. l Dreturn 0;6 @; T7 {; {" ?% @0 j- q
}//------------------------------------------------------------------------------
# Y2 x, H; _ ?. v' [; G8 u& x// Selection with type array
0 p1 s: p: J \6 M1 s' v//------------------------------------------------------------------------------
( O# B& \8 y6 O" ^, h5 _TaggedObject* MyClass::select_by_type()
, }# j5 `- I7 {{; t) m! b9 T% Y2 A- w( e( R
NXString message("Select an object by type:");1 s; e2 {! S6 q- L
NXString title("Select object");
; C; j1 d8 m7 Y. x' B0 w) L6 XSelection::SelectionScope scope = Selection::SelectionScopeUseDefault;* N- S2 i* c$ |, D$ i
bool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
" P& Y& ?( ?6 L- W+ Z( }2 b// Uncomment or combine the desired types$ `) p; x a p! J" J6 @6 k) i
std::vector<Selection::SelectionType> typeArray(1);
. o% i- c, U4 X, O5 otypeArray[0] = Selection::SelectionTypeAll;6 ]. I$ G. f; |, G# l
/*
2 a4 }( T1 a* H, J; FtypeArray[0] = Selection::SelectionTypeFeatures;" F0 {. l; c/ j6 B9 j9 C
typeArray[0] = Selection::SelectionTypeCurves;
' y) S3 v: {3 r2 s: w9 n3 i; Y) otypeArray[0] = Selection::SelectionTypeFaces;
/ T( |' s/ H/ u: o( k2 itypeArray[0] = Selection::SelectionTypeEdges;
! N9 o. E: A. k( a# H- ]typeArray[0] = Selection::SelectionTypeCurvesAndEdges;. r3 L v! g8 p2 {6 W
*/
- F% E* W' f% R/ lPoint3d cursor;
\( p% S4 Q/ A" G7 T! @. ITaggedObject *object; // Select objects using filter defined by type array/ x+ p! J/ E [4 n" H
Selection::Response res = selmgr->SelectTaggedObject(- R5 R) n E9 |( y
message, title, scope, keep_highlighted,
0 w% N8 C. r$ t4 w8 W9 a typeArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )
6 R% l. ~1 x! c{" C5 k: j- {3 p6 r) @7 m
return object;& N* ] ?7 p4 h
}5 p6 p9 @3 ^! F) ?$ `5 U
return 0;+ D& j9 ?; L6 Q: D% B8 k& ^
}//------------------------------------------------------------------------------* @& d- ?+ N2 y, [
// Selection any objects
" Y; }% |8 ^. c% d1 L//------------------------------------------------------------------------------
/ K" J( `3 [: a/ X. z, Tstd::vector< NXOpen::TaggedObject * > MyClass::select_any_objects(); B/ v( ~7 Q6 X( \
{
# I( |" {" x( g5 fNXString message("Select any objects:");
9 M L7 y! D& }: ]6 B8 o0 {; cNXString title("Select objects");
. b7 s+ V( m5 U9 cSelection::SelectionScope scope = Selection::SelectionScopeUseDefault;: X! h/ q" T P6 D6 @' N
bool include_features = 0;
2 m" W- E) R6 d! b' `5 b: Nbool keep_highlighted = 0;0 L5 P0 Z: n0 R% z
std::vector< NXOpen::TaggedObject * > objectArray; // Select any object array' _0 s$ z! r0 h M' q* }/ l# S- l
Selection::Response res = selmgr->SelectTaggedObjects(
0 k7 Z7 m& N- M# ? message, title, scope, include_features,
+ O" C9 g' s0 p" H% |8 F( S7 D keep_highlighted, objectArray ); return objectArray;/ L/ ]- _0 H" x+ C8 e
}& {# ]0 }. A/ ~( A7 M3 r& [
4 `5 Y8 O$ m. a1 B! w, i l
" I- ~4 L; A! V7 @8 J
- r/ y3 ^4 ?7 f4 b% B
|
|