|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
4 ]9 K& P1 X0 c4 Z8 f" C% e
$ r8 U* U: d S; U) A请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
, T+ c5 r7 T1 Z% b2 J& f! _& [代码如下:
+ p l2 h) D" |6 \, L1 b( f4 ]#include "Shrinkage.hpp"
8 p" h: a( {+ K( Xusing namespace NXOpen;
) B5 v" o" j' c/ u# qusing namespace NXOpen::BlockStyler;" J# }4 k+ d3 z; a; {) B* O
' ]6 q0 F6 Y5 Q8 uSession *(Shrinkage::theSession) = NULL;. Z: R. P- {/ A! O# H+ [
UI *(Shrinkage::theUI) = NULL;
5 X4 r$ F& H2 f; z# n9 b, H O: t+ i
Shrinkage *theShrinkage;+ X: f2 K$ {, y; U+ K( u: Q5 w. h
# `4 d% o7 G* |* O* _! X9 ~" SShrinkage::Shrinkage()
( ^0 U3 {0 n2 w+ y% y{5 e, D8 R& X5 N* m6 F# k
try
8 [" o5 n/ @+ ?! Q& ^: D {4 e; v. D; ]; R* V M# a2 H% c9 `' a
// Initialize the NX Open C++ API environment
! _7 }* r4 [# c# |7 a( r Shrinkage::theSession = NXOpen::Session::GetSession();
% A" B6 O, @: E Shrinkage::theUI = UI::GetUI();" L+ o; X- s0 R; Z% T: h
theDialogName = "Shrinkage.dlx"; z7 T; g. a+ T6 h/ O/ U8 p
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
3 D. H0 @0 U9 V6 Y // Registration of callback functions' f3 G8 C% z. A, s3 N. `3 n1 N
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));8 e3 O7 g- K1 B' m
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));5 |5 m6 V7 R& [
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
# I; }- k9 b- L3 v9 \$ u theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));6 b: i+ v8 ^: L. S3 Z
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));. F+ [+ H% E, K1 u' g: ^+ Q( z
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));2 P+ e: U6 c8 p. r$ b$ r
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));2 y7 C9 }$ O3 n Q, ^) [1 F }- ^
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
4 R1 d1 D: ?6 S: `) p }4 z0 J6 I/ N7 s( \- E( d' H( }
caTCh(exception& ex). |2 \. |: c. z- i. M
{
6 U- w& C& w5 }+ N+ m+ u5 n
+ o7 s2 p' W6 i; `4 r throw;
4 t. X' c9 K$ m4 ^ }
: t' W% D5 t/ d* m" N}
+ B/ r' V" a+ O v% r! s2 u7 P7 }
$ O: A& z6 g2 e" e" Q: aShrinkage::~Shrinkage()
% S/ Q9 o: V1 P9 n{; N9 _0 C! b" c+ ~1 m, p
if (theDialog != NULL)- S( l3 [' E& M2 O3 X' U
{& M A0 I' x+ a$ L/ f
delete theDialog;0 }" s% r( u9 q; N# ~
theDialog = NULL;2 j7 b. V4 g5 w- d6 C. C9 \
}0 m( L6 [* r; {: j( ?
}
7 }+ N8 `6 N- l& O/ a$ f4 ^& C9 I( _- l9 _* `6 s [: x
#if USER_EXIT_OR_MENU% w# |8 U% o' t% l& y: E" N6 `
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)' S! r( _/ G! |
{& k/ R6 C% X$ m' h" F( c, ]
try( ]$ f/ @( i. \+ X2 k! Y. y
{
) I2 r; O6 y8 u4 Y6 g theShrinkage = new Shrinkage();. D# z) P" f7 V% N
// The following method shows the dialog immediately$ i+ v5 |: a$ N4 y( \9 n- s) Y
theShrinkage->Show();
6 E! D( T+ Z7 ^: f* V: W1 B8 Z }
, z4 g: v# y8 D8 F& B6 e" g2 j z catch(exception& ex)
5 R" R0 `/ n& h- N! t# _ {+ g$ N4 ]% f! m4 q o
//---- Enter your exception handling code here -----
& R5 D- l+ i% q/ g+ Q1 a- Q Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
* [; P+ V6 v/ S: a7 l }' ?. |, L0 M* F0 C
delete theShrinkage;4 q8 @1 o9 n. g! J) `: Q% ~
}
) B3 i2 u0 b7 D+ p7 ^#endif//USER_EXIT_OR_MENU
% F& n1 o8 L; q: {' F1 |#if USER_EXIT
2 U3 ^% V0 E* }0 ]2 h! t
a# F4 \+ {0 X //------------------------------------------------------------------------------$ n# Q. F- `$ L
) V. @) Z+ \" s/ r( X$ r // MUST NOT use this option since it will UNLOAD your NX Open application image# f2 L8 [6 M& w( Z+ Q( Z! L9 L/ x
// from the menubar.% i! e0 z0 z# z
//------------------------------------------------------------------------------! L# ` c2 A& k
extern "C" DllExport int ufusr_ask_unload()7 S4 K- H& E" n* Q: Y
{
% a# U4 u$ D2 \/ j! O% G' V //return (int)Session: ibraryUnloadOptionExplicitly;
; g: T/ C. p) |% w return (int)Session: ibraryUnloadOptionImmediately;
2 Q0 H: n/ ]9 T8 f$ R. ?1 C) Z2 R //return (int)Session: ibraryUnloadOptionAtTermination;
. f; m8 ^! C" X$ f }8 ]5 [7 b' [) [
# K. {4 t& U* B; J1 ], ` j- G* U9 Y- N //------------------------------------------------------------------------------5 F5 f9 X( B# L6 k) z) v
// This method is automatically called by NX.5 m$ k2 W3 K& V' @! [$ t8 f0 B+ e
//------------------------------------------------------------------------------* J. ?) ` C( c) U2 B( r# k' ^
extern "C" DllExport void ufusr_cleanup(void)
' z2 l2 [) G9 Q {+ |& Y* T2 {% a8 G: o+ Y4 a
try* k1 i6 w0 \. W6 F& D
{
% }- D/ s7 b) ]# `' G5 U2 n //---- Enter your callback code here -----
: ^8 _6 R6 T5 _# K }/ [; m$ V4 S$ i# v1 e. w
catch(exception& ex)
! u i4 p4 v5 Z t# I {
5 h: Y: u4 ^- x. l: `' W4 ~ //---- Enter your exception handling code here -----
g# V* F8 {7 F0 i( D Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
& V& _) F; Y& A0 X# r/ t ?) { } d2 T& V. p' `) B+ F. B1 p$ q
}) }5 s, G( K, i: \
#endif//USER_EXIT
) `; L" z! H5 D( Y% y 5 b3 j0 s& ?! z$ y- f [+ j
int Shrinkage::Show(), p1 ^7 t$ y/ M5 E% G! R/ K0 M
{# n. Q5 y* R( r2 ~; }2 g1 c# l
try. e* t' M5 R( p) I `8 r, C
{
1 W$ m( V S2 E) Z. B" P( p theDialog->Show();9 k% X% a8 M: [2 X
}" t9 n- y$ O$ f! r" ~
catch(exception& ex)
3 {" S$ ^* C m; m0 X {0 H4 `' l( D+ w; [. L
//---- Enter your exception handling code here ------ {: N6 Q) T2 {1 f" e9 z
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());: B# e* \$ z- Y x
}
) |8 B) z! [; _/ w; ~' m return 0;
2 B# n' q2 H! F! ^% h% t8 q% ? }
2 x$ l6 G* @# H
% l' ?- H' ^/ m- }#if CALLBACK7 M3 j% p- j! d5 r6 j
* C- f4 z& G3 X: B void Shrinkage::Show_Shrinkage()
5 ?8 y- ]& }0 S' e {9 O/ u V# m8 G5 ~ g
try
2 C9 X; L% E8 [+ z$ j# l6 _ {
2 f6 ]4 L4 a/ m8 T theShrinkage = new Shrinkage();
8 C; Y0 j( q7 ]6 u( Z3 H) N E& u! }7 X6 J0 f) ~! @* f n
theShrinkage->Show();4 c: C" y) Z- ]% R- Y+ a
}- ~! g3 g# q8 X) K, A( x( I4 N/ D8 [: u
catch(exception& ex)/ |3 N8 L9 v1 C( r. \6 A( E
{3 H1 Q; n) C$ @) z
( Q1 m5 s: I1 E
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());6 L/ |$ u* S; o3 W. }
}
9 ~$ X/ ]7 R4 m! o0 C0 p1 R, y7 H delete theShrinkage;: m D4 }4 Q: L* `7 d4 F6 V
}
( C! P1 ?4 L0 W) ]- f8 x0 l. R#endif//CALLBACK
. F4 q% n7 @, c( V( r2 p : w4 y( Q& y% T: z
void Shrinkage::initialize_cb()
5 v1 a' K; F( g! {- R# g- V {% y; s& N# Y* ?3 n; `1 ^
try5 v: D! h/ @! O8 e7 I
{/ B% Y0 C3 [( q6 ^
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));7 c' I+ F: [# w# y. n3 T0 n
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
0 w/ R5 L" ]2 N `; D6 R face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
9 D" ?, S* p2 ^0 s4 x group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));: S+ R: S8 s$ j$ j
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
& r: }# K0 W0 z0 s4 K) D bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
9 v* S: W; |! Z1 N3 M! I) _; a group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
. d9 ?0 b/ l) O# r" n' e string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));* V# }$ \: n; V8 E( w1 X1 Z' K
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
, z# u+ l. E' _' W string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
6 S8 }/ j/ d2 F% R" t label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));2 M0 c9 N8 x `3 j
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));# y3 ~6 {( |; K% k( L
}
) g; y" S; c) e catch(exception& ex)5 ^# _3 \/ U" u( d
{# b h+ x: ]6 s/ W1 E
6 D6 P! O) M: q% }) Q Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());* K0 S7 i% J A
}
1 O4 M1 w# q" }! J: T }
) V+ @; \. o) p6 m) ^! B //------------------------------------------------------------------------------/ L. D4 ^1 c1 X- ?4 b
void Shrinkage::dialogShown_cb()
( p& v* M* W$ e {$ v. t" C4 ` l& r
try
# W) p/ }6 [1 E {5 j4 d0 Z- K! Q* l4 L
//---- Enter your callback code here -----
: I X% W }" P. L% J+ ?6 w; K }) Y# I3 |: |' q$ d1 L/ B9 b- ~
catch(exception& ex)2 \: X" b4 M7 R
{
9 _% B3 x- f% w2 A3 L7 D9 q, L1 A! F* C& B% ` @9 J: T
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
! y1 d% h! a9 [+ j0 W- N- Q" \) D }
: h' L) R2 T2 C }8 v2 h. d4 ~. B* p- B( W
5 A; J7 h% m+ m& B int Shrinkage::apply_cb()+ ]) u' W# G& |' ~
{3 s$ p1 B& A0 ]. `7 A9 k4 W
int errorCode = 0;
. u! E% ]9 S- ^9 X- H. ~3 ` try- t3 h9 b7 ?, G I9 _' |
{
7 t. ]* D5 u2 J# W //---- Enter your callback code here -----' z8 M. w6 x: \) ?3 l
}
7 o8 ?: x6 R5 Z% |, U$ j catch(exception& ex)
2 O& Z3 E0 w# ~; A$ ]0 V2 f! M0 s: Q {
! E i5 t) y. ]% D //---- Enter your exception handling code here -----/ A* q) A5 N6 y, ]9 [
errorCode = 1;7 ?9 t% Q2 D% b' b- ^* e
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());0 u# U9 J) b1 w" X6 d$ O
}
' P2 u; N! c/ u& v2 Y return errorCode;: }" m; }: X( _* r& ]5 g7 z4 o
} E6 C( F" z, J% t( z
% g( l3 t( Q7 w }0 K5 F# `
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
: l0 G: P- H1 R. X5 O {4 {$ F) E$ {! y* T& x0 b6 w% H4 m8 g
try
: [# N3 M: r8 O9 ^' E {$ n: A: i4 u! V3 i
if(block == face_select0)3 `7 j9 Q! O/ C3 O: d L$ p: b- ?7 e' S
{( F) P" M# ]0 o, u, v7 q% J
//---------Enter your code here----------- Y$ Y& w" W& p" X l
}
6 l# U5 g% L8 W e/ a' v1 C else if(block == face_select01)8 H; {. m' }# Y* M5 F/ q$ T
{0 p. V+ Y) F# H y
//---------Enter your code here-----------& O: A7 T, q7 z* x; C
}
% f2 `7 j# H) |5 Y! R6 R else if(block == bodySelect0)
: O; E& r; ]% |% N Z, i( h+ B {
; ~0 h$ i) Y# P5 n& p //---------Enter your code here-----------% J4 J2 y0 \" g% x- m2 I
}
, W9 s8 E. S# S6 q; p else if(block == bodySelect01)
& r4 n1 `6 D/ x$ p {
e' B, U5 s+ v! g //---------Enter your code here-----------0 B9 _$ |7 L- [3 E& i9 x
}
. a% S$ N* u8 a. O- W0 D else if(block == string0)
% {) l; r3 e2 {( R1 c* I* m* t: a# x {
$ x" x* w z* s; q. w+ w //---------Enter your code here-----------9 h. Z) x# C- s+ ]
}
8 b& Q! g6 z# n) R7 E: p else if(block == label0)8 w) L5 }$ Q, M9 t9 X- \5 t& _# i
{
3 x' v& f- Q: u: t' d( M9 P //---------Enter your code here------------ ~( G! ?8 [- \6 |6 i" L5 X
}
' l7 L. z8 Y1 ^9 y( \7 U F8 T% X! t else if(block == string01)
2 n# |; g! l1 w; \8 f {) K# |- s+ y% q
//---------Enter your code here-----------7 J, s% g0 T5 X9 q
}- m8 |# |4 \8 |5 @9 `' v
else if(block == label01)
% E$ | u5 w7 k5 d9 p: [7 p {
8 \3 w) L: @( x, @ //---------Enter your code here-----------# y7 a) c7 r! @" D, d$ S- |
}
$ `6 `7 K( B7 L( c4 ^ else if(block == label02)
9 B4 R, Y8 L# _ {
7 O5 t4 c3 |9 k$ D //---------Enter your code here-----------
' K! i1 F" `/ D7 N1 T) O }5 L9 p# A* M7 j
}
7 X [9 h5 z5 B" b P9 |" Y catch(exception& ex)
8 O8 `3 k5 q6 V {
1 I! b+ F7 W* o) _6 f: p, T$ k6 D# u3 \) q Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
. i* G# b* d/ S+ m3 a }! o* C0 c; H* j8 z' C2 J7 M' I
return 0;, E9 z" Q$ p! ]0 S& `0 Q
}
" t- O2 C: q7 H. G& X. J, I! `! T A
( U9 U' H( s$ o( i int Shrinkage: k_cb()
6 r3 w5 R# V- ` c+ T, O { X* j( ^" F2 z+ B
int errorCode = 0;
5 ^3 Q0 y9 q( G! h7 t try
# g& D6 {# M' X* u3 h$ } {
" P k. K( z1 k# E } errorCode = apply_cb();
6 |; K+ D: z; e }6 P9 D3 L) L! L3 K% r! v
catch(exception& ex)
& O4 x% U! b' }8 X6 S. w; E/ ] {+ E. t! {% `9 d! B
//---- Enter your exception handling code here -----
! F3 v* L2 o8 { w) {, H) ? errorCode = 1;- o1 J0 D) m8 O+ o
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());8 @# Z# \- c" f6 ]% I7 E+ I9 U
}
5 p& m. O: R% x; p8 V* l return errorCode;
4 K z7 I+ Y5 F: G" d }6 D5 G* ~2 U0 u0 q- o# c
) p( Q1 k! ~4 W. n% d
//------------------------------------------------------------------------------0 Q3 n5 \/ v) w( f% s* v z2 ]
//Callback Name: filter_cb" x) c' c2 K% d" L8 v7 Z0 D
//------------------------------------------------------------------------------
r" K' l& B j+ K0 q0 W int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
. h( }- I: @! B {: M0 L$ E) z% Q, U- r* \3 d
return(UF_UI_SEL_ACCEPT);# Y; T ]/ a* C; `. p
}6 f) S" M# P3 K2 F% \
) T4 ~, s1 p. U/ L //------------------------------------------------------------------------------
0 U; l4 q( R- ` void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
7 R& f+ h3 O9 b7 N. A0 g8 n% w {
4 L# K5 |0 I' B3 ?, q" k. Y try
+ X# ^1 y. _0 P" f) C; Z8 L% S9 @ {
9 R" A7 G0 D/ o5 G$ f //---- Enter your callback code here -----
$ h+ X- H. R6 D0 A1 H% ]( O }
2 R, j1 w2 o4 ~! g$ ]9 L catch(exception& ex)
5 p0 e' K) i, ~2 e* S H7 R {" [1 q( ]6 v) w( k& F$ q' W
//---- Enter your exception handling code here -----
3 S! M! S5 H) A r Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
* U8 p6 |; k7 o; Y3 z+ T8 u7 U4 o }% v* ~( w' D; `: y1 q: r' k! G9 O
}2 a% q4 {' r6 B$ q4 g" U
5 j" ?6 M% E! i" } //------------------------------------------------------------------------------3 o3 {- l. F5 M' v1 z% w1 ?
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)+ X! N% @1 }, p' e& @3 ~) t
{
9 |$ S7 M$ {( ^5 ^. X try6 y2 @5 Y9 e9 c3 B- {( A9 }
{4 G7 M' b/ p4 K6 A% S# L; ?
//---- Enter your callback code here ----- b& f- Q& w6 f" D ^
}
8 K% d/ K5 \' b# V7 t catch(exception& ex)1 y; r4 I0 I; N
{
, G) c1 E- ?/ j, V- h6 d7 m- s% F! u* ]3 s, {+ U
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
: ^4 E+ l6 \$ M0 R }3 y# ]* b; R- J* C( T" G+ j
}
! i* L- ?) W2 T3 g: E3 Q$ X, \# u; W+ q) {0 x8 l
( A, S$ L( M- K- C6 J0 D8 N8 n! ` |
|