|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
选择方式包括通过mask过滤,通过type选择,或者通过选择所有的对象。
, w6 n! u7 s) ^% |! }6 r8 [3 J/ D6 \+ A5 U( P
/------------------------------------------------------------------------------1 W( [, r, q& H) X! n0 L
// Selection with mask
. B3 K/ L) N: U" ?; V1 N//------------------------------------------------------------------------------" f& {& v+ Y( N0 y, F* K
TaggedObject* MyClass::select_by_mask()0 t9 H! p: ?4 ]2 `2 i1 m z1 Y
{
5 U e/ c4 s B3 y+ t* ?NXString message("Select an object by mask:");
8 M$ l7 @+ {7 ^2 f* y6 s2 [6 aNXString title("Select object");& A! r! ^! @! \! X0 x9 c
Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;( v: t8 R5 R6 x1 T4 C
Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;
) ]2 }' w& e7 k7 \bool include_features = 0;
. @/ G+ F. {# n2 R- A% f5 Bbool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.
6 {. b8 p& m' \( A// Uncomment or combine the desired mask triples* ~2 [2 A' B3 ]8 S
std::vector<Selection::MaskTriple> maskArray(1);% Y3 @2 \# b+ j! C
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_solid_body_subtype, 0 ); // Bodies
/ H9 p0 J0 ?# x# J) N0 g! O! i/*4 K9 F; C' _: }6 y! Y) h/ Q' f
maskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_FACE); // Faces
5 Q% w1 Y6 Z6 ], pmaskArray[0] = Selection::MaskTriple( UF_solid_type, UF_all_subtype, UF_UI_SEL_FEATURE_ANY_EDGE); // Edges9 t0 I6 \$ K0 N5 ^+ P z
maskArray[0] = Selection::MaskTriple( UF_component_type, 0, 0 ); // Components+ ]% i4 F9 V' ?) ]1 O+ i
maskArray[0] = Selection::MaskTriple( UF_line_type, 0, 0 ); // Lines7 |- `% A9 h1 |
maskArray[0] = Selection::MaskTriple( UF_drafting_entity_type, 0, 0 ); // Drafting objects7 ]; D$ h& A h! D, [
*/
* n `4 a6 O' u2 {' p5 D* yPoint3d cursor;; V! ]. Z9 w7 l0 n
TaggedObject *object; // Select objects using filter defined by maskArray triples
. ^5 K+ r+ H# L6 bSelection::Response res = selmgr->SelectTaggedObject(
/ Q% x! h0 C4 y& T1 U7 u message, title, scope, action, include_features,: t% \1 u6 M' {/ A2 L5 a; O; J' k) t
keep_highlighted, maskArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )( F( P2 L* B/ J) U$ y/ H2 @
{3 f2 W' J3 J* V" M5 h* m8 Y
return object;
0 ^: L* @* l/ m7 G! o; |0 M0 L}
$ s) Q) j x" ~return 0;) z4 _- ^" i3 |
}//------------------------------------------------------------------------------
: o3 n" s( [8 K* ~3 z// Selection with type array
2 x; Z5 k. E' P/ K$ _//------------------------------------------------------------------------------% k! R& N+ f) |
TaggedObject* MyClass::select_by_type()' P" w( h$ f6 M$ D
{
$ t" g; Q2 `5 u- {0 M" u- @5 XNXString message("Select an object by type:");' E; O9 q6 [8 Z# b s% V
NXString title("Select object");
8 R2 e! q4 N" s z3 @Selection::SelectionScope scope = Selection::SelectionScopeUseDefault;
1 _1 ]% o' j! S( }- ~bool keep_highlighted = 0; // Define the mask triple(s), see also uf_object_types.h.; x D5 K" L- _
// Uncomment or combine the desired types+ _9 |6 z( X" ^% h' W1 B
std::vector<Selection::SelectionType> typeArray(1);
. k I, g) y5 U, w( O+ Q% StypeArray[0] = Selection::SelectionTypeAll;
9 N X) o6 b; V C7 l/*/ `; w" O2 s. O
typeArray[0] = Selection::SelectionTypeFeatures;0 N; W9 E, N% a% L" S. w
typeArray[0] = Selection::SelectionTypeCurves;
& z' E* s3 c& ?& q% OtypeArray[0] = Selection::SelectionTypeFaces;
( |% Z. x" H6 B% T" r1 ]4 xtypeArray[0] = Selection::SelectionTypeEdges;- @8 P. S+ n. A% O) ~$ F5 [7 T3 z
typeArray[0] = Selection::SelectionTypeCurvesAndEdges;
! a$ p4 O4 y, S8 \9 Y*/
! e0 \7 K+ b' Y/ h/ ^8 m+ uPoint3d cursor;% {, p" S4 | @% } p6 A; `
TaggedObject *object; // Select objects using filter defined by type array" |+ i0 A, r& q7 k
Selection::Response res = selmgr->SelectTaggedObject(
3 T" p) k% c5 a3 w8 `. B( C message, title, scope, keep_highlighted, 5 N O" _, Q& H) h0 g
typeArray, &object, &cursor ); if( res == Selection::ResponseObjectSelected )
. C8 \6 y& `( F, B; x; ? {{
' I4 O1 L0 Q* m& N& \1 s return object;
9 P/ F! L4 [7 Q; o! w}3 \2 F3 g! e& H8 H1 P
return 0;
; w8 {1 r" I, V1 q}//------------------------------------------------------------------------------( U& k) x+ L1 ? A
// Selection any objects# e, G- z: |& [, y, H
//------------------------------------------------------------------------------
. z1 G+ M/ U' t- D5 ?' ?std::vector< NXOpen::TaggedObject * > MyClass::select_any_objects()
% }% V, o1 r" E9 ?{0 E% t; Q( \/ u5 \% t
NXString message("Select any objects:");
^- c) z) Z: s+ q8 YNXString title("Select objects");
M5 q% y: g+ ?5 u, aSelection::SelectionScope scope = Selection::SelectionScopeUseDefault;
9 F; Y# M: D# V: l7 S# L6 T) dbool include_features = 0;
; a3 g1 v8 n8 {3 ebool keep_highlighted = 0;' Q) ^% c' v. U
std::vector< NXOpen::TaggedObject * > objectArray; // Select any object array
. f. p: z2 @- U4 r# V9 ] E/ WSelection::Response res = selmgr->SelectTaggedObjects(
+ P) H5 O* S& f$ w8 h( V message, title, scope, include_features, ; y5 b, O; L2 m' h# _
keep_highlighted, objectArray ); return objectArray;- U6 |! M0 d( P+ l
}
$ a* ~$ r' o7 v: V
, n7 Q) R, E# r d& c' s
7 U; X( A+ P4 K0 p- L5 V3 U" z$ z( ^ m
|
|