|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 ; K* c/ a$ d: M2 `
$ x9 T7 ~/ t9 A. Z/ K2 A( c6 n
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
0 ?. }2 y& l Y" S! _! ~& n& q# B8 r代码如下:) }) L% \; w) A) O' P% c
#include "Shrinkage.hpp"
) w* C1 _' B, v$ T4 kusing namespace NXOpen;
1 ^1 e3 J9 [% W. q" \; ?( Eusing namespace NXOpen::BlockStyler;
4 V( |$ F1 p9 {4 j9 k/ K" r5 `- w5 u1 @+ O) V
Session *(Shrinkage::theSession) = NULL;0 c L0 `" x5 [5 g0 X. {8 |9 K
UI *(Shrinkage::theUI) = NULL;+ W& Y5 j8 e. N3 c3 m
: {( j9 Y- Y1 E/ [5 O
Shrinkage *theShrinkage;+ _3 d. m/ b r& X5 e7 T
- w: g: `1 f3 y4 h
Shrinkage::Shrinkage()
; f/ _2 ^7 W+ \' c z; V2 n) k& y{ J! U- K, P& V/ B" T
try
3 t* G- j: c# ?( j9 N {& M, T9 k9 M: o5 u; n. E3 O
// Initialize the NX Open C++ API environment
2 h+ a& K4 t/ h, u Shrinkage::theSession = NXOpen::Session::GetSession();: O7 A1 w6 Q+ L8 [# }
Shrinkage::theUI = UI::GetUI();9 g$ C c" b. z# y/ a- R
theDialogName = "Shrinkage.dlx";
1 M4 T: V% {$ ^; W G$ s: w theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
6 t# Z. J: M4 R5 Q3 O( j* N // Registration of callback functions5 D7 J7 v1 m6 t5 Y
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));. W7 x' w+ B+ k2 h( q
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));1 t$ i0 N2 T( ^- |) }
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));4 k, }: C1 ^4 C8 @
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
" N: i2 ^8 x8 ~- J7 ` theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));% v6 V& v; m2 G; i+ R# e/ a1 m# u
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
4 }5 k- B8 U( \( d theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));$ M3 {- ]) b& ]* D6 [$ V
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
* j# @. O4 e4 I6 i, v, B1 W }
3 l$ G. Y* M' Z! h5 Z% v& x- P) X C caTCh(exception& ex)0 G. ^) ~) [8 E% ]
{
7 [- X+ ?- s+ z/ x0 a
( Y: Q' b$ J8 |3 O8 _9 ?& V4 H( K3 t throw;$ E/ G* ]4 {9 m4 {
}
) L* j; {! m4 U& t' R) Q2 A9 y}
. @3 I: }- {) v0 N: X( A* b/ y) @1 Y' ^" f1 @
Shrinkage::~Shrinkage()
' j1 b# V; M) \0 k2 ]{+ t) T+ e+ F7 N g# L/ ]/ m2 R* z
if (theDialog != NULL)9 W! @- G7 ~. V5 b: d. M
{$ e4 j. m! c+ l) r7 r
delete theDialog;
' J' W7 ^4 s o$ Z. C theDialog = NULL;& q* ]& R0 I: M8 ]( r" \
}- |1 r# |) b; O0 q
}
! G5 [0 A b- ?- L( B# y) S! E/ `, l+ y& I) I1 G
#if USER_EXIT_OR_MENU6 q- ^' }* @& a
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len). b e* |& l+ M1 Y' H. w
{0 L% M4 X+ K W3 k% P
try, w9 \ E6 W) o
{
. \( ]0 Q v; }( h theShrinkage = new Shrinkage();
3 U2 l% E# q2 ]( R+ G // The following method shows the dialog immediately! k, D B; O' q8 c& m3 d! p! w k! [
theShrinkage->Show();
0 L1 J6 d! f- [ }
) V' L' l9 `0 f7 }6 q: ^: R& K9 Q catch(exception& ex)
& k4 w; Y2 y1 a+ l6 e% Y( T2 s {
* Q8 w0 I- W3 F9 |/ Q //---- Enter your exception handling code here -----2 i4 h) x' @7 { [8 N1 x9 w
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
4 K+ K4 V( z A }- p* @* s) B4 J4 t4 D0 f9 N3 g- P
delete theShrinkage;
. q+ s% m" z1 ?! f }! _' _: o; S/ o7 @
#endif//USER_EXIT_OR_MENU
% q# N: C- i9 n#if USER_EXIT' T/ W, ?0 V0 l6 x9 w) P
4 B& @3 w; h7 @4 ?0 E+ u
//------------------------------------------------------------------------------# S! `4 [/ \ s: o
3 C V& N; j3 y( a" ]+ i9 K
// MUST NOT use this option since it will UNLOAD your NX Open application image& X- D0 _( m) a
// from the menubar.% q( [$ j" r- e
//------------------------------------------------------------------------------& J2 x; F5 C I! w! r4 m+ \
extern "C" DllExport int ufusr_ask_unload(), O) @7 c* \( Z1 T+ `# f
{( N8 w& N+ p& N/ l% K( R* e
//return (int)Session: ibraryUnloadOptionExplicitly;
' x! ?1 D; U, r& Y% A" O7 E2 z) g return (int)Session: ibraryUnloadOptionImmediately;
6 B8 `9 D/ T* y0 s //return (int)Session: ibraryUnloadOptionAtTermination;$ j3 `7 r0 C3 @+ H$ U
}
- `% f5 D# O6 N9 {2 L / |8 K8 c. I: Z' E* M( o
//------------------------------------------------------------------------------( [2 x v+ S* h- @ \. l
// This method is automatically called by NX.
. ~- A7 S9 E( C2 ?) E; @ //------------------------------------------------------------------------------6 b/ ]( n- M) o% P1 P
extern "C" DllExport void ufusr_cleanup(void)
c# Z+ A( {, a4 ? {
. o P# }1 U8 V: b5 n try4 S# f3 w/ o, }
{9 x9 ^7 F1 n i$ S8 W. ?% g
//---- Enter your callback code here -----6 R, c# d" C! P6 @; c
}$ I( }- e& |4 ~1 v
catch(exception& ex)
; F* `- ~4 Z8 b! L4 S- _ {
0 b! e- R/ O' r //---- Enter your exception handling code here -----. ~% S5 ]3 r3 @+ s
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what()); W- V2 Z3 O: L; o$ g0 C8 c+ K
}
# l* B- V( `7 R3 I- H }, o' g: ~ ^/ ~. H
#endif//USER_EXIT
( R$ Z" _/ p4 i m% p s J1 {( I. g! t. T 2 \) A2 [2 _7 o H
int Shrinkage::Show()
I5 c1 h2 M4 G% q# X. L# m- u {, i6 }# K6 F! M9 X6 N! j! @1 r! c
try
5 Y0 W4 u5 R! Q' ] {
p5 t9 B# Y% i( s( K2 C theDialog->Show();
. O r% X8 C8 ^ }8 Y* K' H6 ?+ v+ c% ^5 a2 G
catch(exception& ex)- m; k. O; \3 w! ^
{
: r- n# }; n( ^$ |, D //---- Enter your exception handling code here -----
7 A" c. a ?% Z; z Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
* \2 n: d3 Z. L+ V$ n+ { }1 }: @2 H7 w2 \0 [, |( Q1 Y
return 0;
% e3 q1 i0 k3 `) s }* T% G$ X7 i+ {6 y! T5 D+ S
5 K$ b1 \5 ~3 X* @* E/ \- g. [#if CALLBACK
H/ G4 @8 @! |) s% C1 ]. k! y' {4 U& _- a
void Shrinkage::Show_Shrinkage()
' C9 o' F' g6 X {
- Q/ U7 z* e8 [. e5 J try
' ?# g$ q& d' g1 {4 \5 U* e {
, X9 o/ Q5 f4 \/ L _7 U theShrinkage = new Shrinkage();% [! J% T" v- x8 {) l
; }2 u8 d! M& `* \2 h* g% v theShrinkage->Show();
# o! Y: G! C+ A& ?" B }# H& x3 k% T6 V
catch(exception& ex)+ M' _' [* Q+ |) N9 B( Q
{- }, ]5 ~/ A* g7 w8 b
5 A/ A3 z' w- n$ |, `$ {4 `8 h1 f Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());* q- }* v5 o$ R3 ~
}
9 C+ m4 n& i, W" j) S" m delete theShrinkage;' r7 Q, h6 s v5 X
}, J$ Q& l9 m+ s+ O4 K4 [+ H) s
#endif//CALLBACK
' f" a5 W. Q, L: t$ @ " x3 z1 m2 U C
void Shrinkage::initialize_cb()( u& }5 `, \/ V1 \
{
$ X9 i. _1 p7 s try
! K( {$ Y3 U' g2 G0 K {+ K- g6 M( \3 g3 C7 o( }9 Q
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));1 T# Z# N/ M( |
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
4 O% C) Z% q. e4 {' o$ z2 k( D face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));8 d' Z% w9 I1 V
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));4 @# V/ d' f, D& e& a
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));+ i, {* M0 L8 {" Q: U) l: h7 d, R
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
9 C! T- V- u# P4 C* N- d, E group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));7 R% m3 K( R8 Y9 d: s0 T! W0 I
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
1 X1 P. p$ H5 l. v label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));7 E3 y: r4 J6 B0 y$ f
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
8 M% x2 J& E( f# K label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
" b0 ?6 l! E- ?% h" d label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));, y8 \# A. p; X5 b
}3 t% Z/ U8 |; L0 @
catch(exception& ex)
7 V0 y1 F0 g6 \8 ] {- z; V* Y# |1 m( Q9 K% e
# T) e+ \9 j$ T" {4 G$ t5 \# C0 ^( F, C Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());9 M, b! Q# C; n. c; J, m# M8 a1 x0 q
}
! S) _3 e0 w4 g6 | }
. ]1 A& d5 f0 Z% r! S, Z //------------------------------------------------------------------------------9 w: ^1 A* n7 V$ V, L; @+ D/ [
void Shrinkage::dialogShown_cb()* @( N: q" ?& g" T; ?( G
{# E7 |) U1 c [: o+ d8 c- u8 ]
try1 n* r l1 \4 _9 N6 `0 L
{6 _+ H# |$ A; F0 G, F
//---- Enter your callback code here -----
2 I& p! u9 l) I: m }. ?+ @% d$ P' \% q+ O
catch(exception& ex)
! {: P' @: Y5 _3 @8 ~4 `4 ` {. ^4 v" j9 _1 C2 _7 _! Z
, F* k# i0 v0 a5 a9 L4 b" v- ?+ Y
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
# {. w' ~" v+ V, A" z }. U% r- h/ U& t' d) b
}, _: S; v% s2 N# |. D# C, ?
# V+ e7 v4 V( I' e# x7 x
int Shrinkage::apply_cb()/ J0 [# y& P; M. @
{
: c9 ]9 F0 `1 n. g) v9 |2 Y" D( t0 U8 Y int errorCode = 0;
4 _8 n5 X. h8 C6 ? try
- R8 O" t9 D4 i' ] {! p6 a( I" b7 K6 H8 u \' [
//---- Enter your callback code here -----1 d; x& Z. X/ T; f
}
0 W6 ~4 y( N ?( e) z& W# K catch(exception& ex)2 N- W) K0 r+ R) ~* ?5 s$ k# D
{
" n2 r$ G' U( z9 B) d$ A //---- Enter your exception handling code here -----
9 M# s: x9 K0 ]+ i errorCode = 1;1 Z: Q! e! ^, E/ E
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());6 u" R; U$ N/ |2 R' E
}
$ E) G, P+ \% [0 h+ Q5 \ return errorCode;) ?5 P2 q; _8 M! {) v0 v0 A
}
0 M* B: w* }" v4 v7 d4 ^4 S" l1 o+ Q3 s
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)! P4 W# R3 L! H
{
7 [$ }' D5 Y/ e) g+ x1 |: T try) v2 j+ f1 a8 e: ^$ [7 H' w: ], V
{
r/ a$ P" [2 \3 w W; r if(block == face_select0)% y$ H) Y' j3 ]
{
1 Z- ]- L+ P j% A0 c //---------Enter your code here-----------
" J& t8 N" o7 K1 ^ }6 t( L. O1 D( O5 [ q% W
else if(block == face_select01)
4 e$ j G5 G6 d! U' s7 y {
4 L4 T" B- X* r% m ]$ w2 Q //---------Enter your code here-----------+ v; u9 h S! W
}
5 K, r! U, j, O) M8 `0 \ else if(block == bodySelect0)7 b. Z) f8 W$ b* F* `3 a9 e
{
: \, c7 }; f+ Z+ O //---------Enter your code here-----------
" ^9 s& e5 g U3 v& f' n: V" D [ }/ g! h; q3 b9 t' Z
else if(block == bodySelect01)
7 c: ?/ }/ p9 w5 X: Y {/ D' E! ?9 l. o7 K$ Y
//---------Enter your code here-----------2 o H8 k8 G. t; d3 z
}
7 b$ D7 e/ ?& X" X7 b" S/ v2 H else if(block == string0)* ]- P) n5 s5 s9 i
{ J( k; j! W; f. U" l
//---------Enter your code here-----------9 w. x! k8 h4 D, p
}6 P. Z. _3 B8 d6 @0 w" N: \
else if(block == label0)
+ p0 L% j3 P3 n! G( @5 ~ {
3 U) R, Q* w2 E //---------Enter your code here-----------( \1 U; b: p8 w7 }) k" I! g, G
}
9 H7 Q& U" D* G( ?, Z else if(block == string01)2 q0 ]) |- R2 V' q; J3 Y3 T ~
{$ _/ V, n" m& {" m' B
//---------Enter your code here-----------
" s6 ?) l) X2 c2 D& w }+ ?, Y& x8 F' T! R/ V4 Y
else if(block == label01)$ S- H7 b- E, w/ n* |
{
: I# T x) n" A/ s% a7 C8 G //---------Enter your code here-----------8 X V' b, e+ T5 U
}, ?% U! r [; R4 I3 Z$ g9 _
else if(block == label02)
' o* |4 d# O" G1 s {
9 C6 Y$ J/ j7 g& S2 F9 l //---------Enter your code here-----------
$ a$ R N8 x2 R" n1 ?0 t/ S }2 L9 |. R8 T! ^& W4 [& N3 X
}
- T7 m# B7 K, U* j6 b+ ~+ T! D8 U! ? catch(exception& ex)3 V* h% y, f- f
{
+ b. F+ |' p* v: t Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
& U$ n3 s5 i3 E- f } E& k" Z* k A- \7 ~0 m* |- Q
return 0;
0 e- H# q1 x9 L5 d* }7 B# Q } Q8 i& x) C( h3 n% x' S/ x9 k
& ]) b$ {+ u3 I _1 x int Shrinkage: k_cb()
8 m, n1 U. u( f1 q9 T5 ~" W' v {
/ p' V, M- a% h1 y4 D$ [% Q2 f+ G int errorCode = 0;! S; ~$ H- s- N1 |7 p) f# x& |
try
3 Y; T9 }. f& _ {
0 q' I/ U$ A- a. K# p errorCode = apply_cb();6 D0 ?; ^% u% ]0 Q+ _; g
}
, V, N: d5 S; B: ^: E/ q5 ^# S- H catch(exception& ex). T: P2 t, ?# V! }
{/ Q0 S" ?- I- I
//---- Enter your exception handling code here -----$ A. f7 n1 a. A
errorCode = 1;2 s4 u9 I- C* y# R
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());0 k5 r0 t" F- I9 v! E9 X: S
}
! i8 R0 l6 S1 Y1 ? return errorCode;
% W( r- D8 L1 l7 c- e! l. P4 K }
5 k0 R2 `# Q `. a" W; D' c8 s# J + t. K' Z& w, P) c
//------------------------------------------------------------------------------
. W( k2 K$ u' w( T7 c //Callback Name: filter_cb# |$ Z2 p" ?; H$ y. @. z" C; P0 I# x
//------------------------------------------------------------------------------
' B. u7 ?5 G% k* `+ j3 l1 F2 l int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
; W ]) C; `. m0 @$ f+ b {
6 p5 w8 N, I7 N. E9 k4 V return(UF_UI_SEL_ACCEPT);
$ }2 s. T# J: N7 ] }
% ^; n8 H) I+ s) H, z: A
, w Q5 D" K9 E$ a# ]7 B s E, `( s //------------------------------------------------------------------------------
) M8 j" d% \5 [" v0 U, n& O Q+ }2 a void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)! R" g$ k1 ^. F0 z" o1 Q; B: s
{
4 {6 {3 d- x. t try: e4 O7 O' d/ f' Q7 r5 @; |- V* ^
{6 O \5 v* @1 c' U9 \+ J% C
//---- Enter your callback code here -----2 H+ ~4 D$ V6 h3 N8 I
}4 l+ n, g P" {7 ]6 P
catch(exception& ex)
0 H1 B: P; }' M& z* C3 P5 A: g {3 ?2 \& n* h, }9 E4 r
//---- Enter your exception handling code here -----9 R: \5 z8 q" i# ]4 Z
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
. m8 r- @" J* h0 i3 {, X: f/ W }
8 Q# U0 \( ~- [% T2 e }
! x4 g) P' g1 @
, \* H* F4 Y9 f2 O2 v. k //------------------------------------------------------------------------------' x* |+ u2 h- H& t3 w
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
/ a& ?& E2 ]8 f; Z. H8 C8 J$ |3 s {0 L/ t+ }) G# X& ^" ^, }
try
* u: o: r# c' g0 m- g# r- n" [ {; T- r+ d' @% J. s6 i
//---- Enter your callback code here -----9 v8 q) R2 N5 c: ]3 j2 J8 O
}
+ T* K3 m" ?* x- r) @0 H9 G catch(exception& ex)1 Y) }8 `/ L( r0 e$ |- y7 B
{7 H- l& H0 L* Z& b" x/ t. A
4 V' V! V0 c9 `2 Y; m/ A, {0 O
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());+ Y/ f0 h% N% d9 ?, O3 N& _4 _
}
& C: R3 l: j: y/ f) | }
8 N- v& i8 o" A( n
4 T/ i8 x4 D$ w% X
* N2 y- w" M& o6 k2 V/ c" C, w |
|