|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
选择方式包括通过mask过滤,通过type选择,或者通过选择所有的对象。0 P, Q+ s, B( v+ |9 Z! ?8 E" k3 H) x
# y; m0 l6 ~ m+ A7 M" p/------------------------------------------------------------------------------% z- Z4 l( ~& W- _2 {9 m
// Selection with mask' J; h( D2 S/ s/ N% W9 R2 o
//------------------------------------------------------------------------------
- c; n; t8 q! W0 u- ]& j7 rTaggedObject* MyClass::select_by_mask()# M1 B4 A4 b: Q5 V6 u
{$ R% j* O% P8 @: x
NXString message("Select an object by mask:");
) G4 |- o" N n. s3 kNXString title("Select object");/ r; C0 N# h# c$ m
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault; c( ?( ^5 p8 h I3 g4 r* H
Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;
' B/ g( c( G$ S% e nbool include_features = 0;/ g1 C# m. c$ Z+ c
bool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
+ k4 Y4 V, {0 E! X. f4 ?% V8 @// Uncomment or combine the desired mask triples- W* S2 B9 t" b8 n& E; t
std::vector<Selection::MaskTriple> maskArray(1); y- Q2 v T) g6 Y
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype, 0 ); // Bodies, j5 X( w# z6 B; } I2 t0 K5 p s( `6 @
/*4 e( B E2 U. }. V" S
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE); // Faces$ s. P0 B1 O" J2 F
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE); // Edges
W) \. w) h! g1 R$ cmaskArray[0] = Selection::MaskTriple( UF_component_type, 0, 0 ); // Components: `: E1 R/ u4 D5 F; T
maskArray[0] = Selection::MaskTriple( UF_line_type, 0, 0 ); // Lines
# u+ D' ?3 x) b3 a: mmaskArray[0] = Selection::MaskTriple( UF_drafting_entity_type, 0, 0 ); // Drafting objects
$ c1 N! c9 W, }*/
; I8 q& }( b+ \- ZPoint3d cursor;
8 S( S' u) x. Z% @) r" ^0 fTaggedObject *object; // Select objects using filter defined by maskArray triples
) w. B- v5 J7 jSelection::Response res = selmgr->SelectTaggedObject(
* `. X0 x, m# c2 a G' Y/ o message, title, scope, action, include_features,; ?) r# [* X/ ^0 E
keep_highlighted, maskArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )& {5 W' H: y2 _5 }
{) k, j, ]! O- c
return object;! S2 d/ F& Y; B' D! A$ ^
}& y' p4 U1 `# d2 l
return 0;
! ]: Q" r1 I/ Z8 ^3 Y+ r3 \1 {}//------------------------------------------------------------------------------1 Z* |; Z0 }4 M' G/ \9 |& N
// Selection with type array6 a; v+ s& o/ q" v0 J9 ]2 c& M4 q9 {
//------------------------------------------------------------------------------8 R7 f. Y+ K. Z$ W7 v
TaggedObject* MyClass::select_by_type()
5 q0 Z4 }# i! D# k; h* B6 I8 j) h9 {{) H+ Q* w3 l; ~$ w6 ?3 W
NXString message("Select an object by type:");
) ?* f- F) C. ^( T4 c. }7 Q: tNXString title("Select object"); Y$ X" A- Y& j+ t, o: U8 I5 `
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;- ^5 C2 c& d# Z1 N6 L$ O& V
bool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
/ I( x8 w5 H3 }, w6 X) a// Uncomment or combine the desired types& |1 H0 _- ]: X; M* }
std::vector<Selection::SelectionType> typeArray(1);
! X. _- I7 o" ?$ T7 Q+ v* XtypeArray[0] = Selection::SelectionTypeAll;
2 `" v: T( G' `, T( ]/*
- z3 U; B8 I% n5 W( h( ntypeArray[0] = Selection::SelectionTypeFeatures;
. a* R/ f& Z) B: B$ [7 J7 i8 j0 }typeArray[0] = Selection::SelectionTypeCurves;
7 L; o( o7 t, C$ X; ~. \1 D+ y. E! {typeArray[0] = Selection::SelectionTypeFaces;
* K* T1 [( `4 J* _ w" etypeArray[0] = Selection::SelectionTypeEdges;
" V# n; n/ j# W) O- t0 OtypeArray[0] = Selection::SelectionTypeCurvesAndEdges;) K+ M8 W& ?# ~# S) r) i
*/
! S& j) Z1 ^+ [) YPoint3d cursor;" W8 _ i8 H) ]& Q0 p! {2 I" J% z
TaggedObject *object; // Select objects using filter defined by type array
6 B# ]2 ^% ^7 r* eSelection::Response res = selmgr->SelectTaggedObject(
& N- n. {) k4 ~- u8 O message, title, scope, keep_highlighted,
. Q: \7 u' Z. i7 k2 A typeArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )
: `* s$ \+ D$ V0 r+ F E: W{
! T* I1 p% d `+ r& u/ {# w4 h" K return object;# a0 ^: G L( d w
}) H# k) S o9 f7 {" E
return 0;
7 g x9 e2 O( ]}//------------------------------------------------------------------------------
) P1 s" m) m+ k0 A7 D1 `// Selection any objects8 }% W/ K ^2 L: ^
//------------------------------------------------------------------------------
) }. B( E. p% ^std::vector< NXOpen::TaggedObject * > MyClass::select_any_objects()
' d8 g7 f3 l$ A7 m/ d{8 O& B+ e" y& ~' k7 R4 r! _8 N7 |9 e
NXString message("Select any objects:");0 g5 ?1 J& }$ J2 w
NXString title("Select objects");* o5 @9 O8 w' k
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;3 n2 t6 {* O9 M
bool include_features = 0; % i3 d& I1 W+ j" [
bool keep_highlighted = 0;4 B- E2 Z( _4 W
std::vector< NXOpen::TaggedObject * > objectArray; // Select any object array9 K& ?& K; ~% [
Selection::Response res = selmgr->SelectTaggedObjects($ H" O$ X/ w( l* b) q8 Q
message, title, scope, include_features,
! Z8 m9 K4 S+ I; V1 d0 h keep_highlighted, objectArray ); return objectArray;
8 ]9 o% w* y8 j# ?$ u}! m& c/ V9 \, @6 F2 o
* i i* Z3 } E+ O/ M; @% a: b; V, ~0 ]# F1 q' }
% p4 Q3 P/ o7 O. ]! `, ?
|
|