|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
% C, _2 ?8 s9 T% S* A& q: x x8 |1 K3 j5 m6 q
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
{. u+ Y9 ~$ p3 p2 d: v, b代码如下:
8 j F. b6 @. C5 L8 ^& h#include "Shrinkage.hpp"
) C* D" R6 H9 u" O: ]0 Zusing namespace NXOpen;
1 G. S/ U2 {1 e' dusing namespace NXOpen::BlockStyler;( D- e6 `& V: @9 o5 L8 U* U
: ~* ]2 y" Z# y( X6 C' M
Session *(Shrinkage::theSession) = NULL;; U( a$ p) q% u* D. W" g
UI *(Shrinkage::theUI) = NULL;
! Z. g; H* e) Z5 g4 {1 y! g9 W9 }' |2 d% _6 R+ B. k, B
Shrinkage *theShrinkage;
+ H: A8 q" T; \- t+ x
1 G6 I/ ?0 ]6 FShrinkage::Shrinkage()
0 t3 g5 T# k, }8 c- L7 F- {{
9 z+ F- `! m; U- i try4 T: @8 o N) P& v+ J
{7 N& ]0 J6 v0 Y& o9 |; D
// Initialize the NX Open C++ API environment
5 E6 _3 }, Z) O# j+ U Shrinkage::theSession = NXOpen::Session::GetSession();
; E! W( d% K$ s+ R$ F Shrinkage::theUI = UI::GetUI();
0 t. |2 o: [1 [: A5 a. g theDialogName = "Shrinkage.dlx"; O' b$ Z" t# Z
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());3 H6 [) |0 I0 L3 r, N
// Registration of callback functions
$ H% b% O9 ^/ u9 G; D2 U. ` theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
8 m( z/ x( {' m# Y7 S% a theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));2 g3 g5 F1 l4 u* o$ P, W
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
' r7 l/ F+ q, n8 d% d% X+ x& s) E theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
" {! n h1 h# F+ m) S theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
' T) `% H2 \, l! e theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
/ v% F6 _+ H% C; n( m+ T/ ^ theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));0 Y/ b8 b# W; a; D2 ~: d+ I% ]
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
% T; p" Y! {) S) p+ g' R }& J V B3 l' X. Q3 b9 o* p
caTCh(exception& ex)1 c& a, U3 O8 I, i
{/ p5 x9 t4 n# M+ r" o
! O, P# G& X, G7 y' d
throw;
1 t0 b- w6 n8 F- e+ z }
8 m% ~( z; L+ n. y% B}1 Q; p8 L' H8 n, W, l; i
8 J0 [6 E7 k9 e# u6 ?; ^# q& E0 PShrinkage::~Shrinkage()! N$ L& [5 T% Y7 X& n- W6 A; S
{
3 _' t; i4 r, o3 h9 q, X ` if (theDialog != NULL)# t5 B2 a* j7 e6 r) F+ \/ {, ?5 A: [
{
. W5 Y0 k4 s0 ^1 N* Q$ E) u7 ` delete theDialog;
- a. R* |" C8 R/ y. E+ j# F5 S theDialog = NULL;4 U) O3 g2 P" p
}
* M6 ]2 l: B: }; M/ K8 [}
; g' I. n+ S+ |, Z$ C7 n: a: b1 |/ G* V8 ?0 C/ U: n
#if USER_EXIT_OR_MENU+ a' C, X) ? _/ Y: y% T
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
$ J1 h+ P9 U! B {* U) {( o" O( h, s
try) q G2 n# n# e
{
' {8 e6 ?# P) m1 | theShrinkage = new Shrinkage();
% ~9 P- W- d; M" d- `% M" M // The following method shows the dialog immediately1 S/ H. L3 T: E" ^' D" g
theShrinkage->Show();
) l0 f1 u4 T; s }
# _: z6 l! G+ C) y catch(exception& ex)
5 n# C5 o9 G" J1 T* X {+ ?* i) p! `+ Y' u9 a
//---- Enter your exception handling code here -----
+ z$ d- l6 j; ^/ P( M7 ^5 ~ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());/ Y* o5 Q1 ^' ?2 D& l
}
! l6 ] K3 c8 d3 O3 K; j$ b delete theShrinkage;" T6 Z# h. J: s1 M. b* ?! C
}
" k* M9 K5 a- |/ _& |#endif//USER_EXIT_OR_MENU3 t+ Z, D3 v0 g: r, s0 \. T. A
#if USER_EXIT
, F5 q7 r# G& T- M 3 m R% V: q& Z( ^5 ^" D
//------------------------------------------------------------------------------
* J1 f4 n$ y7 h9 ~ O( K( { $ Q% |4 {7 U+ t9 @
// MUST NOT use this option since it will UNLOAD your NX Open application image
: j0 E$ W( K- a5 L) j // from the menubar.
8 t7 X2 G: H9 j% `% N //------------------------------------------------------------------------------* ?( [% Z3 o) B/ @
extern "C" DllExport int ufusr_ask_unload()
5 a# I p/ j' W: T. @& }) g8 [% @' k8 j, D {, D% [! U' q+ M$ H3 U0 @( j5 d% @1 Q
//return (int)Session: ibraryUnloadOptionExplicitly;
' o+ r5 X: c: j, X return (int)Session: ibraryUnloadOptionImmediately;* B0 _ v5 H# A0 F5 _7 T! k$ j
//return (int)Session: ibraryUnloadOptionAtTermination;5 z; V" C V2 F2 K- a1 o
}
2 m/ d1 z3 i) V1 D1 G/ G
: ^/ i. E) ]: w/ u" _ //------------------------------------------------------------------------------8 f6 c% N0 u8 ^! L; R8 ~. A4 \
// This method is automatically called by NX.
! ~6 }: K8 G/ x9 u //------------------------------------------------------------------------------8 _5 S0 w* R/ T' W& W
extern "C" DllExport void ufusr_cleanup(void)# f6 Q6 N0 b$ O% a. O: a' I$ Y
{
* j1 [2 a* c* O; h c try( x! H8 k! I8 `
{% n: \1 `/ m& i& S
//---- Enter your callback code here -----4 X2 i I0 @) A1 N# p
}
' q) Q/ h0 O. _ catch(exception& ex)
5 W7 n: W+ m+ u3 E$ h9 l0 N C {
# E' m+ X! a9 y/ B" f l //---- Enter your exception handling code here -----
4 C/ r. t% e( ]9 |$ f+ u5 t Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
Q0 u5 Q1 W2 L5 L6 T }
% ]0 U, ~$ v# y4 X* c1 L( ^ }4 h/ o1 y7 y& S' e6 m' V
#endif//USER_EXIT6 b0 t1 | g' |5 P' U: L0 N
! k/ l) z; b( s3 T& O int Shrinkage::Show()
8 ~& O# I! A# Y2 v) s {9 c+ O' ^8 z7 }3 L) ^3 { e
try: e' _* ^: D1 j' a" U8 v
{( n0 w' Z( @ I. s+ D. m
theDialog->Show();
5 {) f J; M. x) _2 ` }$ Q" U, l- y0 r7 k0 H* k
catch(exception& ex)
* ^5 _3 y: X, A7 C1 r9 v {
7 e+ u2 ]% h' Y- d2 S6 n& ` //---- Enter your exception handling code here -----; p( q+ ~1 x: O% ~ w
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());# M [$ ^. F4 F6 ^0 l, R* E
}; `5 E4 l; V) S2 N& |8 D
return 0;# o0 M, s: @5 J( Q6 x5 k
}. t H# C5 Q/ Z
1 ?* S" B9 x5 d#if CALLBACK
: u Y# Z( K8 `: J/ ^2 y3 O) D E2 N9 U7 D9 b% W0 j
void Shrinkage::Show_Shrinkage()
! J; ^, i0 S l9 E3 u% j2 _ V& m {" z1 o$ }9 X8 G$ Y
try
' l; A7 M" L# u8 H }" j" g {
4 _5 n2 n0 i$ ?& Y% E6 k% t theShrinkage = new Shrinkage();. m1 D8 N% U; n8 m* W
6 s) E9 n3 @1 g3 D- W
theShrinkage->Show();$ }) U R: L8 U1 S9 ?8 L, u
}
- Q) V* v& | n! p R2 k) { catch(exception& ex)
5 C1 Z% j V$ j; I' j' T. V# { {6 S V2 w6 D7 f& u/ _3 ~ R3 w& Q
C$ o* r9 m- F2 q- g) Q Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
) J( y/ r5 V# T- t8 V% n: M5 d. ] }
5 \9 i5 v+ x; D- w delete theShrinkage;2 B+ ?* k" ], t; G6 w: N
}
* I" L7 {2 t1 S% b: W1 j K#endif//CALLBACK5 T/ g' y" \8 F" K) [7 k
5 j9 B/ _! T4 A% v- ` void Shrinkage::initialize_cb()1 C- ^9 p- y+ n. X9 H9 T3 E
{ q/ f5 ~+ x P# {5 t
try
8 A, K+ Y4 V( B6 v {/ r$ u5 R5 F! x; g7 U: B8 \
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
5 s/ _- Z) x* J face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));' K5 _$ ^6 @3 W. \- R" p
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
; P# P0 ~6 |" \: s* H! e! r5 K group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
! Z, |$ E$ r; T bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
! j3 n( k# j# T2 y& ^4 P bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
# d# z- \ Z# N! z group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));* H6 Z. e) m& D! ]
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));" x+ o6 ^, B, n Z
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));0 \ ~7 X/ \0 F+ T
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));' `1 z$ n) b p. \$ w0 t5 `; s
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
$ H2 s, z, l+ x) |6 _! _ label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));1 v+ ~0 l' c* w, j
}
* K9 X$ A2 O$ G catch(exception& ex)
5 _* a+ ?. H; a& x+ c* \ {0 w$ H4 g0 ~4 b. F" ?& G
( r& p. g# X h$ z' o% F2 U u Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());7 R& N- f( O: z* c% ^
}- }% q: w# U' ?2 k* U1 k. [
}
9 F, N. t/ D: d4 ^# a1 k4 P //------------------------------------------------------------------------------
, L$ @; @: V" [( G5 R2 {: ~ void Shrinkage::dialogShown_cb()0 H) P+ k x) B' J
{$ Y' N+ I" {- q" \ y4 `& B3 t
try
( h* l4 S4 @7 _4 n0 V {
$ V0 j) M p! x9 _* d //---- Enter your callback code here -----
* ]: z6 a) v M8 k& Q) Z }" j& y B {* {3 ^1 l3 B! C% _2 p
catch(exception& ex)5 n9 F: `! H0 r8 ^
{
& x6 x' w' f% n; j' N$ |4 |! l8 y" D' B; p
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
% {) x% n, T3 m) o7 d( \; \ X% q }' t7 ^7 X0 y/ ~# |( m7 W
}4 ]9 d2 ^! C0 G+ D. T
% ` p: ~/ p1 h% ~+ {7 U
int Shrinkage::apply_cb()
7 N* b9 U( @! h( s9 o5 F/ m {
9 z' \. w4 q, n! j int errorCode = 0;' S3 q) ]1 ~- N' A1 T9 b
try( M; f( T" p2 Z# ]3 B, _* C
{
7 R! x: b5 Q. k //---- Enter your callback code here -----
& p- y) R; W1 O1 e6 s9 Y" R }
( T' Z( g0 B8 ?; u; g catch(exception& ex)7 d6 v8 a# L. A) ~
{5 G j" h" j+ B" A/ r2 L
//---- Enter your exception handling code here ----- N; B$ L# X$ K" i" |, G* O
errorCode = 1;
0 o( ]) `# J% a, Y+ k7 I2 i Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ D' O5 b1 Q$ K) K) R }
( R4 _' B# _# s/ ?' n* r return errorCode;
' l+ K" J* `$ g2 M2 R }& J3 A, h* `" V, g3 n( K3 p4 `
3 k0 i$ `3 D& G* G int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)4 O% G8 v, f- k8 E. n
{: E7 x& {3 j( x \1 }& A
try
9 @ Y Y: K" \& b {
$ F$ w% U; b% n' K* L7 B if(block == face_select0)4 d' o& G" a+ ]# k+ V8 @( z
{
( E( h+ Q4 K' m0 f //---------Enter your code here-----------
% F1 v8 K: x, \9 r1 Y# z }
2 F; N* a5 w% G$ _ else if(block == face_select01)8 F6 v3 N% d; p6 \8 p; \
{6 {, C% ?% r/ U7 V. t/ J
//---------Enter your code here-----------1 v% S- `, y5 ~$ R1 O
}
! f. |/ y" c1 G4 ] d* D( X! g else if(block == bodySelect0) k% E- U- n1 l& R( |/ g/ X
{
+ {1 F U z. k0 l //---------Enter your code here-----------9 `+ ^. J; }0 x; k& ^
}
7 ~4 `0 d# i. p( b else if(block == bodySelect01)
# y; l5 f1 I5 m1 C. F7 l) r1 b {) R- ?+ r) V$ n# ~8 K
//---------Enter your code here-----------
. X8 X# V) D Z( L8 G6 X- @ }" U( j) X) F2 S
else if(block == string0)0 T" n! I* u, Z5 U2 w: F( o
{
1 i6 v( @ }/ t" y5 S //---------Enter your code here-----------7 W$ ?9 C% U [) U L! s
}! {. s& [. ~+ m
else if(block == label0)
! [- w* { }2 T$ l {
# \; [2 v/ W0 |& f. ` //---------Enter your code here-----------
0 |5 Q8 l( E) D. D8 D% H }
8 @! Y, f2 G0 x1 } else if(block == string01)
1 H$ N) b2 |1 L3 R2 R Z8 L! h! l {: i+ Y3 N; v5 r% C- }* O
//---------Enter your code here-----------
# z6 k: I: J; `3 p& D A5 Y }4 u" U( a" z7 x1 @2 O, L
else if(block == label01)
$ t n4 p$ K$ t- l {; h' q7 N, v3 z, B5 U F% f
//---------Enter your code here-----------
- |! \- ]& p* E$ z( p8 ^ }% k, T% K' a! O( z
else if(block == label02)4 m+ j' G5 z1 Q2 H9 J' v* S: }4 s
{
! w" H5 ]5 [, F //---------Enter your code here-----------2 i$ g3 U& w' d5 l; t& @% _
}; A+ S9 R1 ?) T$ J" g$ v# @1 V
}/ W8 v8 d& h2 I1 L
catch(exception& ex)& r( [; l. a% w \- G7 ^
{4 y U1 ~# E% ?
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());+ i I$ q+ k5 ^! p ]9 j5 e: Y% s
}
6 ~. H5 M/ e5 V7 h' b+ G0 _ return 0;+ B$ Z* u5 Z0 Z( D' r e. ?
}
6 G' A; W0 }+ ?: X ) d$ }: k4 ]6 W U3 S4 c
int Shrinkage: k_cb()& |2 T3 o4 h6 L* ~/ a* i+ Z7 I
{
1 U8 K" s" d% _0 r, L) f7 R int errorCode = 0;
" X j, V- @0 t) b) n% b. c9 r try
0 X' ]" _% d# c {& x$ \( e5 D1 `8 C
errorCode = apply_cb();
( A* N7 L. k* K, @+ G1 I9 v }6 }$ D7 p! F1 P
catch(exception& ex)1 _( l# u& |# q0 t6 D0 Y- I
{
2 {) k, u6 y d7 | //---- Enter your exception handling code here -----
7 v$ K5 n0 q" h1 w" c7 F errorCode = 1;/ T) i- u3 r. N! N% e
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
" L9 D2 x5 R/ q }
: |+ _7 \6 v, |. o' u" C% G return errorCode;; c- C- m7 R" L; e
}9 w9 P; ]+ ^6 S6 g* O/ F; z
% `. r! ^, A4 q' `" f
//------------------------------------------------------------------------------
( a# i6 K9 c1 p% Q //Callback Name: filter_cb( R/ j& d1 I( G& ^- Y' g, @ Z# p
//------------------------------------------------------------------------------+ H3 S/ _7 n% H _
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
- X# B' _9 J: d' _ {
/ x- t4 K J; L. W( u$ ~ return(UF_UI_SEL_ACCEPT);3 M* r4 ^! o' b: H
}
9 U3 M5 I6 }' h! [
1 Q- o8 b5 `8 v) J! b //------------------------------------------------------------------------------
' z: U% G h9 s void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)5 S) w( z* y3 a7 c! x
{
4 H- v% n5 }8 K+ c$ r9 m3 I) Q try
1 [( H8 m& }$ a2 ?! Y% a3 x+ ` {
* y& Q, ~2 U0 B //---- Enter your callback code here -----* @* K' N4 u T, s
}# X/ c9 I# }0 \7 V8 m5 |( z
catch(exception& ex)
+ ?! c) g; K# d! O K {' f; J9 \$ N& ^8 \- |3 J
//---- Enter your exception handling code here -----2 a" c6 q: P' e3 @
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());# B9 x9 p5 C) ?+ S9 g
}) }( q) q9 X' U7 [" T% d# {9 E9 c
}/ F% w- D# M1 S0 Y0 ^% w/ y
8 r" {! c2 m: _' }% d //------------------------------------------------------------------------------# J g7 p* O" ], z& S& M5 `
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)! U& p$ q: r0 i0 {
{" L/ `( H4 R3 e$ d# T0 n
try
6 t% Q, X8 o1 i* x/ v% _6 l/ c( C {. ~* g8 ?1 N7 ?
//---- Enter your callback code here -----
2 d3 {8 M' j. e6 Q& e }' ?6 Y* f6 _0 G$ q6 y/ ~
catch(exception& ex)$ {9 P3 e, t2 ?
{" E- B2 N, o- b9 M3 e
9 W7 v1 V* [6 P6 p! a
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
4 I2 S' e! V* s" T }
! @ y$ d' G2 C0 ?( {0 \! a) k1 F }
* G. N. g+ Q- @5 d, Y1 V, h) \1 E& T5 X2 B* N% Y
$ M0 J$ L, ~7 Z2 [2 D9 V9 o |
|