|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
6 I; N7 s4 r; c* |
0 l8 C7 k6 q ]9 N: f请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
0 l6 H- x: Q7 P+ \8 b; `& J代码如下:
+ n0 s! v+ L1 |7 t# `9 `: V! }3 T9 @#include "Shrinkage.hpp"
% E' X2 {- @+ ^" jusing namespace NXOpen;
" K" e) f. F+ j4 W& Y! wusing namespace NXOpen::BlockStyler;
+ L% d/ g5 J* y _% w6 v$ J
! n2 |$ Z2 @6 O0 u2 S) ESession *(Shrinkage::theSession) = NULL;
- p6 K/ M* R; u- J1 S5 QUI *(Shrinkage::theUI) = NULL;6 }' j" X% s0 J
$ n( |. K4 e9 M: \: bShrinkage *theShrinkage;
/ M @' d, p. i" N# J2 `, [ z4 M) |& }$ o8 Q( Q7 t8 e% G
Shrinkage::Shrinkage()4 F8 N% \0 A4 y( n; a# ~
{
5 g/ q4 N- s% ~ try
7 Y7 L. ^( U' e/ _8 H {. \- q, l- ^" |7 D9 a' e( _8 ]+ h
// Initialize the NX Open C++ API environment8 l! \8 z, w- G! G
Shrinkage::theSession = NXOpen::Session::GetSession();0 u! f5 I) U' ?
Shrinkage::theUI = UI::GetUI();* M' F# q: _8 Z; C, L) t
theDialogName = "Shrinkage.dlx";2 Q6 R% z$ c- u3 X1 d/ B" u. t
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
; n4 [; k/ N& S$ Q // Registration of callback functions
5 F+ V- U6 |/ `: ] theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));. C0 m' T4 s# L( b8 d' t& t: a
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));) f) s! F1 g7 H+ F
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));+ q! A( t* i8 W) @) S" C0 G
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));- B1 z' y6 f( c% `. X T: X0 j
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
|% ~( ^) j* y0 w/ I0 l theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
1 l- O8 o+ p. r* O theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));& c. f0 k/ e, e8 l* L; G1 p
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
( J9 x* ]9 `% r: N- j" J+ C& v }
% b0 d! H1 Q' p0 W7 U( ] caTCh(exception& ex)" y$ M6 I i2 }% S
{
/ z# K0 y D, n & u, N5 G) v& W* u) f* _9 f
throw;' S$ T7 w4 b7 A$ r* P
}
7 [' d1 f. F: X2 w1 u}
9 q3 G; h% M3 M! ^* {! H
. X+ }0 `2 k9 p) [Shrinkage::~Shrinkage()8 O3 i% L2 d. b9 W, p$ d
{
9 \! v# {1 r; t) \! d5 m( S8 F if (theDialog != NULL): Z6 R j' H4 k- l" ?
{7 \$ L _! |0 p6 u: @
delete theDialog;
) a! d2 y1 j9 Y2 `8 } theDialog = NULL;0 } \3 q& t& A0 Z+ A9 O' b
}8 U j- b0 U6 J& q
}
9 h' v- e; p9 [1 Q3 O8 ^3 F/ h$ }0 K# B/ O. o4 H; b
#if USER_EXIT_OR_MENU
! @+ O4 W I7 }" ~: s extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)! `$ |1 ]4 Y8 g" b# f
{5 r- k6 Q/ |. A2 o5 N m
try
. p' u' T1 }3 p0 ~$ o0 l) h% `- e5 s {8 W8 p/ o" q4 ]0 \3 I
theShrinkage = new Shrinkage();
( u# G2 v5 k' D+ K // The following method shows the dialog immediately
9 f- x+ V! E% `- s! X/ [6 G theShrinkage->Show();( K2 A9 A9 W* N& G
}
) m. u: Q7 h" ?- \3 a0 h catch(exception& ex)4 x! E6 u% W6 h
{
" X1 s( {8 v7 V: ?: e! J% F //---- Enter your exception handling code here ----- E n2 C) i! x5 }0 M; a
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());6 Y( f# M, A `* i% R
}
) @7 R8 P8 g1 G! K4 l" ^" @, x delete theShrinkage;' v) t' P. b3 I$ q1 c
}# y7 |5 G. I# E
#endif//USER_EXIT_OR_MENU
: X, A2 D4 W0 _' D7 j/ N0 N8 k$ Q4 ^#if USER_EXIT [9 o' |7 E W
0 |3 g# E, N! h4 r; M, @
//------------------------------------------------------------------------------- A$ m, |! H5 q2 K Q# ]
% J. E+ e, C0 \3 s. r) J( F) U // MUST NOT use this option since it will UNLOAD your NX Open application image* N1 }8 ^& ?7 H
// from the menubar.6 |# U" p G; \
//------------------------------------------------------------------------------' u8 r- T* h% b f* _/ p
extern "C" DllExport int ufusr_ask_unload()7 ~1 E- P6 S" s) \
{/ u j5 h) H2 W- l4 O1 Z
//return (int)Session: ibraryUnloadOptionExplicitly;
1 A# A% T" [& K( f9 V# m return (int)Session: ibraryUnloadOptionImmediately;
+ b# r) ]1 a5 h2 t$ S8 S% P$ G4 H //return (int)Session: ibraryUnloadOptionAtTermination;
5 J5 x! y( b7 R* t, S }! U% w3 R4 T% m
3 m, L, f9 O% z6 c5 O; {4 j) W
//------------------------------------------------------------------------------1 Q+ y2 {* C- p: k3 x- s: r. L+ K; n) q
// This method is automatically called by NX.1 q8 e0 Z2 M5 _( ~; e: s
//------------------------------------------------------------------------------" E+ I$ g _3 o" _* o% I
extern "C" DllExport void ufusr_cleanup(void)
' Z4 ?% n x) d- s {
5 l3 q; G& _ h* P: ^ K try1 F) m0 c4 P9 p( I! s
{6 A$ W" ^* }9 K6 p1 l% o
//---- Enter your callback code here -----) V3 S/ f- o: e; X
} o6 x( @2 k6 K2 q) v
catch(exception& ex)
5 i# ]" N% K" v* O# Y* R {
\) `8 W% V- A3 O //---- Enter your exception handling code here -----( z: I! U7 a) _1 u
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what()); n ? {' \# @* {( _( F- Q
}- {, a1 |. p0 [8 R# L5 r, K
}
. ~+ Q# O! a& v! I, D) \4 A#endif//USER_EXIT
6 G7 e* {% m) M. S
% L8 o+ W1 \* c' V8 i7 \1 I! B int Shrinkage::Show()
7 e5 S+ ^( c4 e" a { U: v2 e2 I; P5 `, q5 I# w
try3 Z: [9 t4 p" u5 q% x E6 G( d
{
$ c, I# ~; p- r1 ~) ]- J. e# M theDialog->Show();/ J5 p0 |! K3 n" [* m0 p
}' G A; w+ X2 k
catch(exception& ex)
% x7 G" B8 T% z; Z" j. g. n {
* Z* n! n! Q% ?( x5 h5 Z //---- Enter your exception handling code here -----& R s) D; [. [
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
9 M& {; V- B U$ U }; c0 Y! d; @8 i: X$ W; ^
return 0;
5 v, E9 _- B! v2 @# u5 K; {; }4 ^ }! h; l5 i0 K1 v* t8 _' ]( Q
( B! ~" E4 P- h7 E/ }
#if CALLBACK, ?, Z" Z) }9 `3 c
" e6 V' O" ]* d% g! J% I, N
void Shrinkage::Show_Shrinkage()
4 X* v$ L J1 z% \( i' E* r0 j {* }9 ~1 T6 E, D8 W$ [, f1 W
try
; Q. L1 y" u1 B* @3 `+ L: k9 g {: u6 O5 z! D- R* p9 Z& a
theShrinkage = new Shrinkage();
; T# G% ?- a3 k: k" z
% M" z9 e+ m' Z2 E( U% T8 ~6 m theShrinkage->Show();4 |2 A- g3 t- z, H: m+ q6 i
} Y5 N/ `. m; W8 E" C
catch(exception& ex)
: S: N1 J7 E+ h+ C# z7 y4 e2 p {$ z c2 V+ n: u9 {' d$ L7 G
- f0 V- g) ?$ n x4 A0 y2 I Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());" F' U2 X. C! @: a- W/ o
}. F% K3 ~) M4 c
delete theShrinkage;+ b* u, m8 T. Z# B5 L8 \7 q* m# z4 H
}
V1 i( \5 w4 E' c% I+ q% `. q#endif//CALLBACK* t# ~+ w9 Q4 P7 Q0 Z
& S5 |, |1 l1 t$ q7 d
void Shrinkage::initialize_cb()
. z- E3 ?: w( } {
) V& a. u7 x/ ]7 F2 t try3 S9 ]" F6 S6 R( f: q/ q
{' J: K0 K! k& y. q0 O
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0")); w3 _# m! p+ |4 T: l3 ]$ r6 b
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
# q# x8 Q3 k/ T5 o$ i0 T# W face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
: c; k, H/ c2 g9 e group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));2 F% K7 z9 y% ]' H: N
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));! k5 X0 p: I! p/ ^. j1 T
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));9 @+ f5 Z' o1 I) V7 D" Q
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));7 g0 v; D3 E; R% E
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
$ ^% o3 \; p9 ?9 A+ P8 _2 D label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));& B, L, {2 u2 f3 ~" O v) Y
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
7 _& ~' |/ p! W* D0 D/ g0 A! r: ~ label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
& ], \) a, a2 a2 P3 l/ N) y/ o" R label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
! v. ? T9 o( H) \ [ }2 _: h, A6 P$ _' H
catch(exception& ex)
; b2 }, Q0 n6 P, c! _# x+ {3 G. V {) J9 G! _' Y3 H& p: n, r! e
" j7 x- B- O, b0 @' J Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());! o% w7 z5 G5 K
}
" d' j( Z* T t3 ]: O* ^ }) S2 f8 w& J" [( U1 r
//------------------------------------------------------------------------------! m/ q7 z9 O& o$ C' ?
void Shrinkage::dialogShown_cb()4 c5 ?: a/ a4 ?6 m: z5 f2 u
{
& L- W% e9 ^" @' x- g- o try) d# Z- l) p& x/ r) b+ t
{
5 I3 j$ h& T# o+ d2 q //---- Enter your callback code here -----
# y/ e! Y# x4 i1 k' ]- g }" g) b5 _% Z! U, m- z% y4 }+ ~, `, d% n
catch(exception& ex)3 m. w' d: X6 V$ b4 g+ a5 U
{
0 Y7 O, ]2 t1 {! N. A% n6 |' F/ C: k: }
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());- u6 O7 Z7 i6 F8 E! `
}
- P5 H2 I( O/ F; u- U }! u- G" R1 B7 W+ g3 N1 N ]
" A! n4 ^( t( L2 Z, j
int Shrinkage::apply_cb()# v2 i# Z8 m$ U- [" }1 U/ D$ v
{( @# {* D/ i$ q" j( ^/ g
int errorCode = 0;+ ^9 d7 F y1 K0 A# L: F
try
; M& I1 s$ |( s {- h3 S& N6 a J7 ]6 H( X' Y
//---- Enter your callback code here -----
; {3 Q$ R3 @6 d- i7 G }
( H/ ?6 N0 H- V6 c5 f4 p catch(exception& ex)
" P: e+ ~( _( v0 E9 [! E) W {
: `$ r9 t/ q$ A+ _+ B# [4 g //---- Enter your exception handling code here -----5 X7 ` s' F6 v' h5 }5 \
errorCode = 1;
$ i% b# g* _ U0 t ^' n/ N Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
" ~7 V* {2 N( [ }
i( E9 \- d" W) H/ N1 W return errorCode;$ }/ J7 y X! q2 y% U/ G
}
8 l$ u1 ~8 J2 W3 O3 G1 j3 m
! }8 ^/ o% m" M- Q, R* P. b* A4 g int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)6 w* q" w3 |& t- _( J7 u* q
{
8 N8 [ B L" y4 n try
+ }: |8 S% P6 m3 \. A2 h0 p {8 A* ~7 r) V; x
if(block == face_select0)0 J( g( v. _/ v% }5 H
{$ G$ T3 t. F! H6 \# \) `
//---------Enter your code here-----------
( j; i; \" K6 I3 D) X }7 j/ f- l2 c- p3 L6 @$ u
else if(block == face_select01): _0 f' n; n5 _$ o- F6 l
{
' k" f3 {0 _ x% A1 x3 W //---------Enter your code here-----------
# [$ |: l) k" y1 l3 Y, j# U }
9 j c8 _) e5 s/ H" L/ r. P else if(block == bodySelect0)# ~3 y+ d! r4 i
{
) C2 ~: T t( e$ E+ }) U; X& C8 n //---------Enter your code here-----------' ?- c# K4 x9 q7 W7 x& t& r7 \$ @
}
7 q7 G; t- b1 c0 `6 ^8 H$ n8 _ d else if(block == bodySelect01)
* f! M; S. o# H {
P5 o0 v- x; A& u //---------Enter your code here-----------
$ M7 D# C( D+ N3 a# C3 Y# A8 o- H }) H' h+ Y/ U8 P% f# B2 e H* H
else if(block == string0)
$ Z& {7 k: o) R6 y5 w% C6 T {( `( S7 N7 l: c5 g
//---------Enter your code here-----------
3 P+ B2 {& v5 }* E }7 ^% D: m, y. k. G: x- {8 S8 q
else if(block == label0)7 q5 i, U1 L; D" B
{
h* V! h. j- Z3 M //---------Enter your code here-----------
* f! K) w% s, T2 `+ g3 V" L }8 U5 c0 T4 `! j/ s
else if(block == string01)
# P) A& g& G1 k: w7 H1 i {
7 ~6 \# c! |% ^6 G6 T( c" f0 w% Y* w+ F //---------Enter your code here-----------
6 a% b* U5 R+ q" V }
# j! e7 n& M5 x1 p else if(block == label01)9 A5 x8 ?+ Q" {% r/ d
{+ H) d) i8 m/ g8 P
//---------Enter your code here-----------: R; ^1 {/ e' M3 d
}
8 m% `6 u# h4 n; U0 w1 R4 K& i8 | f else if(block == label02)
$ Q& j6 Y) g/ m; }& E j- s {/ I4 ]% r7 a. W5 f) |/ T8 J
//---------Enter your code here-----------
1 ^6 u' l9 `; W( N2 V1 D/ A }
' d: x* W# f7 g- K W }: H- {7 @, N5 o) J! y
catch(exception& ex)4 j7 d1 l, W7 k' _4 o* y* {% l2 b
{
6 f, P% m: E0 [9 \( z Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());# q/ J: p& e5 U
}( N _4 C. Y; j
return 0;* I7 A! D" k2 A
}
6 B4 B7 F6 C7 Z; ~; K+ Y: C# ^ " X7 Y+ T, n( `2 b" `
int Shrinkage: k_cb()4 d$ R; d/ s7 d; q9 @) e3 z$ U
{
, b7 p2 k; Y( R J int errorCode = 0;. V6 p3 m( M1 ~& a
try, Z" _8 X. |# {" L8 Z) |
{+ J* C1 T) m# `' h4 y6 U
errorCode = apply_cb();
" J+ q; u' B+ I: w2 Z$ _ }2 n) P* Q7 v! ^+ ?. p2 O
catch(exception& ex), y7 ]( @4 }8 O, f. @4 D& s
{
# O5 K' U# F" m$ R7 p% ]/ x0 Z //---- Enter your exception handling code here -----
& E7 m' \1 {4 F7 V4 c% O3 C errorCode = 1;$ D) D; M. k- ]4 M# I
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
6 }; V3 K& |5 ?5 I/ t7 v& n }
* |) N% m/ @, z3 S return errorCode;
' R J/ r( [9 x* q; ~2 r }
* O7 W/ r* b$ X9 x, A n
/ p G$ a# r$ U! D3 q //------------------------------------------------------------------------------9 H4 F; x' f, n# X& ~4 s. d
//Callback Name: filter_cb, o6 o% {+ b: H- w! x- E
//------------------------------------------------------------------------------
) G$ u# i% \5 e int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
3 w7 c8 I& r1 E8 ~3 D0 L {% Q5 M b/ z- f _& g
return(UF_UI_SEL_ACCEPT);% x2 R3 b1 t- T" a% N/ {
}
6 `' b! Q, l; u3 H y! i2 r4 ^ 7 g( w2 r. T$ Q
//------------------------------------------------------------------------------
+ ]& J. T3 t# J b' I void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)4 P. w% R8 ~% U5 z! ]
{! x! v6 }7 J+ t/ ?. b4 N
try3 _* m1 |; X* L& X- E6 H& {3 Y7 f
{4 ]* E# w( w7 M) O8 \
//---- Enter your callback code here -----
& T* e' ~: W, X6 m }) Y9 q% h4 O: ]9 u& b D
catch(exception& ex)5 P3 I) X8 Z3 C( v
{
4 Q- k( F0 L- p2 c9 w1 r //---- Enter your exception handling code here -----) l `8 u9 J" O% R' a4 F4 Z
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());' U# l0 f' T$ I3 {
}$ @" _! G' z" l0 D, B# i! y% ~
}/ E- p$ l5 }* J: O4 N) l& N
( R8 J+ s# ?6 O( W8 j! \+ f# t
//------------------------------------------------------------------------------. q3 D% o5 p Q. c
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
+ O2 [, K! b0 p {
$ F6 M$ ~+ N& f/ D$ @3 X' v try
* ~( O, g, Y1 P {1 U2 f% Q" Z) k' I
//---- Enter your callback code here -----, s" E/ m2 Q3 R+ n$ _
}' s; v0 w2 P& X. M* M
catch(exception& ex)
2 i# z; _; |% m1 ~) T {4 } e: L" _7 L1 Z) o e
3 b- s, T; a* w v u2 \8 \
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());: ~$ m" Y* s S0 n# [ y# j! q
}; c C: @& I. Y
}
1 i, X5 y+ q* w' m; g/ h) u
( \5 ^5 f G) n: F# v
8 [; r* A8 r; n4 {7 F |
|