|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
选择方式包括通过mask过滤,通过type选择,或者通过选择所有的对象。8 A. s* B9 y/ Y: B3 L/ T
2 e; T; P8 _) Y4 D# d
/------------------------------------------------------------------------------9 [1 J3 ?8 O) l
// Selection with mask7 m9 x' y6 b) x$ H* A; q. Z
//------------------------------------------------------------------------------
* }2 V0 u9 m1 W5 iTaggedObject* MyClass::select_by_mask() P) d7 I/ t8 b: g9 q) v1 L
{
, a. a. E& l" w6 s0 Z$ WNXString message("Select an object by mask:");: n1 V' |' l* G" W$ u; C6 @3 M' h
NXString title("Select object");* {( q$ S! b5 H: H$ N9 P
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;, B% z( ?9 M" K: j' T) s+ j
Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;) r5 w0 r. \$ M3 J9 l
bool include_features = 0;
/ }$ o0 M6 h% Gbool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h./ {& i8 Z N% o2 Q1 V- \# ]) W
// Uncomment or combine the desired mask triples
" p% t: F2 m; T* u2 xstd::vector<Selection::MaskTriple> maskArray(1);
$ Y, N, E6 K- r/ e% c: b; }maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype, 0 ); // Bodies' l; k/ \9 R/ t2 b0 P
/* P/ T; q) o& N' _
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE); // Faces
' y% }# R* ~. Y- i3 cmaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE); // Edges9 m6 v9 s+ \% A- m4 y( _3 i
maskArray[0] = Selection::MaskTriple( UF_component_type, 0, 0 ); // Components
7 d, D. ?# P! e0 h! ZmaskArray[0] = Selection::MaskTriple( UF_line_type, 0, 0 ); // Lines
p9 Y2 e; v3 I$ i( W0 QmaskArray[0] = Selection::MaskTriple( UF_drafting_entity_type, 0, 0 ); // Drafting objects% J3 U6 s+ `3 z4 l M( b
*/- }3 ^8 }9 ^1 k7 a+ ?( }
Point3d cursor;: \$ g3 f: A# Q+ H- d. X! K
TaggedObject *object; // Select objects using filter defined by maskArray triples4 s0 k: Y+ I0 ^9 Y. W: _7 ?: @& L
Selection::Response res = selmgr->SelectTaggedObject() l7 Q! U6 O' |/ w
message, title, scope, action, include_features,2 z' c5 x5 z9 f7 o8 r" G, p* Y' e" e
keep_highlighted, maskArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )0 r& b6 w. e! b: z
{
" N' y% I' Z" S return object;
# k L' E0 K* m1 o: ]5 v}. E; G9 n; l# t$ S' r
return 0; ^+ p) L& {- j$ A# d* h
}//------------------------------------------------------------------------------
7 o/ ]0 [; F2 \! I// Selection with type array, p$ A; Z( b5 E, D
//------------------------------------------------------------------------------
8 o: y `0 M1 gTaggedObject* MyClass::select_by_type(): R7 i8 h! \& \; k' b' o1 m
{
# m( V0 B# v, M. i# I8 DNXString message("Select an object by type:");
# M. n. H& K2 A } f$ V' MNXString title("Select object");
$ Q4 Y; M! W" u7 ?Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;( [8 ^6 e3 {* l4 l' f
bool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.% e; B+ M% u. _/ V
// Uncomment or combine the desired types
9 L6 V+ d- @1 W8 E$ N2 tstd::vector<Selection::SelectionType> typeArray(1);, R8 C. H9 z3 |& ^- w; x
typeArray[0] = Selection::SelectionTypeAll;
- E4 }; p1 R! _2 S/*
( I2 \0 l, b+ l+ ^typeArray[0] = Selection::SelectionTypeFeatures;% v% ^* v' u% k, \0 U
typeArray[0] = Selection::SelectionTypeCurves;
! `3 V" y& k5 Q: N# f \* N- ztypeArray[0] = Selection::SelectionTypeFaces;! @/ U1 R+ P9 @+ I2 l7 w
typeArray[0] = Selection::SelectionTypeEdges;
% a1 m8 \4 b( s) StypeArray[0] = Selection::SelectionTypeCurvesAndEdges;! F7 m3 J5 R1 x3 I& Z# {
*/. O' |2 O: `2 Q: }! y6 X X' {
Point3d cursor;& p+ c& ]- M: ?5 H0 ]
TaggedObject *object; // Select objects using filter defined by type array
7 r i7 V9 @5 ?) U8 y. A3 oSelection::Response res = selmgr->SelectTaggedObject(
( O' O/ ?5 Z( j& s message, title, scope, keep_highlighted, 1 ?; Y7 G# E. x; N% t3 w
typeArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )$ u K" P ?% a G- r: J* G
{0 }8 l" o( {2 a" J6 m
return object;
" X8 ` F% O9 h! I}
) `- g0 ~- ]/ h0 x8 Creturn 0;; v5 a5 T5 h; Q7 N/ w8 W0 G
}//------------------------------------------------------------------------------* m1 D9 }# g! }3 T& \1 e
// Selection any objects4 h( ^5 W, d/ d" [. J0 {
//------------------------------------------------------------------------------) J4 n6 a2 y i! [3 L/ e
std::vector< NXOpen::TaggedObject * > MyClass::select_any_objects()
% n% d% v, ], o8 X) B4 s) U{
7 h/ q' o3 r' c- l4 V* T# INXString message("Select any objects:");. H. b3 V2 {; V1 ]3 r
NXString title("Select objects");
9 j/ V+ f# P8 ASelection::SelectionScope scope = Selection::SelectionScopeUseDefault;
, B$ @% S# {5 O$ c) {, kbool include_features = 0;
: \% @0 P1 ~6 D+ X6 E+ Mbool keep_highlighted = 0;% P2 Y1 s. i9 |, P* k
std::vector< NXOpen::TaggedObject * > objectArray; // Select any object array5 ?6 T: ^! U5 j/ I7 b
Selection::Response res = selmgr->SelectTaggedObjects(! I" y% X, e, c Q- a( D! |( G
message, title, scope, include_features,
9 j7 w' d' Z( N3 \+ @' \ keep_highlighted, objectArray ); return objectArray;- V" r7 d' a* [
}# G, p) q& V) n
# Q* z, Q: B N, |0 E
z/ }( @3 q, d+ [
9 Y4 b! d! T) L8 u4 Q" J/ W |
|