|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
1 {9 ?' f0 ]- I! v0 v% }
! x7 b1 w& g& q& k: N4 w请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr! l9 |7 R6 p$ t* I" T- D: p- t
代码如下:
, g$ Q7 s2 |/ `8 r- f#include "Shrinkage.hpp"5 t# ^; h G3 d4 |/ L
using namespace NXOpen;
: m; X' G T4 i; ausing namespace NXOpen::BlockStyler;
, k7 N( N k! g6 X. \, W" v( L& s3 X+ D" J! n+ E. ?
Session *(Shrinkage::theSession) = NULL;/ E$ y& }# G0 L5 u
UI *(Shrinkage::theUI) = NULL;
/ [- L, Z3 F. I; s4 B" a3 J( Z
$ W- a, N# S. a% _7 a! c+ jShrinkage *theShrinkage;
c' r3 K6 p8 Q3 C6 i+ T. J" e# j$ J" ? Z4 i; k7 M2 Z
Shrinkage::Shrinkage()
u0 v; U$ z7 ^' {9 S7 y' _; s{& V2 H4 w9 |; D& R: P- _1 k; V8 d) ]
try
% T5 J. J1 K: ^+ ~- I( S9 ~3 j+ x {% V( S+ ]' p' R$ e3 {1 R, `
// Initialize the NX Open C++ API environment
* N2 y' K3 K9 t2 w; ] Shrinkage::theSession = NXOpen::Session::GetSession();( c* Q% @9 F0 m8 c3 H' ]; \3 C
Shrinkage::theUI = UI::GetUI();* T5 e) P+ ~. F! x5 e& p* U
theDialogName = "Shrinkage.dlx";; P) }% h+ O, }; k# |
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
7 g! G) [, V8 t" F6 W ?; J // Registration of callback functions
) Y2 ~" \ y% `8 |: J7 W! w+ q3 E theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
4 L: @& o( `! o' k2 @" P theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));. T" v; z" y; }6 H5 _1 }4 Q
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));3 y( J- e% \6 U! F6 m
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
% }* J) s4 W4 n& j theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
) T7 Q( }6 ]- a8 P8 A theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));, X% u+ x& q) E5 ?8 L0 s* f
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
$ K5 ^& k+ ~( C; c( P$ F( ~0 u theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));8 U1 R7 U) V# {* S8 p
}
& L/ b. D( _6 {1 C caTCh(exception& ex)
! Q9 \* D7 s0 p/ J) M- R {
' `8 a) k# o) z) ^3 I2 m
' J# [; s) T, n, `0 ~* F0 z/ C throw;
9 L# v8 ~3 [/ `* R }
& r4 r5 C, Y' j+ m7 C" D}
& ~. Q0 p! P" g0 n0 F8 H% R# t) w7 g9 ^; }9 @2 N( F$ Y
Shrinkage::~Shrinkage()5 Y! C2 E* l4 I* ?
{1 r6 t0 E! v% S& Q8 m, [
if (theDialog != NULL)- \/ B/ f! R4 j: _8 b
{6 `5 m0 _8 s2 S2 o
delete theDialog;
$ J8 y0 o: ?& x6 m: l theDialog = NULL;. C+ _! M4 |+ R9 t" r9 |/ @3 x
}* \9 Z, T, |9 e5 k$ v
}
/ R3 d: @& m( b/ }) R* N4 U! s
8 ^" P" w2 [: W7 t. l. x' q2 ]#if USER_EXIT_OR_MENU' V- `/ E, e0 S1 Q
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
* V/ \' W3 f6 S; i! E/ l l1 T% j {, U0 t1 j0 d. x1 n) I# x
try8 o2 |& y+ j7 p$ B
{
6 E' I6 r5 N3 U4 M, g2 }2 E theShrinkage = new Shrinkage();
6 A: B4 ^% j0 d. X# ?& K/ u // The following method shows the dialog immediately
\; y+ h. \/ ~ _ theShrinkage->Show();
! ]8 C0 t& l9 a/ }- i( d" B% r }$ \0 K# v/ g, T. `
catch(exception& ex)8 r! {& C9 W2 `& w) _2 `
{
4 S/ S) `% @" [ //---- Enter your exception handling code here ------ D8 I$ }) O7 {1 S
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
: b5 u B# b# w, v* s8 c6 n8 L9 S( \* [ }5 E# f: @: `8 N* s1 E
delete theShrinkage;
- E* ]5 W) X A5 ~+ s }
* x. i+ \2 o+ x#endif//USER_EXIT_OR_MENU2 ?& `, |7 q9 ?: K# {8 d' i. r
#if USER_EXIT
) a! b6 [0 U: y* |9 u; A; z
% h) v% R* B0 a, k6 f //------------------------------------------------------------------------------- P; B: Y! b( _( b
6 A. {2 P+ _, M, M3 d3 D // MUST NOT use this option since it will UNLOAD your NX Open application image @) w' H% w$ k" w# x
// from the menubar.5 w1 u' s8 K& x7 L3 c
//------------------------------------------------------------------------------
7 J$ O" t+ T) a- r3 W( Z w extern "C" DllExport int ufusr_ask_unload()* S6 [) X% Y1 |- r* d/ a- S3 `
{, k% W6 \* c9 M9 P& B# {, J
//return (int)Session: ibraryUnloadOptionExplicitly;, \+ \1 G" D3 r% s2 @
return (int)Session: ibraryUnloadOptionImmediately;9 C& a! K; D7 t( ^+ A# d# c
//return (int)Session: ibraryUnloadOptionAtTermination;/ |( P! \, U& K4 x; `) [7 ~3 q
}
2 X8 t, W2 Q |! U5 N$ Z+ W9 ]1 @
5 _9 N6 A3 a3 U$ A- v: y g4 U //------------------------------------------------------------------------------6 w1 m* ^; s1 p0 o3 `& E f0 C
// This method is automatically called by NX.( _6 l* Y) S3 ]; E2 Z: W. l
//------------------------------------------------------------------------------% Y5 }3 q/ J3 M/ u: m L1 I
extern "C" DllExport void ufusr_cleanup(void)
. s% R0 k' i9 V8 G% z6 X$ K7 C; y {
0 d- m1 ~7 l) [% r% a) t" f4 ^( X try7 y; u2 G J$ N/ j
{2 `! P4 e' l7 {4 Z" b
//---- Enter your callback code here -----+ @8 R* e* L7 V9 [. p& X
}
# i, A0 l6 z: ` catch(exception& ex)* r4 ?/ _8 S3 q0 {
{# s% p. a+ a. o0 ^! e% W( s
//---- Enter your exception handling code here -----5 _* m' ?( \1 q/ }5 C
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());1 h" A1 e* U. \' w
} v. p( ]9 C+ B* P S
}
$ O. l( T: }0 A#endif//USER_EXIT
9 G1 i' K- n2 R; d
5 T. H$ z7 S6 d# s2 G) d int Shrinkage::Show()
$ I* Z D8 H: R- ~ {9 S! w! ?. [3 C2 E0 ~0 A. a
try0 O$ Y& C/ ?; b) u, y9 u/ W
{
3 e- d, z7 ?0 W8 j' d theDialog->Show();& H0 F) Q) h$ l% q! V0 ^" w2 W
}# x1 K _6 u2 x/ h U( V9 |7 o
catch(exception& ex)) x$ P% d" z$ a4 t& |5 J5 N
{
, ?0 h! z K0 s8 H //---- Enter your exception handling code here -----
2 g/ ^- E0 J; d4 l2 E: }' V Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());! G3 D+ G1 N! K( v" j
}
" i! \; I% V7 Y' ~6 O9 ~ return 0;% [9 R. h' A. K6 C, U; J* D
}
% }0 \8 _: V0 C! Q) U : p( W5 c6 g. W$ H- g
#if CALLBACK
! p( o0 z. ?/ N2 V* ^
- d: U E2 A" ^& `- l void Shrinkage::Show_Shrinkage()
# J4 ~# L3 D- H {" Y; `& ^7 e: Y& O
try, ^# G( d. F; v1 `( T+ v
{! T+ V3 x! I3 | o0 }9 ^
theShrinkage = new Shrinkage();
& n, ~( ~* X6 y3 x7 B1 R+ Z i) H2 F9 G4 g Z
theShrinkage->Show();
1 F, g1 U+ R) [! s }9 n" ]' e1 E' ?, b" o
catch(exception& ex)
$ v# u4 z3 H# Y {
! d2 j: f9 S, d8 }% a) [. a5 r# U5 z3 i& Q& f2 ~
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
: x/ n( R! t7 {* ~2 N }
% `1 f" z5 b+ c0 O" E0 i0 E4 Y delete theShrinkage;
7 O U" ]# y( l+ ?6 c }5 I4 W% ?2 p* j$ T, b3 A- Q; W# k* |
#endif//CALLBACK
/ p$ _: K" Z0 i# f+ o+ a! j ' i2 Q+ L" X+ D% o8 N9 g3 o8 }
void Shrinkage::initialize_cb()
, S0 K# {+ h# w7 \ o" D0 V0 x- X {
@% \ y7 d+ E+ C! K% Z& x" x try5 M8 S5 d/ W9 w' o$ p1 e
{% T7 k3 s' _7 l+ _: G% |2 v
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));, F- c7 l; n* F0 ~ P3 E
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));( _) h0 X2 X8 _& T3 f8 X) b
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
4 E7 f/ f9 v8 }0 W- J2 d3 a! b group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));8 A& D. a: o1 d: |* {$ A* O
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));# E$ w6 ?9 V% g, c0 G8 \6 W! t
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
* @* {) j1 J2 O' K2 } group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));& U+ x! \; M1 I- x/ i
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
/ B' i- I9 q& B, w L6 G. S label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
1 S8 \+ e5 t! B string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
7 g8 A c( a: C# Z; y$ j label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
1 J( V. L; t1 ]. i: l3 {) _ label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));3 w! g# ]. H" \6 n
}
1 @! G1 L0 m: c1 p' k2 n catch(exception& ex)
- P+ x8 S, X. h/ C: G$ ^. U) ]0 U {, W1 {* B! [- T1 ]; H5 n2 c
( q' U& d) d& u9 @1 K
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());1 V4 e1 [# Z+ z/ g
}( _! k4 x! m6 p/ w- N
}# G2 B& l* f& t+ P: ?
//------------------------------------------------------------------------------
8 c5 B- C* S( z; r" w4 X, j void Shrinkage::dialogShown_cb(): K' `1 K. W, C
{
0 ^/ |* a) e7 E5 g. W try/ D1 l( E5 T6 j( }" H/ L
{3 U# r; e. q) [' Y$ v7 a
//---- Enter your callback code here -----
, \5 t5 K* D4 j5 f) z5 | }. z6 S: { T- y( z0 W. v! ^% {
catch(exception& ex)/ c E* G4 @0 H A g6 [/ r
{
. h" @% U! B% T/ ]8 N
" { M& }% h ]/ ]0 s0 y Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());$ d4 F# G8 }! _% P/ E8 Z
}& Z7 \6 ]' I3 X5 ^$ z
}
% ^/ u3 G# p; Y9 v* G- ^ 2 m4 O N6 ?9 d6 P1 m1 _
int Shrinkage::apply_cb(), x7 G- D; q T6 S/ b1 V# N4 p
{
1 ~, B3 E P+ @% g f. L, t int errorCode = 0;
4 d5 A$ ?0 N0 k+ W! _ try" e( L0 S4 m5 V, ]
{
5 U# C2 p% P0 d7 A% @ //---- Enter your callback code here -----
3 c% I! F7 i! o) ]& k" h }! K& W* a0 l1 v" W2 a. w' Z+ N
catch(exception& ex)
! ]9 K z8 D+ d( J* x; U/ Z: t {
8 ~3 ~/ R0 `/ n2 h' | //---- Enter your exception handling code here -----
5 K, h9 y* C9 }6 P" i p0 ^ errorCode = 1;
+ X! ?4 j9 U+ N Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());7 r6 K1 H: n4 r! k2 |7 A, F% ^
}2 R' s! G3 r! P' p. o
return errorCode;
# w# f5 v+ L% F) h }- ~# G6 J8 P% Z7 E7 H. j
) [* S; M! y* _ int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)0 M/ ? k0 E0 q
{
1 H3 M J8 K+ M try
% ~0 `8 w I" @% J0 d6 r* u: ?+ _, [ {
' n) A4 I! p$ o; K* o0 v( ^% I if(block == face_select0)& u7 H8 c2 L1 x1 T' d1 M6 l5 H) |; q1 @" i
{
: _$ X- O7 [( W" t- F; ? //---------Enter your code here-----------
P3 H2 Z( B+ G }
, Z/ L3 m3 B! _' z, l else if(block == face_select01)
- L9 y) P2 a2 g D m( n {
7 g7 R+ q2 T) x$ Q4 l //---------Enter your code here-----------* V4 z2 ?, J- l
}
{ B8 l- _( M% _# o. e else if(block == bodySelect0)
6 |) T9 @; R$ W$ E1 `& q {
- V5 c+ N! U8 T7 z //---------Enter your code here-----------
4 `: f6 L4 G2 }. R M4 w& K4 ] }
+ \6 {6 o7 ~4 A! z" a" _$ R+ r7 s else if(block == bodySelect01)
4 D8 \1 }9 e5 u! j {5 Z& h5 l d u3 S3 ^" p
//---------Enter your code here-----------) Y9 ?: f. _, P' i5 C. H$ y
}
$ B1 l1 E( }$ a. Z0 C* d else if(block == string0)7 ^+ O e# w/ T' _+ I9 m# t1 v
{
* H7 n' y0 n J! d //---------Enter your code here-----------
$ _6 u( d" x E }2 _4 {: l% {0 u. J. A9 t3 M! s4 x
else if(block == label0)
7 Z4 u/ B' w2 m: w. R {
6 T$ e7 l4 c8 W' q: |' ] //---------Enter your code here-----------5 L7 |/ i1 F% h; e5 W) o8 h
}
" X8 j( W1 J8 r9 S. S else if(block == string01)" X9 I/ T/ e( }& W! b
{4 P7 R9 R$ M. T7 x' `
//---------Enter your code here-----------
: k+ N' @, {2 V4 o, N; f$ V }
4 c6 \/ ]3 }3 c, F else if(block == label01)
& D1 [- t' C- z% N {
0 g' p) H. Z7 b6 K% Y) u3 U9 f5 ?5 c8 P //---------Enter your code here-----------
% K7 Q! Z" S5 d- B$ d( Z' W" G8 |, \ }
# E/ D# k0 k" r4 p else if(block == label02)' Z' t& R/ `0 b* Z; s/ t
{$ k4 f* g0 ]/ G' g
//---------Enter your code here------------ H) G7 {# ^6 I3 s
}) N* h2 H& h) G8 I5 w, T8 W; y+ t
}
3 c6 u, R9 a! U9 [9 ]0 z catch(exception& ex)
; E- |( w4 z$ t3 l0 g2 r; z {
" {' O) P* D3 @, b1 [ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
4 [$ a% i% _% @, g% B9 t+ M }' }5 m% r& J1 Y' a J
return 0;
- H, @: q" O g. C3 ?* j }
- ?2 R* o$ p$ S2 j! B% ?) Y 1 P) L2 U5 u, M9 g, P" Q' `$ e( {
int Shrinkage: k_cb()
) n1 [2 W H; E7 _, t+ b% ?$ w M {
+ K& q6 F! X9 e6 L0 T! j) Z) G6 c int errorCode = 0;
; {$ J8 s- q4 I; d try
6 @* ?& Q! H" W9 ? {( z( s5 v1 u- K* ] q0 \
errorCode = apply_cb();' x/ K$ ~% {& q- J7 _
}# {. i; C+ E9 g* u) E0 o
catch(exception& ex); s1 g: |! z n# P
{
, I, m" k9 v7 o$ q //---- Enter your exception handling code here -----" K' O; L& q) q0 \) m2 @
errorCode = 1;
( M$ e* x& d' {) c3 n Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());- I& Y! \4 p% F& z
}
9 }: i p. o W8 ? return errorCode;8 |( n/ ^# _/ t: y; J0 ]
}
% e$ h7 {$ d7 J- j ( W/ P+ s: u% k" w- v) K
//------------------------------------------------------------------------------8 C6 J: [0 X1 U
//Callback Name: filter_cb$ F: b8 W( v# j% b' \' E- I
//------------------------------------------------------------------------------& R1 q; }6 {4 i( Y8 K
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)( n" }- _5 H3 w" G+ k: z# W3 j4 g
{9 ~% A5 `! I; \4 F9 Z& T" d _
return(UF_UI_SEL_ACCEPT);9 Y+ S/ o; ?6 \6 x$ O8 k$ n! N
}' p; W$ U; q# [" X& E$ W5 p; K
9 A6 s" x/ E/ @0 K- @5 @, h //------------------------------------------------------------------------------
[5 [2 q% H/ E3 t; i void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus) T+ }# ]9 J9 C) ]. B4 L
{
+ {) A. Y* N, J8 k$ @ try6 ~3 o4 u3 `' `1 V/ Y( {; F9 E
{
% g/ ^ N0 k) ^9 c$ Y: ^ //---- Enter your callback code here -----1 k; W9 S9 {* S8 I
}* u1 n, W p: j( ~" j
catch(exception& ex)0 X8 X6 ^' }: K, R [- N- c6 B% |
{; }8 Z$ X; M _) A
//---- Enter your exception handling code here -----
/ B2 N' i* d2 }% s$ Q D; E) G* Z- o! R Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());+ s0 z' a6 |2 S/ E# S! O9 z
}
+ y6 \: ]6 C/ D" X) D( C; k }" s: r$ c8 w) [: G* G) |
8 O1 B1 r8 L5 q4 [
//------------------------------------------------------------------------------
1 L! L4 V4 o. _7 R6 A void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)2 x7 j$ t. X4 W9 r
{! {6 L. {1 d! `
try0 E* G- k: f d5 Z9 B; T$ M' f
{' e7 D! |! j) j) V* d$ }% M: h
//---- Enter your callback code here -----& G' I1 i: }! ?* a \6 ]
}8 y1 R* n; f; |
catch(exception& ex)
" q8 t3 _8 ~# L7 X+ { {# ^1 f+ @- q/ N5 x y
2 \; T. z" H' l. c0 ~2 ` Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
, B+ ]' t7 I& G8 Y% L/ r) h7 z9 M }
/ u* n' m0 q# X* O4 k; U5 Z1 a }3 E" k! A" H8 S; K0 p
* p4 [* B6 ?5 q
2 o/ @( Q9 ]$ j* L |
|