|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 : v, M# M+ A* s* l/ ?- t! ]: m
& w R' w( H4 Q0 h% A
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
3 e. e2 }' |7 Q- ?代码如下:4 U8 E+ P! W' J! k6 I( h% C! K
#include "Shrinkage.hpp"
$ ?4 U# ~2 [0 X; {. Wusing namespace NXOpen;
! P2 B, k4 ?7 wusing namespace NXOpen::BlockStyler;
( M/ w' _5 Y/ U" Q
* G: @) w; u9 O% I9 B( U& ~% q \Session *(Shrinkage::theSession) = NULL;
2 I, k& ~8 l8 }) EUI *(Shrinkage::theUI) = NULL;0 ]& y+ O6 n! i' w$ U6 Q
9 U$ W* |: k8 Z3 o" C* B% FShrinkage *theShrinkage;# I7 V) m1 ?+ m4 u. I& O
8 J, Z, R* q3 `: H2 s
Shrinkage::Shrinkage()( ~3 E4 u k, O4 O
{
: a( a- _; O8 i- k% S" f try/ y9 Z U1 P* f6 H) v' t
{( R2 R2 M& w O0 G) w
// Initialize the NX Open C++ API environment: z2 V }9 j! @: H {/ W/ i
Shrinkage::theSession = NXOpen::Session::GetSession();
$ f" V3 d0 Q$ `' S/ [ Shrinkage::theUI = UI::GetUI();
# h+ _+ P6 t% W$ P! J+ g5 q theDialogName = "Shrinkage.dlx";4 T4 y/ X' j/ u/ R7 U1 F+ { d
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());9 q# U( p- O" \' s8 a6 n( \9 _
// Registration of callback functions
. ]% l0 A. S, O% _" q, U+ q theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));4 h I) S9 B6 b
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
% Y! N7 T; @" c! ]6 M7 m theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
0 @9 [$ D9 a" L% y' c+ ?5 T theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
1 I/ j! O6 o7 g" U# | theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
' g( P* H6 B, u( d, _ theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));9 d3 m7 \/ g: H V: v, F9 t8 Q
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
$ ]: D, F! {+ E0 v" @& {/ w* F/ D5 | theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));/ |1 t, n3 B$ E% \* \* i4 u
}
/ p# S5 `( C8 [+ a% S0 B, V caTCh(exception& ex)
0 |* | `6 Y6 ^$ W* h6 Z( {) z {5 ?7 D' C7 H0 s
! \% ]1 t& _& v$ W# n- j throw;
y* X# k5 q# c! e9 K/ n7 p }
, v, V: ~0 x; t$ Z& V% a3 h8 L}& e5 A% I, G4 c- c
9 @9 R% O/ Q9 |/ b- P5 C3 }; ZShrinkage::~Shrinkage()
+ i; c# j$ ? T. r( P! b# Q{
|- k/ M0 ]8 T if (theDialog != NULL)
1 x s" K q4 f- ~; t: u: [2 R {/ d$ B3 X. [0 L
delete theDialog;
; q% U5 h& g! r+ U1 F theDialog = NULL;! s- m9 C/ Q% M8 `' z" C: J
} {! e+ d8 U6 U1 h
}
( S5 w8 h$ ^0 T) x8 }
; z5 W1 @9 t k! k% [" K6 R#if USER_EXIT_OR_MENU
: d# H! v! k) l, ?! Q extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
& u6 E4 C# Q h8 I: R { \5 x- Z% P2 s- B# o) ?
try2 E2 Y/ i; b; @9 ^' T+ b6 [8 Y
{
$ v. T4 F O8 N/ R" H9 O" d: Z1 B& X3 @' g theShrinkage = new Shrinkage();
# Q8 X% @( Y1 U9 C8 f0 j // The following method shows the dialog immediately
6 J2 ~% ?& |/ z% B; y5 n theShrinkage->Show();
! v$ n3 t' q1 C/ E6 D) q }
/ [0 d5 f# e8 S8 n6 t catch(exception& ex)
. q [' V3 A3 \' c9 J {
# z( ?3 Y0 j5 H* F //---- Enter your exception handling code here -----
6 ^6 U; X: L! G4 P+ S% V4 \8 { Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
E1 t1 R9 @5 q. ^# r/ F8 R! B. c }4 u9 C8 K& z" {! ~, O, V m
delete theShrinkage;
w# p$ u' x" u+ p }; `( F0 [% _; k; t/ k
#endif//USER_EXIT_OR_MENU
# O3 Q/ S( ^1 U( j#if USER_EXIT
2 O5 U( `/ ] I+ O3 N1 I 1 Q/ |+ n l/ W! w( {
//------------------------------------------------------------------------------! H% W/ Q; U) g9 b, r
8 p3 X; h! T2 v$ A! o+ i, n7 q# [; K // MUST NOT use this option since it will UNLOAD your NX Open application image
" Q/ L5 u d, G; k! A // from the menubar.
/ A. H$ v4 [ _8 v //------------------------------------------------------------------------------$ C7 q6 g) X, e5 `+ g
extern "C" DllExport int ufusr_ask_unload()8 X! N+ e% N. _+ M
{+ _$ P5 R! l8 ?6 {2 m( v$ i
//return (int)Session: ibraryUnloadOptionExplicitly;) Q7 R& B+ W+ Z$ Q3 p
return (int)Session: ibraryUnloadOptionImmediately;0 u. ^6 w1 d9 r! P
//return (int)Session: ibraryUnloadOptionAtTermination;
4 Q9 K/ F2 J: K' h$ Y9 U$ J3 ` }
- }" Z; Z: O" Z; L. y3 Y3 I * r W/ o6 }1 M9 ^1 `8 }6 c# c
//------------------------------------------------------------------------------
) I9 s& ?+ b; D! K3 C! _ // This method is automatically called by NX.; Z: o/ I9 E6 n/ S: y, q# p
//------------------------------------------------------------------------------/ U7 h" B% j% Z+ D+ u
extern "C" DllExport void ufusr_cleanup(void)
$ @3 K7 @$ y" t) b$ Q, }- F {) R$ X8 o$ ~* r/ c6 `+ L
try
$ M7 j( k. `4 r. _ {
8 G5 E# ]2 g3 H! P U( ?) Y3 i //---- Enter your callback code here -----
! n5 x: w: b5 K8 {- k }
/ Y4 Q/ K, a* \- Q2 }8 v, Z1 ] catch(exception& ex)7 q4 y8 t7 L* N% a
{4 G0 e; T4 [7 [+ T- [( P8 C- F
//---- Enter your exception handling code here -----
4 F- j: L/ C, e: C. @ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
5 c8 @5 d/ Z4 l/ U, |) `/ G }- X$ o% X- r/ w/ z
}: N" n0 D/ K1 i" I# J+ P
#endif//USER_EXIT0 O' s0 G0 x p% N- Q4 I
+ J8 O1 [# e4 t3 f) @- x int Shrinkage::Show()
$ I& w% _+ \$ L: |- a: Z3 } {5 E2 f: P9 ?* M
try9 d5 m3 V2 T& B
{
% n) [- p+ K. X theDialog->Show();
4 m1 u! M% U* |7 j6 n }
5 j& r) h4 N# @6 J: c G; F catch(exception& ex)
, \# B. ]9 K1 G- ] {
. O% `* u% i. e$ x3 s //---- Enter your exception handling code here -----1 ~( b" y% U& B8 [. N/ D# b
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ m. ~6 J4 ^2 o% l- @ }
; v7 ?* M% [1 i7 t1 k& T8 t return 0;' v y3 M* R5 V9 [4 p6 _
}
0 P3 b4 r& _/ d7 c3 ]8 \1 G
3 Z1 E: C3 Z: g#if CALLBACK
9 z, h/ G! L8 e
4 r3 p8 q( {5 E, j7 ? X2 |( F void Shrinkage::Show_Shrinkage()$ n8 p, o1 T: `( s8 x; B9 F5 {' P
{% u) z8 I8 L! s' f) Z1 l
try
6 F1 l# I" d* o% Y1 m {' i0 X6 y6 U& Z1 u& L& ?
theShrinkage = new Shrinkage();
. [3 Z& ?2 s0 g) ]6 {& e8 S
. D4 Z. G# F' ~' x! z/ Q0 W9 C/ U theShrinkage->Show();2 `8 w8 [- }9 D, _0 p
}; X4 q( y) V) Q( ]& S2 ^7 \
catch(exception& ex)0 Y2 V7 f9 T" p2 L F! G
{
5 `2 `5 }1 ^2 N( j$ y7 t3 \7 q! x j- p$ K6 w% U% T2 I, ~0 z/ A
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
% J% c7 F* p+ {$ ~9 G } J S, Q6 m0 N0 V" G$ T( ~7 i
delete theShrinkage;) z& V5 g1 M9 a* d* |! x
}) v+ d& N) Y1 { _; {+ X
#endif//CALLBACK" p! ^. R% U% q5 S# ~5 K6 V5 C
) _0 y4 r; Q5 R+ y7 f( N2 l
void Shrinkage::initialize_cb()& k" U; ~0 {5 h7 E/ R8 g( |
{
$ r$ j. U7 K' J& f3 Z- i3 ] try
/ ?) ]# q' l4 T7 @ {, |& z$ R {
& J( y- v( P, I6 D$ C group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
% G ^ H8 f" E. O face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
( T& w" @( Q. ^1 N( ] face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
1 b" }& }! J. ?- h( c8 R group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));3 A0 l* I# t7 e! I" B0 L8 W
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));- c$ ?" J4 U: ]& E. u- B
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));" V& k& w9 ]7 l% \5 d, O: J; Q
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
, i* S }" f/ { string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));2 z# {/ g4 g; Y* R
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
/ Q1 b" `3 W5 W3 ^+ R string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
2 S9 V) n1 ~) G% k$ ?: e label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
9 c Q4 m: J4 O label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
3 ~/ @+ t" O+ _$ ^- b* r+ x }
! A* @) J- I; q8 a1 B/ ^; U catch(exception& ex)
2 |6 E @. d# Y% j7 ^; | t6 f. q; | {
9 W! C+ g S6 |4 \& f7 a( I. S
" j' W9 D! K/ T9 C4 v1 _4 J Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());, c; {4 j3 I! P8 |
}! [ H" m8 u# L* D$ N {3 x* S
}
4 P7 N1 h$ h2 K9 f, z+ x //------------------------------------------------------------------------------; M; P: y% e2 C2 N6 A
void Shrinkage::dialogShown_cb()4 v" f# d4 b$ r$ D# n" q# R
{( i5 K' S( y5 a$ g$ n* e
try
& M1 l' I5 \8 j0 t$ T {
& E. g- N2 I' k8 E" N //---- Enter your callback code here -----
/ s3 Q+ R! h8 J2 m. m# ] }
3 I- x! `* s9 k( P8 t0 h: _1 \5 X3 I catch(exception& ex)
- U0 x% x& I. s! E {
% K, Q7 v' { e4 A2 y6 v% [4 L0 w. [! Y0 O
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());' y" \0 x7 l. L6 R' C
}
# A% z0 {6 l* o, R& j6 c1 x }
! t* J* @5 w8 f- O# J. C- F& u; {
8 h5 a( U5 x$ Y( g4 \: i# w int Shrinkage::apply_cb()
: B& s3 @, o+ L. G {
# J# m6 e3 L* ` int errorCode = 0;
3 m* | @/ [8 L6 _ try
' g) `: q6 W. K$ V( l {# k7 X) d" @/ v# Y! c$ d* }) ?( u1 R8 ]
//---- Enter your callback code here -----+ S. G" v. x' h
}
' ~. I, w/ b, x" ]1 ] catch(exception& ex)% A9 T/ W y1 a
{, e$ k' B7 @( x2 X9 h
//---- Enter your exception handling code here -----* B6 G9 d7 J; F0 r
errorCode = 1;
' Q7 b; V3 J5 ] J) n9 e' W, o$ ^ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());& r/ X4 t- c! T* |: p7 {' t+ w
}4 T1 ?) k$ U4 o
return errorCode;. ?' \) A9 I5 k g1 w8 Z- w
}
7 u+ B, g! K, ~
6 a( d3 y( ?2 E$ H int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
( d/ ~2 j. G. I7 z) p+ y) r {
3 @; w, M4 W7 T6 R# Z try6 j2 a: S+ i8 @1 J" X1 I3 I2 G, M8 ^
{9 f" J7 H, N# P6 F. z
if(block == face_select0) F! A8 s9 L0 s& b$ y. N" ]
{- J7 m# {) Q- _; ~
//---------Enter your code here-----------
; ] r9 K6 N9 }& g7 D4 L }1 c# \1 s2 i- Q: n6 |' K) f
else if(block == face_select01); F& Q, a. I ~$ |4 N( t9 T G
{
. l8 K8 t" C& z5 E //---------Enter your code here-----------
" Y+ e! J& ]& m! B5 X; s }7 v: u% U& {% p; g, K/ d2 e
else if(block == bodySelect0)
/ q+ \$ O! E n) c+ @. Q$ T {
8 @0 g" r3 }/ H6 A9 X: J //---------Enter your code here-----------1 N. X) E4 { ]
}
/ M) ^" x9 \) ] else if(block == bodySelect01)
/ ?' E) ?# H$ ~0 S5 u6 p+ i9 r {
* v5 y) K: A+ L' ~) b //---------Enter your code here-----------
, r- R: `5 G! M! U4 v$ K" G5 } }# x8 U+ ^0 ?6 m1 `: ?9 w5 H- u
else if(block == string0)
! S1 k! g7 T; n G1 H7 N6 G {
' b5 Z4 B ]) t/ @; n: L) t //---------Enter your code here-----------. e+ l, H$ [& V* E' A/ |0 b/ C4 R" S
}, }: t: f& G) Y$ G) ]
else if(block == label0)
/ ]+ O- J' s! n3 Q; Y/ ?/ t {
i9 S- F5 ]2 V4 G //---------Enter your code here-----------
* Y& m4 _$ Z- g6 v }
1 t2 E2 C% P, J( g. N else if(block == string01)
4 M$ q- q( U. `* o3 q { {
5 H; T4 @' a, \ //---------Enter your code here-----------
* O' z5 l/ W+ F }
6 h( K* c1 |; c% @" i* z! `3 x else if(block == label01)
/ |% B n/ s) L! K& p( Y J* s8 W3 E {. X2 W, w& e3 w3 T% W" Z. g/ ^% U: l
//---------Enter your code here-----------
8 X" n( l4 @5 u- q L }8 t8 t) q8 i1 g6 p
else if(block == label02)
9 Y6 P! j5 a$ r a {' Q) y) m ?6 N5 g& w1 L) ^& S
//---------Enter your code here-----------3 }8 X/ t- S" Q
}
@' ^* ?. a' n }
2 _5 J% _: h0 x N# | u/ f catch(exception& ex)3 [' W# c( E$ ~
{, E1 z! N8 o9 ^
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());0 ^/ ]7 e; o) J* ^( @: m
}" {* Z$ L, {$ Y, |: H" f* x
return 0;
* @3 v" j6 R. Z! [' B }
. o9 B" X+ |3 @+ q & N' L. m6 g6 j5 j. D' z' r
int Shrinkage: k_cb()
, A, p! _, O P% L/ n4 t {) S' z8 x) m/ ^! {5 t9 L8 T# B
int errorCode = 0;
4 `9 c: f8 F4 q: G% Q try
6 s, u& L( _. g& u! n) J. I3 ^ {
( P; S4 d6 {) e. W" Z q7 i. a, g- U errorCode = apply_cb();
: N0 }; V# z6 o3 d/ I }
) |1 `" j6 C+ y- n _% r3 p9 T catch(exception& ex)
2 \9 m. L$ _3 O( j5 |/ h {: A" r+ n9 b! _
//---- Enter your exception handling code here -----
, l' Z/ a/ w Q$ S& X errorCode = 1;) a k% F- n: @+ o
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());, p8 `$ v# i' r5 B- ~4 o* o4 c
}) T. W8 C: c- l+ g" K
return errorCode;" B5 d; u7 a: m
} b& W6 R) U+ [" c
4 d8 A) M& ^; x: ^! N //------------------------------------------------------------------------------$ o5 r( g9 v8 t9 N" b+ f3 ^
//Callback Name: filter_cb0 g8 X7 m/ f. w6 y1 u/ d4 {
//------------------------------------------------------------------------------
3 l: g% J2 z- p( S' b* W int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)) { N& Q0 S3 ]/ _/ e6 p
{
' q: t) k8 D' d- B' E9 d' d return(UF_UI_SEL_ACCEPT);
' k* a% n" S6 M" B# s }
2 c0 ~3 Z n3 P' e2 W3 N0 X4 w) g
' z, w# _$ }) ^! A$ v //------------------------------------------------------------------------------
4 `* |8 T0 q! O2 f! [5 y void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
! f0 r9 r) a8 Q# q {" d3 K5 x% t9 o# F9 M/ A% a4 M7 ?
try
; d+ g4 v [* ]! p {& k0 S' }$ J0 Z" n# i9 D
//---- Enter your callback code here -----. P# T8 q8 Y- L0 V. g/ C6 Y% {
}0 y% R1 D1 |, c$ g3 Y5 y x; Y
catch(exception& ex)& T2 ^( a ?, G" y0 ?" ~
{
6 G" o- o+ ?& b) Q+ k+ @ //---- Enter your exception handling code here -----
% h$ h- S+ Y% \+ F9 z4 p( N Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
" c3 { |, ~: d2 T/ y }
% m+ n6 D7 b3 T% [- d }5 ~5 g) y. _4 L4 K, G6 a
- |' L7 O% k# L: I1 V4 P* a7 b" E3 m
//------------------------------------------------------------------------------
- I4 Y& A0 k3 I5 N void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
; T' e' `3 ~# F. A" w% n0 n" ? {
9 P4 }! h/ ~3 W8 R+ }5 P try
) l9 X7 i2 \; G {8 q: e; M+ l. f) a5 ~, z
//---- Enter your callback code here -----
& n: O( a* P8 r5 Z2 ] }
1 t2 l2 X4 Q& S, D) K' c. c catch(exception& ex)
% j* R9 I) v5 {1 M5 f+ d {6 C' `$ t$ u4 _4 {! a
, G/ a+ B6 P! P( a3 c5 p9 @
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());) T( N3 {' g j7 F4 ~; j7 g
}
+ @" Y3 a8 T& P }: h! S& z1 u H5 g- i
& x& @, z" T$ {2 \' l9 \ N ^. F. E
$ N$ h8 V I) ~- W |
|