|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
选择方式包括通过mask过滤,通过type选择,或者通过选择所有的对象。
e2 [" r! G( f' X
& S3 k q/ n9 P: } `) `- P7 g/------------------------------------------------------------------------------
: ~( e# Z2 b, j* M! c% P0 r; P// Selection with mask
0 F4 l* A8 v$ i1 A1 c. i9 @: }) K//------------------------------------------------------------------------------
# t. I# a( P! |& M e( v2 F" iTaggedObject* MyClass::select_by_mask(); r0 ]$ t/ N I! O4 |- [9 k
{
) L$ b2 O B9 |6 B( ?* _NXString message("Select an object by mask:");1 ~" d, `& n/ A
NXString title("Select object");
" [( w- w1 \! x2 H7 p# I0 U2 z3 M1 L1 WSelection::SelectionScope scope = Selection::SelectionScopeUseDefault;
7 j* F) Q* K( z6 t+ T) VSelection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;
) j. ]. k2 V% k+ xbool include_features = 0;
9 O, x9 y- I. K: o! ~bool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h. N+ A6 k; y6 J
// Uncomment or combine the desired mask triples0 u, L) L2 x: s* r
std::vector<Selection::MaskTriple> maskArray(1);
, [ Q% C4 a2 ?maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype, 0 ); // Bodies
. k2 O* [ i7 v; D1 x! W% M# \+ g/*
, H4 v3 Q; e8 p: O( K1 RmaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE); // Faces
% ~8 a" h. O/ o, d( @maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE); // Edges! w! ~% u+ C: d3 V9 P+ p4 P
maskArray[0] = Selection::MaskTriple( UF_component_type, 0, 0 ); // Components
5 ^$ T/ M1 Q& ~+ R9 BmaskArray[0] = Selection::MaskTriple( UF_line_type, 0, 0 ); // Lines
* F% H4 o7 M& [- o: EmaskArray[0] = Selection::MaskTriple( UF_drafting_entity_type, 0, 0 ); // Drafting objects* o2 |; q) ], X4 j
*/
6 k. v/ j5 k, y m* C; @5 u. P# VPoint3d cursor;. h7 b# h% l7 y
TaggedObject *object; // Select objects using filter defined by maskArray triples
+ B0 F: z$ V3 Y$ Z# WSelection::Response res = selmgr->SelectTaggedObject(
( X( u, U2 p% R0 u! ` message, title, scope, action, include_features,
7 x: s$ \' t3 {3 C( S keep_highlighted, maskArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )
9 f2 l0 A8 U% m+ e8 Y6 {8 i{. J" M5 n9 T) e% `6 b {
return object;
$ l0 e8 N5 A/ a- F! o# \5 I: x9 N$ O}
" T' U1 i/ E; d! ~; zreturn 0;0 z; P {* f+ o) a9 v/ }
}//------------------------------------------------------------------------------- W1 C4 p6 |0 u
// Selection with type array
) s- F$ B# [% ^8 |2 v( r//------------------------------------------------------------------------------
; q( o1 N- g, v& JTaggedObject* MyClass::select_by_type()" c8 w, `" o" M
{
6 i5 [# U& }8 f5 lNXString message("Select an object by type:");
: U% e1 f+ o( W1 x4 U9 |2 cNXString title("Select object");8 M0 w& c! r1 r$ K, Y
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;
* L0 F4 a4 j. K' \. e; gbool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.; [6 W$ C& X2 I; V( j& }' B
// Uncomment or combine the desired types$ [% N1 O8 ^) g9 t" S4 U) _
std::vector<Selection::SelectionType> typeArray(1);
7 j& { l* d x' c4 NtypeArray[0] = Selection::SelectionTypeAll;
/ ?3 o! B9 n3 V3 w$ W# `8 y- V& Q/*4 O* r8 O4 I& `* h$ K
typeArray[0] = Selection::SelectionTypeFeatures;" p* O5 O$ V2 I
typeArray[0] = Selection::SelectionTypeCurves;2 ]: |" G7 X& X: q
typeArray[0] = Selection::SelectionTypeFaces;
' m, s2 }7 B/ gtypeArray[0] = Selection::SelectionTypeEdges;; K4 f7 o6 R( j: p
typeArray[0] = Selection::SelectionTypeCurvesAndEdges;
9 ~& G# t3 a. k! B; V, a6 z*/' o. I/ _! M+ q& ^& t8 V/ S
Point3d cursor;$ `! ?) F6 F7 G
TaggedObject *object; // Select objects using filter defined by type array2 y, p4 L& ?* N2 G8 S) t/ e
Selection::Response res = selmgr->SelectTaggedObject(
& j; t' ^7 i+ l$ Y5 A8 { message, title, scope, keep_highlighted,
- f7 c6 K7 s3 ]* |( F0 p typeArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )
7 h- ?' I h, `7 B: I6 t{4 e+ C6 Q2 _ v/ _+ J: B2 c* N' C' {
return object;
: S7 T" q# D+ Z# h7 L0 O}
! r% h7 u6 ~# areturn 0;
' @1 b6 r6 [2 K}//------------------------------------------------------------------------------
% S0 j0 d1 O, }9 @// Selection any objects
) u, j$ D; P' P7 O; O' e//------------------------------------------------------------------------------
1 h4 F+ p8 o3 g& P9 P* J/ pstd::vector< NXOpen::TaggedObject * > MyClass::select_any_objects()
8 x G! u4 e3 U3 c4 T% i{+ C$ i+ ^% l8 O1 ]" ]
NXString message("Select any objects:");
/ J2 E8 t( T* O) m( o+ ]+ |, {5 wNXString title("Select objects");
0 d h3 y/ o3 H0 y; Q0 I pSelection::SelectionScope scope = Selection::SelectionScopeUseDefault;) @3 K7 ~4 T1 @* d$ Y0 h
bool include_features = 0;
0 Q, V: K4 N h# _" H4 F3 ^bool keep_highlighted = 0;" ^! x/ `, G1 y( A5 w
std::vector< NXOpen::TaggedObject * > objectArray; // Select any object array. ]+ j6 j6 s$ X+ Y% [# a
Selection::Response res = selmgr->SelectTaggedObjects(
# A/ j+ L7 ]$ u( @/ f. T message, title, scope, include_features,
9 K2 {; S$ z8 a- t- a keep_highlighted, objectArray ); return objectArray;
* F U8 {* B& f$ v* m}" M% g. R# x, A5 I2 e5 a( F
! u$ x' B2 r) r D0 f: N/ G0 T2 L; y& e! u- G2 i7 l' R1 o+ i
G$ L! R1 w( t, W |
|