|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
选择方式包括通过mask过滤,通过type选择,或者通过选择所有的对象。
7 Y5 i) u0 ^) M; x1 W
0 b B7 ?1 [" i5 V7 i0 I3 I/------------------------------------------------------------------------------( Y( C+ Z1 r7 T3 \1 Z0 U4 s9 i' f
// Selection with mask, H- H" W$ H& Q: V5 n' R
//------------------------------------------------------------------------------
0 ]$ v: \/ q$ ?" \& [TaggedObject* MyClass::select_by_mask()1 o9 ~6 K& R8 S# t% w
{7 t4 m7 |2 s- F
NXString message("Select an object by mask:");4 u y8 ?, {! d5 _
NXString title("Select object");9 n' C! i6 k0 y. f
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;5 I. v( }* W, y2 s- z- Z3 c$ [
Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;/ T5 Z) ?7 W7 E4 {
bool include_features = 0;
* T% i- Z2 ?; nbool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
$ N) R, B* E( F, I4 Q$ b& s+ x// Uncomment or combine the desired mask triples& Y0 C; A8 S; O5 y1 a- i& Q, E7 Q
std::vector<Selection::MaskTriple> maskArray(1);, K D. s; k' A
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype, 0 ); // Bodies
; Y; t. T9 n1 r2 ]/*
/ S+ V6 z! ~% l& S0 I$ q4 imaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE); // Faces4 z* M* ~# B% L4 Z* S( }
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE); // Edges0 S& H. |: ?1 Y6 H! u0 Q
maskArray[0] = Selection::MaskTriple( UF_component_type, 0, 0 ); // Components
V" ~- W/ U3 @ ?0 b: E2 AmaskArray[0] = Selection::MaskTriple( UF_line_type, 0, 0 ); // Lines
& j5 t% E9 [+ V" mmaskArray[0] = Selection::MaskTriple( UF_drafting_entity_type, 0, 0 ); // Drafting objects2 A5 J! Q& W+ n, o
*/
X3 x: K/ q6 @$ {, m6 IPoint3d cursor;5 C! r/ E1 |# k. |; b" N+ E& \0 r
TaggedObject *object; // Select objects using filter defined by maskArray triples a8 M. R7 C. \1 x4 p" j
Selection::Response res = selmgr->SelectTaggedObject(
- {" Z$ k4 d! k7 Y( ^ message, title, scope, action, include_features,* j/ b/ Z5 Q$ u6 T( i
keep_highlighted, maskArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected ): `8 D3 \. a% h X
{/ l4 l7 P" k% S; W; f8 a* G6 y
return object;
O1 E* E, D+ J) E) W5 h}4 L n' U7 Q& r. X# d- f
return 0;: h4 F/ e, z: q% M0 h
}//------------------------------------------------------------------------------) k5 w6 |, o: j. D
// Selection with type array2 [9 L5 w# X& m8 m3 t1 [4 K
//------------------------------------------------------------------------------
( C2 J! g6 S& ATaggedObject* MyClass::select_by_type()* [. n' p5 \; k+ ~. i
{
* N9 r' n+ e- D9 j6 s" CNXString message("Select an object by type:");
; }" z! A7 x: `! ~( XNXString title("Select object");6 t+ a$ P7 b0 t* w
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;$ {+ t5 j8 }2 b
bool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h. Q1 V+ M2 y+ N
// Uncomment or combine the desired types
' M9 M: n; |2 z) i( zstd::vector<Selection::SelectionType> typeArray(1);
, e- @1 q: h- N' B7 g4 u9 AtypeArray[0] = Selection::SelectionTypeAll;
! [6 M. B8 _$ l! L/*
7 F% |( H; d" l& f; ftypeArray[0] = Selection::SelectionTypeFeatures;
8 N& L; b6 e& S3 ytypeArray[0] = Selection::SelectionTypeCurves;8 h8 D6 s' `% Y0 r
typeArray[0] = Selection::SelectionTypeFaces;
9 s1 ~: I4 d$ ntypeArray[0] = Selection::SelectionTypeEdges;
9 W& D1 ?/ }+ p: ^% ]9 @+ qtypeArray[0] = Selection::SelectionTypeCurvesAndEdges;
( G( D, L- b$ \7 J& t2 g0 Y& p" T8 D*/+ E C% g4 g9 P* w- o
Point3d cursor;
. z+ f4 l2 e9 i4 m( Z+ r- K8 iTaggedObject *object; // Select objects using filter defined by type array
( H. i* z0 `6 J3 V4 \& eSelection::Response res = selmgr->SelectTaggedObject(" s q& b( r) y) w
message, title, scope, keep_highlighted,
0 j$ V% p1 ]: I& G typeArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )
" x0 N6 | I9 D" l5 P& D- d0 X# x{( S- }/ S: \1 P: K
return object;
) m, D6 M5 y0 q1 w5 w! O8 O4 i}
! t" m, ]. Y7 x& H' V/ n7 F9 {4 breturn 0;
2 T; |8 M2 ^! j' c}//------------------------------------------------------------------------------
- {' j, l& G( m3 ]; z* }+ Y. H// Selection any objects8 E+ c; ~( X1 A( D- c0 F& t
//------------------------------------------------------------------------------5 z3 ~/ ]0 W8 R$ L7 A8 y
std::vector< NXOpen::TaggedObject * > MyClass::select_any_objects()1 |. M+ S- {. D
{
+ D/ x( H/ H6 j* C* r. E: ENXString message("Select any objects:");
( e, a9 B- c6 O0 e& K ONXString title("Select objects");$ A% J; f+ l, E$ ?
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;; I5 i) @) t4 Z* z
bool include_features = 0;
9 `; Q% ?9 b& @' g/ {bool keep_highlighted = 0;5 [$ w/ V5 H7 _
std::vector< NXOpen::TaggedObject * > objectArray; // Select any object array( l- P; d/ V3 D7 j9 h5 s6 \
Selection::Response res = selmgr->SelectTaggedObjects(* v3 k9 |1 A" U6 K1 Z* q8 R$ F/ ]9 L
message, title, scope, include_features,
a+ `& ~) F; Q0 A keep_highlighted, objectArray ); return objectArray;
; `: K/ H$ k" ^0 A" \% v. l# T}5 S$ F2 O8 u- i
) n; x ^3 [3 e8 ?4 b; B4 {5 n% ^. j" b
9 g" d& \& q' @+ j) _ R; I x) a( Q; E' D* o3 Q. Z, _1 P
|
|