|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
6 V' x' K* M: G B( j* F* d9 j p( q( u# e- X
NX二次开发源码分享:选择管道routing线段的方法6 c; O6 ?1 a$ ?9 C8 f
. |$ R, {2 K; I7 l' L8 G( Q
代码是C#的,主要是告诉大家masktriple的设置如下:
4 K$ r+ c# }! D- _' v+ Y& e1 O& A! {: X
b! }. p2 [9 a- @" X
mask[0].Type = 0;
( U8 B1 j& q# N% h# i qmask[0].Subtype = 0;
; X+ x! W' J1 x5 y; umask[0].SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_ROUTING_CURVE_ONLY;
% D$ r8 B' Q0 P8 g0 @ y+ D- @
[mw_shl_code=c,true] public static Selection.Response select_route_segment(string prompt, ref TaggedObject obj)
# e1 r$ s0 V c { + \. B4 U! N |- I* i P
TaggedObject selobj;
: m6 L7 C7 g$ N H+ C; T UI ui = UI.GetUI();
( F. m4 t$ {6 ]/ f Selection.MaskTriple[] mask = new Selection.MaskTriple[1];
/ a2 C: s- c6 i6 [' N { * a+ n* K ~+ @ O5 f
mask[0].Type = 0; $ C, t8 ^* M" a! f4 h
mask[0].Subtype = 0; , `; i6 G; ^. |& o1 `
mask[0].SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_ROUTING_CURVE_ONLY; 7 N( W% Q) N ]* i8 p
} % c |. t9 y3 M( t; h. j# D/ @1 h/ `1 f
Point3d cursor = default(Point3d); 5 U6 E I6 W" K+ v# B
! {) ]: K/ W5 d* h( ^% [ Selection.Response resp = ui.SelectionManager.SelectTaggedObject(prompt, prompt, Selection.SelectionScope.AnyInAssembly, Selection.SelectionAction.ClearAndEnableSpecific, false, false, mask, out selobj, out cursor); 3 H! ?: T* H- M$ a
" q; b2 o3 m% [$ D+ m% g) u if (resp == Selection.Response.ObjectSelected | resp == Selection.Response.ObjectSelectedByName)
7 d( t m8 V7 t( \' [7 A { & u4 n* y: t9 f0 @' j; Q( i: u p
obj = selobj;- A. a. ^0 D0 `( q# f
return Selection.Response.Ok; * A- p6 t( k( n+ p; }( y& F
}
, }" X* }8 Z# E* s, l3 M6 Q else
Y$ r6 Z6 L. z {
5 z4 H& ^; ^) n0 Z W return Selection.Response.Cancel; \" s9 D: k) j2 j
} ; J5 [5 N2 M6 t: X# q
} [/mw_shl_code]
+ [7 X* _' k& Y |
|