|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
选择方式包括通过mask过滤,通过type选择,或者通过选择所有的对象。/ a) ~( [" E. N
b2 r& i% f. y- b/------------------------------------------------------------------------------: P) S& e7 U3 d8 O. f
// Selection with mask3 A& q3 K0 l1 T2 ?- Z" m
//------------------------------------------------------------------------------ W( O% D7 r. Y) y
TaggedObject* MyClass::select_by_mask()) @% _8 C7 e4 S4 M
{
* r, o! E8 ~6 qNXString message("Select an object by mask:");
+ N Z* h8 V' i# K' ~3 QNXString title("Select object");
" V3 s, w* k/ XSelection::SelectionScope scope = Selection::SelectionScopeUseDefault;
- |& X4 Y( m3 B# I5 FSelection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;
* [$ Q0 k, h0 _" jbool include_features = 0;0 ^$ `6 P' v/ i) O* z) N8 q
bool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
9 j- ]" N6 B: z' Q# q; c. X// Uncomment or combine the desired mask triples
0 C) o0 J5 T' Q6 ostd::vector<Selection::MaskTriple> maskArray(1);
% b9 d1 q* `' xmaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype, 0 ); // Bodies
8 A# V6 B4 ~" L6 y. U4 P/*3 r+ ?2 s ^* w
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE); // Faces! F" Q3 B1 F5 c: @9 E8 T
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE); // Edges" R, e0 k) R4 f& f8 Q3 |, f* {
maskArray[0] = Selection::MaskTriple( UF_component_type, 0, 0 ); // Components
2 |& i! g# I& G ]* h' b: {5 U7 xmaskArray[0] = Selection::MaskTriple( UF_line_type, 0, 0 ); // Lines
" E& K- N3 x$ XmaskArray[0] = Selection::MaskTriple( UF_drafting_entity_type, 0, 0 ); // Drafting objects" [8 w& N( R O) f# y
*/! b$ U5 a2 V; d Y
Point3d cursor;; J. P B' ?# i) M
TaggedObject *object; // Select objects using filter defined by maskArray triples8 z8 W; n; }, X/ \- _# I
Selection::Response res = selmgr->SelectTaggedObject(; w2 [7 `5 A' `$ p& f& p- H7 Y' Q! s/ A
message, title, scope, action, include_features,
, B) c" s; C/ b5 K! P keep_highlighted, maskArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )+ A2 n9 X$ D' b" P) U& O
{* A0 G9 y' ~" N6 s' N
return object;
9 r p3 f4 H" E5 X% Z; P( U}
7 b3 G0 F' E/ T7 N% areturn 0;
6 Y' J, ]$ a9 M; N' r7 f3 s* `}//------------------------------------------------------------------------------& p' @ D& L- B4 S& r! B6 C
// Selection with type array& H% n- W1 D" y" p) A/ s
//------------------------------------------------------------------------------ }0 o0 q7 ^0 R; \/ ~0 [. z% i
TaggedObject* MyClass::select_by_type()
; X$ _ O6 M. H! M* |, H4 ^9 Y' P$ N+ a. b{
6 G7 d/ b/ ]4 y8 p$ { C) Z2 l* u7 FNXString message("Select an object by type:");
" @1 j- R) D9 v; Y1 F, MNXString title("Select object");2 _' m" w$ U, ~
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;+ x; K/ v- g6 w# Q0 t, c
bool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.0 J& R* K6 R3 C- E# k4 K
// Uncomment or combine the desired types
+ Y3 K6 F' Y7 E% R7 [std::vector<Selection::SelectionType> typeArray(1);
2 I% r: w8 W& l! `. f9 c7 ~typeArray[0] = Selection::SelectionTypeAll;
& I7 s& m, `/ U% p j/*+ K# a' }& }+ A @- M
typeArray[0] = Selection::SelectionTypeFeatures;6 B) \; C% j; i2 c6 M& U
typeArray[0] = Selection::SelectionTypeCurves;8 f- s0 }: P) }) M; Z, Y2 b" T2 T
typeArray[0] = Selection::SelectionTypeFaces;
+ w& C( K% n! N" r( XtypeArray[0] = Selection::SelectionTypeEdges;
4 ~7 W1 d; i$ u' i$ W, rtypeArray[0] = Selection::SelectionTypeCurvesAndEdges;+ u9 A7 O' g {1 E1 m8 ]
*/
0 P7 s; |! r4 \3 n yPoint3d cursor;
( B0 [: F$ o) u$ t1 FTaggedObject *object; // Select objects using filter defined by type array- g `& M* F7 k4 k
Selection::Response res = selmgr->SelectTaggedObject(
5 w. v% R' W2 V% | message, title, scope, keep_highlighted, ( A6 g( ?- b8 Q1 T# t9 x) U
typeArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )
) s u+ L7 E8 k{ _5 J0 I: C9 E8 T
return object;4 X8 T% k/ z! p- e
}% Z! W9 Y5 | p" S1 q( O
return 0;
. N% ^% a' b$ A! r2 E9 C& V# b}//------------------------------------------------------------------------------8 Y) s. R( X6 F3 V
// Selection any objects2 C# b- N5 \/ t* L% e" T$ {2 f
//------------------------------------------------------------------------------8 n0 E5 ?4 H- {* e, |1 o( ], N, A
std::vector< NXOpen::TaggedObject * > MyClass::select_any_objects()
5 F5 {* e, O: f+ V! V{
3 S( e, r- A: U. qNXString message("Select any objects:");
4 Z8 q& A: u$ g& h+ t6 {5 K0 wNXString title("Select objects");
k* q( K0 e9 b8 a* a) G2 hSelection::SelectionScope scope = Selection::SelectionScopeUseDefault;
+ d- |9 c* O% S9 zbool include_features = 0;
5 a" L% M5 M7 J* l) j6 ]3 c6 u" j+ k' E* Tbool keep_highlighted = 0;
) Z2 |+ P( d7 B* |8 C sstd::vector< NXOpen::TaggedObject * > objectArray; // Select any object array- a, t: I& ~+ p- n* ?( b. |5 ]
Selection::Response res = selmgr->SelectTaggedObjects(7 l4 k9 p0 d1 s: z6 ]
message, title, scope, include_features, ' w) n" D( v9 d( H0 S: s3 a: g6 ]
keep_highlighted, objectArray ); return objectArray;% J& J. G8 Z* X, j
}- `7 X& I- ^# g' U$ F
h' K6 h$ W5 O3 n# [! P( K% y: M5 u; N1 G
8 y, n) B* q8 _1 M0 c" i9 D& t |
|