|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 * |* i2 F! ]" r5 i7 v
: T4 v0 y% y" [' ~; L; f2 b
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
2 r Y6 k4 o, t) P# D# y* A0 {) H9 [代码如下:* M3 k/ W4 K/ o j- x# r
#include "Shrinkage.hpp"
: o; |6 o: T) Q/ r- }) c: E1 X t# Cusing namespace NXOpen;
( W$ s ~0 r8 s. `1 j7 Tusing namespace NXOpen::BlockStyler;
5 D Q k9 {) U+ M
2 R& u7 o/ m/ i. N Q$ w9 xSession *(Shrinkage::theSession) = NULL;
- Y- _1 o# U; Z- DUI *(Shrinkage::theUI) = NULL;
4 x0 S4 T9 O- G
( X- S) k+ ~0 t8 HShrinkage *theShrinkage;
2 a" p6 p! N) R/ H, ~, ?0 g& j- S E* ?! t4 k- {$ p U# B
Shrinkage::Shrinkage()! x# v9 W# X- e! i; d; m, O, K
{2 o4 r0 e1 F8 R* L; H
try
1 C) ?: `! E) a5 t2 @8 ] {4 W5 r4 j4 Z) x- s. N
// Initialize the NX Open C++ API environment1 B; @5 _- ^3 ~6 R
Shrinkage::theSession = NXOpen::Session::GetSession();
2 S n" [3 w0 T Shrinkage::theUI = UI::GetUI();
; R) q( ?8 }5 H1 w, v theDialogName = "Shrinkage.dlx";9 Q7 o$ K! z9 s6 b
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
5 K3 C+ g. ` P- o$ S // Registration of callback functions ~2 k# F( n+ o. m p1 K
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
5 l2 B% a; t2 E4 _* U; C V theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));! h* ~) s' ~+ E9 N4 R7 ]: V/ |' D. `
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
& f J7 l- j' D theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));) m+ E! N: _- |2 ~$ g) I
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
, A" L8 Q3 {! a- p5 p1 g theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
# p+ G6 U- k0 e1 g. [ theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));3 x# V& W" s3 i! X
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
2 h# m" q, h J: V! y9 V! E }
/ j( b9 \* Y3 z% s- o caTCh(exception& ex)
Y1 [3 d' n7 C" w2 ~* L {3 o/ h( o0 ?3 D2 ~6 g! k
+ g! |7 j# o( G3 u+ W+ g throw;
: m2 D1 r4 { Y# x& p( P# k5 u }
; E) m/ y6 i% T7 m}( p: q2 o7 z+ _0 X5 l8 J
" n9 C$ g( q. N9 n y: b9 H
Shrinkage::~Shrinkage()& f# l! h+ _7 ^+ j" Q9 W* |
{
$ S* k: N% q* V" `- l3 j* _ if (theDialog != NULL)
+ Q5 K; r7 @3 w8 X# O {
$ p3 B0 K3 t/ ~% g5 o# o+ m delete theDialog;" s4 \$ n& e: U1 O$ K
theDialog = NULL;0 d- |' Z/ z. c( E$ c9 _$ A
}9 m& \9 ^2 x; P6 F4 l: ^
}7 [" v2 x8 Q2 s( \" O0 L
: ^4 V2 n4 z$ H4 A) X
#if USER_EXIT_OR_MENU
# Z A# z( f# ~ extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)& \ y9 @- _/ ?+ ^7 b% m( {* K
{
% Y7 e( r$ N: P, ~* Y- h5 ?% }. E try1 t. s& U9 R7 X2 p6 W" Y" L
{
* K% K7 O5 i4 Q$ j9 r; S theShrinkage = new Shrinkage();# b( V1 [* ?' R$ R; W! ^
// The following method shows the dialog immediately) j0 y$ p4 n8 }% m0 G
theShrinkage->Show();: S( |% L T" c' t% t0 w$ n
} }% T: d/ I* z6 m2 U
catch(exception& ex)4 F5 {5 y# i' Y) d+ x, n
{
0 o/ f" L0 f% _1 K3 q5 h1 @ //---- Enter your exception handling code here -----" T8 K: f9 b) j D
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());* Y; n6 x; Y5 D* F1 J f- W. s
}+ i+ ^! g, W. \3 v; c/ ]+ s: m5 R
delete theShrinkage;, N$ n6 b7 U5 J! ^+ }" I% q
}
8 Z, S7 o; _' C" K! f#endif//USER_EXIT_OR_MENU! h% w" i# s/ i
#if USER_EXIT0 F6 |% O6 [1 ^' B" P3 A
% O4 |( x% `, J5 r9 R
//------------------------------------------------------------------------------( y+ t1 ?3 }( [/ y7 t9 m
% @- p& W9 _7 @( `" y U7 |
// MUST NOT use this option since it will UNLOAD your NX Open application image! Q' R Y9 l8 ~
// from the menubar.8 E: B& _1 g& E2 c6 m' I
//------------------------------------------------------------------------------
. R" K( F$ g, O$ @4 J extern "C" DllExport int ufusr_ask_unload()0 m# O& g) Z; s3 [6 i0 m/ b% R0 u
{8 Z; L8 T# [1 f2 Z, J# M$ ]
//return (int)Session: ibraryUnloadOptionExplicitly;( D+ ?$ R* Q6 W. P
return (int)Session: ibraryUnloadOptionImmediately;
! p) e! j& D1 f# e7 ` //return (int)Session: ibraryUnloadOptionAtTermination;: q6 y( E- c# ^7 x! F, v0 A
}
& u, E( W5 M5 q7 T6 y( w ?1 H
7 m1 ?0 @6 l; c8 ^6 c; j0 @ //------------------------------------------------------------------------------
1 h8 K8 b# _4 F8 F2 ]% n# Y // This method is automatically called by NX.( A+ U/ g2 |* c, i& m z
//------------------------------------------------------------------------------
8 W" u; Y# ~% s: A3 B3 D: m extern "C" DllExport void ufusr_cleanup(void). ]( k3 U @0 X0 f
{$ W7 l& m% N2 h, ]$ a/ n7 V
try/ _2 h% W3 [1 e9 ?$ L) Q& a
{9 J5 T% J) `; I6 Z L
//---- Enter your callback code here -----9 q( A' _8 n) p: |
}. D7 ?( b0 m3 b1 U4 V j# [
catch(exception& ex)
0 D# o3 \0 F' Z T {- i# Y a: N8 J" w2 z; o
//---- Enter your exception handling code here -----7 u4 r4 u% l5 O& [9 R& R5 ]0 R4 |
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());1 M4 B9 o, o) f, u
}% c4 l: Q- m1 V+ G5 x: f/ b" \5 @$ c
}
6 L/ ]9 ]8 v' Z$ g( z( o' f#endif//USER_EXIT4 g4 D* R( F, d( |3 L' B3 w" R6 m
2 G0 W2 X% _5 b( H {( ~- C* G& X int Shrinkage::Show()
& g/ L7 y& P5 Z {
# o- |4 H+ x$ R) t/ I try I- G' J b0 V5 _
{
5 K9 t7 d6 N: k theDialog->Show();
% `. N7 }5 u& U7 C) ~ }; P) z* M! |* ~" M+ d/ C: e
catch(exception& ex)1 U7 J( s; u& s+ H
{
2 J* Y+ }* J0 q //---- Enter your exception handling code here -----
. v6 x5 u Z- Y' U* x% t+ B Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
9 c' @* j; M& e( s }
! z: H* {" t0 Y. R return 0;% G# I" w4 Y+ ^7 s
}# N1 U2 X& L2 |1 g: |" ^
& Y: l8 K9 N3 k2 E
#if CALLBACK+ X6 G( h/ u. j; u+ Y/ w
' }* Z4 x0 n' k. Z% p
void Shrinkage::Show_Shrinkage(); D+ I) t( M8 i( t W- n* f, R5 J
{: e" M( B+ u+ D6 c9 L4 E
try( D& o( ^5 R2 g
{! [. c5 U" J/ L! {
theShrinkage = new Shrinkage();
$ T( J6 \+ d6 G/ b: O" }0 b$ R2 F, C6 \8 u+ P
theShrinkage->Show();" ^' {( \! }1 u6 }) L
}
" Y2 R* ?5 c% _. J- O2 @ catch(exception& ex)
$ I/ L' _) w7 I2 U0 C g) Q6 R {8 ]4 C4 [& ]9 q4 D
5 f" ` r% n5 G0 U2 V- Q! \ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
@) u# ]" p8 N! y }
7 q0 [. A" Q3 d8 i9 F& i delete theShrinkage;8 O d+ Y% n G6 E
}
8 m1 z1 A/ T$ m#endif//CALLBACK2 p& z) a% S% G
" q0 |" H1 _1 y( T+ Y void Shrinkage::initialize_cb()* M6 M0 S2 m- J1 F x5 m; p& \: v( b
{
& ^, ~! ^3 ^& E; n. F' @) _5 ?2 Z try
3 L4 `# Z) f* A {
7 ^: r. h- t# M. W group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
@8 z. p0 f* k, @! U& n( h face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));+ H% o( g$ z: j3 d$ \- [' B
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));9 l8 J1 ^/ c6 x+ e# D- O
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
5 t2 u- q+ M: s" s2 A bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
( Z6 k) c S7 o/ v8 ~- J2 \ bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));" i/ l1 }! x8 x- W1 G' U" w3 K2 g
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));6 z$ B$ E& h0 Q4 m7 u2 \
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));0 P7 w& _+ e4 G- z2 y* _+ }4 f
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));, Q% C, M' a( h# ]3 }
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
8 n. ^9 X3 V9 m label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
7 Z- x/ ~$ q& y/ o label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));! A/ r" f; s7 Q4 _/ t6 [5 y& A
}) ?2 T2 h: h0 `; w
catch(exception& ex)
1 `4 y2 \' \) |- j2 S/ J& r {
" f. G7 P9 T e& v' r
5 a& _6 n- u0 O O" ~ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
3 Z, E9 Q) V$ _ }
: H4 y( M* e/ k0 F }
! z; r/ M% Y' F* D; \ //------------------------------------------------------------------------------
) }* w* u+ m$ V% n: f8 [ void Shrinkage::dialogShown_cb()8 j7 k1 K! q0 W8 F! V/ k( c H
{ o9 g+ |* q* s
try X2 Z; K/ g4 [5 R9 N; f
{
' z) k. N1 v9 D' O+ C3 G //---- Enter your callback code here -----
, Q) m7 [5 F( b! }+ { }
( I9 Z" G$ R2 P4 F& n1 ]0 Q3 w catch(exception& ex)! }0 m' |7 p. I- ?; |
{
8 A0 }1 d, A1 a" x/ |9 z+ C- h
6 t, L# Q# M# q, i' C& U$ @9 I3 l Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
& X" D8 K- P9 I: { } [( Q! t& x0 i2 N% l l6 k
}
6 l' X# b) v- f$ f u! A9 O( v( E+ A3 ~7 X
int Shrinkage::apply_cb()+ S+ T% Y4 O" e
{
' ` I- C6 ]/ k# u: r4 n1 L int errorCode = 0;
" K' r% L; Z% `4 q- z2 |+ @ try
9 `0 s i7 S% U: U. z' \+ T. U {# P7 I8 \2 V0 O m h) x
//---- Enter your callback code here -----
; N( F: a0 v( g4 C | }: [6 ?# M' t$ u; C8 i- Q
catch(exception& ex)& y& \: t6 D- p h; ~+ |/ P1 ?
{
2 [* Z2 d- `7 ^6 Q& R //---- Enter your exception handling code here -----
3 C* ~1 l$ |3 B0 b. a5 H" C errorCode = 1;6 f5 L+ f2 h* f/ g( t$ E
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());5 ]* q8 Z1 t a" J
}5 Q' l' ?1 L w/ G
return errorCode;% r. O p7 z/ Q
}4 i( X" C) }9 A5 `; u) W
, F% R# U* Q4 K% b4 Z7 X! z5 H
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)& k( S: u6 f' \1 ]: ]/ D& q% |
{: ~4 M* c. B6 f, I) _' {
try
6 b0 R! K7 G; @* b$ G/ J" F% |" ^ {0 D' c% {7 Y3 B! `& B/ N, D
if(block == face_select0)8 K- Q5 U% E; {' k, x
{" h6 O1 t' N* l6 F* a# Z
//---------Enter your code here-----------( H. t9 y7 P; h9 K1 ^; k! y
}
9 ]/ l$ {9 z i else if(block == face_select01)4 O0 r2 Q! L S
{; h% U) g: D) m$ g/ U. P
//---------Enter your code here-----------
1 G$ ~, O& ]# d7 f: A- ? }
0 g/ N1 U" P* c" N: D4 O/ H( R! m else if(block == bodySelect0), ]& m, |( V# H# u0 Z- o: _% E
{
0 \' D% [% h7 p9 ~8 u; H //---------Enter your code here-----------3 N% d# W. q5 r# D0 d
}
1 R+ `: a8 L; a5 N' g6 } else if(block == bodySelect01)
; B4 v; ]4 v* n# R) f- h: [ {
" D! A! Y' u- ^5 ^9 C7 U5 N, ~ //---------Enter your code here-----------
`- A- X c5 X0 A9 ^2 J }
! t: @& ?" ]1 r' ]+ _ else if(block == string0)
( @' v8 V3 w! J0 S& q; y {& V: r c& j: a* w |) d- D4 O! K" b1 k
//---------Enter your code here----------- }, G; u( q2 M1 y7 b/ D* q
}0 g5 q, g, ^ c8 j- F
else if(block == label0)) e4 m/ F+ h6 G% X, S: ?7 K* ~1 e# A9 l
{! u( \5 V0 |8 k; @
//---------Enter your code here-----------
* Y- K' b4 i B+ _; q }
9 {( x8 g) B$ C" h. X/ y/ n9 J else if(block == string01)
6 ^# }: P0 k1 |$ N! N {
1 J; R5 t4 R9 v) ^: R# z //---------Enter your code here-----------) t8 u! v, q! k# p6 N
}8 ]6 b) z& ? u/ ]2 t: ?
else if(block == label01)9 o. {% k" } |' Q! v
{
T6 m# ]$ Y. d4 X! r/ d0 |# `/ F0 _ //---------Enter your code here-----------+ w4 N! z* s% ^4 a' I
}
: y6 G1 @; j( ]- A: R0 a else if(block == label02)3 X# M- p, W; Z' U3 }, G& E
{
7 }$ w/ z" V0 T5 a" C: ~ //---------Enter your code here-----------
; h, j5 [$ W p7 f5 w+ | }
9 i9 \" H8 ?6 q) _. o }) F$ G* l4 I6 {' J
catch(exception& ex)) Z6 }1 B5 p. q8 E) o& _# A
{ l0 t7 I# V; |7 c
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());8 I% Q7 H2 M* q; |' L& w
}
4 O6 n q) x% I& e2 c3 ]( X3 m return 0;
7 ^* Q1 l, L4 \. ` }) L3 E1 B. r/ P* _; ?9 ~
6 c9 \1 x! q4 {* C int Shrinkage: k_cb()+ R, k0 w! i% E! U% G8 p
{: i6 p" \! Y( y3 U1 h
int errorCode = 0;' |; E' N) |, u: N$ j, P, S
try' c( p i h6 O, s9 p
{8 r: \9 f/ G# r% m6 P: }; f
errorCode = apply_cb();
$ q# y, S6 R3 R. n1 ]- _- g }
. c) \3 M/ z: N( ~ catch(exception& ex)
k- i' n# B" N. ~ {
8 |) i; \9 z% a, j% w4 ]. P; K2 R //---- Enter your exception handling code here -----
0 y! m& |- J8 y errorCode = 1;' d" `1 j6 K5 F- h2 }' A
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
4 y1 h9 e9 \2 ?) W5 K: s }7 S( l8 E, }6 I2 i
return errorCode;, G2 ?# l% @; T/ S- |2 r" R
}% N8 f5 u/ Y4 H2 F% Y
& p: u/ ]: ~& _ //------------------------------------------------------------------------------- Y# Z5 I5 S1 s8 K
//Callback Name: filter_cb
* C8 K9 y4 Z; c: l2 L! P) w: A //------------------------------------------------------------------------------
! T1 ]8 ]. m3 k! m int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)* c3 v! Y6 ]; a( C& ]. |
{
4 g: K# o+ G) v/ F( t+ \9 { return(UF_UI_SEL_ACCEPT);1 `+ q h* j! ^/ A( H: n
}! ~. R* ]6 C: x: ~. C5 x
2 P; ~' h/ I2 |8 s6 Z
//------------------------------------------------------------------------------
# {+ j. w/ }* A. S# E1 j9 a$ H void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)* {9 i- _; B2 e2 x% J5 {4 o/ Y1 S
{' Z# v7 o: V4 w+ k
try
) x' ?1 W; Y3 m5 e" J9 W {
7 K9 G. F! ~2 c: O //---- Enter your callback code here -----5 D5 P k9 d2 f' T$ T- L/ ?
}
4 i* N/ b; }3 [8 Y/ C' S4 N) N catch(exception& ex)
' R" k H& X' w( \4 N! ^) k- ~ {
) V7 ?4 W+ V9 [1 j* Y //---- Enter your exception handling code here -----6 A1 a* q( C: m
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());! G4 w8 T, [) @7 I
}6 V! K8 X8 u* F* L8 v# D
}
* O* b) J9 s& G9 O5 ?8 R# L
* ]: k4 T- b% o$ `. i9 u //------------------------------------------------------------------------------
" H) C. Z3 \4 S$ M. [5 H7 n- M* K void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
7 m" m4 R% i# s0 ~+ K+ e7 K, w, j3 J. _ {/ K$ ]' R3 G+ ? M7 h) e. j
try% k) D+ b4 F& ~, r: K$ N
{' d( s- k! o2 I: B! l
//---- Enter your callback code here -----5 J* _" q9 g. I0 U" H. M! o
}
& |) T+ N8 \5 I6 Q* X5 v" ` U catch(exception& ex)
: H6 U* U, s3 ~ {
" U; V: }* F6 P; [
. @9 }% ^! P* y, j& I Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());6 Q5 m! i+ \& @" l! V* B
}
0 }6 Y3 V8 d4 C9 |6 L/ q }6 O) { d- t6 r/ _
' J+ ?2 M( b) c9 _" M5 h j
; v* |$ X) F8 p1 `7 s* E3 e |
|