|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
选择方式包括通过mask过滤,通过type选择,或者通过选择所有的对象。) B" W; j8 j2 X
+ [! h$ D) s7 j- v7 Y
/------------------------------------------------------------------------------5 j/ [. \, U' u S
// Selection with mask( K+ D& I) B h }
//------------------------------------------------------------------------------7 }" @# a: P) ` o) Z3 b# L% D
TaggedObject* MyClass::select_by_mask()
& z1 {$ q$ |" O9 @- r4 G{" u t/ u2 O; M' s6 h7 C+ S
NXString message("Select an object by mask:");
4 A; f6 s% c' R& ? P B* WNXString title("Select object");
' C/ N; b9 M7 t2 W: c# w: ^Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;4 P: J! U* T* c$ V0 t
Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;
9 ]( ?) V# Q1 G: [bool include_features = 0;) s9 y9 p9 X E
bool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
+ G8 m+ p0 X( ?/ D6 o/ N// Uncomment or combine the desired mask triples6 |! k+ Z' } t N5 z! R
std::vector<Selection::MaskTriple> maskArray(1);
& F, C. I* I8 V# l. T9 l, }maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype, 0 ); // Bodies2 l9 V3 U$ V) _4 N* c
/*2 `4 s. A2 }3 ?) C; ~9 e
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE); // Faces
+ x* Z% H l2 Z0 o( @/ VmaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE); // Edges
1 h3 O" C/ P X6 H% f5 y' kmaskArray[0] = Selection::MaskTriple( UF_component_type, 0, 0 ); // Components
9 q3 U- I$ }3 Y1 F' gmaskArray[0] = Selection::MaskTriple( UF_line_type, 0, 0 ); // Lines- l5 H& `4 L0 f( D' i! [
maskArray[0] = Selection::MaskTriple( UF_drafting_entity_type, 0, 0 ); // Drafting objects
1 }; [$ G5 {* y( ]$ P*/' p! }# P! s; f/ m
Point3d cursor;4 I* u0 G% o( S; s6 Y5 M ]7 J
TaggedObject *object; // Select objects using filter defined by maskArray triples
7 D* J' G j4 S$ Z9 d {, f KSelection::Response res = selmgr->SelectTaggedObject(
$ p; m1 |2 ~2 O) `, b+ W, { message, title, scope, action, include_features,! m# q' c/ ]' t$ p" X6 b9 V8 Y( ]
keep_highlighted, maskArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )6 d7 u3 V- I7 c& q& k5 z
{
$ [* x- |; H5 l- b return object;$ e5 h; A; G; K" I- m
}6 e: P4 E& S3 R7 c( j
return 0;
2 l+ a' C9 m# N+ u6 e2 u. }2 j}//------------------------------------------------------------------------------( d2 b4 h9 A6 T( c, L
// Selection with type array
( O8 j, u, H; p1 R' H//------------------------------------------------------------------------------
$ {% ^) f7 S# W2 n' VTaggedObject* MyClass::select_by_type()% p, N; ]- b8 a" V! w) H" [
{
# W! B5 m, o4 N* y. {0 [NXString message("Select an object by type:");7 I$ M/ [( Q* |# `2 _4 @
NXString title("Select object");" O' e O' D+ v! x8 n6 `; g
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;9 z) s8 H3 v! F: z) v
bool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
& S: N! n# Q4 K9 X// Uncomment or combine the desired types; w2 ^: Q) }6 X- Y' Y
std::vector<Selection::SelectionType> typeArray(1);
, T* E7 \$ O1 _( UtypeArray[0] = Selection::SelectionTypeAll;
5 T$ K' e$ u7 Y1 H( P& |/ p/*
s* w2 { U6 O7 ?0 GtypeArray[0] = Selection::SelectionTypeFeatures;+ Q( ^9 e6 n0 w# c- { }# k
typeArray[0] = Selection::SelectionTypeCurves;
6 w7 s8 Y- F' F3 n5 ^) atypeArray[0] = Selection::SelectionTypeFaces;4 x8 X- v* e% G a7 a/ H' s
typeArray[0] = Selection::SelectionTypeEdges;
3 T/ z' ?& p& `% f, G6 Y9 w3 v: D# v: htypeArray[0] = Selection::SelectionTypeCurvesAndEdges;
& ]: B2 w3 o0 f" y- d*/* D9 Y+ i% ^1 S8 _ {0 N' u
Point3d cursor;& v$ K) p6 [& N0 u$ T. `' f- e1 k
TaggedObject *object; // Select objects using filter defined by type array z7 X' f3 N8 t& _3 R% m) k
Selection::Response res = selmgr->SelectTaggedObject(
( Z. u S4 E! T O1 A0 p6 C3 Z# J message, title, scope, keep_highlighted,
0 P, Z; c! |4 S/ M" {% M typeArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )
6 ~4 c# ]5 v3 R{
2 \5 m- O+ N. p6 p return object;
. `3 Y% k7 a, |" ]}: t# n% |# x. [0 a* s* ~# A3 p
return 0;
M# D4 [% j" b# U' B; O+ w}//------------------------------------------------------------------------------
; i! P5 W; e( `+ S0 q! V// Selection any objects
3 p* m+ s. d$ [& w# f//------------------------------------------------------------------------------+ I4 h" K! _- E5 a4 Q1 a- b
std::vector< NXOpen::TaggedObject * > MyClass::select_any_objects()
+ \1 N, v* V$ e{
2 d/ p c" K4 @' G3 E! M8 g: A! TNXString message("Select any objects:");! S) w" E8 i( s! r$ i! k2 ^& L
NXString title("Select objects");6 T' A2 k( q2 H5 {
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;& a/ X4 k: h( ^% K- m
bool include_features = 0;
" `; V6 L, {2 L% m! T0 fbool keep_highlighted = 0;& R) F( ~7 @& P
std::vector< NXOpen::TaggedObject * > objectArray; // Select any object array2 g* S5 M! ^9 N
Selection::Response res = selmgr->SelectTaggedObjects(
2 H9 e; i! |1 q( Y2 c% A( {9 b8 d message, title, scope, include_features,
! V5 c: s5 s- Z% o* v( B# B( h keep_highlighted, objectArray ); return objectArray;
/ e* |' A+ G0 l}" `6 {& x& J4 d
9 V: X) f) J5 i1 E1 O" H5 x- y% U! N& n
t# \$ b: I& w" Q# ?
|
|