|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
选择方式包括通过mask过滤,通过type选择,或者通过选择所有的对象。' Q) N: O6 | V* s; d
( Y& I8 R; O& F4 u+ a9 S- x' t/------------------------------------------------------------------------------) B* h, u. s+ Y# k, \& a
// Selection with mask) x8 ~% a- z4 ^4 R7 O1 o6 j
//------------------------------------------------------------------------------
K1 G9 D% p: S$ m! m, Y; R& tTaggedObject* MyClass::select_by_mask()7 ^0 V4 a+ S& Z2 f
{
3 S* V. X& x8 V. s# H" QNXString message("Select an object by mask:");6 G j, E. K9 a% @) Z: ^
NXString title("Select object");
9 D2 y# Q) ^& \1 w0 WSelection::SelectionScope scope = Selection::SelectionScopeUseDefault;2 a/ A( c5 {. [3 f" P" v+ r
Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;" U9 c3 V. v2 U7 ]0 Y
bool include_features = 0;/ Y& G" B9 R& J
bool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.0 H9 C4 G2 E. O3 K
// Uncomment or combine the desired mask triples7 w8 @7 s, s, u4 B/ i) H
std::vector<Selection::MaskTriple> maskArray(1);0 W3 ~& |4 Y' w. }+ ?" X/ x( b
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype, 0 ); // Bodies) f: S0 r4 g8 E" Y; ~8 q
/*
8 Y6 X7 f) d: U- ~maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE); // Faces
/ n: X2 I5 B PmaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE); // Edges
! J8 l$ [+ d; O- c& w" P8 ImaskArray[0] = Selection::MaskTriple( UF_component_type, 0, 0 ); // Components
/ o6 Y, |% l) _0 }maskArray[0] = Selection::MaskTriple( UF_line_type, 0, 0 ); // Lines
( u' n' K- k" ?' E' K, ymaskArray[0] = Selection::MaskTriple( UF_drafting_entity_type, 0, 0 ); // Drafting objects+ X6 d: W9 O6 y/ q
*/! M; N7 `2 ^ \. s, ^ p
Point3d cursor;
) P7 o- m/ U: `/ r0 j, ] V, @TaggedObject *object; // Select objects using filter defined by maskArray triples: m/ t5 b1 l" w# ^! a
Selection::Response res = selmgr->SelectTaggedObject(
3 }6 v1 W$ ^# Q5 F5 p% X% ^ message, title, scope, action, include_features,
: }; ^1 D" n k8 [6 S# M keep_highlighted, maskArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )
( ~) `% f, L k4 o( Z1 J; i{! Q- s [8 d% p/ A2 @% A5 t
return object;
+ \0 q* S& b2 \& B' W Q! x}+ O, j7 u/ @" b6 R6 N7 U/ m3 B
return 0;
0 l* D& S6 e; v* e3 y; |3 M# k/ G, c}//------------------------------------------------------------------------------1 c1 j! ?2 ^( y
// Selection with type array
2 K: q: e2 I( n3 C# ?//------------------------------------------------------------------------------
. F7 R, R$ T3 G6 w* g5 DTaggedObject* MyClass::select_by_type()
9 ^( p2 c8 N) G* O; ^{ }0 |7 F9 ?6 ?; F5 Z; w0 ]
NXString message("Select an object by type:");
5 f. f9 T2 @% I% m$ E& e( S7 rNXString title("Select object");/ s6 U7 b5 Y r& _ b
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;
0 e; I2 ~- d* i; p7 f$ gbool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
& ~- _/ f* l! i( w7 i// Uncomment or combine the desired types
7 ~7 W9 @' k7 `5 \: ?5 V) dstd::vector<Selection::SelectionType> typeArray(1); W, w! B: v6 d+ C4 |4 r, x
typeArray[0] = Selection::SelectionTypeAll;
4 o" I @9 \+ \% ?, F: s1 v& r4 s/*
$ l* V7 y1 N. H+ EtypeArray[0] = Selection::SelectionTypeFeatures;
+ i4 X! V( O" a& v; G; {- RtypeArray[0] = Selection::SelectionTypeCurves;
( X1 Z! P7 G2 atypeArray[0] = Selection::SelectionTypeFaces;
" p7 f/ E; g2 ^ I5 s% S: jtypeArray[0] = Selection::SelectionTypeEdges;
- b9 m; z( w( J+ f7 \typeArray[0] = Selection::SelectionTypeCurvesAndEdges;
" N* y$ G6 T+ y* P: ?2 p*/
+ G5 v$ K3 q4 }4 j; R2 ~' JPoint3d cursor;
( ^) A H; M) L3 C( ?TaggedObject *object; // Select objects using filter defined by type array7 K+ R$ l# B% r& E/ c* j
Selection::Response res = selmgr->SelectTaggedObject(
& ]$ `: @/ c9 p% m$ { } message, title, scope, keep_highlighted, - P _' c* |* o' g# S
typeArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )( F! u! q' W* \6 [( @
{3 z; |4 K* v9 t: P+ L4 H X
return object;
`6 }0 C- Y2 ^" j}# Q/ W7 [2 ?$ l
return 0;
- C" m; W# u# H}//------------------------------------------------------------------------------0 U5 p. v! ~ d" c# D- }
// Selection any objects
) r+ M0 \0 z9 w; D8 m//------------------------------------------------------------------------------$ n# |. F# O/ ^8 @7 M
std::vector< NXOpen::TaggedObject * > MyClass::select_any_objects()
; m# `( L" O! [5 m+ w- m- h{
+ K) ?" o% u9 }* h4 i1 Q9 p' JNXString message("Select any objects:");
2 j! m% _5 P. {* t5 b; g6 @NXString title("Select objects");
/ Y+ l4 L7 e2 U) I# B' {Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;5 N4 b1 W1 S: G* W7 x* B
bool include_features = 0; , M. ^* K) Z- P; {% @. t! @
bool keep_highlighted = 0;
: k8 }, r2 E, K4 Lstd::vector< NXOpen::TaggedObject * > objectArray; // Select any object array8 ]; S I1 N! q5 s. n
Selection::Response res = selmgr->SelectTaggedObjects(/ Q$ S. k- c$ V. J8 o
message, title, scope, include_features, / h, O/ C* I8 T' X& M
keep_highlighted, objectArray ); return objectArray;
+ ~! Y) N5 T3 o: Z9 R' G}
7 W- C# m- X2 Q- _: @0 H
8 V# {% f) I9 W& U. q5 }0 {% I A4 U9 _
' y; D/ ?# V: r; K$ v
|
|