|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
6 a% `# H3 c# {7 k. p5 v8 f
$ r5 r1 ?. b8 r请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
0 {, E% N! m$ H- p) r5 A: L代码如下:
* R/ G! c$ m1 \& g#include "Shrinkage.hpp"* s1 j7 w, v' p
using namespace NXOpen;8 `0 D+ g/ t, B2 K8 W
using namespace NXOpen::BlockStyler;2 s! N/ W Y- J2 s
1 f$ a$ `. e/ b. F6 ]% [* o( f) l% L& q
Session *(Shrinkage::theSession) = NULL;; J% B% @; u% k$ M6 Y
UI *(Shrinkage::theUI) = NULL;
: j6 M4 N1 N g- g; m$ v; g$ u7 ]
3 \! @6 C3 k/ K. s$ T9 hShrinkage *theShrinkage;# B7 Z( U0 g0 ~" n" O/ [
1 ~+ a9 K' X! u1 AShrinkage::Shrinkage()
8 Q$ B$ K# {$ h" v- ?# |{
7 N# `0 i g9 u. } try/ I3 W8 J/ d* u2 w
{
3 q. J2 x( |7 v% [2 S8 O8 E // Initialize the NX Open C++ API environment
1 L+ Q" U& V* h/ B( b' Q* O9 C Shrinkage::theSession = NXOpen::Session::GetSession();
4 U' P6 z' _3 m: `% W( ?2 G7 C Shrinkage::theUI = UI::GetUI();
G1 D2 A$ g; ^: j+ }- L theDialogName = "Shrinkage.dlx";. H( Y1 q: G# y' K0 F$ |
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
+ B. r2 _+ T, G$ l3 Y // Registration of callback functions
3 C, c' S: b' T theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
3 M1 A" U/ Q7 N: \) H theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
- m, F- A5 l7 Y. y: W theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
$ e! s3 ^8 ^+ Y& r theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
7 Z0 ^1 l3 ~8 J% J2 Y7 q$ y theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
& N" @2 a: ?) f0 N theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
. Y" S+ Z5 v. L& u theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));! i0 W1 U( v$ p0 v* a6 O8 J0 \
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));" T8 n& e% U* U* A1 v9 K3 p7 f$ |! o
}
3 @3 C. L9 M3 f+ a9 m caTCh(exception& ex)
$ N' v& \& |9 D2 f {) m: J a8 z( c3 f4 U% x' r
, d7 y x& _* i7 m7 R throw;
$ ^5 F( b5 r: w$ h& ^% X7 v- N' b }
& R6 S& i3 L0 k& A}
+ \: H0 n v$ F. ~0 L+ B' R! X! M* s0 u+ B* r) S5 ?; j, S. Z
Shrinkage::~Shrinkage()9 A4 M. L# X/ |
{
- J) V9 R' l; ` if (theDialog != NULL)9 k) Y! E! t+ Z3 y, x
{$ G4 z, g; Q8 F
delete theDialog;" ?! B& ?, ]$ Y9 _
theDialog = NULL;) t( k; U/ @) ?2 _/ \2 T4 [0 F3 @
}
6 u' g( F# y9 C}
: z! H/ g- t8 R# O5 i) s5 P( r1 Q( V+ {8 d
#if USER_EXIT_OR_MENU
. f) o' V1 G4 b! K extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
" k1 H3 H3 j; R& o {
+ ]# J& ^& o' K9 [- Y! A) `3 } try- b! ]4 G% g4 g7 f2 d' D. x
{# _8 [% f n" d) W/ \" g
theShrinkage = new Shrinkage();
W [# v, \) a1 V& |; Y1 V1 B // The following method shows the dialog immediately5 }/ c$ d7 R9 b
theShrinkage->Show();
5 A$ s# E1 U& d) r) j# S }: v1 [# P& C1 r" F
catch(exception& ex)2 a6 D$ j5 k S+ Y3 [( Z7 c
{8 v ^9 H- X2 B0 Q, |
//---- Enter your exception handling code here ----- ^$ Q c) ~# x0 _1 w2 f7 o
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
. K- R1 `2 m; U) H: Q2 m( L }) D a! W5 `- d3 u& S/ A
delete theShrinkage;2 q: n- W$ R6 Z. E
}1 p# W/ l/ a! Y8 k3 e& @
#endif//USER_EXIT_OR_MENU
' e' D# Z7 y q5 j1 s$ w `#if USER_EXIT6 [" c) Z9 ^- K0 U
3 i2 N$ h" D" m7 f
//------------------------------------------------------------------------------& @8 j$ @" G Q# @! E+ S2 \
& [% p: ] d. v( m
// MUST NOT use this option since it will UNLOAD your NX Open application image
2 [/ D( L$ Y8 g // from the menubar.
7 q+ B1 l( q/ @8 g! e //------------------------------------------------------------------------------% U' G3 E0 T5 q+ {6 Q
extern "C" DllExport int ufusr_ask_unload()
4 l3 o1 r( R; U {
' M3 X3 \2 Q- p" o //return (int)Session: ibraryUnloadOptionExplicitly;
" \& G$ C% i X# { return (int)Session: ibraryUnloadOptionImmediately;
$ F3 N1 ~9 y, w, a6 }4 G- ~ //return (int)Session: ibraryUnloadOptionAtTermination;
9 V- j: e" q* ^" t; N8 N8 N1 Q+ U }
' Q% F; Q& }4 Q9 ~# D( o8 F ; G% `- P& o: X% X
//------------------------------------------------------------------------------
' M. |! j* ~+ J# o# Y // This method is automatically called by NX.
- q; I2 u. v$ v$ r1 p, T* e* O //------------------------------------------------------------------------------2 T+ o1 _$ Q4 e6 a8 \& C# Z0 o; v
extern "C" DllExport void ufusr_cleanup(void)
8 t2 c! p+ f2 V4 G0 w7 L* c {
9 n" ~( O- }# m0 c7 u4 F, z try7 W% j; ^( d5 a2 T# z- W2 I: N
{( `0 a+ W& G9 X& C5 \& E
//---- Enter your callback code here -----
- i/ x8 G4 ~' M( b! F2 Y% d9 B/ v }
O- U, M5 ^4 j+ x" _5 V0 D- I catch(exception& ex)+ Y7 V2 N8 {& o
{
$ ?! B4 @5 i% O% x! i: J* ` //---- Enter your exception handling code here -----
$ M- _4 V5 G, \ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
5 z8 P+ Y A0 x# Y/ P }) v4 W/ n6 Q& f2 N2 u+ J* C( I
}
& k' G% E) R2 E#endif//USER_EXIT
# s# v6 V$ G" n! |; T( Q; |0 l
! ]* {! D- e# @& l1 S9 S ] int Shrinkage::Show()) Y4 x8 q8 B( m2 w3 Y F3 f( t1 f
{7 U, j- { u( R( r: p! @5 X. v
try! _ O0 P) O, l W- ]3 n
{+ U) }" Q3 b& v! w' V0 |
theDialog->Show();& R2 P H& u* L4 x3 p* h$ r3 J
}. ]& s; ?7 D5 ~9 J$ ?
catch(exception& ex)
, b3 J- A. k- f' Z9 b {- [, W4 X: q3 n+ R; r: K* S
//---- Enter your exception handling code here -----
4 n' j/ P) W7 P ^1 u8 ^+ h* r: U Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
( }7 e+ v- O, L' p }
6 P6 _2 |+ Z, N! j/ i8 Q, }- x0 k return 0;
* l1 ^9 e: k2 {& B' f }' v" c' k; D7 R m4 I
- P1 C# z( k0 J; L6 T3 D#if CALLBACK
( A5 e8 ~& S8 V. M7 Q: D$ {- h9 H# \, }" _+ A3 r
void Shrinkage::Show_Shrinkage()3 |! o4 _8 Z1 Y$ t( S
{. C3 C" h1 D9 c: o& F" Z T$ F( X h( R
try
, [3 M# i$ F% d9 y' {! s {
: ~. ]9 f9 A5 @0 K theShrinkage = new Shrinkage();
4 {: F4 O' {# L; t2 ^2 y; k
$ Q7 a# E6 p3 f2 E theShrinkage->Show();0 j" y2 z/ d) ?7 {; V8 w/ }" n
}
9 k( J B( Q0 a6 K' X catch(exception& ex)
7 w& G3 N5 F% z6 p% R0 l/ I. j {" _% @+ j M/ _" a# Q( ?1 n/ J- G
% |/ b+ s, j+ s6 g+ i7 B
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what()); Z4 U2 A' l2 d9 H
}4 C9 W- `. }4 w1 |* f( T1 w' {/ x
delete theShrinkage;
" w c7 M4 b+ }2 z. E }
1 f9 P5 f) W" B6 M u#endif//CALLBACK
' C% V. w/ E* D" g" ?
% [4 ^) \: G+ ? void Shrinkage::initialize_cb()
% g; @) A' l& S$ }4 E/ ^/ j {6 j, ^9 X1 I. b
try: Y/ ^# h. q) q+ r/ J. K. s+ ]# Q
{7 E6 J! Y$ H7 n7 J( i
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));; [; Y4 p: F) [ _: O/ V% y
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
/ ?5 r) |3 s' t6 Q face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));+ G& b8 p+ d9 o( M
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));; ~. ?0 {: T0 D+ j* T$ k4 t
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
; @! g" m: p. d3 {- A2 S0 @ bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));0 l. I: N6 u: s
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
& H2 c. Z% E2 z0 E string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
' d5 m: Z6 g0 W# L3 ^3 a label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));# j4 x, f$ O+ S& X. B8 [
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
& i/ N/ t& G7 k label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
. Y3 w5 W1 E8 N2 @, l" \) R# _ label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));# K& q6 T0 @, W. @
}
2 R% Q$ n. f8 M- m5 u# `9 I catch(exception& ex)
4 p: S8 _$ S0 D5 t, d; ~: a; t. a {
8 w# i. b/ H8 t' p9 e J
$ u) j$ \+ t2 G4 V0 @' V7 K Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
1 T# D/ Q, Q3 F3 k }
& n- Q% w/ G; @5 x9 e }
7 c- S5 K- `9 ~ F! e$ i //------------------------------------------------------------------------------
+ m. E" [% D( W9 F void Shrinkage::dialogShown_cb()
9 i9 K6 q! p0 d n) C5 R {$ A/ Z; O8 G1 `% S) J$ ^
try
0 A$ Y$ T& ?) W- A* q {
+ n$ Q( k5 T O: }* f! ], X //---- Enter your callback code here -----5 g* H* s' d& n* f' C0 A
}; z- I Z x' q/ `% \
catch(exception& ex)
& B, e/ k8 u- R( k% A0 i I {
u" L H7 x' K
' F3 u4 D1 U1 j2 {7 B6 V/ L& g Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
|& {3 f' v8 \! V4 q$ Q% u% X2 q2 S }" S# i( Y; h( F9 ~" r2 H
} @, q5 j9 D& B4 j: Z
6 T" L8 r8 w2 P+ m
int Shrinkage::apply_cb()4 y" p" g x4 M' J; n
{! O$ i* b6 } D% s# p6 l
int errorCode = 0; {+ U8 R& T+ @. f5 N
try
7 l3 B8 Y1 Q7 q$ B0 Q6 V$ ~* k {
8 t+ H- [8 b8 P7 [" c/ { //---- Enter your callback code here -----5 h p! Y0 E. w8 c$ f
}, V3 Y7 h0 ~8 r9 P
catch(exception& ex) @8 z) N5 f% i3 P2 m0 y
{" v% z! x' p$ |& K' u% o
//---- Enter your exception handling code here -----2 Z# n$ C/ D: M* C$ G7 V0 r8 b# i% u
errorCode = 1;
m9 H$ o- r( }! v$ E8 F# Y Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
; E2 U3 m% t5 p, F' I }
% r3 k2 a1 X* Y# G/ B# w% p- q return errorCode;) o9 x8 c' i. w$ c
}* G3 W, m: H; S9 B
; s6 G; {6 l% @. ^/ N+ l
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
+ d* c% t) c+ V. z {
9 b, ^" t4 m1 C+ l* s try
; \- ^1 g9 T3 ]9 d6 h" ]" t) ?" y {
0 {! c y7 g/ h' u: J if(block == face_select0)
) Q& i7 p W* q e6 [: E {
2 x+ e# l6 S/ `' m+ l& r //---------Enter your code here-----------* \) R1 |7 t% N' _
}2 l+ J/ H) q5 c% Z
else if(block == face_select01)
' a- y8 t) M5 x$ [5 | {
$ ], b& P% i" h6 E0 Q //---------Enter your code here-----------
j# H5 n9 |! d8 t }8 d; X: K9 G( v0 \: p
else if(block == bodySelect0)
: v& K* F4 S: E' e) a* K {
5 F2 B1 w, _( n: y* P //---------Enter your code here----------- H; O' q2 E0 u3 d+ ]( _
}
1 L/ r8 k7 M# k5 w0 | else if(block == bodySelect01)- j1 j( x" x$ Y- P2 B4 }
{
! I) T6 B% S6 w //---------Enter your code here-----------
, p+ n7 L+ C4 D, C# t }6 C9 y3 `3 J: R4 o6 Q
else if(block == string0)
9 I+ V" I; M8 @8 }% ]* [# ? {, f6 J: ~! k+ ]* [& P
//---------Enter your code here-----------
! J* q: r; k) C: u) K }8 o6 b; F, `: a1 B
else if(block == label0)
7 w( Y+ l. e; W {- V) i @; t& I# E$ M A
//---------Enter your code here-----------
8 R. _6 ^! l2 Q0 I* a9 a+ ? }% a: w/ |2 A% o' B
else if(block == string01)' M, L. k0 q$ @) k
{. S- l5 S/ x3 i1 N2 p5 p4 d: [. M
//---------Enter your code here-----------/ g0 n2 i; \) A4 I* j
}8 g+ v+ U5 C6 }$ f
else if(block == label01)$ x& `+ u2 G5 q; e8 a' x
{
5 L8 C+ m3 P2 ^8 T1 @' s //---------Enter your code here-----------
2 i+ I% ^% \& J ] }
: M) p9 A1 s3 b& E else if(block == label02)
' e$ }% G& P' p% C8 {' V {7 F* p9 I( l8 k' Y) \% `5 h0 a
//---------Enter your code here-----------" ]5 B* H; |. U$ ?& D! ~
}: b" t/ y# \" E$ s I
}
2 I3 t K1 K/ N9 M" }& Q+ S catch(exception& ex): d* r" q1 W3 z' h
{& u! E& z1 `' R7 h `
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
0 x& K5 v/ ^1 t# p! `, | }8 }/ L6 P9 E% L% P7 i: r
return 0;
5 @- R* N5 t1 Z/ A A* ^ }$ S/ F' g; d. Z* W
0 E* ?! a' B; S6 v4 S
int Shrinkage: k_cb()6 x7 @( i0 u' e
{
8 t h# G; A0 O int errorCode = 0;
6 h I9 {( a2 y2 n, D3 L try
; K; j! }+ r. R. ] {- X& |, K% |0 @1 o* i: U1 t
errorCode = apply_cb();0 g; g0 ], R$ E5 v5 h
}
# }; [& ~/ d! O catch(exception& ex)
3 h: z: P2 w1 Z1 b8 U {+ y! m' e! i [6 N, s
//---- Enter your exception handling code here -----
7 \, m: l) L# o7 \ errorCode = 1;
/ W' R) d+ S. l- w Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());' L% f: U& t( [+ I$ ~; V& e8 m
}
5 t9 }( H6 R r, |6 h$ x; @ return errorCode;5 _1 b% a8 i/ j( R* I
}' Y( `# p( u7 |* _) d5 X: E9 x0 `
, ?4 _/ R' X7 e0 [+ K4 v8 X8 O/ |
//------------------------------------------------------------------------------& g1 Q/ g# b I0 f' R
//Callback Name: filter_cb& l, _4 e/ Z, l- W/ V: A
//------------------------------------------------------------------------------
) N0 ]3 h, V1 W' E' z/ @' }/ O; J( | int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)6 I& {& @4 K0 a# {
{; k* j c0 T: x7 T7 u3 s
return(UF_UI_SEL_ACCEPT);
' Z7 R, [" Z" ~7 t' _ }
; q0 V1 j" Y, ^8 ] . o. M: \2 g( [5 K2 H
//------------------------------------------------------------------------------
+ f; J% o6 S9 G. w( Y* J: \ void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)! @3 |. \4 b5 a2 I
{
9 U) t9 h: l' j9 y S9 q% _ try
d' ~" r- p# D- j! |# r {) z# A) ^2 {" q) h g
//---- Enter your callback code here -----
0 c$ I' ^8 z0 l) r9 P, L }
1 a2 R+ m7 {* Q( @% z catch(exception& ex)6 c: a" o, z9 ?; U- ` I. f( k! y
{& H: n, v7 R' r: O% ^
//---- Enter your exception handling code here ----- g% ?7 J. ?& G+ K, G4 a
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
* Q8 b) b+ J9 p. u) k }, A2 E1 r4 N% L
}
8 ]; q5 V' ?; m3 z, N# p3 } ' t& L" y; p" s' X( U
//------------------------------------------------------------------------------
9 p. H0 f9 [: X5 d7 O9 ?& A void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
e2 g9 X, k, W1 F3 ] {
0 @. P" h- r* ?/ C! I7 D0 N& O try
& ^4 a+ f8 ] Z2 N" U. m3 J {- V0 N6 t+ h$ k' P( \
//---- Enter your callback code here -----! G/ N: O3 b6 O
}
# z' F) U* j% o; }! ^; Q6 g7 ?) u4 Z$ s catch(exception& ex)' F; q) O6 U n4 b
{( g4 H0 x4 t$ G: ? n
5 u& Y3 E4 k8 s- @ J
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
( m- e# O/ W% E5 U9 U! n# z }1 t( |$ O/ o3 Z6 l7 A
}+ P- j/ O1 g: I4 e( \
3 u+ I; O6 @+ ?4 H9 b0 q
2 [. X: \7 _" o+ J( Z: `' I |
|