|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 4 e; L3 n3 D5 Q( R4 K8 _
" Q8 Z1 ^' I- A/ ]$ B; h/ c请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
0 d+ r% I$ Z! _% p代码如下:
, Q5 J. K' T& e1 b% C0 E5 C#include "Shrinkage.hpp", ~# c& [) M3 G! {9 k0 n
using namespace NXOpen;
2 ~ H0 r0 k+ F# v4 ^* y3 musing namespace NXOpen::BlockStyler;/ U: K* Q, c. _* n
6 o2 G: p6 E. f) {- q3 C A4 nSession *(Shrinkage::theSession) = NULL;/ S) u% }8 h& ~; Z* E
UI *(Shrinkage::theUI) = NULL; h% H2 m7 Q- }
8 R# R' \& m% ?8 z |0 [9 s& z+ S
Shrinkage *theShrinkage;
2 _3 G. m0 A" Q5 j, S9 _2 r e* W$ E ]+ g Y. [
Shrinkage::Shrinkage()9 y9 b( v4 R% a4 L' ~ a8 [
{. z' M4 ^' U, n4 z7 f0 s- W
try& F6 h6 \# P* t. A
{6 N! r3 c; J, ?% v
// Initialize the NX Open C++ API environment
! B* K% X; f$ S8 ^, a: q Shrinkage::theSession = NXOpen::Session::GetSession();
7 s1 U/ K5 Y+ M9 I! { Shrinkage::theUI = UI::GetUI();
% h8 W' W4 c1 O( X4 K( J theDialogName = "Shrinkage.dlx";# g) Z+ Q% `# s; P! M/ o
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
+ V8 n+ H: o. [ // Registration of callback functions
# C, |! O# F8 ^, ?5 ? theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
; t# ]' Z ?: f& j) u theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
: }. F* R8 Y1 @ theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));' F9 O [8 Y6 Q7 H/ r5 ?$ a
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
. f5 t P2 D9 y/ C theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
; K# ]: \ l1 g8 V7 G+ F theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
2 ?" \: F0 i$ i& Z+ j theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
& q: x5 _1 C) ]- {0 I theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
- K. w( }2 d2 a- O, D) O }
7 M4 F0 d6 r7 j6 n" b; t$ E9 f caTCh(exception& ex)
F, ~2 L" N3 T) ~ {* A, {/ R* Y' S0 ~# ?
$ l* u. E2 i1 E: u, y3 F
throw;& l9 o0 q% I0 i2 J
}
8 }4 |/ o% @# j9 A' P}8 L3 O! K+ N' y+ Y
- N, B! N7 B2 Y) \3 J0 ?. P
Shrinkage::~Shrinkage(): T; e! m/ I' `/ a* w
{
% L* K5 }* F( U if (theDialog != NULL)
* Q8 R0 H, S/ B. z2 r {( v( Z& Y2 j: d8 I0 U
delete theDialog;$ j6 k. {& ], w3 H1 l( B! u
theDialog = NULL;
V- `* A$ K* [4 T } J9 e; i; R5 E9 q) L3 [1 |
}
/ d0 x. A2 \8 }6 @& s7 X4 r" l; x, F
#if USER_EXIT_OR_MENU/ N4 R! e6 M& w
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)" g( G9 }! T+ ?: ]) a7 Y
{- D6 h' w/ c3 G$ k) O# f, v8 o* |- [3 N
try
, y3 ~+ S# @' {$ X3 }% Q6 B$ e {
" i) ^2 M: l: s) Q) V. w6 R0 A theShrinkage = new Shrinkage(); F0 \/ D# [6 h' e/ v* z. q! p
// The following method shows the dialog immediately8 u* J% v5 H) D" q, D0 o9 d
theShrinkage->Show();' ]4 I2 q/ d& H9 C+ F
} O5 K) D8 w5 _- B
catch(exception& ex)* X: v1 I, ^3 T
{3 L0 f7 D& c. e" f5 p b2 f
//---- Enter your exception handling code here -----
! Q9 X ~( {* t7 z U# T" S Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());$ }( \; }* Z: v& ^* U0 k R# _: H
}
- C: N) g; V2 K delete theShrinkage;
$ I) _7 P, m) w- T0 u5 K }; Y- `8 V* e3 F5 O6 c! r
#endif//USER_EXIT_OR_MENU: b% {( \9 R. N. d
#if USER_EXIT# `: V: ~# p$ F2 { Z! O
% a* z/ q u3 X/ G1 t$ Q$ H' O
//------------------------------------------------------------------------------+ v8 b$ _4 J& Z m- p& s9 H1 s2 v
: R0 W( P. h2 c) C/ H* W- v% q, J+ m, Q // MUST NOT use this option since it will UNLOAD your NX Open application image$ i- R1 v5 Z) H9 p3 N( @8 d* e
// from the menubar.- F" l, l- n* J+ E) \" G
//------------------------------------------------------------------------------
) }5 j* ^9 S0 d4 }; O extern "C" DllExport int ufusr_ask_unload()$ j% k; _2 [2 p1 W1 t7 }1 ~3 K
{
7 ^/ i) B; y5 f //return (int)Session: ibraryUnloadOptionExplicitly;. S3 M: U( }5 [* _2 B& d1 \1 ^
return (int)Session: ibraryUnloadOptionImmediately;
k& s0 W2 q0 ]6 t4 i( v //return (int)Session: ibraryUnloadOptionAtTermination;
8 K0 L5 d# ]9 f }
! p( ^5 E3 E8 d. [8 ?
3 A, i3 s3 ~. U" q3 u( Q! i& b" e! z //------------------------------------------------------------------------------
( C1 k" }0 n5 v) H, y // This method is automatically called by NX.! x0 ^+ z9 G/ C3 N: \* r; _
//------------------------------------------------------------------------------% s' k" f( @" k& d. _+ c
extern "C" DllExport void ufusr_cleanup(void) V8 R, B$ n; t& G& X6 D! ^% c
{6 M. @2 S3 e8 M, n
try
' R, w; p: c- o: W4 C {
* e- A7 c z( ?. M# @2 j //---- Enter your callback code here -----1 l- ^8 ?. M) | V4 U/ U
}
& e M. T; s5 P$ ^/ T catch(exception& ex)
5 F) E0 ^) D. u9 d% X" ~1 z {. R8 j, m: {" V! J# `; u0 N! x
//---- Enter your exception handling code here -----' H( h' M, j8 @5 V* T% z$ C' H j
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());8 k: T5 q5 t( z' i
}9 l/ `( E( L9 z5 x3 S
}5 x4 U* M4 z# L, l9 V( I7 z7 K
#endif//USER_EXIT
" r9 y2 V0 y: o3 T! ? / Y) W2 m8 k8 f4 f9 M/ j
int Shrinkage::Show()
+ I' J* `/ i8 q. L5 }9 g0 W {
2 L4 O: D8 w9 _7 k; a try
( t" U8 R3 ]% Y1 j( s {+ R8 h( w& V, R- _, a) j& F9 B0 F
theDialog->Show();* W2 _! `. {# ], u" r
}
+ L& w! o' d! T% j9 q catch(exception& ex)
& }* R5 w5 b2 G+ ]* p4 h( Z, `0 S# f4 P {$ B$ G" S# D/ }3 n4 C
//---- Enter your exception handling code here -----4 s# |( a3 M, ~) n2 B: I) T
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());" Z( y! {! \) b# e- c v6 M
}
7 z4 m& Z4 [( a, {, r return 0;
3 R) K- k) M+ R- V6 Y }/ h6 V1 j8 F7 M" `7 M
6 s( m& p) Y# K
#if CALLBACK/ o( ~. {% }1 z+ F; O
E/ n) `" {( O2 k, q) u ~: H& \" i
void Shrinkage::Show_Shrinkage()- f$ L7 `* i# J3 P# R' a3 P
{
- w8 u0 H/ P+ V$ \) f+ B try
7 q5 U; |( i9 ? {* Y4 F. y* A! d y" i, J$ O2 K
theShrinkage = new Shrinkage();
, m. e1 [) G$ V; v/ r6 `6 t' B" o# y9 b7 G' n7 q
theShrinkage->Show();
7 j- }2 o* ]4 L9 h. a }
" E: q- O. s3 \1 q2 Y catch(exception& ex)( T( L# z1 f. Q& ?: {$ V V
{
4 N" E" j/ G) g1 R" e
: g7 k! K* r/ v$ ]1 P: @ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
0 w, `5 p: b4 o- R }$ |5 D, b- l& I+ l" l& [& l
delete theShrinkage;
' K& b" d; f4 b+ o0 l }
: ]) B5 j' d, s#endif//CALLBACK
8 `+ M. A8 a8 a% q3 ]
* r. ~% H/ m, t8 d void Shrinkage::initialize_cb()% ~) }* }# A' I
{
- R+ V! y6 Q. C+ }5 E" a; ^, i$ t try- e* W; p3 O: ^2 N+ M( s
{% J% E- |4 l8 P$ a E2 J
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));* R& }, Y) l- k6 F
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
- m: \) P. n2 N* Y% f face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
a+ G8 B& P4 V" l2 F3 C5 d group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
6 N5 }) v; X! \% w( h! F0 U bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
% F; ]+ L; t% A+ t* z- V3 R bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));: }) j* n" P* D2 I
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
5 f" s" H1 Y s string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
9 m* e) l C5 g, [ label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));- d& J4 U+ X. O8 Q6 G, G, E
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
/ y( M; A4 L9 E/ ?/ K* u label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
7 B' e, ~0 s5 ^% \: O label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
; } g$ P8 n* V U8 G; N4 h }1 [) V1 Z% u$ e% {# _
catch(exception& ex)
5 q% V0 s: ]: g8 n" a! C3 R {9 A- D% }0 D0 G' L
' i- I+ F" D, `! u Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());0 D% f7 v; T# O+ F4 u
}
: ? s- W7 G7 q0 @8 X& W }& N5 O3 t7 N; R9 ]* p7 g- o
//------------------------------------------------------------------------------3 v+ |6 v+ N! ~ o7 J
void Shrinkage::dialogShown_cb()
) g" ]5 X1 Y. m+ K5 j) ^ {, g# s5 s8 R1 t0 [) \9 J* V
try
* w& X1 P/ `5 o- o9 \. J3 X {& B- e! |' g+ i2 w* ? i
//---- Enter your callback code here -----
& t- n3 L; A/ U; n. e }
$ e F" l, R, \9 U* _ catch(exception& ex)# ]& G6 H) K; Q, X. s/ S
{
$ l9 G+ h. B3 q9 ]4 b
. V( R$ }9 h; ~- f2 W Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
4 E1 f2 F3 P" x' E+ c }
}" d Q8 _! C, q R9 p/ W- t }
: H, T& P# v: E; p
$ V. ?4 o6 V- ~ l int Shrinkage::apply_cb()" q# m& s* _8 P6 i' k8 F" X
{
! X1 c- c4 A0 u' @( k8 Y int errorCode = 0;
" _, `/ i5 ^' r& M# @& U" E try- r4 W T5 a9 W% c6 [7 [9 c8 T: Y
{9 U2 d2 s n( h) ~1 e
//---- Enter your callback code here -----! V2 K% Q3 n) r w. i
}: J6 B) ~0 |, w
catch(exception& ex)# R3 ?+ v. N' L! f3 D+ z
{6 k# O5 p3 I ?* ^6 ]8 k3 [$ d/ c
//---- Enter your exception handling code here -----
, i* Y* T$ s( v- S: R errorCode = 1;
8 t; [6 R! |6 f6 \& s: r7 n Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
( @" n6 A, [9 v9 N! i: x( c }
0 i. o& P3 j) j$ y: R6 h( ]( ? return errorCode;# f5 {' {. z, U, H3 U7 S7 q! r
}( x5 @1 z; \( O( v: y
( {* p7 r4 O4 m, _- A int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block); w/ v# g+ R2 F) D
{
4 }& C% \! w( ?7 X$ l, O( G try
; e- c( T3 A: \& S9 e' V6 x2 O8 r {$ s2 p+ V8 E& }4 j( c/ I2 N9 l
if(block == face_select0)
: C+ y T8 P" r" f {
. @( B* p# _. D //---------Enter your code here-----------4 r3 ~! {0 ]* S- }% ^
}9 s. z4 s X6 G4 R; U$ f
else if(block == face_select01)
, Q& X# d( E1 C9 P7 v# b {
7 h+ ?: p& {7 a) a7 L5 A //---------Enter your code here-----------; u9 U; _6 K7 |& f" @2 M8 w
}
! H0 U( F$ ^* I# }; m+ k; I, l3 [ else if(block == bodySelect0)
j8 W( ^/ E2 C {
$ Z- s# E" w1 k$ L //---------Enter your code here-----------& @& W3 @& c- }
}- T8 W: y7 q9 z% A# |5 A
else if(block == bodySelect01): y/ u$ {1 t, f# u, @. Q
{: t1 p/ @3 A# e# E
//---------Enter your code here-----------
2 C; u [! X! e }
- @5 o# f/ Z6 J: x( a else if(block == string0)
" s* n0 \7 a8 d; C i, J0 w {
e/ f1 Z0 r$ x. U //---------Enter your code here-----------
8 F4 j: E9 E& F. O( U" w# M; u }
1 ~" O- K- w8 d6 l3 L else if(block == label0)
2 O; ~+ U5 N% f {. ?) w* S- B4 h0 z
//---------Enter your code here-----------0 C4 B f& I( e- y/ h% m3 i
}4 P) b+ X7 F! M# X: e( r
else if(block == string01)
2 n) J6 w4 s/ J' n$ M {
6 H& H" u0 x! X4 m, w2 D. M4 e //---------Enter your code here-----------. l! c4 d" G/ `2 M; ]2 g2 g; {
}" L. X, {2 B, U& `
else if(block == label01)
% @/ C* _9 r4 C* k: H0 | {
6 M! [& V @' _' w8 [3 D //---------Enter your code here-----------; h4 t/ L9 C% I% l9 J# {9 A
}3 _2 {3 i% F! T
else if(block == label02)' c& x9 u/ x/ w3 ]0 X& }) f( w
{
7 r5 X! N9 D& i4 g1 `) l //---------Enter your code here-----------
6 H: j$ T& ^6 ~5 {5 w/ z }
- L9 Z x& a: `' V }
9 e+ B9 Q% _. ] F catch(exception& ex) C, v' W: Q6 ?& D8 n
{+ r8 l2 T! [/ h) k* s
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());- _7 p; b `3 l6 q% {1 p- D
}2 Y7 K9 Q' j# `( F; T% r
return 0;
. c) A) K! G4 n }- l9 c! ^# f' t4 m R6 X3 I2 |
9 n" U! G9 k/ Z$ a. A0 B n$ O
int Shrinkage: k_cb()
4 p8 z- Q2 D( Z! q, e, D( N {* v) y$ |7 o* N) \
int errorCode = 0;! J, N' W2 S Z) r0 U- H, l( Q
try$ F3 S: f, b0 i* E9 @
{" A% `0 |) f5 r9 s4 F
errorCode = apply_cb();3 d8 W! X _9 |+ k+ {' @" X# }8 v% ?+ ]
}
- I" k, k2 b4 _! w6 H% S catch(exception& ex)
V1 J- t; V' }, }' Y ?" M# l- q3 A {
8 a9 A# {' I1 x: t) l- C //---- Enter your exception handling code here -----2 b( P; j! J6 H1 j* N U
errorCode = 1;
7 r& R' o' ^) q+ o" d: N Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());. `' G; g0 @0 S2 ]7 @) r3 V
}
: @9 s T3 Y% ]$ m return errorCode;
, @. I v9 e4 V) ? r }. s' [! O" J# H# k9 g7 x
- P2 i( z0 _% j) g //------------------------------------------------------------------------------
: \& E6 g8 ~, H' k //Callback Name: filter_cb
* C+ J* G# x4 d" `' V: @ //------------------------------------------------------------------------------
" @+ F' C7 g' Z+ I$ P4 [& ~# [ int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
* R5 \' v* p4 {; ? {
& A) b* g4 u$ s* ^% h4 \5 Y return(UF_UI_SEL_ACCEPT);* o# w/ G1 M! k
}1 |% S" U f% L U5 D
$ v( _- _1 J/ i4 C! P0 x1 A% M5 { //------------------------------------------------------------------------------
/ E: l4 C) A* d0 B3 L void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
: I5 v g( e& S3 q6 B {8 P- G2 W+ a; E2 i( G
try; I' g% ?% ~7 C) ?( b% R5 Z
{
! ?; V! q2 K9 X. \; a //---- Enter your callback code here -----
# |% e* Y1 C9 y% B }& E& O [- @! `3 I2 U2 j5 e1 j
catch(exception& ex)/ t5 i5 n+ U, e
{
2 l) C# U, i7 N; g6 Q' ? //---- Enter your exception handling code here -----
. A+ b, f9 f: x; U" b Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());4 y$ \3 A" \4 H# K$ y& r0 i
}1 u r2 k' F/ G
}
, b/ e( @9 ]5 o9 C" p) x. c 4 N2 Q" l# b1 t) ^
//------------------------------------------------------------------------------9 l( ~- }7 `: X" T
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)7 @% T, V; f0 w7 @7 T
{
4 g# H# ]6 W: O. O+ P( b try
1 `$ ~4 V% G5 m& _3 f3 O: K# h {
+ d# h8 g J6 M! R) x1 U% A; c //---- Enter your callback code here -----
% b6 i4 F* X8 Y7 ~1 o2 g# c }( i) r6 o8 ~$ y: P2 V9 w+ u$ C0 z" g z
catch(exception& ex)$ m+ s& I# Y( m3 u6 a9 w
{' p+ v. C; F. V# X
% `, }0 _8 w8 Q+ E$ n, F, m% v
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
/ `+ ?! P$ [3 i8 I/ C% ]# k" O }; w( V; W6 k+ [
}
& u6 K9 f/ u0 M- o
4 ^% a. I* }6 D
& f) V1 ~3 H# f) U% B% W* e. d# n# X |
|