|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
8 o J, c% Z: a; \5 l- i* `6 c- o, U* G+ K; _2 }9 w+ m8 l8 S
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr( ^! q2 U: j0 N: G$ ~' j
代码如下:
0 ?6 ?% G* u5 V7 f( ^#include "Shrinkage.hpp"; h3 g6 H3 m5 ~/ V6 v0 l
using namespace NXOpen;
# D8 t% {; k" q" c6 w% C; c" t, _6 Nusing namespace NXOpen::BlockStyler;
+ `- r2 x* I& F4 p
( E" d7 n; u3 ]; z. nSession *(Shrinkage::theSession) = NULL; G! k( ]5 W$ e v) _" p7 |' C) Q
UI *(Shrinkage::theUI) = NULL;
# A7 \ T {, P1 V7 @
( m+ K5 Y1 l0 _Shrinkage *theShrinkage;
; ^: C& F0 H% I8 ]
9 E: \/ V$ z$ M' d1 G; Y/ s! D/ LShrinkage::Shrinkage()
2 |. G+ o% c% ~9 Y' O7 R0 D7 k{
* F. [( I5 `& M2 r { try
3 @; T8 Y2 d! | {
' ]/ u. B( D' Z9 l0 ~ // Initialize the NX Open C++ API environment7 Z$ o b' K5 a! v6 P: x
Shrinkage::theSession = NXOpen::Session::GetSession();! h: B0 b/ ~1 w! Q B' \+ B
Shrinkage::theUI = UI::GetUI();0 }3 T" W/ N& L0 I, w, h6 t: b. @3 S
theDialogName = "Shrinkage.dlx";/ i/ x) E" ]$ ?1 C1 Y7 K& U5 F1 K
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());: d0 C- D4 m/ z+ |$ D' i( Q/ Z
// Registration of callback functions3 U# x1 b2 Q# w- ?/ ]5 K
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
# q. g; g+ v( ]1 K' H6 | theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));: S5 t) [, Q' d# W2 d9 k4 g
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));/ k Y0 C3 U+ X% l( D% O1 n) Q
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
. ?4 D- A& r6 q theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
. U3 Z' Y3 e9 H9 S6 @6 o) ~ theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));, z( r! i" e, S
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
0 ^3 l/ X0 k' l4 T* t theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb)); x! r* C* Z, G4 A
}
1 r1 h, l$ |5 a* M. }; U caTCh(exception& ex)
B7 d% n7 b4 f' q$ n: e. X/ m E {9 W5 P% b4 ?6 x' Z3 K3 W
; I1 a5 X; [6 H throw;, m; k! I& Q% {/ A8 ]6 Z$ m
}) n( l0 z# ^6 V" i" v
}
; ?1 Q# p/ Z$ `; s& B+ S% `, B3 o; H! L* N
Shrinkage::~Shrinkage()
8 \: L: N4 z" u8 A& y1 {6 R{ Y/ H1 s9 h% c
if (theDialog != NULL). K% d- A5 K5 O* z# U0 e
{
6 d# e" T; ~+ ]1 z6 E8 u delete theDialog;1 f) j: \9 l9 Q k3 U
theDialog = NULL;
$ g& G' R- y) z0 ] R s }1 S7 ~4 q, M; ?& n8 [3 L: N( M
}% {4 p$ {( m# H) D$ v4 ]. b
( F) M* P1 K; m1 \2 q0 L f
#if USER_EXIT_OR_MENU
) x$ A# F2 `. l( M1 f8 t2 e8 U extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)9 H" k) q7 y8 t8 F! j
{7 b; I2 T* u+ L* N
try
+ B2 E8 t; p8 t {% @+ C8 W9 I/ L q. X
theShrinkage = new Shrinkage();
7 C7 S n/ ~8 M& k // The following method shows the dialog immediately( v0 B9 ~9 p1 C q) B
theShrinkage->Show();
) c1 u7 b$ T4 I. J4 C" d }
. A+ Y% y+ d4 S5 E: @ catch(exception& ex)- X- w" X! J7 h5 w1 S G, H) L# `
{+ H7 n, ?! G: B
//---- Enter your exception handling code here -----
3 ^* q9 r; W8 a* j Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
; G% M, s1 y' z; n& f: D }
0 b3 h$ i, q0 ] delete theShrinkage;
" R/ Y7 P; I9 E; G }% O |: d6 x2 ~1 J1 U6 g* h; @1 S
#endif//USER_EXIT_OR_MENU" }2 I* a/ N7 S* u
#if USER_EXIT
0 Z$ d* T. X- C5 J5 Z; Z' p, } $ Q* C, c5 I3 Y" u, W& X
//------------------------------------------------------------------------------
- Z& ]6 k+ P) W! G' B: ^ + S/ ~- J# a c* a }
// MUST NOT use this option since it will UNLOAD your NX Open application image
/ T0 S: D* _) _( W" V // from the menubar.3 e, y; v& ~& ~: I
//------------------------------------------------------------------------------
$ i! z2 X# c! t! y/ ?1 @1 @/ {7 ? extern "C" DllExport int ufusr_ask_unload()
* \2 B5 M# e( n" C% e {( R6 g2 o- _; S( j) h; ~
//return (int)Session: ibraryUnloadOptionExplicitly;
1 J# I% G3 c/ u$ P, t# E( D, Q return (int)Session: ibraryUnloadOptionImmediately;
Q4 J+ f9 x2 R& h2 W: f //return (int)Session: ibraryUnloadOptionAtTermination;5 C% \" D( R4 @' ~8 k+ k
} B! h% Y- V% A! \: y
& q" h6 z! b/ z- h8 Q2 s, N# V3 F$ Z //------------------------------------------------------------------------------% ]& g/ S. u: f& V- c0 z! o/ G
// This method is automatically called by NX.
3 O. S3 U# C! v# Z) C% S //------------------------------------------------------------------------------* Z/ M4 K9 v5 a+ Z/ r) a# F) s
extern "C" DllExport void ufusr_cleanup(void)" }! ?3 M' B4 I' F" _' s) i
{
6 [; K0 M- _' [8 k9 K- i0 {9 C0 @ L try2 I& f/ B0 T- p% s- D/ P
{; n' m5 B4 a- h6 I& U" o
//---- Enter your callback code here -----* Y/ A" i* j( g* m6 ~! p/ D1 m
}2 a* r. A0 u F
catch(exception& ex)
9 k1 I% V8 S& Y9 J1 m- H& h5 m {
* ]1 U8 Y4 T# M" H0 Y //---- Enter your exception handling code here -----
6 b7 f( C. E, n$ U& @8 _ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());. F1 W3 w# I( N, u3 `6 |
}4 s5 C/ {; o2 f' S! k: Z$ i
}6 v8 J; j9 x, N [& G2 y/ U3 F- b
#endif//USER_EXIT+ o1 _+ p) O3 a& a
6 M4 t' ]. M1 p7 M6 ~
int Shrinkage::Show(); M8 Y# f. S2 |% i* }" U- n
{
# Z; N E6 v' Q- B6 I try4 p( x0 c3 L2 b
{6 H! d1 s1 d, C# U* T% Q
theDialog->Show();# Q6 ]7 T6 a8 v ]) P1 N
}
( r7 e# V. {, V- R# o9 Z, B catch(exception& ex)
$ C) O, [8 j: s* H7 H" C l6 I" S4 ], S {3 | n: O2 a; l+ R, s1 {4 ?) v/ x4 R
//---- Enter your exception handling code here -----: |' L ^1 [; L K, t( [7 D8 p
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what()); ? A* H- D# E9 g% l5 G; M7 z! o( q
}
' X! Y* @( q& X& Z return 0;7 z: K% R" u- L. Z
}2 \3 c7 v8 h( e$ {/ ]4 @
, j* T5 K( X- C) z#if CALLBACK; s1 @! z1 F3 O1 w
5 P( `% j9 c+ v: \+ [, k
void Shrinkage::Show_Shrinkage()' y- i8 P, c4 d& U) J
{
" N1 P1 U$ N. L8 O8 f& X3 T' @ try8 _+ j) c* C: v# i5 Q. W; I
{
+ P; v2 L! o# S+ V- K theShrinkage = new Shrinkage();& } T+ B+ x# p% b' @
7 T2 I; |' r6 \ o0 ^" [- N
theShrinkage->Show();: d% o1 D4 M/ E5 f9 }* O
}
1 g+ Q$ W; A& z# X7 y2 E, j4 Z9 ` catch(exception& ex)
3 V! O1 ^& v4 z% ^7 J0 K, f {# k6 N. B$ U5 r) A
) @. l7 M* I7 M& d8 E; q7 K, S
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());/ f; l# c. H/ t# J7 I- n* x/ A( Z6 W
}
" n: h- a \7 l3 K6 M0 D3 y* h% u delete theShrinkage;
, N' K% {0 G7 L% a; {* ]& E }- ^1 x$ b% ]# c" ~' J0 B
#endif//CALLBACK8 r$ p* R4 _! \/ C6 N
" v9 E' U8 V8 y% k! H" w7 R; b
void Shrinkage::initialize_cb()
2 J7 ?8 V/ U# Y3 X' F( T {
4 I Z: v) n/ s7 P" `7 T try
- A* n; A/ d. b4 T l {2 v- b6 f+ p8 p/ ~! }4 H
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));: i( e6 ~! x3 ]( S
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));# w ]3 b+ a- s: k0 I9 v. Y
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));6 l; c k2 n5 I# I6 J6 N# c
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
+ X' k" [- {/ q; G6 @ bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));/ h: N, D1 ^, F9 g
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
" W+ ]( L5 `8 X# G6 s" w' p group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
" H8 m) W6 b* ^; p* |/ I* T string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));8 `5 W) a" |/ M5 i
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
/ T, V) @' j4 I7 m q string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));+ u! s: ~; x: N& b
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));) s4 ~- z+ ?- Y/ E. w
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));2 D4 v% T" A+ ~) ^9 J# t2 c
}6 J( Q: ^- P1 V; n* l/ ^: ?: q
catch(exception& ex)0 R- f* b1 Z: M( A8 P) }
{
+ v; k% S( ?+ Z: l7 ~3 i6 ^& Q
n F; I8 R. x. h) U# v: r/ |; @ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());) v1 i; _3 ?- \& E
}
. I2 i0 e& }# S) A0 s/ b. E }
. J; A$ L0 Q4 K //------------------------------------------------------------------------------8 R @ X) ?1 S7 ^4 |, h: [
void Shrinkage::dialogShown_cb(): ^$ x# l7 C: N+ t
{
- M% _+ }) W% S* Q, c/ \4 c) R try- b/ Z8 S3 Y6 ^' `+ m
{* \2 v1 J ^) e. X# ?5 }, f7 C2 Y
//---- Enter your callback code here -----
- T7 z4 {% e# S1 C" q( r& a& ?3 [ }% e6 T" h% T! M
catch(exception& ex); d1 U! x' Z F* r* r
{9 ^* ~6 N$ G+ y, o r' I& D
1 k @+ A% D, b& y4 R* x! D
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());) x& V/ B) ]6 ?9 X/ Q- W, a( _/ B @
}+ D( }% m( R) [0 K" s! o$ t
}$ X/ ~5 C; @$ {4 H" v4 ] M
4 w6 k+ Y* x: o
int Shrinkage::apply_cb()! ?/ _: u& \: r6 x3 p7 u+ k
{
7 q$ e; X f$ W4 U int errorCode = 0;
Z' p. b1 B$ L% z% \ try; @3 E4 [0 y: a# H; B% n# P
{. h9 V7 I& Z2 L2 a0 D
//---- Enter your callback code here -----
. N# s, ~5 q- O9 F' _# k- r2 B4 F- ~, u }
4 X" I( Q" K* x$ ] catch(exception& ex)5 A6 a: Y" D6 I2 ?- Z7 S$ f
{
' Q( H' W' o5 _ //---- Enter your exception handling code here -----' h2 j* U3 _$ a( t6 | d
errorCode = 1;' R6 ]. C1 J' l7 [: c. o
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());+ e7 u2 _7 ?7 m9 Z& E$ g
}
; r* Z. \: Q- h O return errorCode;
; j5 C$ |3 p" o* v/ |" w& w }$ ]* m' g/ n# ?- z
2 n' P/ Y5 h2 ?
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
; D. S( i# a2 x" _ {$ V# b5 \( c7 q2 a+ t, _
try0 \9 }0 [7 Q8 S, G; {6 J
{4 m% Y T9 D; N4 |3 S% @
if(block == face_select0)
- `+ ^; k: F% V( C0 | {
$ a9 p$ I% R0 h' n+ ^. p7 r) v //---------Enter your code here-----------
$ `* K% p, d$ j) U; I2 y5 g7 p: X }
& {2 G* ?' `/ N; H. a8 y else if(block == face_select01)
|8 q0 w# J: p5 T( ? {
5 p6 N% E; H/ ]$ l //---------Enter your code here-----------* S* t' K6 ]9 b- e7 f9 o
}, f; k! f& {3 ^# M: w! ^+ Z9 l
else if(block == bodySelect0)8 D U; f2 S2 O' x4 {+ p
{' F2 h6 Y7 Q; c* T2 I0 H/ i: b
//---------Enter your code here-----------1 N3 k- M. {( W. }7 J# T& A' i
}
1 S+ c# B; g" M. P- R else if(block == bodySelect01)
6 g( y$ S- c- j' _, D: k {0 h. H+ b4 x% R, O ~0 E
//---------Enter your code here-----------% |* c3 |' z( V T0 `+ a
}4 m0 ]' I; K [7 A# \
else if(block == string0)! a" s1 K" T0 r6 Z
{9 S3 d" j9 J1 y+ d+ W* k$ E( \& ]
//---------Enter your code here-----------1 V2 e1 n/ x/ a6 R3 B# t* F
}
k7 C; G& Y- R" G- {& ~$ b else if(block == label0)
1 w" g( \. k2 y K# I' k) E3 w8 R {! L: J7 i# D% R" y7 w S' [: O, E; D
//---------Enter your code here-----------# _6 a' F! r! h
}
1 I; i: q9 {4 C) N# ^ else if(block == string01)
/ q/ w, N8 ^9 { G5 [ {% M1 `# ]# L3 y9 _& k/ ]$ D5 d4 V
//---------Enter your code here------------ g. J) P2 X: c' i9 r- [2 ~
}
9 {7 g) M4 w- w/ U( a8 x# G else if(block == label01)) P( U8 O7 R* i( f
{8 K: c& o( d- K
//---------Enter your code here-----------
+ S$ x1 x7 m+ y# j3 V }
& s9 b; g; F$ @ else if(block == label02)0 h4 E# ^7 P( }; C& Q2 T% W; c+ k. s
{
6 x9 ?- o1 ]! y' u //---------Enter your code here-----------
[! l' m3 Y7 o+ v# v* K }
9 N# J, H s2 e' o; [6 x }
" H! n/ Z" C; q) { catch(exception& ex)) G4 F6 I- I K- D
{' p! T- }) l# O% y6 i% F0 X( U
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());5 j0 j' S |6 _6 o) z
}) Z' u$ L+ c- ^
return 0;
* T+ N9 X2 S2 r" h }
' {$ l6 v4 [$ O, z, y# U' B
0 ~* z% X: B ^: @, h* n/ \ int Shrinkage: k_cb()0 D+ c) |2 c' F7 u/ R; T+ P$ L
{2 k+ C2 C* }9 U* Z
int errorCode = 0;. ~! R/ E2 ~1 x7 W
try
1 T; e" I; |1 k: K2 M) }" V6 k {2 ^# j% Y& E# k- K; N
errorCode = apply_cb();
8 h. n+ {6 C3 @) u }
! ~! I1 L2 [: `* [7 l catch(exception& ex)( U9 j' X' X2 \/ u9 e [/ \7 C
{
/ w! T3 v+ W& ~- w! E //---- Enter your exception handling code here -----( Y) V1 M0 t4 W3 G3 s$ c4 N
errorCode = 1;0 s7 W% w0 _8 T) p) e5 F4 ?" H' d1 u
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());& R' O$ C6 z, G0 g* q; \0 {! f
}7 {' X# f6 M& k- s+ K6 Y/ M
return errorCode; q& f: f2 q7 l8 w9 d9 E$ e
}
5 _8 o4 W E3 i8 d/ C
$ d+ W# `$ _: K& U5 U# l' Q( _3 l //------------------------------------------------------------------------------9 g9 @4 U- a, k
//Callback Name: filter_cb7 W- \" e8 U a" C1 B. b* \
//------------------------------------------------------------------------------2 d% b! G0 c- Y9 Z% k
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
: C1 D: z# m0 S' v" }' }# h* N {+ D. t$ @5 J6 y
return(UF_UI_SEL_ACCEPT);
8 j& {6 X t: H: I; w! {4 @1 ?6 ] }
6 Z3 @- H" b0 X# Y6 G6 b" v' ? ! R; O- ~0 e2 ^' B7 t2 Y5 S) }
//------------------------------------------------------------------------------3 N. p, C! T5 ?/ D* ~6 k6 v, p- ]
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
0 ~9 ]& g X+ g _2 Z {
2 \0 ~- o; k5 E, a8 c( ] try3 o; U( T; y% h* u1 @& R1 l
{1 E4 S7 l4 {, B
//---- Enter your callback code here -----' d+ y% y* h+ {2 T' ], }
}* ]7 N! i. h! K" c. F
catch(exception& ex)+ P$ e' M' _3 r. h; R+ p: @, b
{) v; @9 e" a& H$ A/ t# W0 ?4 }' Y
//---- Enter your exception handling code here -----
) A' w" Y8 U5 r5 r Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());4 [5 D1 R5 ]+ t5 v; h+ C" e2 R! d0 s
}* ?0 v6 E+ v# u! D+ B; X) L
}
: @) C* a) }; Z2 r 3 E* O0 H, C' O& w) w9 _
//------------------------------------------------------------------------------. ~- Y7 q$ U+ V R5 ?7 h
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
/ ?/ k6 ^$ d" {" P( u. e& q {0 D5 t' ^+ }. L( c/ f. y# W
try
+ Q% X2 H7 D2 E1 E; R0 c {
4 m/ y7 T8 g' e _) Y //---- Enter your callback code here -----1 ^" v* V, A8 C6 m1 _( m0 R
}7 D) m" G y3 ?- j! ], V
catch(exception& ex)
, Z+ K+ y2 _5 f. m& ~ {( W: N: u3 n7 v6 _. l$ S
7 q$ C. @% P. t. G
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
- t/ X& a+ Q \' N }. r |( R) v1 w. v) W, x* R/ _
}# t/ y. H4 J* G
- U, f( N' b- C2 R. T7 B# _8 l9 p
$ n; X L0 P# T' Q |
|