|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
* K: z; v% [; _2 B" {
: O) d% O1 ^/ p- n4 b2 y$ E请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr7 |" O" F O+ [! v: E- @
代码如下:
e! Y' v) n5 ]8 W5 K* u5 ~+ K U#include "Shrinkage.hpp"' Q" s$ f1 t( H4 i" |4 H( i% Z: c
using namespace NXOpen;
% r- O3 q X% s) G) Y/ xusing namespace NXOpen::BlockStyler;
$ W( X6 b. J/ Y# W E4 g$ p& l6 l" H2 s: ]
Session *(Shrinkage::theSession) = NULL;
2 r9 F- Q6 J- d: ^* Z, {) I1 rUI *(Shrinkage::theUI) = NULL;
7 f( o& d: U, B$ o. h9 k
# }) M! N4 o8 o1 tShrinkage *theShrinkage;
! d3 h6 u( J( _5 q( c) ], n5 _% L2 c, g# L" u
Shrinkage::Shrinkage()- p7 [: Z. a1 s+ @% _1 B
{% x1 M6 P. G9 j) Y# k
try
! n( d/ S. m4 b* J7 C. x t+ Y {/ \0 }7 R7 D. R) F4 X& Q
// Initialize the NX Open C++ API environment
1 E9 ?5 e, b- K5 s% D Shrinkage::theSession = NXOpen::Session::GetSession();3 B" y/ }, S/ N# W4 a7 J. M, a0 a% ^
Shrinkage::theUI = UI::GetUI();
# `0 k! R: e& s& Y3 X- X theDialogName = "Shrinkage.dlx";
' m5 `! Y: v1 Z8 B8 _9 } theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
6 g# d. m* ^) @ // Registration of callback functions% Z& r' G7 a0 h( j% [. |5 }( p
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
7 u/ O% I5 E/ C! @3 J- v theDialog->AddOkHandler(make_callback(this, &Shrinkage:k_cb));3 k0 S: S; P* o' ]: k# J. v8 i7 B1 }
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
& Z/ b5 N8 t% S9 x, u theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
2 W1 T- e: L! b theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
7 q8 e6 o/ K( C: K5 W9 p theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));* k% L) n% y7 U, M$ f7 V
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
4 i" ^4 V; r% d8 S5 H# \9 S) } theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
4 L/ f1 O, Q& A C+ k: d1 ^0 i+ \ }' [* u/ e% O( W! `; P
caTCh(exception& ex)
& }2 i4 N1 y5 `0 } {: I7 X0 c. d) S4 d, N
' r w4 l1 j- J, [/ Q J& G2 b throw;
; |! o! Z2 z* n- w }* G: f3 e) @$ o( s1 O! q
}8 i( r& \1 k- }: i
1 g! K; k! N' J6 e6 r0 f1 z7 gShrinkage::~Shrinkage()
! W2 ~! I4 G- h7 D+ F+ r{! { {- S( I) K1 E0 k2 w) V
if (theDialog != NULL)7 m, v8 v& z1 U% {, \% U# F
{
8 w2 E) }" A- J; o% s1 E( u delete theDialog;
% Y- w& f& b$ O! ]) C8 `0 l theDialog = NULL;
- J# |7 p7 T$ ` }4 b7 f: d& V5 J9 u% E
}
7 R, c* F0 H6 h0 a9 o: r# X1 C$ ^6 V) V* _* s: l% ?/ I9 Y2 V
#if USER_EXIT_OR_MENU
5 Q) g9 O6 o+ X% K- v f extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
2 c& f6 \$ A5 b* j3 a1 P {* D B; L4 t7 ?2 q X
try
/ ^6 z2 B; ^- X; r {3 j6 g- z0 Z& J! O; u: ~& E e" m
theShrinkage = new Shrinkage();8 i9 S4 h+ \5 d+ J7 Y
// The following method shows the dialog immediately
3 ^& s! G' d) g4 ?! V: ` theShrinkage->Show();6 Q8 g( f. o2 S+ i
}
, t. y4 K) n8 O* h catch(exception& ex)
& E/ \! N& f% T6 e3 V; B {
% W2 b. x( j( Z5 M) u" N //---- Enter your exception handling code here -----6 \3 h, N* ~. c' z P' t% g/ w4 }
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());4 @8 @$ T' ?3 H o4 Y
}
8 n. I6 L7 W' e0 f6 h# ^ delete theShrinkage;
# Z! A+ L: f% I( K% ~' V }
6 ^1 S: @- [+ u* p8 B m4 Y#endif//USER_EXIT_OR_MENU
; l! d$ f0 `5 ^#if USER_EXIT
1 J7 S! m" y! C! U9 b/ W 7 G) l# ^& S0 S1 C$ ^
//------------------------------------------------------------------------------
; d7 m1 x1 {; C( b4 g6 O: `
2 z3 R6 ?+ F) v) [% _ // MUST NOT use this option since it will UNLOAD your NX Open application image; }& Z5 @) R) p$ l& H
// from the menubar.
5 @7 P3 [" S* v7 U: K //------------------------------------------------------------------------------
2 B% r, B7 i2 ]+ g' n extern "C" DllExport int ufusr_ask_unload()
5 E# Y1 M( i* |. F* W {1 I' Y- j" S! C+ V
//return (int)Session:ibraryUnloadOptionExplicitly;
& `! Z6 `7 _: C* Q% o0 c4 x% ^$ J- X% | return (int)Session:ibraryUnloadOptionImmediately;+ `1 D( Z5 R" I4 C
//return (int)Session:ibraryUnloadOptionAtTermination;3 Q& |' I. P- i6 \$ ]
}; B% m0 p3 o4 k! H0 n0 C
1 v* E6 s% K: v, g4 d
//------------------------------------------------------------------------------# B& d/ Y/ }3 t# e+ O
// This method is automatically called by NX.3 ~& K$ c- [4 h
//------------------------------------------------------------------------------, a4 a' \4 g2 c* e h4 `3 N! V# V
extern "C" DllExport void ufusr_cleanup(void)8 N; o- N( Y1 t0 x( W* m
{; C0 Z0 Y: \+ v% w2 l- Y `8 U
try
, G" a: `- }+ y# _' Y4 W) V {
$ S; ]' u; C% J- D2 T/ a //---- Enter your callback code here -----
O0 r0 i2 b0 K! K5 ] }
4 \* p: G, y! K! C0 U catch(exception& ex)
^$ a" `: i8 M) W: L" T {
$ z5 j" ?8 J( r$ @ //---- Enter your exception handling code here -----
) d, v3 R. a* a% I) j- z6 f Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
3 @. |0 z% u' ~. q }1 \% _0 R' I6 s: P) P7 R0 D8 l6 `
}
2 T+ j1 i3 Z4 r1 X. h! J#endif//USER_EXIT
1 u7 W7 D" }0 r9 n$ \0 M
0 t- I& _+ a. s3 _1 r/ g, p int Shrinkage::Show(); \! Z$ r; a! W$ Z) T
{4 i7 i7 ]0 Z `5 e9 _# ]; _7 j
try2 x& ~4 O% m' E+ ^/ T6 z) [4 E
{* j8 h6 W) w$ A2 O1 i! ?
theDialog->Show();
: q5 o# J: g$ r+ [& b6 B5 f }1 p1 {, M1 w+ r+ p
catch(exception& ex)
# ]6 `2 y* v8 F U- c) L- O6 W- @ H {" L- w/ @" `' a; `+ `
//---- Enter your exception handling code here -----7 x# Y3 B. L* W& M& D& w
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
- D9 z% B% }% A! ~0 W }
+ z6 c, @ x# u) f$ C return 0;
. H6 `# O- I7 c2 |* z" U2 p }
0 n. S, f x) c
( q8 N) D. N: W8 {#if CALLBACK
! r" l1 B' l0 L$ V9 C) c9 S1 d( r2 ]9 H: w: `/ z1 L1 |0 `
void Shrinkage::Show_Shrinkage()
' q0 f {# X! }' M+ i2 Y {; i9 H" e- i0 J- X! h. {
try
8 d: s' P9 Q3 z% n( M8 K5 H {& u# r. o9 G0 h# V2 c( ?- h2 P
theShrinkage = new Shrinkage();) Q) G% o; S8 U
6 p4 ?' x- Y( I+ Z& U8 w) {' z3 S
theShrinkage->Show();: K9 j: x4 p0 Y1 [( c
}" V1 p# z4 W' f3 k8 B
catch(exception& ex)
# c, C' p6 ?6 R" E {
0 g0 n9 w! A5 x, i; w; ]
! C$ ?; Q3 d8 b |! B; w x Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());/ |: b( t) H9 _
}" U l1 ~3 x9 V3 [$ H- U, x4 o0 V1 y
delete theShrinkage;
d/ p7 `& w- |2 | `, u7 G }
* ]2 \& n. B H4 n* [#endif//CALLBACK# O8 o* ^% U C: Z
6 |4 n& R4 ^4 X9 |& C: Z
void Shrinkage::initialize_cb()
5 F9 ]8 |' q" C5 S$ {# e. H) Q {- J5 a. @6 R' l
try
& g8 T. |: r0 m6 y. p; c. H {* C% e( F0 c0 s- n( K. e+ {' t
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
7 c- `7 U2 v, |- D+ k face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
& ~" f5 ]( a2 C0 g face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));! W* }/ a/ T f" B7 h! J
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
7 n' a9 U& }4 E. C; i9 V4 [! V bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));8 ?% c1 T; s* z' N3 Y* E. a
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));% _6 c5 G9 `0 }5 O% r
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));: }2 s( [- l$ O' }- a- D
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
8 H( ~ O+ i2 }* f label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));( L- [# U3 Y' X3 `, |
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
& l% o, K; V4 O7 x% e, w; J8 V label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
( A8 W4 n0 I1 Y. P label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));" t; {. f. y& g; G9 w g
}7 D/ a; z5 W7 D6 U( H
catch(exception& ex)4 q6 c& ]7 p' s& A& ~
{4 R, n0 W6 G( O( k8 i
9 A' ] l' @0 G; x6 t3 o
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());& |- U- n6 u$ o7 f: [8 j5 i
}
0 s2 |! a4 @) K# t }' a y5 O9 |* m' _: J! d* I
//------------------------------------------------------------------------------
- q7 [: P" G4 a3 V. \ void Shrinkage::dialogShown_cb()
- y4 x* C c2 w4 U w {
5 U/ Z" z" O1 j4 \ try$ C( w$ }. l- ^; c0 J
{: E% t2 L/ k' K/ Q2 s0 S
//---- Enter your callback code here -----
! V& t# {3 K$ X1 } }
* Y5 D% r+ Y, \4 R( z catch(exception& ex)) N. W) l2 ?) O$ c
{
4 n% ]1 ]! S4 l. w/ Q# Q! ^( t+ ^- R5 ~' k$ N
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
" E5 @) b2 h) r% x }
: p D9 x: r% ^* K. N. _9 M1 G }
( m4 M$ m% v6 I) X* t! V6 P % a5 v8 b1 T7 _
int Shrinkage::apply_cb()& q; `! I* P2 y! j. u6 _1 W. _! @
{0 i# b3 H/ G) W
int errorCode = 0;
0 R$ h& G) u( e/ e try l/ _. H# J' o, c8 I
{0 w' w% v3 y. [8 [* i3 K" A0 w
//---- Enter your callback code here -----$ E Y" _- m1 f9 R
}
+ l' Q l6 v( o1 E catch(exception& ex)
, {6 C) d3 `( u3 e- ^1 _ {: _. t' Q: V0 V
//---- Enter your exception handling code here -----: w8 X$ v; }% r- }7 v# B v& V6 X$ O
errorCode = 1;
7 @. z9 U9 c7 T+ r0 e; o* ? Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());3 b! d' L1 L3 a8 a, ^' G6 k
}
. o& g9 h, n0 i. @& C return errorCode;
: y/ ~, n# |/ x' Q: T5 A }- V R, Q7 Q& `0 I1 w
' o$ H4 S& `3 T1 L% K J
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block), X# ?2 P% t4 h4 S" l$ W
{
, |! p7 S, S, q' B. B try1 H1 Q* r8 u$ l" ?7 G
{2 w% d# y6 a7 H( d, U
if(block == face_select0)
* Q; k$ ^4 M9 I3 m4 V" ? {3 X: T2 `) e0 |, e6 z
//---------Enter your code here-----------
' x' A6 ?& E% d" I# o/ G }
1 D# n3 p0 w( K, l. q$ T else if(block == face_select01)0 r4 t2 Z" ~8 u; h5 _/ A" x
{+ y p4 V9 @/ g4 `$ {
//---------Enter your code here-----------
; W2 l2 t8 ?# P" a. C0 U& X }( `/ S, b$ r$ O0 d! `* S& p5 W
else if(block == bodySelect0)) u/ k/ u, `" Q2 ]' I. `& F
{( ~& |4 s& o2 c7 ]5 l& X$ S
//---------Enter your code here-----------+ b( H( M9 M9 A! W" J, w( a. A/ E
}
' \6 W9 k8 \2 C% h- e else if(block == bodySelect01)
B0 J" K' d& H4 | { @9 e- \. ?, W& T b& Y3 S8 e
//---------Enter your code here-----------. U5 |( n2 b; F0 w: |
}
: [% {! D6 P: K else if(block == string0)
1 u" c6 \; v9 Z* f- g$ m' q. }) Z {2 g( y7 V9 u: I$ L _
//---------Enter your code here-----------7 ~2 _% |6 |' V5 I6 j3 z7 M% v
}
) K/ e0 H8 m- r) t- b2 y0 w else if(block == label0)
: [0 t$ E# x" @ {8 L. K- c8 U, J+ V4 \/ W0 \
//---------Enter your code here-----------1 M5 s, X/ ? T$ B% e
}* Z% Y# G7 i* i: d* y7 i- M# Q7 B! [8 Z
else if(block == string01)
0 o |- J# @9 n6 l& u& Q7 y5 J" j {
; r# b4 D$ ` Y# O1 D. q& T9 H //---------Enter your code here-----------2 t# I T- D: o: Q8 Z' `' j; M! d! F
}
2 A4 ]/ E G X# g* |# ] G. D else if(block == label01)7 @9 `5 _( p5 c3 \) [* ^
{
' B- }9 J5 ^3 C, Y //---------Enter your code here-----------
* g/ D+ q: S6 e3 j1 h( F }
8 t6 v8 h) F/ J else if(block == label02)
2 f/ c3 y( R" K {: E$ U `; y/ N _. t! D
//---------Enter your code here-----------" x. I# O+ T& w1 {& x
}, {( ^/ Z' H8 P' H; }$ a* \% A
}
0 s+ w1 p3 j* S5 T1 d: R catch(exception& ex): R1 K9 H/ }2 Y. F
{) L3 L# H( x& b B
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());, h% Y. B W: ^3 U7 C6 M* X, w
}
4 b& t" }2 a' V5 K6 ?/ O return 0;
% Y4 i- ~8 v8 L8 E X }" ]2 D. l+ L4 k4 f) ~1 ~, i+ e* G
! R! v" g( U9 v; i int Shrinkage:k_cb()
?% l: Z8 j+ \; `0 y {* b3 g0 }4 j! E% x/ R( M; I
int errorCode = 0;
/ N- V* M C" _4 u3 l5 x try
+ w$ U8 a7 J$ _& n {
1 O8 p6 @! ~* b6 F+ J4 V4 z errorCode = apply_cb();3 H- h/ @3 v x% X: }7 e
}
/ p! }, I/ M- T catch(exception& ex)4 r d5 x9 L) G6 R
{
6 I$ c7 C6 K- a9 y //---- Enter your exception handling code here -----
/ d- M. E6 m8 B errorCode = 1;
. j0 Q7 @3 [0 F0 q% R7 `7 `$ N: t Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());3 h7 I5 F/ R) _5 q1 t. L9 {6 \
}
$ A2 q2 _: u+ [, {+ _ return errorCode;
, i# L1 T+ Q4 O) O7 W! r: Q0 } }, I# j, g; e* R% `0 u
3 v4 I G( K: d
//------------------------------------------------------------------------------
; H5 e& I. W; k# z) X //Callback Name: filter_cb
4 o* y' r# y2 } //------------------------------------------------------------------------------
' f$ ]" f2 [6 P int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject), v1 V# H& C& D1 H
{ ]' s- @- R2 Z( E6 f" \
return(UF_UI_SEL_ACCEPT);
! X& B$ G, ]. X0 j% r1 _& n }3 t( o( O) h# f1 _3 ?/ r6 t
& U. G9 E' `" z6 S+ [, ^7 B; y2 c
//------------------------------------------------------------------------------6 U# ^! N3 S$ x9 ]
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
1 `2 s- o! S; l4 I6 `0 m& _ {* S; O- K% Q1 m! o$ \2 s
try
/ O5 Z. z& s8 a+ h7 q {: C# g$ \5 S3 x
//---- Enter your callback code here -----
0 A+ S" C, K/ {* @* v2 U }) C u& Z4 T, g5 e$ a
catch(exception& ex)
" B; ^3 i/ Z0 R! P {
2 c; M4 M8 k8 i' a( ~8 s: D //---- Enter your exception handling code here -----
0 x6 {0 G' Q5 ]+ ~, I+ x Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());! S2 B+ j J2 u4 I- U/ L
}3 e* S& Z& ~% V9 ?/ n/ D% }
}
0 p6 g8 v* N1 t* Q 9 p5 h8 {# E: f- B. G' _4 }
//------------------------------------------------------------------------------
1 [ Y# E+ n: I" L3 p void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
' z$ _' A1 L. C: d. r6 U$ i T {. A& c7 q6 ]! v9 B6 r
try% v2 M0 J# [5 U5 m1 x X
{4 d. _( Z. }, w$ O1 ^/ Z; n
//---- Enter your callback code here -----. z4 r. D$ q2 V! e4 }3 \5 s- h
}
4 ?1 ^. {$ Y/ q0 U" z N catch(exception& ex)
6 [% k' k" r! Q) r {
/ Q; t" l2 j4 r3 i
1 y( S t2 }% F" E- w3 V% G Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
. O9 m2 c: t. h! p+ H5 ]. x }
0 W% m& ~/ J6 \6 Z8 U/ w1 ]9 W }
3 @! ?$ q: h2 |
5 }8 v% x0 s) U$ h0 I; l; i8 {3 X" _$ ?
|
|