|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
选择方式包括通过mask过滤,通过type选择,或者通过选择所有的对象。
* Y6 ~* s d8 N* m$ ^' J; |
9 U; i5 G! K' O0 [/------------------------------------------------------------------------------
d' @2 K* {8 @! H7 \// Selection with mask
& Y8 R7 b3 d* e, O//------------------------------------------------------------------------------
. I3 B7 G) y" f& G) l4 m4 b0 o6 |. c3 E" fTaggedObject* MyClass::select_by_mask()
1 j6 ^/ s4 s" c9 H v3 k* U: t4 J{0 z, j' g2 ^. N8 ^( T+ j1 i$ C% j
NXString message("Select an object by mask:");
' R; B& F2 f' b' C ?NXString title("Select object");
2 |# O9 V1 k) s1 a9 eSelection::SelectionScope scope = Selection::SelectionScopeUseDefault;
7 r; W5 H3 k2 z* c% |' j% oSelection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;
$ V, z0 S& A6 O: k( ?2 o* u! k3 p1 N) ebool include_features = 0;
% c3 _$ T. e3 O$ |. ]; X! Qbool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
: |- P7 `5 `' a- _// Uncomment or combine the desired mask triples6 M; z- Q6 [ E+ {' T
std::vector<Selection::MaskTriple> maskArray(1);
; \4 c4 f7 X, [maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype, 0 ); // Bodies! E$ c! h" d. U+ u# F
/*
u0 |* K0 E* H1 D! [7 c* pmaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE); // Faces$ x# c- h9 H/ l" X
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE); // Edges$ c) }( W7 Z) @ C; S. p
maskArray[0] = Selection::MaskTriple( UF_component_type, 0, 0 ); // Components
; a! j9 c) e8 V+ u9 F( cmaskArray[0] = Selection::MaskTriple( UF_line_type, 0, 0 ); // Lines
1 w; T" L8 z# G, z* bmaskArray[0] = Selection::MaskTriple( UF_drafting_entity_type, 0, 0 ); // Drafting objects
; j7 c' L# A. k, x, D9 b3 h$ m*/
% x8 J! ]! D9 N) [4 OPoint3d cursor;
( M9 d: |. o3 M0 O) \* CTaggedObject *object; // Select objects using filter defined by maskArray triples
+ n, o* y$ N2 Q# ESelection::Response res = selmgr->SelectTaggedObject(4 W& Y3 C7 Z/ S1 C/ I ]
message, title, scope, action, include_features,
! b+ P) V( C3 F3 U6 k keep_highlighted, maskArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )
! }* O- n/ i9 K: W{
! ?' @. E1 q9 ~% j return object;
4 u' ]8 ]! o5 [: m}
2 o+ r T7 v6 n+ }return 0;0 E* S, P, l6 Y# D' J O! G& N' t
}//------------------------------------------------------------------------------ f) I9 l5 y# Q. z
// Selection with type array4 K1 D7 `9 r1 J7 n
//------------------------------------------------------------------------------
; |& d0 M; H' _! V4 J2 Q, }TaggedObject* MyClass::select_by_type()
( i8 u) u2 h1 d3 n) j( T$ }% {{
. [' F0 a' E: u# B$ eNXString message("Select an object by type:");, ^( t6 W( p3 T9 `
NXString title("Select object");6 u- h; q0 [. z u7 P) ^* `
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;
+ D) c6 b( s# f# h) c v8 Rbool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
0 e% m. u( c a w1 _# |: H// Uncomment or combine the desired types" M: u, C* y( b/ ?
std::vector<Selection::SelectionType> typeArray(1);
0 h" J# m6 J) @$ y/ z `typeArray[0] = Selection::SelectionTypeAll;
; x9 Y. I9 ?. i. ~/*: Q) y8 m, O$ e" x; N. O0 C7 W
typeArray[0] = Selection::SelectionTypeFeatures;9 Y$ @$ O4 m( B. B4 Z9 {1 g
typeArray[0] = Selection::SelectionTypeCurves;5 s$ r r3 V+ y
typeArray[0] = Selection::SelectionTypeFaces;8 `& w9 v4 s' U- y: g
typeArray[0] = Selection::SelectionTypeEdges;( K$ F' H r0 A, D* R
typeArray[0] = Selection::SelectionTypeCurvesAndEdges;0 K, ]! y! ^# }0 Z
*/
+ ?0 W/ N1 w% F; UPoint3d cursor;% t. Z+ `# o- M; N( g1 J
TaggedObject *object; // Select objects using filter defined by type array
% m2 v/ i" f$ {Selection::Response res = selmgr->SelectTaggedObject(7 Y9 J$ ?: o0 m- S$ p
message, title, scope, keep_highlighted, ! H6 e" ^) c7 o9 w
typeArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )
X% _/ O) O8 g! \. o# ^* m/ g' w{
, G& ?7 R y8 g return object;
0 J5 F$ q/ c$ N0 [$ F8 F: q}
9 p# m0 t9 O5 F. }0 H3 W. Wreturn 0;6 k' p1 O$ L- x Q h
}//------------------------------------------------------------------------------
+ O6 X" |: D! y. Z1 A// Selection any objects
% ]2 _' G! V8 }, {% }/ l//------------------------------------------------------------------------------
. |8 P/ b6 d6 \std::vector< NXOpen::TaggedObject * > MyClass::select_any_objects(): r8 O, O# W `$ P
{
& [9 q2 v" J% v0 rNXString message("Select any objects:");6 D# _% ?8 y' _3 w- e# V$ A* J+ v
NXString title("Select objects");
$ U7 T9 u" h( N9 ~9 GSelection::SelectionScope scope = Selection::SelectionScopeUseDefault;8 h$ S2 y" u. v$ C4 w2 p! z
bool include_features = 0; 9 I4 M0 J, }5 L# ` C
bool keep_highlighted = 0;
8 H* O# T/ ^5 G8 [+ Fstd::vector< NXOpen::TaggedObject * > objectArray; // Select any object array
% J: C' t; s: V/ V6 d# @/ mSelection::Response res = selmgr->SelectTaggedObjects(
% ?: |: _! k' p( i. h1 X% q% w) A message, title, scope, include_features, F# x8 ?& a1 T$ h' b1 |7 [* c
keep_highlighted, objectArray ); return objectArray;: q4 E7 O; {/ r# N( J
}( C. h& ^6 S6 w. N, s6 l
( s( r" G/ K" z* g3 O% d) g
" U- N0 [3 \& r' Z9 `$ c8 H
( h* W5 q% f( f7 L8 r/ C |
|