|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
选择方式包括通过mask过滤,通过type选择,或者通过选择所有的对象。9 g1 Y3 ^* D7 x0 b% N. _5 ? w
" X2 I% [& Y$ [ I, A/------------------------------------------------------------------------------1 E9 L- c4 N1 p- W* r
// Selection with mask! U8 T8 }* Q" ]# @" w0 ^: ~: F
//------------------------------------------------------------------------------
! p1 H b' o& |6 yTaggedObject* MyClass::select_by_mask()4 c0 b" c. A7 r+ N$ c
{
5 D+ I3 ~; @2 Q% uNXString message("Select an object by mask:");
* m, l' A1 {! X4 V& L8 A bNXString title("Select object");
% g3 \& V5 C* E( p% sSelection::SelectionScope scope = Selection::SelectionScopeUseDefault;4 r# L, n1 Q% B" ]7 [! q- ^! s
Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;6 _- X$ I' |7 U- ]: ] w& q
bool include_features = 0;
% {; A! L0 b& O" @8 Qbool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
4 \& K3 `8 h+ V) C0 V: k" k9 R+ f( Q/ h// Uncomment or combine the desired mask triples
8 ]" R5 r, q: H. ~$ @1 L! K" Vstd::vector<Selection::MaskTriple> maskArray(1);. u/ z0 X9 L7 p7 i% u$ t1 ^4 x
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype, 0 ); // Bodies
3 c/ c" j3 c- h5 [4 z1 c+ `/*
! F2 r) }. S. `( a5 q+ lmaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE); // Faces
4 W1 }$ s$ ^% ZmaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE); // Edges* [' G. _% p7 j9 _
maskArray[0] = Selection::MaskTriple( UF_component_type, 0, 0 ); // Components1 S- J& U# x: O
maskArray[0] = Selection::MaskTriple( UF_line_type, 0, 0 ); // Lines
- X1 m# Y4 b9 c, ZmaskArray[0] = Selection::MaskTriple( UF_drafting_entity_type, 0, 0 ); // Drafting objects
( S7 k- b- K2 R; k*/
7 ^% @% H: u ]Point3d cursor;1 [( u& X) H- }- g8 x$ s/ ^
TaggedObject *object; // Select objects using filter defined by maskArray triples, r% x$ t, P: H. j
Selection::Response res = selmgr->SelectTaggedObject(# ]8 z) @: x8 [* X
message, title, scope, action, include_features,
$ h" d' c. J7 c, y, B. B- {2 J. J! H' E keep_highlighted, maskArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )
' Q j. g7 C5 n- V B, x8 q{( Y- C- @2 W9 m' q5 S3 O
return object;6 Z. @" P1 Y) t- n5 E6 p
}9 h6 F! j/ a9 v m r; ?) d5 t
return 0;
. N2 A4 P' @, z; N& N. [}//------------------------------------------------------------------------------# @9 y& i( r/ y2 o9 J
// Selection with type array
+ b; c5 b% `* l' k5 F//------------------------------------------------------------------------------5 D& R' q+ r# F7 ]: y0 E- [) ^+ k
TaggedObject* MyClass::select_by_type()
( F" H1 p0 J. m% z{
& G6 h: C* i' p3 ]( k3 Q4 mNXString message("Select an object by type:");
; P. M5 u9 m' s6 }5 HNXString title("Select object"); E: |8 L$ ^0 l {" K, |
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;
6 I5 @; O- w( t5 A3 U# @& Fbool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.+ e7 r2 r/ } o" i) W+ D1 W
// Uncomment or combine the desired types! X h I: E& u, i" D+ c9 ^
std::vector<Selection::SelectionType> typeArray(1);
) @* k3 x* S2 E! I6 M4 JtypeArray[0] = Selection::SelectionTypeAll;
0 Z0 b) ^) J4 a; l3 f4 S$ h0 k, `/*) t) A9 ?) B( B9 D, B
typeArray[0] = Selection::SelectionTypeFeatures;* t7 p* L' Y: S7 U; R
typeArray[0] = Selection::SelectionTypeCurves;' c* C* q0 E' g4 e/ R, ^* n3 Z
typeArray[0] = Selection::SelectionTypeFaces;% k5 T4 _# l( S$ n- t
typeArray[0] = Selection::SelectionTypeEdges;
: C, W4 n, z y1 T$ _typeArray[0] = Selection::SelectionTypeCurvesAndEdges;
( B$ D! h# U) Q0 x*/
( e7 J7 [6 A' m5 i# s+ RPoint3d cursor;
8 @+ C2 Q1 {) h; K( OTaggedObject *object; // Select objects using filter defined by type array
- |* x0 u! m% W/ l+ X+ BSelection::Response res = selmgr->SelectTaggedObject(6 f3 E3 F5 e( t8 [, i- s& b2 L
message, title, scope, keep_highlighted, , f n& T' O8 Z& v' ]+ t
typeArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )1 V; h' @5 R4 n- v+ H. \
{
! H3 {! s# Z& G8 K) g: I return object;
' b& C1 _% |1 o4 l' m9 K}
" h1 [. G, c {return 0;
# b) Z D- q+ u- t1 h& K}//------------------------------------------------------------------------------
, Y0 y) ~4 h' Q z' ~7 G. ?// Selection any objects
( L2 B& H/ `! c9 ?//------------------------------------------------------------------------------
0 c6 F$ w* j# b( y6 k5 x1 S! `std::vector< NXOpen::TaggedObject * > MyClass::select_any_objects()/ ^# Q# L: p. ]) z
{2 S4 a2 ^0 d0 d5 U+ t6 w
NXString message("Select any objects:");
- g m7 N& [, b e S( G4 FNXString title("Select objects");2 z3 L$ z" Z0 e% Y0 K( a
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;
3 j5 s3 R# Y4 {# ]) i9 N1 f2 ?bool include_features = 0;
( B' }: s" [& O9 ubool keep_highlighted = 0;
3 f+ n( a2 g/ r, I! n) P M) Wstd::vector< NXOpen::TaggedObject * > objectArray; // Select any object array
6 i. d+ B/ x0 K' T3 @. p$ tSelection::Response res = selmgr->SelectTaggedObjects(% U" e- [. G- W/ q3 H; j9 e4 N! g
message, title, scope, include_features,
' _; W4 f2 _( B4 f keep_highlighted, objectArray ); return objectArray;
2 M3 N+ @# {( b) b3 ~* q}: ^9 X0 z0 z& f1 J1 n
7 e N( x: w5 Q4 P
' p/ H- P) T& L6 Y+ B! t L H: R3 d4 x7 p1 x- E
|
|