|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
% k4 M. @! G$ P( R9 {
$ S7 `3 D0 @9 P8 \% u请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr4 I, B6 L4 n( o
代码如下:
" W2 P7 |: t' @8 U" z3 [: \5 t#include "Shrinkage.hpp"* K7 ? f9 T7 W- q/ M9 |4 n
using namespace NXOpen;4 H" {# G; _3 o* l {) O& w; S; f3 i
using namespace NXOpen::BlockStyler;
# j7 |+ k" y8 ]& ] J1 c
; S5 @2 e" l3 z3 gSession *(Shrinkage::theSession) = NULL;
# c3 \% n; a [$ T) _UI *(Shrinkage::theUI) = NULL;
: ~6 K, }( Z Z9 Z. O) s
. H9 f; y- Z0 G9 N9 Z3 t; }& [# BShrinkage *theShrinkage;
6 V/ i- I2 C0 C" T) S- u( J: ]( _
Shrinkage::Shrinkage()
' s- k4 P2 d* ~- [, @0 I" M{- ?+ r. Q- T5 B; o2 Z6 z
try# S6 Y; v/ y2 o2 ]
{7 {: l( o/ f k4 S% s- v* D
// Initialize the NX Open C++ API environment
9 s# B! O1 f& c/ z Shrinkage::theSession = NXOpen::Session::GetSession();
" k @# g. w( X# T& H$ K Shrinkage::theUI = UI::GetUI();
2 Z4 `$ {, L6 E+ C% d3 O! o, C theDialogName = "Shrinkage.dlx";
. b( G% u0 ^! \: l5 t theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
: [4 I V& U) g! [' _# D( X6 a // Registration of callback functions
- c* X; g4 N. R$ ]- M+ o' o theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
3 m2 f3 o- H! G0 `4 O theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
4 ^4 O& B& f- K* Q8 y6 ~ theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));- O+ ~. l5 i% u
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
2 ?. k$ W* [; b7 I theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
l# D$ `8 Z1 ]" C3 A theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
_6 M* |, z% x0 S1 E. a theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));7 w Q( A9 P, O$ r% r1 D
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));' s% r& k1 f: \; F: p4 j+ J
}8 |6 L1 @% A9 C7 Y
caTCh(exception& ex)2 [" g& j+ Y d- D" Z
{
a/ K- l& L2 R3 H* Y
# b ?- ]: |! ~ throw;
; P" q! n9 S0 a. `4 y }% ?1 J5 n$ M( Q/ h
}. m; V. I3 U+ j6 e2 M6 F- k$ `
6 J$ B; Q' [. n2 yShrinkage::~Shrinkage()- k. i! B- k/ n" @/ o
{: t8 R$ t- |* [* E7 T, @
if (theDialog != NULL)
9 t" }# f( C0 V1 ^ {0 V2 b x7 s" z6 @4 {% y
delete theDialog;- D& f1 m- }/ r1 d9 q
theDialog = NULL;" z: U; q7 `) q; h5 C
}
/ m: ~+ T5 w4 |' `- E8 d}
9 B, k6 l1 t- O3 K2 J
1 L- o; S. [" c V+ _2 s#if USER_EXIT_OR_MENU
, R0 w& l5 i# [+ ^ W3 p1 z! K9 F extern "C" DllExport void ufusr(char *param, int *retcod, int param_len), @5 U- W! T1 Z- u+ y
{* z' t9 j$ o: w6 o( g2 {
try2 H$ n8 T( A" S! o9 D6 k) e$ B
{ d. {% E$ g. z- d$ u
theShrinkage = new Shrinkage();* @" b+ @& T1 ]$ g; T4 B
// The following method shows the dialog immediately7 `5 p9 U1 q: Y/ c+ D1 G# z
theShrinkage->Show();
9 h8 j+ J; _9 } }
! q" A1 G" ]; U, { catch(exception& ex)
, B. Q2 R! i! P( k6 a {
5 `" T/ _1 W5 e" R" U: I9 ] //---- Enter your exception handling code here -----2 j3 w# {0 Q. j. n# L6 E, F
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
2 {4 M+ y( V. T, L! o- `7 h) ? }' Q7 j# }& o) _- E/ v) i& P) {4 r
delete theShrinkage;
5 U& _& r2 c. M' ~ }. K3 O" H8 Q" z. E, A! E
#endif//USER_EXIT_OR_MENU
6 P) g% @- d2 U6 h0 { n#if USER_EXIT. d8 f0 L' H5 q- B( D* H9 s( f
5 k5 Z5 i }# `$ {+ y
//------------------------------------------------------------------------------4 {# B. n5 {( c. \$ p2 A) _+ ]+ W; y
' o8 {1 @- P9 M7 t1 R: {9 t& d9 _ // MUST NOT use this option since it will UNLOAD your NX Open application image, i) g# e9 d# Z. C- y/ I4 v
// from the menubar.
5 p& ?( U1 ?1 L( m! Z2 Z //------------------------------------------------------------------------------, q$ n1 U% i2 G, I
extern "C" DllExport int ufusr_ask_unload()
- i- _( i% l: _" C# H {2 ?6 V8 w7 |0 d1 b, J
//return (int)Session: ibraryUnloadOptionExplicitly;
6 y: {' k3 N3 Y return (int)Session: ibraryUnloadOptionImmediately;6 F, k" S7 l# l8 _ z! c
//return (int)Session: ibraryUnloadOptionAtTermination;4 w+ w" ^8 T+ Q8 ~
}& s% a0 J1 l8 x$ `
5 e' \6 E4 U# X, D% N' C4 U //------------------------------------------------------------------------------
* \7 g( M8 f* z. N Z% q& O: o // This method is automatically called by NX.
6 S9 K; z; L3 ? {6 e) ?$ D //------------------------------------------------------------------------------
# Q2 U) A( J* t( v) i extern "C" DllExport void ufusr_cleanup(void)
$ s9 y! O5 ?# L1 z {* E& R# r: L5 @) p+ W4 k
try
8 i# q2 Q( _ }4 z {5 |% j3 C( ~ F1 U2 q
//---- Enter your callback code here -----( ]6 ~4 v) y5 a% b# ?
} J7 R8 B7 \+ {/ Q2 u" T9 n% `
catch(exception& ex)5 k. c0 x8 I) I) `
{1 j8 ^# w9 U+ E [ y7 l4 Q% k
//---- Enter your exception handling code here -----& ?- \1 _1 t3 e* N5 M& S
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());% O# g4 R+ A5 F% G( u- D: ~
}
" D9 E% h9 M1 u5 K1 J }
. k- F2 w5 S% P2 P#endif//USER_EXIT2 S. h7 X! |6 f* O1 ~
+ r0 y; A1 }/ J/ I- k, ` int Shrinkage::Show(), i: I8 j& T. L% A! a; w
{+ O6 K$ m* U' K/ C# ], ?8 v8 s! w
try- Q( F2 {- V- p# D) d" c
{; V4 B6 S; u% z$ Y3 E" n9 p
theDialog->Show();- | p3 J5 a' B# J
}, [: D, D8 m. {% R4 e
catch(exception& ex)
- G7 ^. w( u3 I3 r; ~1 l( g {
# {/ b X4 n* ` //---- Enter your exception handling code here -----
0 V) j S' C- ?& K% Q8 G Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());9 q& K; r! i0 {9 b/ H
}. M' j9 P$ k: f7 W! N! Q d
return 0;' X; a- J! a0 u5 S% p0 d
}
J% c' \( I' Q+ E
/ q" I* d! c. e5 l( y1 J1 D1 K#if CALLBACK3 j% A* O( D* v4 I' C$ r
0 l c5 B3 O: m# ^) e, w" a9 A void Shrinkage::Show_Shrinkage()- W# R* l) Q2 k9 U3 b
{
0 q" |1 O: X: ?) j ]' M try
, W; ?8 ]2 g" O* ]! b6 M {& h- D3 d' D ? q
theShrinkage = new Shrinkage();% L4 Z/ C0 l9 {- @
% X; }- N& ^( n: `& W$ }2 F7 A* Y theShrinkage->Show();
# ?' _+ h$ c; t# w: S6 t- m$ F* D }5 D/ L' d: G% X$ m" P& ~" w% Y
catch(exception& ex)3 ?% i* G1 K/ \ x2 B" \
{5 F4 N L3 e0 ~( n* d) }
9 V- X' E0 D% K5 Z0 L7 `
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());& ~5 X7 U2 S6 V
}
7 t6 ^% G$ `0 W4 ]3 d: R+ I+ n' H) p delete theShrinkage;
6 O* H& S. u* ], ?2 |- T }
6 N( p T2 w5 p3 Q: C; [% `- I#endif//CALLBACK
; {3 F" z; y1 `- g9 i
. k$ w2 t+ ^0 r5 q1 ?$ h+ _ void Shrinkage::initialize_cb()- G G5 G: Z& Y% v6 M" f
{
( y7 c8 e. H2 A8 ]0 Y try& h# B; t& z; u
{
. t2 y' S% j( B$ u2 u! E4 O5 E group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
% F j1 n! b- r- ]3 z9 h$ c face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));" d; h5 O( E$ H: q3 Z
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
; l, C) P/ N6 U/ R group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
3 Q3 a. I( T* n8 ?4 T- S, h bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
3 L- J) K1 j) |( _" r! x. m bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));1 z' u( R% F _ ]" _
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
: u5 ^ G u D3 T string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));5 U+ e" ]( z i0 K2 M0 e! `: E
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
3 N$ U+ l/ K% X" P. _ string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));; c8 r2 K: r) C
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));% q) y8 t2 X: Z8 S. \8 j" s0 U
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));: @ [& W3 T" Q
}9 x% A- z' {- s! M# i) V
catch(exception& ex)
2 C! @: V' ]0 ]' C, c- j3 ^ {* R' \0 L. e8 ], |% J+ {# K
7 b+ T/ ^! J4 Y" \
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());8 R& g2 N6 S* V3 S& S& ~
}
" U& h' G' q# ~3 ] }
" C2 P6 |+ O1 b( @0 p //------------------------------------------------------------------------------
/ {. P) m; S/ p4 N8 K$ I: N void Shrinkage::dialogShown_cb()1 S: |! @: e& k/ f0 M
{ A8 _1 r2 s3 I: t9 l: `
try
7 }* ^6 X; X( V8 u( J {& ~& `- F1 G! |9 G* v
//---- Enter your callback code here -----
- z1 M: F9 D* [* S }
* ^( L4 w& R; X% J. _ ^ catch(exception& ex)
# \' C) a* h" s {
# e. x1 F; y! l6 V, E; b" M/ ` T% X3 X/ D0 ?9 W6 Y I0 K
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());; c" ?5 x' m& m
}
9 N6 j2 k; w& [' b }
- H* i7 L! G( U; p' p ; ^. _. d5 d2 _+ d3 H7 ~) P+ l1 x
int Shrinkage::apply_cb()
3 M( H1 a( h. v! }/ F2 a) k: N {
h- q4 c( ]' A int errorCode = 0;
9 D y4 A0 \1 q# m1 k try. K3 Y! V0 q- V! X% ]
{
% B: |0 U, W3 L //---- Enter your callback code here -----0 v. T# G, o+ y# j1 w6 l2 X ^
} z2 B( r7 ?: g7 X+ w
catch(exception& ex)
& t) L: ~! j6 m7 U( F1 B {, c% A, q6 l! X4 R' @
//---- Enter your exception handling code here -----
! k: {* i/ E2 c% l2 o/ i$ d errorCode = 1;+ M( o5 P: ~* s& A5 X
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
2 {" q1 \2 c0 I) `+ S* B }& z4 `0 L0 N3 e
return errorCode;
, k8 o$ W3 v# ] X! y' J }
3 r/ H/ g X9 j3 \% u# W
* U/ W+ }7 } Q- i3 l% `9 m& f! N int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)# Z3 _, Q. n u7 \) a: r
{
# s/ C6 e. Y+ r; f) }! i8 N try
6 o4 D; B# {. H+ X/ u; y {* y, T3 ?$ T" z7 p6 B8 H/ M3 U- r
if(block == face_select0)
, X: P' Y; p# f# q {+ B, J" F0 ]$ h* I! E( }6 ]! i
//---------Enter your code here-----------
7 r# U0 p1 _: @! M }
% Q3 u3 c9 z( [, ^: d# [ else if(block == face_select01)
/ |: j/ l; W% ] {
" u( g. a2 ?+ z. h8 G //---------Enter your code here-----------
% w, a6 D+ s4 {. E. A ? }
* s9 {9 Y# Q& Q9 G else if(block == bodySelect0)
0 {* G% j! y/ ~8 U6 `1 x# W {* E; M5 ?9 F6 n3 @
//---------Enter your code here-----------
9 R: b- G% k0 Z" f% N: T% E }
) R: L$ d. }+ z9 r else if(block == bodySelect01)
2 c* |! x+ R& A% i, v% s {3 A5 Q9 j% Z# v- B- l
//---------Enter your code here-----------
- Z) ~7 s* S H. W }
& {3 S9 D2 g9 c else if(block == string0)4 r8 c9 p0 ?7 ?/ B! L/ P( I( A
{
0 h- x0 g; l" B3 _ //---------Enter your code here----------- A4 O" f$ o4 L7 F; l D: m
}) ]1 Y6 V$ b# d0 L6 }
else if(block == label0)4 e. M% N7 _/ {$ M5 }- z. j. w
{
0 P. \2 Z$ ]! R$ q) M, X* } //---------Enter your code here-----------) m4 a7 S- m5 \. u9 G. _
}
4 P! }/ h* E" j V% u else if(block == string01)
- \! g7 O% `4 ~) p: x0 }6 ~ {
7 `" m9 H& w6 r9 s! k0 a$ A$ |2 J //---------Enter your code here-----------% E' Q y% s9 S* q% f1 |
}
, A6 `4 c! G3 F9 f else if(block == label01)
# `: R, z+ ~# q* S* s9 B5 Z6 ? {2 d4 a8 B& n; J1 X6 u
//---------Enter your code here-----------
/ u- U, l3 O0 N e- ^( F }
2 q4 N. L# q+ E9 a else if(block == label02)
) n2 V2 u+ ^, g7 x* \ {; T4 _6 V6 k3 B2 o4 P( y
//---------Enter your code here-----------% j3 m6 d/ o4 y3 T9 w* G" m1 a4 d
}$ T- C5 t* L$ ^0 n- L9 s
}
6 r2 `; U9 |: e8 X2 F- N catch(exception& ex)6 s6 p. t4 B5 V) U
{
: F; \# M5 e' r Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());5 J6 H0 T& D% a6 h
}
2 V4 r& X* ~; C( A4 \# ~- e- Y return 0;/ f& v6 |% `, D
}) }! J/ F4 k6 D% b4 w
: o7 U6 `5 C2 e0 _% T$ F int Shrinkage: k_cb()$ n! C/ F) g5 ^, }$ W2 I! T
{1 P* j0 W. N/ {$ A" x- D; X* L2 w2 p2 I
int errorCode = 0;
% @- Y6 o ]9 j8 v try8 W+ m; p+ f H$ T/ U- B
{
' Z& W1 `7 h$ J" [ errorCode = apply_cb();, a" c' |$ K: j: P }
}
" m( B6 c; r! s catch(exception& ex)* m$ S. Q+ ~% T7 V5 a- {# Y7 M: H
{ h7 I8 w8 O& k0 v- A4 x h H$ U$ \
//---- Enter your exception handling code here -----, ?% Q1 U4 P3 |% `4 h
errorCode = 1;3 u$ n( O+ A0 s z
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
" @* q6 d G- c' \: C. Y }
5 b! y t6 k) Z+ x p return errorCode;
0 p/ ?2 L8 y& Z. B. \ }
( Y5 B: G4 F% v; k- ~ , R, h( w8 l5 S& U
//------------------------------------------------------------------------------+ B+ @2 n( w% N5 T' ~1 {0 g$ |
//Callback Name: filter_cb, n' \6 E" X% s& W v4 Y# w
//------------------------------------------------------------------------------% I9 @ T; @7 W- U! [" J6 X% E
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
" Q8 J* h# q5 H {
* w$ n4 \- s0 N) S! n return(UF_UI_SEL_ACCEPT);# X/ [( H( `# c$ \" C. O5 ]* i
}, ]3 B; ~- b5 k1 ?1 W; w( m
" s' \% U! c1 g8 A
//------------------------------------------------------------------------------- p( q3 [& B7 k% R) K0 H* w: l
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)) _# U1 D! l9 y5 O' z+ V4 a
{7 y; {% {6 F' H! `
try- H' r% y8 K& H- V! f- S% H
{% h7 C% X: F4 Y2 z4 }4 M/ ?
//---- Enter your callback code here -----
4 n$ a% i. J' I2 i3 ^) i5 z) i8 j }5 }# L3 A. l& ]& Q! W) x7 F) {
catch(exception& ex)- a( T6 _1 ^6 p- {
{: q1 Y& C" f' p8 g5 p
//---- Enter your exception handling code here -----1 R- |' x0 [ l1 _4 S+ ~& ~/ z( R
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());, `+ d( z$ F: k% v) a
}! t" L6 i, E$ x h b& e0 @
}+ q9 C0 {' ^/ B
7 O0 T6 r! m. _0 Q+ d //------------------------------------------------------------------------------
) [$ g; W. T( L4 { void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus). A( d( X X) r3 i5 C. v7 }0 y
{$ {" R3 Y+ h3 v3 I
try! k" N4 g* A" m; [! W% L! } x
{! v* Z! m+ g, M6 a7 g
//---- Enter your callback code here -----
: G0 F( G9 i5 p$ w; [9 s$ m }
0 h4 ]9 {* A+ L7 B catch(exception& ex)6 B, F+ i8 k* V' y ?4 L( o
{6 |2 P+ O. Y5 e9 m! u. ]
+ o' u! `1 _. z( l1 m8 J2 X! C
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());5 O9 c6 _1 \9 E9 P7 \
}2 Y4 C% L5 c8 {, a% d; Z) x2 o
}
; w& J9 B5 X( a# H& m
8 }: H9 Y: O6 i! E8 |; v
. P' K0 |$ o: B5 T |
|