|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 , L& X$ _/ [5 a* Q4 S* q9 ^
' @! j' K- t0 r9 G4 @% ^8 g请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
6 }- L0 U) M! G* w代码如下:3 T2 d, e8 _8 A/ u8 P' S2 ?
#include "Shrinkage.hpp"2 @% K6 Y' i; l" N/ H. `, h
using namespace NXOpen;# H0 q7 A# q% R
using namespace NXOpen::BlockStyler;% H; [/ N) O: q% a( k8 C
% k* u p5 U: h1 e: }Session *(Shrinkage::theSession) = NULL;" i, H& m% ? h) K8 S* q( n# L C
UI *(Shrinkage::theUI) = NULL;( K' B5 R! a3 N' Q; ~1 e6 `
. Z) e) q9 S( f4 i' o
Shrinkage *theShrinkage;4 g4 z3 t$ \, q& r. G! T9 O
6 X. ]5 B9 r8 J3 O7 U$ ^
Shrinkage::Shrinkage()% i% A Y; z, {% B
{1 n/ u5 \7 y( L6 R4 d
try* r- y, e2 ^- Y: N2 J3 m4 S# [
{
/ c( L7 U0 O! R5 L // Initialize the NX Open C++ API environment
' [+ M! z4 Q& }: d( g Shrinkage::theSession = NXOpen::Session::GetSession();4 S- j3 Y# k: W7 k: E$ U6 a! l' J
Shrinkage::theUI = UI::GetUI();% h9 z' w, F" p
theDialogName = "Shrinkage.dlx";
+ `/ n: _" I+ |* z# N theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());6 E H$ v2 S; U6 ^ ^/ w
// Registration of callback functions
1 o4 x+ k& g1 {6 \ theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));# p! {6 _$ ~2 I' r4 i9 h' s
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
5 w4 c8 c) z7 ~9 h. u! E theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
/ g" _3 t9 [) Z theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));3 |+ R8 L* N4 Z
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
# B& K! b7 z6 M7 z1 h theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));1 o6 }$ ^8 l% ]1 R
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
$ d4 k8 t- ^: U9 @" z5 w3 n- r" m: [) m theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
$ W+ G3 e5 m2 B1 q }
# y4 l8 R8 }4 {* y caTCh(exception& ex)( A; w5 H9 G' }, ^) _8 A
{2 A" [! ]$ A' G. h& k
! ?# h3 f4 @1 u" \3 c Y
throw;
+ @+ U) J, O& ^9 H* C }
8 y* d: q2 ~7 P6 [}# t$ A0 K& _7 P9 ]
, x+ u, k, ^) {; O! J, E, pShrinkage::~Shrinkage()
, Z+ }8 H" |. t' L: I4 y{ ~# t0 Z, L' k4 S. a/ M. j
if (theDialog != NULL)
; E" n4 I% d' f3 b1 [, l {
0 p" U( U) L( i% X delete theDialog;/ @1 w0 z6 s2 B0 A
theDialog = NULL;
- Z9 k! @; U" V) \0 N S }
6 G8 j4 T( p7 ]1 ?}
% \+ i3 ^+ W" g* V7 f" y) x+ Z; K: O% ?6 J6 m& }. K0 \
#if USER_EXIT_OR_MENU
* [9 \% P. U$ |/ m9 m% X extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)( S" w& |3 m* ]% F; N' Q4 U
{
: X! J/ S- E: Y9 L+ \% ? try1 _4 H( P3 K; }. ^' K
{ `. K T6 w: S+ b- _7 q
theShrinkage = new Shrinkage();4 }% C& |/ j3 E" M
// The following method shows the dialog immediately
7 X- c6 }6 f; W( O theShrinkage->Show();
. {8 d& m+ f0 h) f9 i: O: F }% `2 X* x, s) Z( m$ y
catch(exception& ex)
# R; A% q+ u6 d* d {
7 h$ E( A) ~% \: d: P, n2 L2 g* ` //---- Enter your exception handling code here -----
X/ D" S% j' a9 T1 l( o# H( P Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
: N7 q2 T- S G0 U }
- ~) V4 S2 ]: f% l6 s4 t delete theShrinkage;, p9 F# `5 p& w* J- {& B# P* c6 N# e% `" m
}& e# _* n" [1 s! _- t& k
#endif//USER_EXIT_OR_MENU
; f' U1 q$ s$ Z4 {8 o l Y#if USER_EXIT8 H" f/ X- ]# [/ Z' ^, \
; |6 a& }/ y" e
//------------------------------------------------------------------------------
{2 G. Y' E! j: P" ]6 k6 m( a
8 }4 r6 M$ i6 o! p: A // MUST NOT use this option since it will UNLOAD your NX Open application image3 M7 c) H4 x4 B9 B- k- R
// from the menubar. A: Q! C: L3 @; F
//------------------------------------------------------------------------------
7 F# K1 M. E7 L+ |# N9 z extern "C" DllExport int ufusr_ask_unload()
2 p* X4 a: s) m$ l; ~ {
( b8 C! L4 t0 U3 m3 A //return (int)Session: ibraryUnloadOptionExplicitly;% v- e% {& i/ {' G/ [. D
return (int)Session: ibraryUnloadOptionImmediately;# Z: T1 Y! d- D+ L
//return (int)Session: ibraryUnloadOptionAtTermination;6 y2 d0 }% _2 V+ u6 n
}: A0 R8 \. K/ W$ _& }1 q6 N7 o- A
1 z+ Y$ [2 {- |! r. @, e
//------------------------------------------------------------------------------
: B8 R5 Y& u' v4 X. D" ]. u7 k // This method is automatically called by NX.4 S8 M: l: {5 S4 Z" R8 z
//------------------------------------------------------------------------------
; z( Y8 J5 [: q5 k extern "C" DllExport void ufusr_cleanup(void)! J; |5 w2 {% X% P; o( G
{
7 l; j# @/ h* o% \! R; [* u try
* _. N. E; L" a4 Q- x {4 A0 D( @3 I. u! N: f9 W# ]9 g
//---- Enter your callback code here -----' e& w; J7 C5 L' G
}$ P( E; t/ a) [8 D/ Q9 @
catch(exception& ex)
# D! K3 d( t3 {/ ] {
/ @' A ]2 [8 [/ O6 C! G //---- Enter your exception handling code here -----
% h. }% L* F3 I Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());% |, U4 y4 s4 t4 F
}2 q% V% k! Q2 ^4 K$ z# B! [
}
$ X% w% F" y$ v0 ]( x6 o* Z. s#endif//USER_EXIT
: Y! _& ~" w. ^
8 U- u; A% i7 _+ P1 ~) v int Shrinkage::Show()
* w A8 F1 z6 r {
- q k3 R* ]- q/ W, W7 O, z* [3 p! N2 u try
# [0 C& h% H. U% ] {
1 \* x3 k7 G* Q1 S5 k! f B theDialog->Show();
/ [, k, X+ u; Z/ v2 k5 @7 n% w }' K' g# V! [, R4 w* c6 [) H- c
catch(exception& ex)
E6 V6 f/ T/ c) ^' I) @2 |. t {2 @" X/ y7 L5 u# t
//---- Enter your exception handling code here -----; T2 B1 B( c8 y" c) _7 Y/ x
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());. @* C H' i4 e# ?
}# f' y* z( a( z. c: y
return 0;- {5 i. [/ F' i( s
}+ [8 g( \- O: g* }: \; h: m4 C
) @. H4 Y) u& d#if CALLBACK3 g. l+ B. Z( [
; M5 E/ k" A% V void Shrinkage::Show_Shrinkage()' V$ l! Q. P/ }& B3 ]9 Z5 X
{7 m$ o) a: e/ T2 M
try' i( A8 _: o0 s+ V. F: P% c+ G
{, r2 V/ N; Y. C; ^
theShrinkage = new Shrinkage();
6 E/ Q3 c4 Z" I) ?3 G6 R% q! B' v$ w2 R% e8 e/ l2 m' h x
theShrinkage->Show();
/ Z5 B; p2 e+ G3 a7 Z# m }$ x4 {4 b+ _' \
catch(exception& ex)
& s) w9 D' d. W$ d, v3 F {# b7 c5 `. _ T3 r0 r
0 d% H% h+ }) l# V! g; z' O$ a
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());' D3 m" ~0 | b4 y: @
}
4 E0 { _5 F2 X" j; q. B G delete theShrinkage;6 t, b+ V2 y/ E7 M/ u) a
}# I: ?* P& B5 P6 [( i% p4 \' ?! [
#endif//CALLBACK
8 k$ |& J! ]6 U# h/ r ) q) a y1 d, D9 D0 U
void Shrinkage::initialize_cb()
$ _) v: P. p9 {+ m {
1 O( R& ~/ R4 T: Z$ e; s, i0 F8 z try, s8 i+ S4 N$ |( V
{
/ `) z$ Z: F- G) X) N: T' Y" S: Q6 p* s- X group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
$ e- o% G* x3 h! ^! ? face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
, ~1 |2 c6 p6 h8 O) v9 T( ^, [ face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));/ @/ k# i" S! M. J! l- D" ?
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));: Q: c( R- ]2 S! d( H+ w, u) Y( T
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
" w& o- q+ y6 u# E bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
$ N; a* L; g# L$ E5 q$ \5 G group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));: v2 Y$ j. r+ Q2 O% x
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
* q$ c& E5 [& h. h U) V label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
* T1 a8 n# X9 F$ ~$ s string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));* u: V V- @, q
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));$ d8 t2 o+ {+ E# H' n+ @5 J
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));. o$ x8 v! u3 `3 ]2 F3 x" f, x% ~
}3 U# `* X8 {) l% E
catch(exception& ex)
3 O2 I2 @# J' @) }( @ {
; ?3 K9 T, O0 ^+ `* ?5 b, b: v ! v, P* ?) y3 z; W X! L+ I' e
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ o; ]1 h6 T) Y( ? }
" }. n$ u4 p0 g }/ }( ?; @1 Q5 m9 z) B; a4 J" k L! @
//------------------------------------------------------------------------------# Z+ g. X8 Y+ d; V5 I. u
void Shrinkage::dialogShown_cb()
9 _4 n) O: Q# W# n2 I; J {
. ?( }" _# Q: }5 L. G0 f try
5 I y) b5 L4 q {; }- e# }& C# S4 M, `$ Z/ h
//---- Enter your callback code here -----! {0 M0 H; w- H7 f2 f( @! r% X
}
% p3 Y" o# ]$ S. G7 i catch(exception& ex)
! ~7 Y2 J9 T6 S& K3 w9 j8 B {
$ ?( m0 f. p K+ [" B+ {7 V0 |; `3 E4 a+ M @
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());7 ?; x- z& K) t5 v) ?
}
0 M9 n6 \, U/ V }
/ P: H0 S. a# M8 G6 b5 L0 n
: W4 t9 s2 }6 Q& D6 i5 u int Shrinkage::apply_cb()6 T8 e: x- ^6 f7 U/ z) S
{* r; d7 C2 q0 C0 x
int errorCode = 0;
% m* W b5 m5 m5 z) e8 Z4 u try
* S8 l1 K; X! p- ]0 O4 U {3 H) I5 V! Z% I) E' Z# \' u4 ~1 I
//---- Enter your callback code here -----
$ I2 F9 n$ e8 u7 P; { }
6 {: K8 b4 B; t catch(exception& ex)
8 _0 s. g p' [; W: W {
5 |+ [! v; R4 x3 u, n //---- Enter your exception handling code here -----
& `1 D" X8 ?. E8 W& ]9 | errorCode = 1;
1 f5 F5 x: m% z6 o I6 r Z Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());/ j w+ [" g$ @6 i
}
( C1 A# |4 M2 B4 p# o+ p5 Q7 d return errorCode;
( C% e' X g+ g1 Q+ S+ n }
2 b8 L9 N$ J; k1 s! Q& b" n& ~$ Q
! a6 a _, y/ @) n0 F' x# C0 d3 T int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
+ B% J# P# E; d, Q5 j {. }# H. B x, _& z& h: y
try
# g* e0 w& Z) T& @' S/ z. [ {
) l4 q6 ]$ H) J2 \ if(block == face_select0)0 [/ z) @+ F' e* U+ i
{; ~4 B$ l1 M0 O7 L
//---------Enter your code here-----------
4 e6 @( V$ T' U1 [- t }
& }7 i+ q& q# c3 Y; k, ?; ^ else if(block == face_select01)
4 J5 `* b4 ]& g {% [2 @2 A8 Z1 v, B1 k: i4 f
//---------Enter your code here-----------/ {8 l6 @; W" d! M0 a/ v9 S
}
8 w( g7 O. a9 P, _+ Y T' p+ c else if(block == bodySelect0)
/ u) N1 C# a7 e2 r {0 y/ A: V3 }8 c( q; Y. R+ c
//---------Enter your code here-----------' n& i" l$ ]$ ~- f! P. x1 o: C
}
0 I' a; e7 J# ]3 h4 H else if(block == bodySelect01)
3 ?1 Y( Y: R" i {, Z+ F, P8 X4 q
//---------Enter your code here-----------
6 W: U9 m# q8 d }
# V8 B! e/ k. |" I' e else if(block == string0)
% [" V k5 W! v j0 `1 B {9 u& S0 O0 M, p' ^
//---------Enter your code here-----------
; [% C/ M5 j* s' l# m }7 T5 _5 G" ?. |! o
else if(block == label0)
# z! m7 ^, Z" A; J0 o" a3 u {& w5 K; L5 K X ]: I
//---------Enter your code here-----------/ n* H4 S# o* _" K u
}5 [1 _, |+ b1 t# E1 K Z9 X' \+ m
else if(block == string01)* J/ y: X$ [! E1 q0 d4 q5 J$ r
{
$ {4 @* s# ~- J- F; K //---------Enter your code here-----------
5 F+ m$ Z/ |& Y$ W' d5 ~. ] }- i3 ]) |; P t6 A+ j2 b
else if(block == label01)
7 W! c5 U$ y1 x6 d3 z. Y {! k: E$ i) a6 M6 J9 l# B, q9 g
//---------Enter your code here-----------
& ?# E1 s5 O* b9 T4 [ s5 k; |. f }
3 `+ @: j0 s% P( Z2 a else if(block == label02)7 W/ D" x0 E9 E1 q; @; N
{
8 u- Q% q# P3 X, W //---------Enter your code here-----------: {6 e" K* C) D1 l* y
}
, S$ j: `5 P; i$ {* u }
" z9 r g4 g+ G5 K: b catch(exception& ex)
- L* ?* c! \. \7 C/ I$ L) M {
$ ~ I2 ^* g9 _+ z( e2 f Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());. f/ }# ~ m# _/ D3 V" v
}
$ ]" i, @4 U; w, q# c. j J F return 0;$ V0 V, G- u6 z$ L
}
/ _, P7 h6 h o; y# }1 V2 \ ; c$ X" x3 q- e* K+ i# T
int Shrinkage: k_cb()) F# w. Y2 x; z7 C7 F3 Y0 a) F
{
& U4 E7 q5 `4 b5 n/ h8 [3 J int errorCode = 0;
& s" O3 x1 R* v/ v9 K- W% d( R6 F try& o/ D% }% ]# n0 Y, J
{2 d- }. j& g. v
errorCode = apply_cb();; _+ ~2 _4 Z3 B% }2 }9 J
}; W0 f5 L+ n9 Q
catch(exception& ex)
& [$ ?2 s( q& _& w) j& C' p {
$ j" K4 Y% Q, J: C //---- Enter your exception handling code here -----
9 V" @4 ?2 @: `$ I+ a errorCode = 1;8 R1 U8 U6 }3 \
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());+ E. d e' X8 u4 y v
}
; G& z! |! W6 A5 ~! Z L return errorCode;
3 _6 r6 {5 d. D# K+ k1 ^ }' c' Y! N J* I* J, ^. Q7 @
* f2 m& ~; @: Z5 S& S: O
//------------------------------------------------------------------------------
. \) J/ ~* U1 Y( k Y6 f //Callback Name: filter_cb9 V$ p/ e. c1 d7 e% o& u# E( |% g
//------------------------------------------------------------------------------# j6 u' F% P( p, x9 h- C& b( l8 m
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)" O9 E6 |7 {" A' y4 u/ Z$ v
{
9 H4 R' s6 \; |& ?# X1 L4 Y8 L return(UF_UI_SEL_ACCEPT);
* M7 W9 w, |) E }* {, x. P7 U5 h
% K6 k4 J" N; \; X& H* Z //------------------------------------------------------------------------------
9 E# h* S- v$ A- b& m void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
" S& Z9 h. Z- s9 m8 W0 o/ J {& d s9 L& Z" ~4 T3 S& O2 y
try4 r Z; z4 p! u9 T9 K m
{
, l3 z# G; |$ Y0 B, N; h! m4 B //---- Enter your callback code here -----
" D8 z, S4 D9 t A( t, L. c3 { }
" ?5 `- N' r& A$ ?7 d catch(exception& ex)9 p1 f Z8 _# B& \. S `
{
2 u+ n9 ~7 v6 g //---- Enter your exception handling code here -----
5 ]5 _7 E" s' K& X# v/ z+ a1 h- d Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
; X, C. t5 v+ l' Q6 U9 m }
8 C6 K, Y$ O+ O/ o" k: b! J! f }
0 j6 T; b) Y; P* j$ _! q% {" E & o' \) [' |# b" F
//------------------------------------------------------------------------------0 L4 s _; z2 c6 v$ {+ z( m9 B7 v9 o
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)& L6 e( i/ v. x; R
{. X S' s$ C& Q% { g6 i3 t
try6 c" t4 n! v6 ^; {
{
4 p- [5 H) S3 T& y- U# r //---- Enter your callback code here -----
& x- H3 f! a7 E7 V( ~# d- W }
& w" U# }7 R2 l# B8 K! U catch(exception& ex)
. u/ }+ v2 [$ Q$ y) Q {
: f5 t f0 j' ]0 H4 l
5 j9 a4 b, y9 M1 a D, ` J Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
0 n* n$ |# u6 L }
, v0 y1 {; A1 l3 b, A) i) Z" w }8 f, ~: w j& v: O
5 J9 n9 D$ i/ Z% u8 e G E p
y' Y; i5 q$ s7 P y. A |
|