|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 - }# o+ }2 ~# g3 Q" Y" j9 U9 o) D+ S
. ]! j$ f- u7 E. Y% ?
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr" [8 h! `; q$ ~9 v1 R& U/ [/ h# h
代码如下:* N9 b2 ?! Z8 K' D
#include "Shrinkage.hpp"2 ?! t- v9 ?, a
using namespace NXOpen;, g6 m2 j, l9 I: ?6 v
using namespace NXOpen::BlockStyler;$ ^+ I& l; `" d& o7 B9 t0 [0 z
5 p" D1 i! O& v+ K
Session *(Shrinkage::theSession) = NULL; h1 j: z9 k5 S i% d( j
UI *(Shrinkage::theUI) = NULL;
( ^, V) U6 E b4 p0 T. `5 x6 t6 q) ~; E+ u/ Z7 T
Shrinkage *theShrinkage;# m& `. o4 a Z5 Y l* O/ x. K
9 ~7 s/ \ `) |6 N, MShrinkage::Shrinkage()
Y" X! g# f, C t{* e/ B) k. Y6 s* l5 F
try Y7 E% _& s1 I7 o& H( T
{
% s6 r) @) N" k // Initialize the NX Open C++ API environment
9 ?8 s( Q0 t3 R( H Shrinkage::theSession = NXOpen::Session::GetSession();% C3 [0 ]* v2 \, Q/ B
Shrinkage::theUI = UI::GetUI();
( j; i u; U7 [3 c* v theDialogName = "Shrinkage.dlx";
$ D- z) k, @9 w& N theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());% I& R+ E- k$ q6 Y4 L* r6 s
// Registration of callback functions
2 e- o5 e2 j, F% w$ Z6 P theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));: P g3 v4 e! q% F e
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));, E; l, C, a8 A a, O$ G
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));. D4 O8 {; O$ ?' @: x
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
1 r/ `& H2 J& s0 s theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));9 e4 H6 i1 J# J! G% `3 P
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));. c; O T# {# }6 k9 @2 x
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
' D/ c' Z- v6 w9 O theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
' S( Q/ J$ v) ?' s4 v }
* j2 \$ x t2 X- F* I. W caTCh(exception& ex). ~) J! }0 L% N1 H9 R8 S
{/ S- Y! F t+ Y# d3 ~
: u; d6 E) f' L throw;: q; ^' \5 j) V6 S
}) A- f4 i" Z6 G. j; ?
}
. I0 y* X! g J0 L" }4 J- i! s$ T1 b
! |6 p- P6 v; QShrinkage::~Shrinkage()
$ |/ \: q! b3 x3 L0 x5 M0 }{& l' i- ]& O( ~( X0 L
if (theDialog != NULL)
# ^. S0 n4 ]- D* R& A4 ^+ ` {+ d# Y. o+ N/ u; K9 p3 g! x
delete theDialog;
8 `% m' J+ T. S9 O$ _" n theDialog = NULL;
$ Y4 M, _$ _9 Q$ s1 p }
& ~, ^% W5 v2 C9 f) J+ U}9 N/ m& \) x3 ^8 A1 A
# s& p/ x9 M7 |3 R. {#if USER_EXIT_OR_MENU
' y/ U5 r* y2 F7 B3 i X- Z extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)% ?# h# C3 N" K: `9 w6 | P
{6 ?4 s! |, v6 @! `2 M
try
& }5 C# p' s) S7 h; c {8 S6 F" f, J2 |7 j' O* ?0 z
theShrinkage = new Shrinkage();
6 s+ `) \4 a3 d4 I6 }1 v8 J6 o( J // The following method shows the dialog immediately; D2 E- U( Q& ?4 |
theShrinkage->Show();
9 g" I' L1 A/ L5 X1 j; y }+ l& {+ c7 ?% X" N
catch(exception& ex): E% [# N4 } `: K
{. X5 }( g- H3 c; @5 V, j8 z
//---- Enter your exception handling code here -----
) x. Y9 F j$ x/ k: k Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
6 v$ a; ]! @5 B }
0 j! }3 N+ d9 {) Q. R* W! k h delete theShrinkage;1 n: O7 Q% R: F8 D0 V: |7 o& V
}0 _2 y& |$ s% Z R9 p% O
#endif//USER_EXIT_OR_MENU6 N" e0 x* o% O4 V
#if USER_EXIT
7 C& @5 g4 Q$ ]: p* e( M
9 C8 I" R9 u$ G; b& Z" v/ B/ z //------------------------------------------------------------------------------
- q' n$ t4 ?5 S
' }# x; |' `* T7 P6 t; A5 Z2 }, c // MUST NOT use this option since it will UNLOAD your NX Open application image
2 X* |3 z v! \ // from the menubar.; z% K0 h ?; i4 r- x
//------------------------------------------------------------------------------* ~- W$ x" a& f' `! e3 e% \
extern "C" DllExport int ufusr_ask_unload()- q* W1 `4 T3 q) Y5 I; T" ~. d) C9 b
{
6 w+ d6 P# h' ]3 x //return (int)Session: ibraryUnloadOptionExplicitly;
s b- Q, |$ e return (int)Session: ibraryUnloadOptionImmediately;: q1 l6 f# r. }, z4 @0 |
//return (int)Session: ibraryUnloadOptionAtTermination;/ f: W. T$ U x" B# R
}" o& r8 R+ Z" N5 f) C
; |: b ^9 M# K0 k) u //------------------------------------------------------------------------------) _. H. s8 J L% B
// This method is automatically called by NX.
; h3 Y/ H+ d2 T3 v //------------------------------------------------------------------------------
; a$ R |/ k5 Z4 y# D3 p) Y extern "C" DllExport void ufusr_cleanup(void)
. c: ~4 |5 P$ e9 r' T; g { M4 m0 Y, D8 v& K& G; K) A1 ^% j" u
try
& o$ a) u2 w( w9 g% q; h {
8 |$ N+ X! y5 U! X8 r4 v //---- Enter your callback code here -----* ]' `, B1 t- E" x; G2 w
}
* p$ S/ z, y" ]/ h0 w( c catch(exception& ex)/ b# |$ u% U! q' N( i
{0 u" C( v' E- y5 {
//---- Enter your exception handling code here -----
: Q! q7 s$ {; ` |: l& b } Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
Z: f" u0 P2 N1 B- B7 f; i }
C4 \# A6 ^) I, V* W$ x2 i }% ?2 y2 |: `: g1 D& P
#endif//USER_EXIT
; H$ Y+ Q7 f' M& O) v) B2 O% x8 k) D: O D2 |( o/ L4 S4 @
int Shrinkage::Show()7 c. C) s. o$ v$ @
{( O; p! T4 B8 f9 b1 u7 t
try: z) a3 D5 ?% L% O) I
{
1 C0 w3 I4 G5 S5 a* P H theDialog->Show();
5 F" m- G0 B- d! J" K# `( F }
/ A8 O" V, _. c4 _ catch(exception& ex)
. T S" F% _4 k" t W. z5 ~ {" k8 V9 C* \2 z/ g& j
//---- Enter your exception handling code here -----
7 Z+ @9 Z6 ^4 d Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());; p5 n! H% A, e8 A7 o
}/ ?+ s$ T6 n3 | v4 O6 k% K
return 0;
7 H: }2 n/ |$ \: t5 U) d }
& G7 Q: T, I* f% d
3 `1 D- ^2 V3 T0 V* N, K# \#if CALLBACK7 I+ _2 x+ Y' t& [4 H. j6 n( G- H
/ R( k. y; {4 v0 a0 Q( V7 F w& t void Shrinkage::Show_Shrinkage()
; @6 c* K' X6 C0 F$ R {
; T* l" ]7 m# m0 n3 L$ A try
h# g5 H0 Y2 s: }) H+ _ {
4 e) K1 {8 m1 w, b theShrinkage = new Shrinkage();
4 Q' C6 D$ Z( Z
5 f: u7 S( J; s; Q1 z5 j theShrinkage->Show();
' F$ g6 s7 ?4 V2 T }
% t- A8 B0 R5 W3 Q0 X4 S catch(exception& ex)
4 N2 T( E! E0 K0 _; @ {
0 v1 ~" C% Q1 r5 r2 l5 w( }& ~( x' _8 ^" t. ]1 M7 |+ p( R( W
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());' @5 [% r6 K6 I. B! H7 w/ s! E3 `
}# C: T: d4 Y0 k' b) g- X: ~
delete theShrinkage;
6 t8 l5 B; e4 i4 ?" f" S2 k: E } Z% v0 y' ^" |, X
#endif//CALLBACK
: s3 _# k3 H* A1 q& j ! n! Y$ {- p8 p$ m
void Shrinkage::initialize_cb()
% T; O" f: Z( `5 d3 `0 s3 F/ \ {
0 F9 ~1 n& P# s8 {9 C, Z: u try
! A+ p# E# v6 ^" n. X {& M3 e5 k4 a* ~9 I$ f7 {
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
, m% n8 q m) S. r7 T& E# F face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
! X0 L& Z! I' R9 L" V face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));* t& b% l& b8 e" O$ w" d
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
$ I2 V* c! ~. A- s9 \. N bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));0 y7 }4 T; ]' t% U5 }# y
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
% X3 R: j$ b, C group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
* L# ] T; M$ a) {: F; M string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
& o/ S6 j6 v( V# [+ Y6 v label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
. l3 l: _/ ?# c/ \! ` ? string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
8 C& X6 R/ B3 f0 T; d7 T label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));. O- m. D0 a; O, Y$ F, a
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));3 K* |' l" i8 b- N
}& L6 N) L. N" Y; n
catch(exception& ex)
) z" `3 @3 U( A1 Y, _/ t+ ~ {9 {5 S+ ^8 C8 g9 S& S- e
% e& b0 W {$ \, F
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
4 R# c4 j9 O4 U }
- K* S0 {+ B* C( P5 d }
' q8 x, z4 B& z' }1 a3 |: | //------------------------------------------------------------------------------% U& {) h8 A& L6 C
void Shrinkage::dialogShown_cb()' n5 ^% }( H7 g3 d! }+ M) N+ F# ?
{
. l. U& c5 L% k try1 l, ^' \7 f% @) E* l& f
{
6 G# O+ ]" i# o# T9 D2 u9 S //---- Enter your callback code here -----, y& `6 l- s0 e& f7 x! B
}
! v8 B- a2 B+ q5 Z( `) ] J catch(exception& ex)
& i0 E2 c7 | X& k* x {
9 i$ c( V" G `7 g6 \3 r, F2 y
& @+ F: b/ Q o6 v) } Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
, P/ g$ F3 Q% u/ R$ @) X }
1 G: i3 D0 v' x$ b; N" ^4 } }
! ]. i( S& m$ V9 _* V
1 G; \" P G- e S) b6 g& Q int Shrinkage::apply_cb()
3 z+ Y! V' V' u {
7 l9 ]% I9 G1 B0 f; j int errorCode = 0;2 A! [4 ~( x: Q9 |5 e* A
try
2 }9 d. k9 m% @7 t: } {9 k1 Y6 M; O$ {$ C
//---- Enter your callback code here -----
# O& `2 j5 a2 y* U }
; p- P: ^! F; N* b2 W catch(exception& ex)
: \) m$ w9 z& T$ e( j( X {
3 ]) i0 n' N9 V //---- Enter your exception handling code here -----
7 s5 [0 x) ] c- F) O% [( y& n errorCode = 1;* r: Z7 @% ]: C% F. B
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());* R( g( c( s9 F9 N$ V
}' [: `4 k! P4 L8 h
return errorCode;2 f0 o6 }' }( {; S4 y
}$ e, }( A8 O; x4 V! Q( a' T
" y& {# l& l& Q) O$ O
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)- s- W# U1 k0 y7 s) s2 T
{1 \8 {: j- w5 Y' ]
try
" w+ r$ Z! U/ `+ E {
7 U4 z( n+ h8 b% [' m if(block == face_select0)
) C+ F6 q! W* \8 h; j5 i j {+ K5 l4 {* K. I: h
//---------Enter your code here-----------
, P& a* k; K% G$ U }& d4 [9 Q, |% u$ s9 k' s z
else if(block == face_select01)
" ^. V' M. [/ b2 ^ {3 B* ]7 T5 \' o9 O
//---------Enter your code here-----------& V( r8 j7 t4 I# I' I) }$ x
}
$ c9 g9 _; d$ _1 s, {; z5 j else if(block == bodySelect0)3 b+ X9 [* C; { C+ ~
{
9 y( G2 v5 B: ~. d2 [" ~' H //---------Enter your code here-----------
9 P5 M0 [' V5 ^( U6 ^2 X. {' S }3 A |* @# J+ m J+ b# {
else if(block == bodySelect01): Y: ^3 n8 ]* H3 O2 H
{
. z2 s# \8 Q% N6 u9 ? //---------Enter your code here------------ J, T! u$ u- {( F# t# B( O1 ]; k- F @
}
; u' @) P) X D" c& I* E else if(block == string0)
: Y$ y4 t c2 } `6 U+ f$ U) E {
# L0 w- D' k) _* z //---------Enter your code here-----------" b/ W5 w, Z, W
}) a! z; x/ [) {6 e. ^3 J$ n1 T- A
else if(block == label0)' y# p) x4 f, ?0 C7 L. E
{- C5 B7 L) R7 r# i
//---------Enter your code here-----------
/ W- J* ?% W6 s Y: G2 K9 u% e& { }+ ~% I# f- A$ T$ Z& b' ~9 x
else if(block == string01)6 Z9 S! G8 [4 l; n4 a
{
0 Z+ c- ] I8 g' A4 i //---------Enter your code here-----------0 ^5 I1 Q) o1 C) }0 L
}7 \7 f2 H; w( n
else if(block == label01)- m: ]9 \# v6 G, i0 I5 X1 s4 f6 m
{
$ J! y/ h, ]2 M( E/ ^3 U //---------Enter your code here-----------5 w8 l- R" Y q3 R7 x( s1 T
}$ v: t7 h/ u* C' @. A
else if(block == label02)
& N$ G6 x. k z {
9 V( E1 E5 I9 P5 R0 n //---------Enter your code here-----------: R9 G0 t# l( L& g3 }% [
}
6 D% e# m; e& {# q4 {9 ]9 g# n. ~ }
& y( j- \. \( y8 ]+ ^ catch(exception& ex)
' i% T0 a% F: n& i$ ~) x( ]. \, W {
8 o3 C$ \7 \& E* U$ @3 M. U" O Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());! B( ~* C3 C& p. m; q6 K# W% X
}( r) Z+ ^: [7 w3 f: O" z
return 0;
& S" v+ ^1 h" h% G& Q$ U% [- }) e+ W }
" i1 T* R% E1 r5 e2 Z 1 w: S( e# A$ ^ B/ ^
int Shrinkage: k_cb()! x+ K a! l e( I
{6 V+ T6 P/ t1 ?
int errorCode = 0;2 @" j* j" V+ v! [+ l' F/ @% l X; |
try
' ?; D2 N& W& D* ]0 E" z7 D6 e {
8 n0 Q2 T( d. D( T0 i% i P7 j errorCode = apply_cb();
/ t' L& n( e6 s$ [1 |, ^* i }" {% i' w7 A! {3 j7 h
catch(exception& ex)
8 e9 M9 b* d; H, l' Q {" d7 E1 B _" m$ P" Y1 x
//---- Enter your exception handling code here -----6 x% H6 a0 o4 Q) V9 y* G0 I
errorCode = 1; F% p( E# V+ I- x. B; M) s% Y
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());4 g2 d! r& u2 i
}0 }0 V& r# O6 K
return errorCode;7 j1 l+ C" \' ~- S/ P
}
5 P8 K) h! ~5 I" u6 Q
4 t5 g$ h% [ i, f //------------------------------------------------------------------------------
1 U% f* |" a: } //Callback Name: filter_cb
+ m r R7 f2 I8 H- B+ ]# G* j //------------------------------------------------------------------------------
, w8 m4 W+ t4 } int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)3 i6 x* H0 x* u9 q& x% T
{0 U9 N) C+ i& H/ x$ ?* a: Z/ k0 {+ E3 j
return(UF_UI_SEL_ACCEPT);! P/ p" o7 d* R- z
}* t2 c) X9 ^. i& c
f* k$ a" e5 R2 I: H1 S" [& Y3 J //------------------------------------------------------------------------------% j& K& g; _' f1 e6 f
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
8 g# u( D. s' @0 U6 ? {4 D7 i9 j- u3 K
try
& i2 j- `+ f6 z y( Y! N" o6 k {; K! F1 K0 C5 W( f# T; d
//---- Enter your callback code here -----+ N H* y0 d9 |/ D+ p6 d
}* e$ l( {& s6 k" m6 V3 w) \& o
catch(exception& ex) d1 t( k9 O# { C' S! D
{
7 u' n3 e* m: G9 i; y$ l8 | //---- Enter your exception handling code here -----2 B6 n# f: p( N. n9 B" l" F- s
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());0 p0 D" _: r: _& C/ K
}: o/ K% M" p- P3 b2 t* m) U
}
6 k! R- _) ~- U 9 `( l+ h0 y# h5 w: H+ w' |8 k1 G
//------------------------------------------------------------------------------
3 J% F0 t" q7 ^ void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)7 x& \4 P5 w2 r. D9 _; D. b
{9 c" m, F: {: g& U9 P% d: ]+ l
try4 r/ e2 ?% E0 q: G$ }6 D
{ [1 X% n0 c4 ~% `3 k8 I; ~
//---- Enter your callback code here -----
& o! E4 m( ^0 ~) |: f" X8 i& Z }* |" U; f, X3 }5 {- C: F Y' [
catch(exception& ex)
/ i+ D9 _8 y1 k! `! d9 h {
' l; h3 i9 V; f ~1 J1 l) v
& D; C" z; r/ o6 x) V Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());1 h$ b I" B; ~8 T( G
}" d9 I1 U3 A3 d2 A- H6 u) @ a
}. ?0 h+ D& M2 o4 ^
9 V: ~% Q" i# ^" r
3 u5 x9 c0 b/ v |
|