|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 ( Y) p- l+ _6 ], r R
2 `+ X) g+ ? R$ ~5 @( P2 G( i
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr' E" F: r3 S1 S
代码如下:
# S) V7 d* F' R6 g* {4 h* r9 v#include "Shrinkage.hpp". |; ?* B0 Q* q! A2 F% @3 G
using namespace NXOpen;% q5 ~. W A3 d
using namespace NXOpen::BlockStyler;% I4 A/ A( P- g% b
& q C, E: E# Y* k0 @( c- o% T# q) QSession *(Shrinkage::theSession) = NULL;
! K# J* \% X1 U* AUI *(Shrinkage::theUI) = NULL;/ i- @) E7 G# t# t! h
! r# o; W" T* e7 AShrinkage *theShrinkage;
# l) @1 t1 U I4 y( A# v# s5 o( @. w- J/ M, v1 |$ D& E4 n
Shrinkage::Shrinkage()
9 g& M1 b" }9 b1 U{6 h& x8 q6 L7 H
try
) G' Q6 t% k1 { {) @1 @5 ^1 L! R5 [8 ^
// Initialize the NX Open C++ API environment6 z3 f* J1 n9 ~1 j- @2 s8 U
Shrinkage::theSession = NXOpen::Session::GetSession();# x2 O+ d5 H7 L' }& b- u+ C- S9 l
Shrinkage::theUI = UI::GetUI(); s8 c0 d+ O& R( G9 I1 ?
theDialogName = "Shrinkage.dlx";0 [1 y8 \" k+ R
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
) a, f6 w1 D. P/ P8 p0 O0 m4 b // Registration of callback functions
! p& R [' O, v5 S1 W theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));# j5 H$ g* K# ]2 d3 G
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
7 u% R' Q2 L `( } theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));6 j3 f+ |. w( E, ~* K
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));6 M5 ?7 s' D9 x) c. ^6 E
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));3 E3 f. e. @9 z* t' i% A5 ~ r3 n
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));, T* i* h8 |' N. C/ P
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
% I4 a$ @2 p8 Y theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
2 X0 q" |6 l, T5 ^ }
7 N2 }! O) h& x; i. q# N caTCh(exception& ex)
0 S6 ]: C2 Q5 t# E3 b, Q1 t {! g% M2 ^3 }/ [- B) v. T4 n
) a: d( U, V. }0 n2 y2 E
throw;
8 y' d7 b# Y# E; {! b% P% n# a }, Q( N8 Y9 ~1 k5 H
}5 ? M5 V8 E3 S; Y( k
& l1 @& U/ \& u3 z0 {
Shrinkage::~Shrinkage(), [ @! x% I2 I$ E# y+ c
{
# D/ l- L; n2 q- g3 V- g if (theDialog != NULL)
' p. d3 n, x# |" s% e {
+ K/ _$ O4 o3 O9 L N* d i delete theDialog;
( h1 r/ i1 y+ u* v: J2 H theDialog = NULL;
- |6 Y! u& K' Z2 @2 @ }
3 a% m+ U1 C+ I! `1 X) q7 w}
( M* _ L2 ]" J5 t1 U$ o& c$ u0 y: i- z; L7 a- y; C1 f
#if USER_EXIT_OR_MENU% O4 O2 K9 q$ a4 U3 r% c
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)/ D& r9 g# D0 m3 d; n( z) ?
{$ `* k" q! D: O/ `; u+ Z
try
8 Z2 A7 \! h( {5 @0 `9 C {
+ P* H9 V% Y3 m theShrinkage = new Shrinkage();
D- p: ?8 D) C4 {3 k // The following method shows the dialog immediately
`0 L) q+ w" E: c' \ theShrinkage->Show();
U6 q+ t! X o( X/ B% h$ X, J3 O }
! ~' C! @9 f S0 G8 Z& N2 V catch(exception& ex)
7 e1 l4 T3 S1 J6 P+ ^ {$ n' v* O! t, @6 a( O1 c7 {2 v+ t
//---- Enter your exception handling code here -----
8 F* ?0 N3 R. H" W: E7 J+ l. e Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
. | W0 [' \9 Y j" L. k/ H }
Z# ~* A. Q# s; b- n ]( L delete theShrinkage;( o5 `% `! r1 B, Q
}
( R0 f8 H3 M* d8 B; B. ~4 I#endif//USER_EXIT_OR_MENU
E8 ?$ r$ c- n8 V# |0 P9 R9 B#if USER_EXIT0 N: }$ I" w$ O8 B5 H1 Y1 h
& q1 c" I" i, z; z
//------------------------------------------------------------------------------
' `2 c) W( E7 F. t2 c! [
5 A$ H( N$ [2 g, H // MUST NOT use this option since it will UNLOAD your NX Open application image# O+ g$ {2 E; P9 u' \9 z
// from the menubar.6 T2 j& I: H* t* X. c5 Q) ~
//------------------------------------------------------------------------------( a9 Z0 E8 Y1 |' t9 I! g' ?: @6 @+ c
extern "C" DllExport int ufusr_ask_unload()5 J2 S. B7 @2 |7 r9 |
{
o5 E" f* Z" o. E: c //return (int)Session: ibraryUnloadOptionExplicitly;
( G% V- i4 h! e, u" c$ H; d! X8 x return (int)Session: ibraryUnloadOptionImmediately;
" U8 Z/ ~5 I; f6 k //return (int)Session: ibraryUnloadOptionAtTermination;
9 P; m! |+ Z/ v/ _" L }
" x9 v4 q( W, V9 j& C: ] K" n
* {" u3 |) |. O; C; @ //------------------------------------------------------------------------------" D9 f6 J+ p4 V* z! }
// This method is automatically called by NX.
3 L" R; d4 N# O2 {$ o //------------------------------------------------------------------------------* u6 Y. [0 _" l& t7 i: v- u
extern "C" DllExport void ufusr_cleanup(void)
# a* F- ]- p; H0 P6 \ {* W: a* l# i. Q& l' T& a
try# _- l. X+ H8 i& m! Z+ }
{
" e/ c# i5 _, z; Q5 P //---- Enter your callback code here -----& Z% S& \. x% t& x
}
# C4 e' O- Q. ~& l2 u5 G) y7 N* B catch(exception& ex)
( [, ^4 |/ t6 U; Q% V8 E7 F {
& n) y) P! p! q //---- Enter your exception handling code here -----
8 N# ^) b% {( a' j% o Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
. G6 U$ ]( [# F( R9 e6 g |2 ~) ] }' \' [# [: W8 U, t$ C$ U4 ^
}! f$ H# a. c6 j* K( U* @1 H: R( h
#endif//USER_EXIT4 z! k* f& F. q, v8 e" Z, H7 h- K! C
" a% a1 F3 j# r
int Shrinkage::Show()
5 N8 v% q o6 @7 r& n {
& B3 u, h( T# x- h try$ w$ i. ~' x1 f
{
/ ]. T" H3 X' P1 N theDialog->Show();
* k8 X0 s9 D: a# a$ R1 f9 I' N8 y }& ^, j; u1 D# q, q2 \8 |0 }
catch(exception& ex)* Q. H- p0 L, T: M7 @! a" [
{
' m/ |- j: S* E. M- L //---- Enter your exception handling code here -----, D7 T$ N" r. s. ^+ l
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());& u( H7 l$ o2 B! p$ Q: L2 c
}
% s4 x+ y8 ^$ y/ h return 0;0 q2 @( M G6 ]' y: O0 U
}3 D5 c; ~7 r8 Y3 I
# B i) g& r/ D) r! A
#if CALLBACK
3 q/ V/ d3 M0 e' _/ u3 D
4 u4 ~7 K% I/ F9 e# {" I/ k P& M void Shrinkage::Show_Shrinkage()
( @9 S% T2 h5 m% A2 T0 [ n, o {* v7 X: f- P1 s: P
try
4 B9 L7 R/ Y# G. } {" M/ I( b' `/ v* a6 U5 A
theShrinkage = new Shrinkage();
2 I( L" t4 t) R1 b0 H3 r3 o) A' Y+ L+ [
theShrinkage->Show();
6 g5 H( @( D+ [ }: l9 I$ }3 `8 L/ B: w, s
catch(exception& ex)5 k7 O, f2 C: w+ m- e
{1 c8 _5 o- y/ q5 f9 \
) d/ o; d5 ]5 i; ?
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
3 M& |; E& o. {) G2 x6 P }
. q$ `- [$ @+ M. g delete theShrinkage;# u# z8 _7 u9 G$ _& q
}
+ @9 @3 K, A j#endif//CALLBACK% p7 k% E8 {- _
4 j9 V; `) A$ G5 D' I% ^: Z void Shrinkage::initialize_cb()
# e* N' Y; R. p$ Q- N, R' Z* s$ { {
1 c/ L5 ?' K6 e9 i try
$ `/ ^% i- C" u* X- } {4 `0 r# u+ H% e# n% |' d
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
, N; b8 z- K3 ^! N$ y" D6 K face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
1 @1 v8 \- b$ Y9 j+ x2 s4 ~; Y face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));9 B B# h: H% T' v. a
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));( _& S- L* H: R: e
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
3 J8 s) {7 x& S3 D bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));; I+ }& s* e. c& A) F g$ _- b
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
8 O! u! G, E7 p, ] string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));) j8 E4 m' `9 i$ H2 s# m
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
2 Q% A. t |1 ^- a- a& h: C- M3 n string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));; N. ?3 ^$ C R% y, \
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));: w' `9 ]8 |2 I* g0 W$ b$ ?
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));# k6 R9 F% J8 M- Z3 B5 v& g: }
}
0 a, d8 _* r0 s catch(exception& ex)
{, w! E+ \0 N% ?( w {) A1 {* c1 J& x; M2 N1 ~8 Y& u
: ^5 O7 W+ T# w! @
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ c* B! e! B# E2 j* _ }$ U- P P) n4 `! p9 s
}, N& O- S) W! F, M" I' a
//------------------------------------------------------------------------------
( Z% H' ^' {& w% U6 z void Shrinkage::dialogShown_cb()4 S: d/ o0 }$ ^7 L: }
{
# K- l1 F+ ? S2 ~$ S try
) J, M5 Z o' M4 J) _9 v) K0 ^ {
, L0 E5 _4 z$ a( Y8 b //---- Enter your callback code here -----* c; ]3 K& ^" |% z* P. L$ z1 m
}
0 {4 T W3 ^, u; H catch(exception& ex)
: y$ W2 ^- ]: _ ~1 R' V2 k {4 {5 J1 @; \& r) d# w1 I
$ U' y$ U% s9 M5 V7 Y6 M9 K w
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());, R. u7 i# G3 H% s$ c
}# z- r, b! q K Q" c
}( d' i( T' k. u& a
, Z6 J: A2 o: ], P2 N2 U: w
int Shrinkage::apply_cb(). Z3 P1 U; k" f$ D& V
{
1 g( _# a# P8 |7 s int errorCode = 0;5 U# Y4 P& e- G) f+ v9 A
try
' A% s3 M* s2 P8 e1 a+ { ~ {
4 |7 o5 A5 \; m9 { //---- Enter your callback code here ----- W/ t. |% D1 D7 p
}
2 ^7 N. @) d) A: |) s catch(exception& ex)+ ]1 Z/ O/ b0 r" g/ T4 S
{
2 P3 N5 K9 N6 V, Y2 O //---- Enter your exception handling code here -----
$ S: v$ Y% i$ q3 e/ }" [ errorCode = 1;
( z) r& o: x4 M0 R Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());. w9 M* F, w& z
}
9 S$ K8 e: q' r; W! L8 a' m. G return errorCode;
5 n* ]0 o4 w6 T% W9 q% _' o }
, P+ @8 y2 ~" m4 h# p$ l9 S
+ K+ ~8 S2 K- i$ P7 X* g int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)& Y# I3 N( I6 h! T
{
( N1 F( i4 R1 Z3 q; Y try
" e5 B( T% |0 @$ r9 h! V; {6 P {, s X! T7 Z% \
if(block == face_select0)3 @; d1 j4 c/ e+ v
{+ [0 n1 T( U5 `; i4 ?) z3 G
//---------Enter your code here-----------
7 S5 E5 G) e1 h, b }. l- Y. h' o' ]# F
else if(block == face_select01)6 n/ L: K$ S: J2 n, `6 [
{3 c% Q4 N' g- Z
//---------Enter your code here-----------
n8 U" }3 c" b1 ?& @3 @! @8 y% v }
! V( j% V, i: `: d9 o3 N1 Y7 P" H else if(block == bodySelect0)' k4 ~ B4 @/ i8 ]6 L
{3 Q" e8 I7 C* s9 X K7 A
//---------Enter your code here-----------& i1 k. h4 C; v5 e3 P) H' a0 G, A! u
}
3 M; ?5 V; Q# A l% V9 G& f8 | else if(block == bodySelect01)
( c+ S+ n2 T& Y* @4 \ {
# L; z q- ]" G+ B% J, g4 ^ //---------Enter your code here-----------5 u( I% x; N3 d' B9 V6 s+ ]
}7 m0 m0 \ } Z
else if(block == string0)* C! U5 h5 p2 F
{! k$ [1 ]5 T& ]
//---------Enter your code here-----------
3 i- E' U; c U* e }
- g# H2 w( e% f& I | else if(block == label0)
' P: R% x( y# w4 Y5 s' \ {( V. q6 C6 m" y) C$ X$ L% V) c
//---------Enter your code here-----------
) f* S4 E! X. o$ A2 Y }0 |7 Z# V" H' \
else if(block == string01). Z5 [+ N3 i5 p& v" S( A
{
# ?( ?8 C- z" I //---------Enter your code here----------- T% B) s- \5 `4 S, m& o/ F
}" q" v7 N& ] M6 P! V
else if(block == label01)
& m4 ^6 x) a3 C# G5 @ {
_4 K H# b- m& [: l //---------Enter your code here-----------
1 K+ J9 v7 W% Q( { }" w0 ^4 n& H! ~+ p& i& z; r) c
else if(block == label02)
* P8 [8 @- P& Q {
0 a9 {, V9 }) l3 ?* F& f //---------Enter your code here-----------4 X8 E" N4 c" j+ w8 D$ P5 f( W: E' |
}+ A6 u. J7 Q2 A! V% O5 b( o Q
}! E0 O6 h, m/ K3 f4 D. i
catch(exception& ex)
4 M# B' w* p i E* }6 ] {: k/ ]% y0 k4 x1 Q: Y; B
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());+ b$ b8 O8 h6 n# ]- |- N
}& ?- R5 `! h% U: M6 r
return 0;$ S+ [. e( f# z7 ~, S, R" T
}
$ ]) p' N, C8 ^7 T
: G U5 _& D/ } int Shrinkage: k_cb()
! x) z* M9 |& K% w* S5 T8 u3 ]4 t8 Z {
% Z( b$ a& @% D! [ int errorCode = 0;, c" x# z1 D( J: f7 I. h$ q# k
try
3 o$ X$ ^& u3 y: {) s {
$ h( i$ z4 k$ N9 l: r$ h errorCode = apply_cb();
" G7 n* X7 V6 D$ ? }* ?1 m2 c J5 v1 B
catch(exception& ex)
* f7 z' d K% ~% o% [ {
# L0 z5 o1 q- n3 R" ~2 n& c! v //---- Enter your exception handling code here -----
- Y+ u; X. N3 C: s; V; L$ k: T errorCode = 1;
2 U' |. Q1 N8 {3 c" N Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());2 P1 k6 J' N; {+ T& ^$ A% `
}5 x+ b9 @' h: e, C
return errorCode;
: v, U( z6 R# h4 J }5 }8 k! a- Y5 c
0 D9 P) C, I& m2 F: d+ q1 V6 o //------------------------------------------------------------------------------8 T5 g$ w4 e" B1 [
//Callback Name: filter_cb, Y5 R- N- u0 o/ b% \, D
//------------------------------------------------------------------------------- \& h! _: a# D% l V
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
# Z! X: z( ~- ~. G# H: z' g {
/ F6 V8 i! l9 C4 W- [6 \9 _ return(UF_UI_SEL_ACCEPT);
9 `$ D; x) J' x0 ^ }, S/ N8 _" r; F$ e' |' ~; K
! _6 E& N6 s3 I- O# Y' r4 P! J h //------------------------------------------------------------------------------
; c% f7 f6 l9 ?) x0 |: T7 b4 w1 ? void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
) V3 t# q6 w7 A2 E. k! { {: M0 w8 l8 `: w$ \' u- e m$ y) c3 ?
try. \* n n& z& N
{
$ ~9 v( D" @$ y# F$ B: b4 e+ P0 O //---- Enter your callback code here -----
! I2 E" {4 v/ v5 k0 Q0 ~ }2 C- T6 G) U+ y4 b' c8 x5 ]
catch(exception& ex)
+ g8 L; M+ \0 `+ c" | {
! v# f1 c* `6 x) h Y: y //---- Enter your exception handling code here -----
1 R2 |0 w) |# q2 F Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());% j7 _0 k( R7 P6 E# J4 |7 y* |
}$ Y2 D+ C3 f4 z2 r" \+ G9 w" {
}
4 f0 R9 |% ]4 |3 T8 Z2 Q S1 I4 I3 n% B0 a+ X, ^4 }+ K
//------------------------------------------------------------------------------% c; w9 l! }) V0 C3 N
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)3 [. l7 T% p' L( q( A( @1 }5 |
{ K! v8 l! L5 e& k
try
+ F/ u; m! Z6 Q9 h$ P- ? {
- k' `3 b3 j; R* |/ W //---- Enter your callback code here -----
# B2 b3 h7 g9 A( [) Z6 z }
# _# R2 C& b- B/ R catch(exception& ex)- E( P7 o9 x* d2 N/ S/ y& A
{
' z* l% L: y) y# n- j# Z4 s6 ~( Y A. P' ?; T
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
! h w# r6 }) B8 B }5 s$ ]3 a2 O# e- J+ ^7 {1 r" a
}, r3 N2 |, {( g. `" z
) \2 }# w" A# S& u: K# @, S& H* ^& J7 x. X: G" ~8 {; S
|
|