|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
选择方式包括通过mask过滤,通过type选择,或者通过选择所有的对象。- x& ]+ C( e/ \5 i6 e
6 X2 @+ c( U# S: r/------------------------------------------------------------------------------# C4 w: Y1 W9 z3 H* R) }
// Selection with mask
7 ~$ \" j: G4 ?6 m0 u1 c% o. }//------------------------------------------------------------------------------
* f' {" P# ]: O) K6 K: \0 W, zTaggedObject* MyClass::select_by_mask()
& f! L, P1 ?' w* g& A{+ W- S' b1 |& L' I) s2 S
NXString message("Select an object by mask:"); V; i% Z, ~5 c! V: X8 ]
NXString title("Select object");% y' N' H: X4 t( C
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;& @ F$ W2 N5 {5 C/ a1 [
Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;
/ C6 Z" I. {6 K0 s% Zbool include_features = 0;
2 S6 M- s9 g1 X3 G9 i" gbool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
3 u: B9 z! I; ?$ W// Uncomment or combine the desired mask triples2 P+ O. ~1 y7 i
std::vector<Selection::MaskTriple> maskArray(1);3 l& F' F% p6 C z( @
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype, 0 ); // Bodies
' Q. w1 P: z( d+ n# t% C2 N/*% U I. A! y' s) L. ~- T2 u
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE); // Faces
( ?* w6 k8 w$ B, f4 n: u/ fmaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE); // Edges' [+ N. |- l z
maskArray[0] = Selection::MaskTriple( UF_component_type, 0, 0 ); // Components& t j4 G) p9 @. S4 m
maskArray[0] = Selection::MaskTriple( UF_line_type, 0, 0 ); // Lines4 F( t+ o1 d9 B6 \
maskArray[0] = Selection::MaskTriple( UF_drafting_entity_type, 0, 0 ); // Drafting objects* k, u& G n1 y& Q! K4 |
*/0 [, C8 N/ r+ T. r
Point3d cursor;
6 } @- R" j, E4 F/ o+ [. Q6 v eTaggedObject *object; // Select objects using filter defined by maskArray triples
, Y, ? N+ v) w" |* }6 rSelection::Response res = selmgr->SelectTaggedObject(
8 Y/ [0 x& L8 }+ T0 s message, title, scope, action, include_features,5 O# {5 @8 |' y% R4 x/ E( N" t
keep_highlighted, maskArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )2 d( k' M' O- \8 N5 m
{
/ S, F. y; d4 }+ I1 e return object;) O: p$ X- s- C9 a! { c8 |
}
. q B( P5 X. K3 C' Ereturn 0;
2 k( \" o# Z1 y* q. {3 X}//------------------------------------------------------------------------------
' J' S5 B/ Z6 s0 ?// Selection with type array2 \. r+ n3 ]# I7 k+ w
//------------------------------------------------------------------------------
$ n3 @: y' Q) t" UTaggedObject* MyClass::select_by_type()+ D# i2 j5 _4 T8 c# i4 j
{
* J4 v( x$ M, M( VNXString message("Select an object by type:");
- I% u4 V m1 I B# W6 YNXString title("Select object");
+ B) r& j/ r0 aSelection::SelectionScope scope = Selection::SelectionScopeUseDefault;& n. b5 Q' ~3 w# r3 @& R; v% ~# U
bool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
4 \1 {# R* i, _// Uncomment or combine the desired types- u; H$ f- Y) h: Y( V/ n- ]! h
std::vector<Selection::SelectionType> typeArray(1);
# p& k% s* g# b1 U) ?typeArray[0] = Selection::SelectionTypeAll;
' g1 r+ ^) A0 e+ d1 ]( u/*
: o' T! a5 b; O" Q" ?( R+ @/ `, RtypeArray[0] = Selection::SelectionTypeFeatures;- O5 ~' x% W+ v0 i7 O
typeArray[0] = Selection::SelectionTypeCurves;7 ? V S; O& o& d- ~, c
typeArray[0] = Selection::SelectionTypeFaces;: N+ {" u5 N6 z* g! N$ o# y; F; C; O. h
typeArray[0] = Selection::SelectionTypeEdges;
% v6 B2 O) U3 k/ j" Y2 a3 StypeArray[0] = Selection::SelectionTypeCurvesAndEdges;1 H* P5 n" F% a+ k- _; u
*/% H" O" G+ W* x- Q3 Y
Point3d cursor;
5 O: j+ N: V9 p, ?TaggedObject *object; // Select objects using filter defined by type array
+ i% R+ O2 @& W7 qSelection::Response res = selmgr->SelectTaggedObject(" R' ]2 S% _/ h0 [( A& `
message, title, scope, keep_highlighted, {7 u! C% l; O$ ?
typeArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )+ O/ y' e! S: |5 Q3 f
{! z" h/ s4 N! K3 T2 y @7 s. g5 L4 }
return object;
) G; ]4 u1 {' b+ }' d" y}
2 _! m6 F2 |+ N* Kreturn 0;7 ]$ ^: W' q3 p' j
}//------------------------------------------------------------------------------
- V; L# u8 C! \' |' K2 u// Selection any objects) v/ h" T. q. Z- _( l" n
//------------------------------------------------------------------------------. M5 h% S$ U" R; P$ B7 }3 x
std::vector< NXOpen::TaggedObject * > MyClass::select_any_objects()
& ?* t9 M# l# G, E{4 D7 O" R4 C/ D- x' I) ~
NXString message("Select any objects:");
) z) [8 v. F7 Q1 l0 INXString title("Select objects");
5 M. S3 I* f' v: a$ b' K" C% h1 nSelection::SelectionScope scope = Selection::SelectionScopeUseDefault;
5 I7 ?: D* O' ^& |, R$ Obool include_features = 0; 8 {0 q9 O7 g, X$ C( J" a
bool keep_highlighted = 0;/ q" y. E. c4 G: U9 g+ E
std::vector< NXOpen::TaggedObject * > objectArray; // Select any object array) M/ B/ Q* V0 T9 \# t
Selection::Response res = selmgr->SelectTaggedObjects(
5 e A( W0 I) N. n message, title, scope, include_features, 3 v5 Q1 F# D$ M
keep_highlighted, objectArray ); return objectArray;
( P( \3 f& \6 Z& s' P: A}
& E9 q- q+ O: ?; O. q7 Q# o1 d/ g
3 e5 X* p) l* G4 N6 r$ k) T
/ ~2 @+ J. t$ r* A
4 ? H' k2 _5 D1 F8 I9 V |
|