|  | 
 
| 
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 $ y/ j+ Q: l8 Q$ t! m. I9 ~
x
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!您需要 登录 才可以下载或查看,没有账号?注册 
  $ N, h* j! P. [: C0 q( j5 B" F
 请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr0 k' ]; P: |) r+ F8 N* |% B# m/ S8 S
 代码如下:" }3 b; n' I! f) K
 #include "Shrinkage.hpp"7 b+ J: G& s1 |) F2 I2 _
 using namespace NXOpen;) K2 g' t( H  n8 X9 u
 using namespace NXOpen::BlockStyler;
 4 ]" r! Q6 x# Y/ h& o# R
 $ ~9 P7 `( [0 Z9 m+ ^Session *(Shrinkage::theSession) = NULL;+ V; @& ~  A( Y2 G8 O4 W
 UI *(Shrinkage::theUI) = NULL;" q9 h* A- z4 S0 r
 
 / w2 b" c& n8 AShrinkage *theShrinkage;
 + s3 G9 U& D& v; |
 5 t! i4 q) N4 o0 P$ N" ^* cShrinkage::Shrinkage()
 . t7 s) I0 p6 }& j- v{  [7 `8 u  @! D0 X( f
 try4 j8 v* v  l8 ~1 t
 {2 _6 \6 ~- D9 j8 K( ?) R0 b
 // Initialize the NX Open C++ API environment
 - O; X7 U8 M9 m: T. `4 }" B        Shrinkage::theSession = NXOpen::Session::GetSession();
 1 r& ]! l; m! \- v% W        Shrinkage::theUI = UI::GetUI();; p+ j& y4 {$ b2 y7 k
 theDialogName = "Shrinkage.dlx";. S7 e# R$ H* y( S
 theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
 5 v% z5 X1 w5 W7 T' m        // Registration of callback functions0 |+ R0 C* i- R8 B
 theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));* E8 q9 t" Y: t& G
 theDialog->AddOkHandler(make_callback(this, &Shrinkage:
  k_cb));- a0 ?/ I6 F* `9 J theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
 5 {: Y2 p2 G4 z( r+ U! s! q        theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));0 ~5 g0 @3 |! f1 n2 p. g: l2 m- C
 theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));' h5 m! \4 |; y; W
 theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
 ' w; a  `& s" f; Q/ s" Z        theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
 , r. D' o+ V: z) d( j- Q; Q- t        theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));% g; Z  t$ Q7 _
 }
 & W9 e2 M5 i5 F    caTCh(exception& ex)
 5 w9 ~8 D; O( J) K+ y& k1 C5 N    {) R9 f8 K! V+ j& e. ?' R
 ( ]+ N9 O- m3 k4 S
 throw;8 ?/ N. j) B- P; X  m, d" H
 }
 : `6 \: Z" X  m. a- k2 q! z}
 / j, b8 t  X. \' a- |4 P5 M$ N$ A$ R* M: b9 r. m4 z- l2 G
 Shrinkage::~Shrinkage()
 8 T+ s0 X0 j& S$ r! c) _{
 / q. q9 x/ j* v6 q    if (theDialog != NULL)
 2 K2 ?  l1 F! M' ?& L% T2 Y9 f    {
 / n; y7 `& P9 K% l; q9 ?5 c        delete theDialog;; f0 ~; m0 j- z$ |
 theDialog = NULL;1 U. Y& H7 x' P2 ?! y6 M
 }$ E: E. I: V3 k7 Z# I
 }  Z7 v" }& D# r4 t3 |: h
 
 5 D0 ^1 o' T0 u+ B# g  t+ e: w' k#if USER_EXIT_OR_MENU5 e0 s* h$ Y, r/ v1 x" ]$ Q' y
 extern "C" DllExport void  ufusr(char *param, int *retcod, int param_len)
 : v' S4 B' C% c    {
 ; }; E5 |+ w/ w6 B* F! s, ^        try
 & y, ]2 t- W+ L$ P8 o- k  D        {
 ! C, M, Y  h: I# T; F            theShrinkage = new Shrinkage();3 u2 J- e- E% t3 x  K
 // The following method shows the dialog immediately
 8 K2 g* X$ @6 x6 e2 ^! K            theShrinkage->Show();6 [/ v3 j" Z4 m; Y- L) P& j
 }
 # @$ a9 ?, `( `) X        catch(exception& ex)! w, t: V1 }1 \) _! ^
 {! ?) p* c4 H$ j; C
 //---- Enter your exception handling code here -----" N# s) m$ o1 B$ O2 n4 ^
 Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:
  ialogTypeError, ex.what()); # c5 |* [% ]) R        }. R: m( Y* z6 J# _; y* ]
 delete theShrinkage;
 ; B# l. K# x5 Y8 J7 e* q    }
 0 P2 f0 H) a$ g( ^/ _$ o& R! L#endif//USER_EXIT_OR_MENU
 2 i# @8 @4 `- i$ G* Z/ i, `9 F#if USER_EXIT
 ' U9 @8 a& Q' I* ]    / J0 P1 L/ }: |1 O  z
 //------------------------------------------------------------------------------; x. ?) K7 [1 i. c# n. C( s/ D
 
 : [. D1 G+ U6 G( ]( f1 f1 p    // MUST NOT use this option since it will UNLOAD your NX Open application image
 5 ~: `' h( T6 Q4 v8 Z9 W4 w, i    // from the menubar.
 P4 v6 z- X5 r, A# F: Q& l    //------------------------------------------------------------------------------
 . t8 d/ ]' F- F7 @    extern "C" DllExport int ufusr_ask_unload()
 2 N- _% S' a( k3 O    {
 5 x3 _! z5 I, F' U) `9 `        //return (int)Session:
  ibraryUnloadOptionExplicitly;( o& O$ l6 M. @" }, q9 V. N return (int)Session:
  ibraryUnloadOptionImmediately;9 T" P  ^; M+ e2 r9 t //return (int)Session:
  ibraryUnloadOptionAtTermination; : x0 [% _$ \5 X3 x; V" P- b( n    }
 ! Z5 S0 o* G9 v: ]
 5 i" |! r' O, b, l- E& I+ B    //------------------------------------------------------------------------------) D9 n2 J' \* U/ c: _
 // This method is automatically called by NX.( g9 w) Y0 s9 [$ r; ?$ b( M5 l; l
 //------------------------------------------------------------------------------/ }) }7 A7 J& Y4 q1 A7 J4 k
 extern "C" DllExport void ufusr_cleanup(void)5 _1 E3 \- V' ~( b8 V
 {+ f3 f, g) X6 ?$ X7 K
 try4 c$ i" |$ O+ c4 T2 g
 {
 7 _/ l$ k6 P4 l2 o) t            //---- Enter your callback code here -----0 _" F: O2 z* i! t9 M
 }
 : l. M' H' f; ]( C        catch(exception& ex)
 8 a+ y  l1 c* g. |5 i+ o$ D# U; D        {; m* L7 s9 A% i' B
 //---- Enter your exception handling code here -----2 m, O& u# K" o- Z* ^4 J
 Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:
  ialogTypeError, ex.what());3 }( A, i% `. c2 G0 \# \  @  w }
 # g* U! N+ v3 `  q4 ~    }
 + _7 ]( H6 J: m, j) T#endif//USER_EXIT
 ' o" T8 l9 f6 b4 |. t) U
 ! C, i. E+ ?- C7 z7 g5 y- o    int Shrinkage::Show()
 . m  c, A! r$ _  ~    {
 4 D" _% a7 Q) T6 A7 Z( H& l        try2 @0 E' @2 E- d- v5 o
 {
 % p% @% Y5 w* P9 P' ?$ E( [. ?5 `  h            theDialog->Show();
 3 |/ Y* P2 z' Z. ^+ ^        }- x! G6 l6 t7 e4 ^
 catch(exception& ex)& |- v+ m8 c- l
 {
 9 t- r! p  R, l1 E! |. X            //---- Enter your exception handling code here -----
 4 A8 g/ [* _2 |5 }            Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:
  ialogTypeError, ex.what());- u/ I3 d2 _+ b" o }
 / G6 a% n" I0 O* W, Q        return 0;) C# F' e. [' v# C4 Q6 N2 Z
 }9 }4 c9 T3 r9 T, q0 ~* R& k
 % |# l  j3 k. e
 #if CALLBACK
 # a0 l8 H7 g% r2 a: {# F* I% x
 : e5 N- S1 j) x    void Shrinkage::Show_Shrinkage()* B* M" w& c" y9 s: P8 Y" {
 {. J7 t, o$ d3 V! F" }
 try
 / `; T  F1 _% Y$ i3 N5 ?" ?2 W5 r        {6 Z, m! }2 k. [  ]
 theShrinkage = new Shrinkage();3 D. _, o" L, C9 G4 b0 A' `
 
 ) J8 @$ D( ~0 E. Z1 h) `            theShrinkage->Show();% \: V- C. G3 J& E( s; a2 k
 }5 j) _: _* n0 z0 M* A5 O1 I
 catch(exception& ex)" k; C# K* W# q4 ~7 G) c% d
 {  }' E$ x  E5 e3 n$ _& \! }8 W
 
 5 m: J. K; ~( ]            Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:
  ialogTypeError, ex.what());: F# q% n) [" k" P }3 X/ J8 \: x1 N( W( ^5 w* q$ _0 Y/ u
 delete theShrinkage;# c3 n5 N7 q* _
 }
 3 j7 Y7 m1 W' ^( h% c# j# M* x#endif//CALLBACK
 " D" D4 u+ l% h; {" J- Y: L) P    . I6 u- e8 w# h
 void Shrinkage::initialize_cb(), d  l) x' c" x
 {/ n6 k' {7 n. C
 try/ z/ j& Z% _" [) E
 {0 K) y8 ~# Q! N, f! D+ w2 _  T
 group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
 * \4 i. n9 B% b# s            face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));' k) q" `3 J+ B4 _* V+ g3 C
 face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));/ o+ l7 Z4 M5 V0 v' M7 f: b1 p
 group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));, F4 A/ {3 z! Q
 bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
 * b. g) C% Z8 i+ T            bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));9 }# i3 u! X# F% \6 r% I
 group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));3 K9 n1 }) J9 X6 _& E
 string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
 : ~% F: n0 N4 a2 {, o            label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
 : n0 A3 F% s: A1 Q( a            string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));8 X- G! H% D1 r* B0 {. l
 label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));5 R/ y( G* ~$ x& \4 W( v
 label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
 5 |4 u! z! F* ~, e        }( T  s+ |* w: Y% |: O& t
 catch(exception& ex); p0 `' K* f- o2 y: s1 L9 T5 T# k
 {
 & a: E8 L3 `) G6 W" I           8 \# O, y9 l- g" l
 Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:
  ialogTypeError, ex.what()); - m! P" a. F6 }7 K        }1 ]0 M# m0 K# [& h( L+ {0 v
 }
 ) R6 c" N5 e2 Q+ A$ `# T    //------------------------------------------------------------------------------3 \" j' d$ t) K: i5 }; W! P
 void Shrinkage::dialogShown_cb(): t. O: s$ L* q$ T0 A5 h3 ^
 {
 / Z* s1 t/ E( @* O7 O        try( b( Q* t( ^8 K. U8 K' F( D: P
 {
 5 `% V, C& @0 g8 |            //---- Enter your callback code here -----6 l  i+ b! G4 R
 }
 8 i. |8 n1 T) W( E- K- W        catch(exception& ex)6 M1 g+ D# `4 z3 z) e3 {, d
 {, |# Y& Q# ]' {5 \
 
 ) O% e0 B% i' t; }, K            Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:
  ialogTypeError, ex.what()); ( o" u& ~5 G% M" \* [9 N        }
 ' ^' L  p* t5 Y6 w# X; w1 D1 K    }
 9 C; @# D6 h  ~9 J
 ! O; M+ M- ^( w* ?' D+ E* y8 d    int Shrinkage::apply_cb()- }  V3 N$ O* H! Z
 {- Z" V) k( P$ T. r6 ~
 int errorCode = 0;
 8 z6 h) B7 `" l0 b        try$ f7 J% ]+ J( f3 ~$ c
 {& `8 p1 |6 I: o0 p; z  |) n
 //---- Enter your callback code here ------ U) H$ w5 Q) r" S& A% i, T6 @' U
 }; P- B% e! B: F
 catch(exception& ex)" v  a2 d1 `# n6 ?+ ]
 {
 ( q3 V! L4 v5 h: ]' S            //---- Enter your exception handling code here -----
 / m. o9 E0 }# H/ ?            errorCode = 1;( K* U3 P' r3 w5 Z( N* O
 Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:
  ialogTypeError, ex.what()); / D7 g& H8 I5 A% B2 v9 ~4 Z, U; O. ?        }
 ) _# E& l3 K3 U" C8 H        return errorCode;
 ; j  _2 n; \$ T    }& [/ T" g9 m% p  S' G% v
 
 ! C$ j+ z. s3 c3 [    int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)2 W) D7 r9 D4 e5 w/ T( l  U, {. M
 {
 0 Q* k5 }# C- b/ Y        try
 J7 B4 k% V( Q9 }$ b7 ^9 _2 {  ^        {
 3 w$ A& Z& h: g9 p( ]7 e            if(block == face_select0)
 7 U2 Z8 z7 z* i- \5 F9 X            {8 H0 w2 S: e1 O/ n$ N+ w; n* z
 //---------Enter your code here-----------7 _  C+ Q& z# D! C8 n
 }
 % g) m5 Q' c0 r- e7 S9 c7 U            else if(block == face_select01)* ]# r+ P0 V( n6 Q* o( _) u
 {* I) a0 }2 {5 S$ v2 n. I
 //---------Enter your code here-----------
 " d" o' F- i4 |7 w            }5 H, C/ Y) L% m. g, |2 g
 else if(block == bodySelect0)8 A  G1 i% }$ ^& T6 i4 h9 x( V
 {# u7 m1 f3 a) @- d
 //---------Enter your code here-----------8 {9 t% q9 X7 a% K4 \
 }; @* v0 L$ V6 H  H: {
 else if(block == bodySelect01)2 e- L. }5 F1 @6 B9 f
 {
 ) W' D* v) g% _            //---------Enter your code here-----------
 ; e6 ?/ h& ?. Y6 P# @3 E            }3 N. F7 {% [+ w% z3 O/ m6 ?  ?
 else if(block == string0)0 E% B1 S7 B5 h+ A: ]
 {. ^) K: {, m% \4 N: V1 l1 S1 }
 //---------Enter your code here------------ t- u& o# n( L. s+ \# }
 }
 R/ D" S+ E$ W1 F            else if(block == label0)
 , C1 N- d& y% t) ^, L. ~& u            {
 0 p( u4 T+ k5 a0 U* Z+ j            //---------Enter your code here-----------3 g4 S+ W5 g, g' m. t/ o' g3 {
 }
 / g' S7 e- n9 Q( w( `5 k8 K+ [0 d7 ^            else if(block == string01)
 : k- Q* [# W# E) T& I" R            {
 % t8 g3 o0 }  D' `9 R6 ~- ]            //---------Enter your code here-----------' M) c' O4 F3 Y5 d$ L
 }- T; x& y" {& p2 S/ ]2 G
 else if(block == label01)
 " i/ j8 t8 Q+ b& s/ v' F            {  \7 G" o9 j9 h4 |' f
 //---------Enter your code here-----------" \- Z, t% c9 V$ {7 Y
 }
 0 i6 R0 B/ |) M/ v            else if(block == label02)4 _+ e7 o# ~  j/ |" Z) @
 {
 ' S8 k; r, |/ `; m            //---------Enter your code here-----------
 $ O, ]& n9 U. h% T" `            }
 0 @" v' U5 E5 y" j8 Y8 v; k        }9 V( }7 I, v" A- [# A  C  ]
 catch(exception& ex)9 m* H& }( F# E$ Y7 [
 {
 : K) ?5 e8 V0 {7 P            Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:
  ialogTypeError, ex.what()); # @# z; D- U8 O0 X- l, t0 s        }- c3 b, r" A# m# S' A" V& |0 q7 Z; j
 return 0;0 U& ]# I4 ?' M' x) Z# O' C
 }
 % r* T8 X; I- a' x2 s* J& f) m
 # s- A4 y, q! Y    int Shrinkage:
  k_cb()6 w* n4 m3 F1 X {
 ; b# t9 ]+ Z4 U# L( G        int errorCode = 0;
 # J' Y4 s4 }$ @4 L! i1 t: u        try
 ' u# F' H# Q' @+ K4 f9 y        {8 O2 J5 X9 [/ _7 Z& B
 errorCode = apply_cb();
 8 _% H# K5 q$ ]+ p. q% h& F' O        }
 ) G6 A& ^: j1 b! o2 |        catch(exception& ex)
 ; J7 }7 b/ S; y$ d2 E( W        {( e2 ~  D* k. j! A8 p( O+ L
 //---- Enter your exception handling code here -----
 ! Q: G# S3 f8 z( d5 g# K$ J            errorCode = 1;
 % P" j0 g+ r4 }% F            Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:
  ialogTypeError, ex.what());/ k/ {- @. \: _" w8 ~9 B& {3 \ }: c* {4 M& D0 w, P2 L  k- L: v' ^
 return errorCode;$ y7 i3 G. X  U3 h
 }
 & W- e, \9 H4 ~8 l- p    % o8 \  w# b/ i! y
 //------------------------------------------------------------------------------; \4 A# M2 h$ U, e4 r
 //Callback Name: filter_cb4 X& |' D% @) g% e, M$ k8 d  l
 //------------------------------------------------------------------------------
 " {/ |3 R% ?& {9 B# z    int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock*  block, NXOpen::TaggedObject* selectObject)
 $ V7 j' C( S* ^! l2 ]0 H1 l5 r    {$ c' r- {$ @, `, N4 L2 R
 return(UF_UI_SEL_ACCEPT);
 $ b+ S  E3 V- ]7 x, N    }0 X, x, ?5 J: w  x
 3 W, X; N7 ?0 B$ S
 //------------------------------------------------------------------------------
 9 O5 x- E+ P( m! e( f8 R' h    void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
 - U9 r: V& c- H$ |' p$ ?4 |: e    {2 w" f& J9 N* J
 try
 ! A4 ]4 m7 ~- s6 x# b" \: G        {
 8 j0 T: Q# H0 O# V$ x            //---- Enter your callback code here -----( [" `- Y5 i" u8 ^2 K
 }
 ; f; Z0 |3 h2 w! F- k- W2 F        catch(exception& ex)
 $ {7 Q. {5 j2 j# ]" m        {
 * r2 P/ T0 T9 T) L: c            //---- Enter your exception handling code here -----4 `8 o% y, A- X2 N* h: e- X0 B
 Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:
  ialogTypeError, ex.what()); + m- x/ ?: r- [% o( Y' l        }9 O$ Z* C/ Z/ A: Y1 O9 H( p" s
 }- F- e4 c. e% Q; R9 D. w
 7 S. H/ V; f) o3 B
 //------------------------------------------------------------------------------
 : d1 |0 y* D5 E$ n6 q3 X& r: U    void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
 : z1 u+ ?: ]2 u    {
 - y, r" r& x+ C3 ~* H        try- P4 b2 h1 T/ U9 e: P
 {
 % c, ]9 x$ V! O            //---- Enter your callback code here -----
 . e, r1 e1 k: y: t9 |! W        }; |! N$ B' m' \4 Z- X% a) Y
 catch(exception& ex)- g+ q$ o6 Q  S
 {' s$ G5 [# N$ z% p9 F+ M1 M
 7 P5 f7 q" t. R9 `3 ?
 Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());) A6 b; m& l7 n  H9 |/ N# H
 }
 ) t4 O7 W. ~/ P# J- f: |' F7 L* O; T    }
 ' ]: n+ ~6 U% b  z& ?
 2 y8 V8 N# @! t" n0 r- T2 M% _% q: ?% a4 o
 
 | 
 |