|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
选择方式包括通过mask过滤,通过type选择,或者通过选择所有的对象。
6 r9 ?, s: }: C: ^: H+ t# g5 g" p
/------------------------------------------------------------------------------) ?9 Q( ~. v2 c) y+ d% t& j! d# q
// Selection with mask" d" b- y8 w$ x0 [3 b5 ~6 t7 V$ J
//------------------------------------------------------------------------------
' O0 z: G1 R7 x3 ETaggedObject* MyClass::select_by_mask()7 }4 \" D( R, U
{
: T0 H0 h j7 Q: G5 S5 F* _NXString message("Select an object by mask:");
8 \/ [( c2 `! MNXString title("Select object");
; G' ~6 R/ w/ _Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;9 |+ x( t ]5 K4 i, q% J
Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;
' E& U$ q) g9 m. I) J& r$ n$ Ibool include_features = 0;
7 a: H5 C( _9 O/ ~& Z/ F- m* Lbool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.) X: Q8 {1 m* ^' r, w0 P$ D. U7 M5 ^
// Uncomment or combine the desired mask triples, i0 ]6 }* d. r) W. Q. o
std::vector<Selection::MaskTriple> maskArray(1);. b8 t, V1 a! l9 S; ~
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype, 0 ); // Bodies
5 {% W) h0 Q3 r8 B- c7 h0 }7 [/*
) r3 @) U/ J, ~% t/ EmaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE); // Faces1 R5 G7 f1 d9 h: s
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE); // Edges2 T( S% d+ |9 h# R
maskArray[0] = Selection::MaskTriple( UF_component_type, 0, 0 ); // Components
0 }/ u0 @9 R. B0 w# [2 MmaskArray[0] = Selection::MaskTriple( UF_line_type, 0, 0 ); // Lines
! F6 F% `8 h( G: O. {( SmaskArray[0] = Selection::MaskTriple( UF_drafting_entity_type, 0, 0 ); // Drafting objects$ G2 u+ ]! i8 }0 D3 W4 ]( z4 o
*/$ k9 t4 n# o/ ]
Point3d cursor;1 Q( i+ E. R; }- W: `$ B% `/ D
TaggedObject *object; // Select objects using filter defined by maskArray triples
G. y2 O. y4 p$ S& |# aSelection::Response res = selmgr->SelectTaggedObject() b% l9 k% t5 {. P# `/ H9 o' ^
message, title, scope, action, include_features,
: Y1 `7 w" E1 a8 | keep_highlighted, maskArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )
: j2 k: o/ X3 `, ?! m1 I% ]+ s- y( f: I{7 k7 D' k' j, R* k: T& p
return object;7 @, t+ X3 y/ Z6 g$ U
}
) _2 K+ h& ^# d8 r) O7 S; b; {return 0;
2 F2 C& q- T- K+ H, A. C/ ]}//------------------------------------------------------------------------------( C% @% r! ~. G- Z \) y
// Selection with type array
& ^, {4 ~6 o X( w% @//------------------------------------------------------------------------------& D" Z, |2 _6 I; ?' ?
TaggedObject* MyClass::select_by_type()3 e3 l9 Y, t) n! r( M6 C
{% _, D" @6 q5 d
NXString message("Select an object by type:");
* g8 i9 ^) e4 b4 P$ D$ G7 nNXString title("Select object");
* e' b& U' a- V9 MSelection::SelectionScope scope = Selection::SelectionScopeUseDefault;, d8 r; e4 K/ S, D
bool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
/ y; g! I- ^. W0 h6 Z// Uncomment or combine the desired types9 }% Z- O+ b( j# g' `4 a
std::vector<Selection::SelectionType> typeArray(1);$ T& V8 }) R" p' L6 Q! E7 q
typeArray[0] = Selection::SelectionTypeAll;, Q% v) s& B! y' v8 `, I
/*
5 a: ?& x% O a0 n: p; l# Y6 `typeArray[0] = Selection::SelectionTypeFeatures;0 T4 a+ i% X3 S6 c5 ^
typeArray[0] = Selection::SelectionTypeCurves;1 C( B/ o7 l0 ]8 ]
typeArray[0] = Selection::SelectionTypeFaces;+ J4 u7 k: N4 P P7 g9 `% d
typeArray[0] = Selection::SelectionTypeEdges;! ^$ a5 G F8 ^: h2 U) Z! A
typeArray[0] = Selection::SelectionTypeCurvesAndEdges; Z# W" Q2 c3 M$ F, E5 l, i% z
*/) m6 O: w, p' v [5 \$ J/ C
Point3d cursor;; |6 V. d: p/ V8 I
TaggedObject *object; // Select objects using filter defined by type array* N+ y# Y% [0 w, R$ P9 F4 x$ X
Selection::Response res = selmgr->SelectTaggedObject(
6 M H3 p: O: P+ u# E) h- Z8 t message, title, scope, keep_highlighted, 8 ^$ E( ]9 N0 w- k( n0 u
typeArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )% k+ f9 O" Z) p7 q# `
{2 C+ F3 t/ E- o2 P- a: E
return object;
9 }' w) _" C! {7 U* v- u" [}
( Z$ p6 |) K7 e! _2 S9 q- Oreturn 0;
& l; d: I7 `! B% f0 r}//------------------------------------------------------------------------------0 v# j5 [( _- ~' |, x
// Selection any objects X0 d+ d: w3 w0 R
//------------------------------------------------------------------------------
/ r! Q) \+ ]- z5 K' Y/ W! S) mstd::vector< NXOpen::TaggedObject * > MyClass::select_any_objects()
2 W( g& b, P) q, @; l4 j: t* l. t" _{( N* G3 j- t/ \9 D, q
NXString message("Select any objects:");
3 Z3 ~! d1 g) J' }1 RNXString title("Select objects");
2 v$ I9 \: ^% D, ISelection::SelectionScope scope = Selection::SelectionScopeUseDefault;
) ~, x& _& N9 C- Q1 E( Wbool include_features = 0;
6 p& T, J( o. q9 j+ o: fbool keep_highlighted = 0;$ p+ X% Z. s1 A1 F; _
std::vector< NXOpen::TaggedObject * > objectArray; // Select any object array
$ f, G' m- n" _ e& w TSelection::Response res = selmgr->SelectTaggedObjects(! x! n S% Z4 C/ m+ w4 v1 ^
message, title, scope, include_features,
' u, t: I, `8 h& j keep_highlighted, objectArray ); return objectArray; ]% N+ V! f' G9 [ n( o
}
( \, t9 N+ h2 G$ k2 o! Y$ b" E5 t; T2 `7 V' @% ]8 D. E
/ I |. h" I( |2 N3 U- K% x' ~, P% @
$ v. c9 U% t$ ?: Z" \
|
|