|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
8 }8 p4 f% _/ ^4 p" p+ Y& H. B7 z) F; h- Y4 v
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
% F2 Q7 F7 d' S6 W; G6 k7 E代码如下:
- ~! M; [* q# ]* b#include "Shrinkage.hpp"& i5 U5 T3 Y3 v5 T
using namespace NXOpen;2 Q* J* J' t" _
using namespace NXOpen::BlockStyler;
% R4 i% {* o! s! x7 y) H' ]: q* u. a% ~
Session *(Shrinkage::theSession) = NULL;
& b' y; ^" O8 V9 f2 e& X- x+ m6 uUI *(Shrinkage::theUI) = NULL;
% H9 F" p5 {' D/ |! m+ G6 E5 r! z2 D P
Shrinkage *theShrinkage;
1 L _& q( I* [) Q4 C4 H. t# S) F4 n7 H+ b% A8 [
Shrinkage::Shrinkage()* U: w+ ^$ w- Q1 H8 i, o6 `; p/ k
{" l0 ]5 b, E* w) a# y
try
8 _3 F- D7 I& x* {1 T6 c5 j; T {. L3 V# u( _4 i9 U+ h2 ^
// Initialize the NX Open C++ API environment
, z( x! r0 Y5 [3 m1 T" W6 s Shrinkage::theSession = NXOpen::Session::GetSession();
s: ^: M) h/ G3 ` Shrinkage::theUI = UI::GetUI();
& |% J M/ i5 Q. N' R theDialogName = "Shrinkage.dlx";& f( m' @# C2 u p- U# o
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());1 [- N1 G- E) _0 ~4 n6 ]" w
// Registration of callback functions
/ [( {% @9 R; n theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));! {$ m, {( @3 E% _# k1 Y Y7 N
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
4 _0 o% L1 Z7 f' ~ theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));7 @6 g- h& [( E- M3 I% Q2 p
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));: Z5 j) ]/ z$ ?
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
. Z4 x. i+ _2 S theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));- b! @8 d: B1 ]) G5 y6 b- M& Y; R
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));, K' j4 @1 z; M6 \- U* ]) J! r
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
T/ b# s' {+ f }! G* L( S+ A" i, r0 [* f: x
caTCh(exception& ex)
0 O) B6 Q" {4 |+ b }% j {
! K( t! @; n8 w; D- o" ] " J( m. ?6 I1 j
throw;' D. u X6 T T/ L) T- a* J
}
1 a# V, j7 l }/ l+ |; B}1 h( ^. `3 P4 y x& S
1 N/ s' D* B" y4 a
Shrinkage::~Shrinkage()
$ t+ A" x) ?. G ?& @) d{4 G1 T# Y& e; w3 h( O: D# A) O
if (theDialog != NULL)8 k) o& ^$ S9 h5 l3 D! Z
{
5 ^+ i. p* N4 x% n8 K/ o2 e delete theDialog;
/ }' j$ ~$ y4 l3 [5 ^ theDialog = NULL;
, a6 I0 X- t/ B6 D% J+ t }- P, q0 O/ d% y6 n) F; c! ~
} w3 N, G: n2 l" y; M D" q
+ ^$ A4 V( S, `( v
#if USER_EXIT_OR_MENU
) _2 X3 A0 z& D, m, V0 a extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)3 w" q# p' z) H" H9 x
{
, C# ^8 |4 z \, e# s* o- s try
~4 D: P, }4 [) Y+ H {7 j/ @# Y1 x( a I* ]8 I7 _
theShrinkage = new Shrinkage();
0 k; ^0 F' }( O // The following method shows the dialog immediately
& j' b: A" x. i0 `0 K theShrinkage->Show();
* L" F% }: ^0 y* q }
# L. d8 n _8 u. v0 z) c catch(exception& ex) o8 N- m c" ~3 C) p( y! ~
{
7 T6 y# f) Y5 k6 K //---- Enter your exception handling code here -----
* }/ M( D E7 p, M Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());0 x5 j4 k4 c- O, ] G; h
}
/ @7 ?) n& K9 U- {1 _9 n delete theShrinkage;1 d- a7 t" V$ R- C
}4 x! A$ A; \- ^( W
#endif//USER_EXIT_OR_MENU
+ d: {0 r% ?$ ]* Q" y* M) g#if USER_EXIT
: o3 A2 r- V" P% d! v 9 ]6 p" \' j1 \; s" D4 k
//------------------------------------------------------------------------------, }; o5 _& p) s! u: X0 f, R* C5 @
+ D0 Q+ z0 x2 E- \5 U5 |, g p // MUST NOT use this option since it will UNLOAD your NX Open application image
( H. b; E0 |# p" k& X" g0 h( H // from the menubar.& E: `3 Q$ p6 i; C/ [9 a" o
//------------------------------------------------------------------------------# H3 N, [; d0 Z) ^
extern "C" DllExport int ufusr_ask_unload()
7 S j/ `3 A5 f; l. J {$ {. s! w% i% x$ ?
//return (int)Session: ibraryUnloadOptionExplicitly;2 s/ p% M6 v$ h& s; m
return (int)Session: ibraryUnloadOptionImmediately;8 J' Y" P: b6 j8 S+ B
//return (int)Session: ibraryUnloadOptionAtTermination;
* [% C4 d0 F( r& ? }( d4 g O, z( _9 B
4 g1 O1 z" P: h7 S. V2 E- Q
//------------------------------------------------------------------------------+ g# F" e: S5 L6 `! [7 k! h* n! b
// This method is automatically called by NX.5 Y# H/ h6 Q d$ V
//------------------------------------------------------------------------------, E" s4 I: R1 g0 L
extern "C" DllExport void ufusr_cleanup(void)0 _ e) u, R1 [8 G, m/ b
{
+ Q" d( H8 h/ } k6 I) s) ^1 r9 l try
2 b8 k5 W2 M" J3 c4 z" { {
2 u" c! i6 R9 k7 s- s# X0 @/ X //---- Enter your callback code here -----: W$ H) p& J# Z$ w5 C4 c7 a" b
}
3 c$ x+ j4 x9 P8 @) u catch(exception& ex)
8 O! [" t$ [5 j8 j) o! c7 Z$ {' R {3 W4 ]! @+ }; W' a3 J, N9 ~: o
//---- Enter your exception handling code here -----
! H0 l1 x* H- p% N$ I: w3 H Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());4 j, z" w% i: I- M! z7 `
}
* ?: s! C) t( X. c }
/ d# J7 j( a1 i9 ]#endif//USER_EXIT1 s3 j1 n8 V/ W1 K9 P
! s g! S7 W# b+ a8 J& u9 M3 E int Shrinkage::Show()
. ?2 J$ g3 w* d! F7 s7 }; Q {
5 O5 X- R- [4 ^, X8 u( H4 ^ try" p) T; z- f/ u: y; y1 _
{
0 e5 B7 K- p6 C" _; H theDialog->Show();+ {: j& ]0 u7 A i' P
}- r$ \' K9 a9 [1 @6 U4 K# F6 D( V! u1 A
catch(exception& ex)! V$ ?; r3 R* H$ }3 Y W- k
{7 m( ?; r% t! L$ `. O" @
//---- Enter your exception handling code here -----
0 I9 d3 n( X5 G Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
' m# H% C. v( q) g8 x }
) h$ ?% \/ C( S. N: o6 J return 0;9 Z- c2 F1 }+ G: S/ k; a t& O0 r5 l
}' E: O: `! V3 H$ _$ g3 ^% B
( d1 h, `' z: B/ |0 S: b#if CALLBACK" j! m+ S5 T# U; ~
. x% K2 m( e$ g, `6 l( e' m void Shrinkage::Show_Shrinkage()
2 Q& G0 L$ B* M; v' ~# [ {- \; G6 _6 |; _6 g5 d: W) y6 L7 W$ w
try
: C h. \: Y4 _1 [ {
0 @' G0 a1 D5 ]9 E) m' [4 X7 Q theShrinkage = new Shrinkage();
* d$ M/ N% ^: z1 V$ ^3 J5 x2 G6 [& W/ ?
theShrinkage->Show();. l, P/ N4 h5 Q5 V
} T" v4 a' \- J* c2 [+ [
catch(exception& ex)
! O/ r4 r0 q& j; o% a/ l {
# i: X- {: j, J
" z y. a; i$ w) o3 B Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
9 S; f3 w O' l# c& _- O4 s2 } }" S& m# m( \) o0 m8 v2 E H
delete theShrinkage;
+ ~ a" n+ k0 m& E5 }% H; u& \. k }
1 r6 c. f }9 V4 v+ K; B% Y7 g#endif//CALLBACK
' l7 o) a% w: R* I4 h0 T
& a' N, \) m$ Z5 E6 n3 N void Shrinkage::initialize_cb()9 _, k2 c L0 b/ J7 _$ ~
{ j. K6 Y/ @- H5 v
try. k' O6 Z( W* X
{
4 D& ~& U9 Z+ ~" i( a; W! b group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
+ H( M" \. @% G9 T6 F. Q3 O face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
~# z( w" `1 ]6 j face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));6 i5 e2 }/ S8 H. o1 Y7 A9 ?3 K
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
+ r6 f3 v' u( k bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
, H( v# }& c% D ]! L; I9 ^6 Y; s bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));. Z+ ~5 f7 \% M) P; z- t
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));* h* I) ~ Q9 g: Z4 P: K! ?; p
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
5 g) m$ X" E+ @- |( F# G7 I label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
) {! D0 D1 i+ I! v) O4 D) Y string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));5 o8 B( z' h& Y- Y* [+ C
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
5 g. N4 U6 m! J" T; A* T" D/ S label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
/ o* T$ _( @0 o% g) l }
. s$ F5 L9 r: s } catch(exception& ex)
9 s/ w t$ `( b3 B {1 e3 G& a {& `: N! f8 T
( T6 l4 G. p6 @4 \$ R
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());5 _8 ^2 [% w0 F( x( B
}
2 W! V' \/ d/ N0 \7 t$ R# B) ^: u }
8 _- F* k8 ]& K //------------------------------------------------------------------------------
* z1 g$ a: [7 u void Shrinkage::dialogShown_cb()
+ I4 I9 e; C Q8 ?# \0 k1 w; D, k {) k/ ]5 e0 c P3 p6 i! W# \& p. g
try
: Z5 S0 o& M! `7 K { L1 `9 U" q+ I8 C" J+ b/ W$ x
//---- Enter your callback code here -----
) ^/ @+ n5 M% }7 C }& N) V- V3 ^' c* n! l; q
catch(exception& ex)
9 o, W, v. B5 v+ U# x {/ M/ |* G+ k4 _$ {5 Q, b
" \4 a7 J0 k7 {) k; Q
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
; G1 f1 t2 O7 c8 x }
9 U, S& {9 e7 Z7 c }
. B0 M# \+ h9 H 2 z b' f' J4 l
int Shrinkage::apply_cb()8 R6 u V' q8 r- j" T% N# a0 f. x, u9 a/ V
{
# \- _, d1 _& T2 R0 p7 t, K int errorCode = 0;- L9 J4 `' A$ L J7 N
try) w7 a+ ?! [% L# b; g1 R
{
% m: q/ F2 @* ~# m. w2 w" t* S //---- Enter your callback code here -----8 c# B: |' |$ {
}: B. I% m7 y7 Q
catch(exception& ex)( X) T2 k* d6 t# u4 ]' w" j
{
3 O: o7 x) u; d0 p* { //---- Enter your exception handling code here -----+ G7 q6 T/ f* Q" L% I5 ~# u
errorCode = 1;
% V( w \1 d6 ]9 T' E. q Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
/ K; I# M4 c2 t( ]4 C8 s }
5 {, R. }4 L8 }% I0 M. b return errorCode;1 N3 h4 I2 V* F
}" D1 x' T# n" Y
/ g0 Y* d6 f2 y# g: `7 t) P% M3 s int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block), v3 `7 q* f( f' Y) T
{( n5 A, B6 b5 O0 P6 y& i
try
$ }+ Y1 L( v/ Q+ i& e5 o {( U& S5 Z; S' R" J5 u
if(block == face_select0)
, Q' d" S x/ h8 h& w+ R' u: q {4 d& ^: |% s( \# `
//---------Enter your code here-----------
$ L6 e: x- z$ R2 ?! \ }, Z* W$ p; Q& Q9 S* \
else if(block == face_select01)
- B0 M- S0 b* X: k; m {
0 k, j5 y! t' S6 U# X7 w5 y# F //---------Enter your code here-----------8 ]; Q Y2 l' v1 \& [
}# H7 _/ a2 O% P9 z+ t- p ^( W0 }5 {
else if(block == bodySelect0)$ x) R8 X5 k' L6 i. W3 `
{
! z+ i7 q7 @! W6 `% Q" L //---------Enter your code here-----------9 ^) y0 ~2 M+ f8 v) m
}
: S5 d, N; ~) L0 Z: A; c+ V9 X else if(block == bodySelect01)
/ r2 f) V- o- L: O3 B3 K$ g {
( J; w* {9 a6 u- k( m //---------Enter your code here-----------1 }9 k, ]( B0 s) D
}
% M2 K4 H4 D! Q( x else if(block == string0)
2 N" [+ u0 N( d, E6 t {
2 M7 {1 B+ z3 s2 D- w0 `8 G8 A! _" W* ` //---------Enter your code here-----------
n9 v1 w( [5 f$ j }
9 v! \: g2 J" H: r8 L3 `3 d7 d6 u/ ~ else if(block == label0)% M p; e L" f
{+ ?2 o* R. v6 R2 `2 p4 K+ `
//---------Enter your code here-----------
1 G: a3 T# J( k, A5 Y }( @) P4 p) \9 Q7 W
else if(block == string01)
, e& H. H% C* B" H {
5 v$ o& p1 t% s+ e0 F ~# u5 d //---------Enter your code here-----------7 z% i+ |: [+ N& g) O6 Y% _9 }3 X! x4 N
}
4 a; b5 Q& N0 T/ |* c/ P else if(block == label01)/ c8 L1 }- U( u" \" Q/ ?1 G
{
" e5 t# B* h3 C0 Y- Q' M //---------Enter your code here-----------; O) A; @* m% E
}
( x' r e0 U3 G6 b else if(block == label02)
. w6 F" B, }/ M, N6 M {
" I2 ^: k+ ]5 G //---------Enter your code here-----------' U0 y8 r0 i' f& R4 r
}; j0 l1 c0 l* u1 d
}
& |3 H1 v3 @1 k8 Y, ] catch(exception& ex)8 ?/ J% J+ G) {# u2 L& v- D
{
) S6 u2 F3 u* H/ W" b' T Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());. C* O, w) H1 n5 e1 q; m, x
}5 r9 o5 j Q# \" T- Y0 M* T7 c3 C
return 0;
$ D$ x8 g* ]& b/ l/ A1 z }
$ o9 H/ i5 _% a' Z% Z4 X G % e, m5 A, o, M8 I. H7 i7 z J
int Shrinkage: k_cb()
+ `0 k) N) |. F* W {
- {; a n0 M$ T9 c" ~3 N. g/ y+ K& a int errorCode = 0;: v1 o( f+ A* Q# J4 Z( X. f2 z8 e
try
. o3 j5 t3 O4 V. ~1 } w {
- c4 ~) _9 X( z errorCode = apply_cb();
8 x0 \) X. i6 E" X# i9 B, o" V }& V. ^1 J8 W, K: x
catch(exception& ex)3 l+ x$ A& b$ g9 i4 X$ c% p
{
" V! _) m4 @0 K3 e' ~$ J //---- Enter your exception handling code here ----- \+ b* _7 b4 H! ^8 K T; j5 u1 ?
errorCode = 1;
( r; u+ Z H( C% \( U& J; O Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
9 A2 B7 Y# L; D7 G; C; S0 N }- R. u! j- ^' X$ h1 @0 }6 u' H
return errorCode;. K) w" D3 Y, y @9 c
}
' |: Z- j4 L# g" u$ j
0 {9 s( A9 P& Y; _/ r4 J% r4 o4 V# D5 m //------------------------------------------------------------------------------# C9 f6 l0 k# g j
//Callback Name: filter_cb$ x. f0 U+ v$ I8 ~* g
//------------------------------------------------------------------------------
4 J) e, [5 ?1 O' E( c int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
- f8 ~6 t$ u- P B q: ^' E7 ^ {
$ R& Y M6 l7 n, f& q return(UF_UI_SEL_ACCEPT);
2 O+ |1 {# f0 l1 |1 W" S$ \. { }2 s1 B; o5 [! C, s; L1 \
* U' v% q; e% o6 P //------------------------------------------------------------------------------( E5 j% z& I1 U# p a9 L/ \& o
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)& I' t- A+ D# T+ s
{& A) Q0 e- C; O$ }$ m4 S5 H
try: d$ a1 v1 L# G" i. Z: }
{' s$ j6 c# E8 T1 ~
//---- Enter your callback code here -----6 U% Q, Q3 E, | `
}
0 p/ h+ N. W0 M" h) X catch(exception& ex). N* P: z z8 I8 G
{
. m7 y" }2 ~) V //---- Enter your exception handling code here -----7 W& r }/ k, z
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
9 M1 ?3 B$ L9 p! \) ? | }
# ` s7 d) W$ |/ q% c5 k }
2 R" e0 F1 h ]- v
4 v1 W. O( \0 D$ e //------------------------------------------------------------------------------
6 M4 g9 y! T1 t( D7 F% u void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
& r5 L1 B6 o; Z8 B8 V3 V {
! D# e G. V( P. E try
$ V/ y9 m2 F0 p8 _. i" H {
& @$ X' v" q g$ ? //---- Enter your callback code here -----
% M. B0 d% N9 V' x5 k0 I1 b7 ] }( D6 c1 k- J# t: O. U; {
catch(exception& ex)' _+ n9 f- M) G( K" Y% K! n8 x/ o' k- ^! h
{
$ a6 P" Q. r$ W2 O
7 F1 y" F5 O' R- T! {' t Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
! }7 g# ]+ V7 ]4 N }' \# j* h" ]3 O
}
6 E1 O% ]% e! ?5 ^& a- B! k$ o& p, g _1 E5 u& y+ [' y1 W
- Z+ b' c/ x* Q7 h# a+ P |
|