|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
9 ]5 n5 W5 v3 X5 ?9 d
NX二次开发源码分享:用ufun函数选择一个装配组件
) |+ p, y9 m9 n
* f0 N& H8 O; B( [* j3 lstatic int mask_for_components(UF_UI_selection_p_t select, void *type)
8 M3 \, V* H; d, K z{1 o; v2 x, p, D6 o) B% b& B
UF_UI_mask_t2 Y3 E/ K. z3 C3 |# e) J1 V4 k: S' b
mask = { UF_component_type, 0, 0 };$ x8 k- ]# q3 F1 V; h# j0 P! W6 Q- l7 _
6 Y( D3 w2 l2 c: g if (!UF_CALL(UF_UI_set_sel_mask(select,* a* P8 Y( Q3 D) c
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC, 1, &mask)))* o- P6 q+ S) X7 M7 i
return (UF_UI_SEL_SUCCESS);
, r, i8 J* c! M else
/ _- ~& I* e* F1 y! E return (UF_UI_SEL_FAILURE);
1 P! ~" V! Z4 g/ i' d, o}
/ A# R& N! r- |8 j7 h$ c0 V9 Q ]6 D1 ` m
static tag_t select_a_component(char *prompt)/ K5 o0 [6 z, h8 I. P7 }5 S
{
5 `2 P- }. @3 N& N7 J. t int7 |7 A6 T* s/ ?% K# u% N. ?
resp;
; h O' f1 s3 X5 W double
. q- q& C# u5 ? cp[3];+ H- V0 Y/ K# p2 V6 S
tag_t! E; p% G0 l9 G- w" j, A
object,) N2 i4 ~* v* n3 B q# D
view; d. p; {9 p1 X
9 f3 u( X1 b9 ~
UF_CALL(UF_UI_select_with_single_dialog("Select a component", prompt,
4 X4 z. F9 s5 W0 M. j$ ?* J: }" I UF_UI_SEL_SCOPE_WORK_PART, mask_for_components, NULL, &resp,
& m$ w$ f" U4 d: G. W &object, cp, &view));
9 b* r7 g/ E& C0 y6 b8 l( m j: P- D/ w* _
if (resp == UF_UI_OBJECT_SELECTED || resp == UF_UI_OBJECT_SELECTED_BY_NAME)0 |; E. u7 `# R- z; l- m& s
{
! ^- A. Z& ?: `$ h8 Q7 b9 h: t; c UF_CALL(UF_DISP_set_highlight(object, 0));
) ^; x3 b6 H# v. B1 m% z0 a return object;( |( q* \8 r, c0 U
}
* {" |. ]- N5 \0 w else return NULL_TAG;1 ^5 a# n. h) ]
8 T0 c; K! {5 k& d7 `/ e7 ]! C}6 S. t' m2 X3 B% k8 t
0 |+ n& i1 |7 d: A! S |
|