|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 ' M$ Q: p v6 f; f9 v- G) l9 c
3 K; E# N* \( P% ]- ~- T" C! O请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
! N( {0 w+ z7 I: k& M) u" s代码如下:9 R: ?/ [; ~0 L% @0 U& a) J0 {
#include "Shrinkage.hpp"
0 [: b E& e$ ?6 P6 o, @using namespace NXOpen;; r" j6 ~! I$ S
using namespace NXOpen::BlockStyler;* v; G: N6 t4 s0 i
2 U. Z; e; [: n7 R p1 q( _
Session *(Shrinkage::theSession) = NULL;/ a' B* | S" S+ ^. _6 S7 U
UI *(Shrinkage::theUI) = NULL;
W) [5 a) E" l* v; m0 x$ v1 z
J* {% {8 z& x( w6 V- ], B! I0 HShrinkage *theShrinkage;
! V8 ~4 N9 {- i% B
! G) e; x3 G- G( r6 V- F9 oShrinkage::Shrinkage()/ x2 m# q+ ]- A& j3 H& N# I7 H
{
' s% D$ U/ a0 ]$ O8 S8 \ try
: u0 Q+ J( b4 F7 R; x {
& k0 Y! V P7 H // Initialize the NX Open C++ API environment+ E1 g" x. j% \1 J6 g1 U, C8 j
Shrinkage::theSession = NXOpen::Session::GetSession();: V7 y# W" l2 c3 e w. ]9 Y
Shrinkage::theUI = UI::GetUI();
4 k- y2 Q! C. E9 B theDialogName = "Shrinkage.dlx";
- L' l. Q) \! D theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
& C \; _8 C( @* l- _ // Registration of callback functions
; K) F3 @) E; @& ?0 |) ~: A: P- j theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));% T1 D, u* }' f" }
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));) _! j$ r7 Y X
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
4 E) A. g0 t" ~" H: n; ?$ ~; g: ~ theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb)); Y2 V2 q* H# `* U/ Y2 K$ d" z7 E! ~
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
+ \' a" f) \; N) e% n theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));* |& {6 R8 O' \
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
1 O: O5 x) L' h+ C) E theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));9 z/ d3 \. Q) C8 @! t3 ^( L
}' _, _6 q% u% {( g3 E g
caTCh(exception& ex): ?* \" z) S( T, Y2 L, B
{) {! _, P8 _8 h) B, T
+ ^' v0 u/ Y3 {4 a throw; L! R2 D( i/ Z) c. F
}
, M+ T! B2 q( W2 z5 H}! f9 X2 |: \4 f
o. o3 A S( i6 m$ M! [; ]Shrinkage::~Shrinkage()( m8 `4 r& g! `/ q4 i
{! q& w. ]9 S& l- ]
if (theDialog != NULL)
) x: k2 | V V& @ {
) I+ R/ T5 O8 Q) Q7 u j0 R9 Z8 d delete theDialog;
i5 r) Y% \: P9 @$ ^ theDialog = NULL;
* X2 u( b" P9 ^ }8 {' _3 B6 M; L+ x/ S/ \
}
! w9 m$ C0 O/ X' g# x+ F
' n6 ?+ s2 b2 ^#if USER_EXIT_OR_MENU9 M6 W; N* W% ^9 Y' M' Q$ Q9 `
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)# b0 @' Y5 E& G1 ~' ?( Q" @
{6 b0 r% c7 k4 h M& ^. H1 P
try
- Z7 u5 L# ?" v$ p; d% p7 f {3 x, E0 V2 ^4 K t7 K% d) _
theShrinkage = new Shrinkage();
4 q& J: J: ~; s# f, O // The following method shows the dialog immediately
( W$ ~ c: k! c; K0 d! T: R8 C7 q theShrinkage->Show();+ A' w/ K0 L* J. Q2 P" y7 b
}. e! n; [8 O1 J) u8 F3 j( Q
catch(exception& ex)5 M; S5 R: d# {+ b0 T, h+ A: g
{
$ [( R' _: D3 h* H3 J3 Q1 m9 m //---- Enter your exception handling code here ----- j- e [/ O. [* n7 i2 C; f
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
. J+ }3 ^# t% B. D. _ }
$ J) x" a3 B3 V. h( O delete theShrinkage;
- G4 o, B' H$ c2 f }7 X4 v& I! W) g! }& g
#endif//USER_EXIT_OR_MENU. |: V* z% \! [$ M* G
#if USER_EXIT/ i4 |' G1 N- Q% k3 |3 U- e9 O: x# D
) ^7 G; H9 T% l5 X# h3 d/ D F6 H) D$ C
//------------------------------------------------------------------------------+ k6 z( x* y$ u$ o- W3 e& p
( a0 b: ~# d |) T4 H
// MUST NOT use this option since it will UNLOAD your NX Open application image
# T6 v' T# ~ Y. J1 b9 q4 F // from the menubar.5 M& @5 d$ h% [2 D
//------------------------------------------------------------------------------6 V" p( d: r- i. V/ H
extern "C" DllExport int ufusr_ask_unload() X4 \0 g& `% |' }, v6 \# r
{
1 F/ K* U- a' j; o //return (int)Session: ibraryUnloadOptionExplicitly;( s6 F: b6 Q- R
return (int)Session: ibraryUnloadOptionImmediately;
9 B& @! b: S/ K3 q0 e/ [ //return (int)Session: ibraryUnloadOptionAtTermination;
" v: m" d) M! \: h" t: Q6 [/ Q }
$ v! t, l8 o6 d( ^. h5 O1 V0 r
8 P& |2 g5 E f! X: D- D //------------------------------------------------------------------------------
0 V' D9 I" j8 [# ~1 T* H5 c // This method is automatically called by NX.
/ s; ]; J! j _2 c //------------------------------------------------------------------------------
8 S8 Y" }: ?* w# W$ v extern "C" DllExport void ufusr_cleanup(void)
, f5 U1 e5 l, z0 ~! w& J {9 W: v* M: p( e9 n8 l7 }" y3 b
try1 O7 B5 o- K1 C2 }
{
2 M, U6 m6 q4 _, | //---- Enter your callback code here -----0 j3 E' f2 ]3 G% x% Y: P2 a
}# {5 g! K/ T8 c) N
catch(exception& ex)# z7 I, A' X& }5 v: j% C9 K
{
8 c9 K% z9 N. t: p0 w //---- Enter your exception handling code here -----
5 {* l0 e. e( Z Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());& Y. m2 x: [" S$ x, S2 T# f0 B! `1 d+ \
}$ `& ]8 S0 ?: p# B1 l
}4 a6 z0 j. K1 ?) d z$ v2 ^- n
#endif//USER_EXIT4 o* W# e( a& O6 ^
! T' s" G4 Y4 L. e1 Q int Shrinkage::Show()
% [) u* r( p: ~5 J: M6 h {" k; v9 c5 s( S
try/ ?2 k8 D3 |' w9 t
{
; A V1 I- c' t. P$ w% Z1 P theDialog->Show();
- K+ a' u3 X! B" O# Q6 f }# I) [ e5 n d
catch(exception& ex)
% n0 Y# v) F) Y0 e% P0 r. t {
4 o7 ^ D( S6 T1 ` //---- Enter your exception handling code here -----7 i* I3 U! I1 `2 S
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());0 I( V ~. V- {% }. ^( @* v2 t# a' k6 N
}
: T& _; i0 M% H7 U3 ?# @! \9 T return 0;6 a* i$ P$ H+ v; Q7 r% z, C
}8 }1 t3 F* X y6 J
' ~9 y2 S9 Y, ?% r+ b, C#if CALLBACK
- @: U1 @; {# x1 W6 d m& P; D( H( I' z( O: H$ K/ M3 C
void Shrinkage::Show_Shrinkage()" S6 _4 x. j) ] s0 ]' k- u
{! r( ]2 i2 ]$ l2 X* i, ~
try- n" V( S' P5 n6 A7 e' b
{
3 b" {$ g' B4 j5 Z6 H: N theShrinkage = new Shrinkage();
1 G' x9 d; m; {, F
7 |% A( k! S' O8 p3 p5 f1 { theShrinkage->Show();
, j( }( j3 a) q6 B. `, X }! _* x& B( }4 U7 n
catch(exception& ex)
; L J8 K3 T0 t/ H9 B" p {. b" A; r! e' m( k, `
( ^0 ~& p" i: T% ^5 E
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
7 b1 {5 M* j6 N+ }# f. ^" w } l/ h% y, Y" J
delete theShrinkage;5 w4 L# l! y6 P, }" y Q
}
4 Z& ?; |$ A( W; G: r& }% u#endif//CALLBACK" g; }0 Q" W+ V. u9 Q/ }8 @- G7 E
. {2 ?6 Z* e# O$ c# v ^ void Shrinkage::initialize_cb()3 W {. \0 x6 f1 C0 d# Q: A
{
* `0 u* i1 a `3 M, f+ B1 E( B( @ try
6 s3 H# _2 h5 j { z. P/ ]6 ]6 H E
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));/ ]- {+ g6 B+ A X5 f0 Q4 n6 i
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
$ \9 o! ?# d% ~, M; d% a* I face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));) r- P4 v5 v" d
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
7 P, O+ O O. J; R# I8 H( i" K bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
7 R: s" m1 V- C4 T* `3 l bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
2 h- I' W+ e2 H% l9 K group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));4 G9 Q! M& ]: N
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
! e' C5 ~9 f' }( M; S8 I( J label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
* `. i& {, s2 h- e2 ~ string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));/ [4 [( N2 M k1 q
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
, M* L0 q# r0 |! m: y9 t) K3 } label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
4 J \4 @; a$ V& s }6 {( b' Y( {% A0 E& L, `3 R& s
catch(exception& ex) ?; A: D# K5 p% C# a
{
% N1 A; e! C! Y4 R5 Y; G 4 q& p( Y8 ^ z8 U5 }: j
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
4 z$ X; y: e4 c+ f2 b* T }
- r/ h% i9 Y; | }
% ]5 z5 @0 @( ?$ Q& y) `7 V. I. ` //------------------------------------------------------------------------------& P; D# ]' R8 { _
void Shrinkage::dialogShown_cb()6 s! W# @; ^3 X0 `, {+ x
{
" U3 N" O" i5 O( D9 a4 M* ?2 ? try
" n% i9 X% E. g3 A {9 D) {' |6 x: a7 u
//---- Enter your callback code here -----0 }! x& m) Y: E8 H* N
}) C" ]. _5 w8 `7 a$ o* V
catch(exception& ex)
0 @6 g- h- ~3 m l5 R! d1 y( ? {7 M# ]' n+ @9 r4 F
$ c$ R$ ?1 o# r+ d3 T8 U* P6 r5 t- ^ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());; y! C; M) E& c1 u
}. R2 i% G+ U7 X9 Q7 C) M* h
}
2 \; [5 M) {& ]: j" m$ {7 W
0 Z# J; D, N+ m/ d4 G int Shrinkage::apply_cb()6 t x2 B+ R$ k3 g7 b/ }1 C
{
' U) ^- b" Z5 K6 p0 s0 Y int errorCode = 0;
M- C6 Y! S* {. I* M* m) ~& Z try1 `$ D/ ~8 q& C& n/ \
{
% M) \5 h" J/ W //---- Enter your callback code here -----
# b4 m/ k; z- I2 h/ Z }
' G2 F/ Z: _7 s% @# k catch(exception& ex)3 S& ^& s. y1 \& Y' y) f
{3 P! Y5 W( m7 h4 L' s
//---- Enter your exception handling code here ------ O; ^! G. p0 y9 F& B0 B
errorCode = 1;# I/ X6 u* H7 p( p+ K8 |/ B; U
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
. u8 d' D& A/ a; q }
# V x) ]$ K6 N7 [& Q, Y return errorCode;1 M; c4 S: F/ X3 ^; l
}7 R, \+ r6 W1 E$ j0 `2 q
* a9 ^) ?) |, A( h8 r& M, T! M% Z int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)( L. ?' B( V& r( U
{
- e$ j" p, q9 l! _, W" {8 V7 l. K try
8 w- Y( b/ j. b- A9 e# ^ {
' y: B. w* X! r- g4 X, T if(block == face_select0)
$ G6 y9 ?0 h/ v6 U0 W- V4 }( e {
, @; y3 }! t z8 ? //---------Enter your code here-----------4 a- F3 Z: e8 f3 h$ G2 w8 T( ?# G6 i5 k
}
0 o6 R9 o! n' j5 b$ ^# @ else if(block == face_select01)1 @0 m' v/ w* z& \2 c+ C
{
+ `# j E( v4 a6 n! J( m //---------Enter your code here-----------
5 d6 Q; V$ ^6 r6 m' Z N }: A$ B& s( j* d5 ~2 i+ E5 J
else if(block == bodySelect0)3 c- F3 ?8 R! m3 h
{
# {6 L) j* ^2 Y& r //---------Enter your code here-----------+ u: r/ A5 c' N$ k
}
; q4 c+ e1 |6 J0 r, E else if(block == bodySelect01)
3 r+ e9 F7 C* H9 U0 w& r* Z {! O# j; K! k. A* l( t1 l
//---------Enter your code here----------- p( c& K- I: q
}0 H/ }; {2 S6 b* f5 w1 V; i$ d, W
else if(block == string0)
# I$ }8 ?4 N! n# F0 j {4 ]: D9 `' v; p% r
//---------Enter your code here-----------
+ v- Y) U7 N. U9 x J( k/ O- y* e }# b, S9 l5 J o% N8 C3 }3 C6 |
else if(block == label0)" \. P: h3 t9 m* ~0 k
{& j/ J! B* x, n& y
//---------Enter your code here-----------
3 K* C$ C5 i* l! `9 q }
& J' n- K6 R- o E2 A2 Y else if(block == string01)
' l9 L" M9 k& o c0 u0 [3 b {
2 i3 u- K @4 h9 G5 {+ i+ j //---------Enter your code here-----------
& r! f/ X1 V; c* T0 a& v }
3 w: m# C v E1 a% n1 V, O else if(block == label01), a- h6 T; J+ w. X, W, z
{
# B6 c) i/ O6 `. `! W //---------Enter your code here-----------2 Z6 X" ^! p. g. E t
}
8 G+ R2 M$ U# z* w% l4 J4 b0 ?: z else if(block == label02)
2 G1 c5 [7 f* u0 Z {
" a; Y$ C% ~+ u3 U& s6 ] //---------Enter your code here-----------$ Q! G. }1 X0 E1 S( s
}
8 ?+ m- A/ r M# i1 t }
* O+ l; n7 V0 F( x/ ` catch(exception& ex)
) K! A2 u; R& L: S( ?& f {7 l! ^, X: ^$ F) J& y( ^! q
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());) Z3 }& T6 N( k( p: K
}" _ q8 e' s4 H
return 0;
% G) N4 }1 j" \ }. t. s5 S) f/ l. V7 \* J, I& \
% E" i' @9 N0 S) A
int Shrinkage: k_cb()
( {) X9 m1 C: B- I {. _; T$ c2 X' n( x7 T0 Q" q; s/ @; \3 m
int errorCode = 0;; V) x/ G* k6 |' O4 m5 A; d
try
- K+ n1 ]: J6 Q: m8 x3 F2 ^/ W6 T {- w2 K* T$ Y3 n0 @2 N7 k/ a9 V [
errorCode = apply_cb();0 R8 G: I# n# V& z- u z
}- r0 P; O' K& e) D( J, D9 \
catch(exception& ex)! F- N/ k; h5 j f* A8 U' {
{
J; m2 r" U \5 \0 k //---- Enter your exception handling code here -----
- ~$ b* X D. n errorCode = 1;6 I6 Z. D/ f& l' ^6 I
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());3 m9 p9 y# i9 B9 A1 t
}, c/ h$ z; D' r
return errorCode;; @$ v7 m* P" j8 {
}
7 f0 U7 X4 x' H9 c ' c3 J3 O& t: L- k1 w
//------------------------------------------------------------------------------ U7 z9 }5 u! c7 g/ }2 C8 X
//Callback Name: filter_cb
6 h6 q3 C; q) S/ f3 j4 r //------------------------------------------------------------------------------2 V6 @9 k$ e3 X) {* ~
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)7 T/ o; O! d9 I' F
{' `: O4 ~+ T1 H: k9 R$ P
return(UF_UI_SEL_ACCEPT);1 J& }+ [% y3 T0 \
}
. H/ M3 K6 l+ b5 s/ ^7 z # |: z1 l2 f1 N. }- T3 D
//------------------------------------------------------------------------------
8 r3 {* I/ Q8 q$ m3 J7 Y1 X# H void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
4 E1 C8 l, M" a2 U {+ N" B5 E, i* x! \; ~, @' h
try% n6 l: g0 l; H6 ]# z* w
{! P/ q0 |, x4 i, z2 H
//---- Enter your callback code here -----2 q# e" ?5 E% t5 ^
}
: L5 ]3 l2 y& H( c1 _' K& m+ G0 b catch(exception& ex)
2 r8 _& [ B+ Z* S {! D! E0 c& M1 F+ m
//---- Enter your exception handling code here -----/ A3 R0 r/ A6 G% I1 O& j# z
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ V$ v6 F8 P4 r* K }
/ ?. J$ R' J; `+ N: Q, o }
4 x E0 L9 T8 r ?+ J- C- l9 d 2 n+ ]3 V; I/ \* Z& F! m0 j
//------------------------------------------------------------------------------ y% H# |* p! G
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)2 S/ z y9 L* ^4 t1 l6 T* }& B
{& J4 R# J& f4 S% @" g! W# e5 t
try
4 f7 N. V* o5 f& G- S R; \- w {- b6 q$ V) x' g" {! W7 I
//---- Enter your callback code here -----: \; @9 w( S9 L8 a R {( m
}
4 u# V" V. ~/ J! Y- B4 G" h catch(exception& ex)
. A1 E: u) r. u1 C e6 d3 R {! q9 v1 [1 G8 ?
8 U. g* K" q+ v% J
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
# I: l* m! k' V9 O5 c7 k }! ^" ^) g+ ?6 m! v
}
4 B+ I5 E3 z. p3 b2 x7 O. E9 J1 s! @' o& U/ |3 y- D
1 V4 a. @: d' ?& g6 n |
|