|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 7 c9 h6 |5 c+ Z: h C
; W) c, d( R- f$ {5 A8 J- W
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr# |8 ]% x& |1 d" P6 X/ M" x# @
代码如下:8 U1 g+ z+ z& `" ?
#include "Shrinkage.hpp"9 n7 y F9 Y1 u- L
using namespace NXOpen;
4 X/ D. W1 |, y6 r+ L/ K$ y$ n' vusing namespace NXOpen::BlockStyler;: V) e; u; d1 D7 L5 D d' v
# l1 A7 T% U6 R$ p0 b. _) ySession *(Shrinkage::theSession) = NULL;
! G' ~* e; p* N: w: |" R2 {UI *(Shrinkage::theUI) = NULL;. p. N# N: j, Z" N/ m
3 u$ M; B! Y8 `5 ~
Shrinkage *theShrinkage;. x0 L% s0 e/ H/ h) N
/ a2 W( \% ^$ l* v$ H% [
Shrinkage::Shrinkage()
* A( Q* `4 e4 ?2 b g. t! s+ n{8 M. {$ B( ]: G) Q) a* r$ |
try
8 L$ I6 V0 h1 ?% z) ~. s! I; g: c {4 z7 ]# Z8 [6 I: {% v
// Initialize the NX Open C++ API environment2 m& [! B! |6 ^
Shrinkage::theSession = NXOpen::Session::GetSession();- _- j, N! l5 ?* W
Shrinkage::theUI = UI::GetUI();
7 ]: g7 a8 w7 |* q- }1 R theDialogName = "Shrinkage.dlx";* R/ T! Q R8 A3 U$ i. Z; g! t
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());( V B: P \ n: {7 t4 p
// Registration of callback functions
& ?# M- Z/ v# J" b# T theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));: U7 B, P+ E; u; k$ x6 v% \
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));" C) g( M9 {4 Y* \% y. r
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
+ V) M& _1 \6 u" } theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
4 H2 v% W. B* w: [' f- S$ z* G theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));' n* `# W* y# h0 W
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
$ A i0 _- O4 H4 h m* o/ _ theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));( I% P% U3 ?9 F2 m2 _( y
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
# ^/ g4 `# }! I: m6 V6 s, D; G }6 u E8 B6 c4 }9 h) q, a0 E/ E ]
caTCh(exception& ex), `7 V. J. }2 K5 L( u Y `. {+ v
{/ K% X8 G4 D! _) x4 L' X0 d
) o- b; O9 V$ B, l) T
throw;6 l1 |1 S6 e; G9 w7 Y
}' F4 f8 U: P3 V& X2 g
}
' y; d! z! \6 n* U5 N
$ }. H, X8 O6 F; LShrinkage::~Shrinkage()7 c" I9 }4 h3 g
{, q* g `8 Z' T5 b# F, E# a( P: R
if (theDialog != NULL) u1 H& _8 M& r. C! K9 i1 A. `
{) q! I+ F8 ?3 L2 p! e% d7 [- a
delete theDialog;
- i* S7 B* E' L! |3 `4 h7 I) W theDialog = NULL;
+ L8 N3 o4 S2 G. f! w }5 ]3 e; Q( O7 u' P
}! P4 r. N( x- H7 k7 m5 l8 Y
% q% u8 t9 b! d! Q. P4 a#if USER_EXIT_OR_MENU7 Q' L+ V+ @# p* H7 h" T' q
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)+ A! B6 f- F7 c8 _/ S b& L
{& m1 N7 Y2 i6 }+ l( a0 t
try" ?& X. n& o+ H. J7 L
{' Q( B& ^1 S6 H: ~
theShrinkage = new Shrinkage();
' q! s K& T0 F' }8 \, c // The following method shows the dialog immediately
4 a# F( h* _- |6 p9 g theShrinkage->Show();7 O/ B. H8 [: U/ P& p
}
0 N/ ]8 ]$ d' F3 Z' Y catch(exception& ex)7 C1 y0 j) T; X: |4 c8 a/ \ f
{" X/ C9 @; L! _; z* }5 d
//---- Enter your exception handling code here -----
* _( Q! N" Q+ \ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());" b# x% L1 f9 @# W# n
}
* S$ b" z# X4 W6 O5 y& c delete theShrinkage;8 [" n. ?4 _2 ?8 _, i. i% Q
}
+ r* @; |3 e1 L5 J6 X9 S) p#endif//USER_EXIT_OR_MENU! T3 @. Y; j- {& l V% B( H0 t
#if USER_EXIT
& ~8 x* ]9 G% ~; D8 S( ] " ]' O ]5 O m" d) @5 y, G/ v
//------------------------------------------------------------------------------$ v h) g! G' B( ^5 ]1 ^+ h
, y1 ?5 h* I' E6 J" I) n& \( _
// MUST NOT use this option since it will UNLOAD your NX Open application image
a, y8 K1 S, _. K* ?3 j S // from the menubar.. D$ D2 U* X# o8 _
//------------------------------------------------------------------------------
v% |" X5 l2 D1 Y extern "C" DllExport int ufusr_ask_unload()
# P" P- r0 |4 |3 g2 L* q( I/ k {
! b3 B2 g8 A+ l+ d6 w$ T8 K //return (int)Session: ibraryUnloadOptionExplicitly;
, D( e- p8 `# o- y; g& q* v return (int)Session: ibraryUnloadOptionImmediately;
4 D3 E- Z, _% L; V% ^/ Q) i //return (int)Session: ibraryUnloadOptionAtTermination;# {" _, h0 C" _2 _
}
/ z6 h4 E- A8 D5 p3 A/ V 1 w& x) W/ w9 V8 H9 e U' }
//------------------------------------------------------------------------------
; j, ?4 t3 A* a( `$ p8 @7 o // This method is automatically called by NX.
, m3 |2 F* n5 I3 M: Q+ N8 }( O$ i3 h //------------------------------------------------------------------------------
# @2 ^- M2 l U) A0 g% W) V) d extern "C" DllExport void ufusr_cleanup(void)
3 U1 V& L+ p: b9 a2 m {
8 C- A" o8 p" j try. |. x8 E n2 T- U
{
/ W, p2 y7 q. ?, k4 S //---- Enter your callback code here -----
7 r9 n4 G6 y+ q9 a+ `0 A1 @ }
& r5 P/ j' ?: V8 N m catch(exception& ex)
2 [+ }0 B8 t2 E4 l( t$ I" P% J {5 l; K% D& t! D6 m
//---- Enter your exception handling code here -----( s" f7 P4 j" Z; V
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
* Y2 ?1 Y' X7 V+ r' x }
! ?! d0 w" k& ?+ M) ^4 t }
' Y% v9 c& \4 R- ^, S) l' J" p p#endif//USER_EXIT
8 A7 n$ b1 k0 a( s5 y% Z* w# J: W( {
0 q6 B+ |, s' E0 p( b int Shrinkage::Show()
: d/ d! M( M/ @/ q# I( B4 } {) E- ^9 v. b$ ~/ ^
try! i6 c0 ? ?9 A7 n& }) `7 w
{8 ]' o+ D- D/ ]7 G; p) P4 i, L
theDialog->Show();7 v2 B% g6 E& B- E. H
}; K& F1 b6 m+ r6 ]; S; c6 G! L
catch(exception& ex)
; E% T* Q) [9 ?* v: e. w" r0 X {, U1 C9 l4 H/ a' g
//---- Enter your exception handling code here -----5 U5 h) p/ a& L) A1 r9 T. s$ f- A8 W
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
3 c9 H* d# K5 J* B: D }
% [* U6 I7 J9 w6 R9 w# a' k7 }. O return 0;
4 m6 q7 }: g4 z$ o4 m1 [/ { }* n3 s3 j- J4 j
$ N6 V* W+ Z# n6 o/ ~0 P#if CALLBACK+ N! o* @, b3 n9 F! e4 @3 `0 b
& x5 a# A! K/ ^6 M+ c" B# _
void Shrinkage::Show_Shrinkage()2 ?3 z4 v) Z+ B7 D, D
{
5 c2 X3 w; E2 f6 c; y3 i try
! |/ C# J* l5 s7 q2 a {+ g6 Z, h4 p2 W; x) S% T
theShrinkage = new Shrinkage();" ?" A! ?. ?+ @/ W6 ?
6 _9 b+ G6 p, f" o7 ?+ _& a theShrinkage->Show();" o2 i: m: I/ M( {4 j
}
5 s1 y( D. Y8 T7 o catch(exception& ex)4 \* \ A8 g; f7 Q6 ~
{8 P, n- P4 M& c
0 Q T9 W- B9 D8 C3 f Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());* z: K9 T& M+ `$ G4 t- n! R" L
}, H0 l# ]0 L' s' X
delete theShrinkage;6 L( B" ?& ?5 I0 f* b6 |
}
+ m( y" r4 e/ q) U. g7 r$ x#endif//CALLBACK& h2 l. Q# h$ `: ^2 t2 E# {) p
% v% R" d& X$ T6 ^# a/ E
void Shrinkage::initialize_cb()0 ]" S( T/ k& y/ b2 J
{
x4 V' Q0 x8 N1 t* D try
- ?0 b/ b8 j n {
9 e2 j, e& p# ~% ` G% C* [) o group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
+ ^6 P l1 A( }+ I# E t; n; d8 C face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));- ?7 ~7 h! G x, m5 H4 Q
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));+ {# z3 o- ], ? A) l- l
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));0 Z, }' O* H; P
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
, J& A$ V, S9 l' S bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));9 J: I0 r8 I( ]; E
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
: @0 f; w( r# Y; I9 H string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));- ?$ W6 \; x+ l. K4 u; M1 e( Q
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));9 M% F3 k7 _, o1 b* ?: }% z2 w
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
% z) `8 v. R i% U label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));4 E" ^# ?" H3 [: n0 Z2 U1 A
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
2 z. i% @2 p. J" M i2 B2 G3 l }) i- v5 w8 |& D, W( Q) K B
catch(exception& ex)1 @& `$ {2 _! W+ f. m
{
1 y+ K- r. W. F/ L8 N
0 R+ b3 u' @+ ^0 x+ y4 n9 S Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
" G% K9 `9 G/ O( |- @ }
, j7 ? A0 P* C8 j& I" c! Z }* ]) T7 A/ [3 d1 P# ^! G! B
//------------------------------------------------------------------------------9 K6 q" f3 I& F
void Shrinkage::dialogShown_cb()
3 k3 J, r% L% @8 @; ?6 L1 u {
6 B# q* k. Z( q% S: c1 J, x1 Z try
9 B% A( I' R9 N8 m3 k' g6 o2 a, ] \ {4 s0 @7 H$ X7 h& U1 Y5 t( n2 O) p
//---- Enter your callback code here -----
2 p5 x4 K, n# i. i, O+ ^1 m4 T }5 N/ _8 x# Y' t+ S r
catch(exception& ex)2 ]6 D' x( b3 _; h; r
{
1 N3 W6 o/ x0 y' J% k+ K7 d6 ^. b. l4 v
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());& u( W D. k% z* _0 X, Y
}7 _) [! z' V9 W3 `
}
% o% m9 [, n/ m5 I' I2 Y
/ f# ]4 q' w+ [2 p! I int Shrinkage::apply_cb()
. G& W& I' t7 X0 w {
1 T" H/ P+ c& g/ T; j int errorCode = 0;- l9 a% D6 v) y3 Y, x7 t6 N
try( n! ~6 S$ C$ i$ B% X B" d- B
{$ U) a, p9 R/ z6 K0 P8 n6 o! t% @+ b
//---- Enter your callback code here -----
: b; V( [4 y$ }; }8 d- W0 B }
7 G. Z Z0 g" \2 Y# K catch(exception& ex)- q$ ~3 k5 m$ Y% I3 w" j
{, S9 H+ k) f) V( W% r* ?- c
//---- Enter your exception handling code here -----0 t1 Y( v5 u2 ~: I
errorCode = 1;9 C5 T ]5 |0 q% ~
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
' X( Y7 H5 U) n: ]. ?6 D e }
& R# j- T7 e% Y7 ?7 P& j return errorCode;
( Q% a3 q: v; @2 X% b3 N }
6 C/ [: U$ ]. s! f, N. Q7 U, ]. f' \% r7 u. O3 u1 X
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)( [9 \ F3 g" T2 @6 c+ `
{
8 @& T& w% J5 w7 T try" M7 U0 W* U9 ]' ]
{
2 `' |# F: O2 @7 H2 a8 r if(block == face_select0)
" L7 h2 V9 Y' a( b; \ _0 k {% J# s% Y; w8 |. }- W
//---------Enter your code here-----------
k* E/ `, A8 o }8 J9 p" M1 u; w+ w. O. G2 o8 X4 @0 F
else if(block == face_select01)# {, ?7 z. _3 Q: u5 L6 Y3 e
{
+ c: `+ y9 ]- }) Z //---------Enter your code here-----------' R8 {7 E; z a, m0 j
}/ E- l/ }4 J) ~: o+ [& k/ A* v
else if(block == bodySelect0)
9 f+ a' y8 y$ Q* X1 H: O4 k- a- R: u {
' q& O; Y8 N$ _; b, p& B //---------Enter your code here-----------
* V8 m9 o& r. B }1 k* c7 U! L$ o- \6 J+ l
else if(block == bodySelect01)6 Y; }; ~, Q X" s
{. K3 l9 o1 ?' R* ^4 E
//---------Enter your code here-----------" A3 v0 P& D% L
}% L1 u$ ]9 w4 s$ i8 X- B
else if(block == string0)
5 \& y! f+ |3 f6 c {
7 z4 u/ [6 g2 c. I6 c+ I% }* Q //---------Enter your code here-----------
( B9 @9 ~' ^1 M/ A* G }2 q1 ?" z' r7 |4 K) H% `' T% A! C
else if(block == label0)5 i& G6 M6 j/ I3 |
{
; e. B. F3 a+ ?4 B+ A+ x+ }. I* H //---------Enter your code here-----------
- E* n# a: q/ x }# f6 ]. L9 O$ `. m6 x/ A3 b
else if(block == string01)
) S5 K0 @2 P: [0 _# E2 p { D4 [- C+ z2 b
//---------Enter your code here-----------
/ {5 h! Z$ R2 N }
# C' @3 A+ v+ a2 g. I1 h& D else if(block == label01)
2 @) b: u2 |/ I+ X7 G* c$ f {, Q( g% C# T6 p8 B+ ~# h" ?' D
//---------Enter your code here-----------
1 |& c/ k0 ~8 ?; [ }; ]# @9 [/ f1 W1 `
else if(block == label02)! W- I( |$ U( g0 G0 L8 w* M; p6 ~( n
{4 O" @3 e$ K1 i
//---------Enter your code here-----------
2 j- @: w6 D/ O' i# X }9 `' I3 Q! C/ a5 F
}5 ?( I# k" k0 _+ N3 ?
catch(exception& ex)
7 m" Y7 A, s, w# u8 M, l {
6 M; x( J" f, G* Q Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());' G$ C. L% s7 K% c
}8 k0 G" ^! |4 F) ]
return 0;
% e" R: s/ c1 c; a. J/ N: Q }) E* i7 s& M! }& _7 I
V7 ]/ t3 Y; I& C$ e7 G% g% X/ K( J% t int Shrinkage: k_cb()/ P4 n; e9 ]. R+ z: G1 s
{
6 S! f- F: i4 U/ D3 Y, O* a int errorCode = 0;
5 n& C# L, P, k, i( ?3 z ] try+ h' J& s7 R" [4 B- i
{8 s/ p0 a% ~" A
errorCode = apply_cb();% a" i; X5 v! Z+ q& [( j$ U" W
}
$ L1 H3 h, H; s h2 {& O+ Q, p catch(exception& ex)
. H' _; ^* |+ _ {
e0 R) [, ?5 R7 f( A+ Y+ m) t //---- Enter your exception handling code here -----) P7 H f/ S* |9 o- e
errorCode = 1;, `1 l) i; f0 n: V& E* z x/ @0 f
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());1 j' v8 G* f! l7 h) {- m
}
" Z( V" p; u5 B& W4 }& o+ W3 v5 c return errorCode;# @3 l$ D! R6 G+ P
}6 J0 _1 ~0 u& [
. [! c5 X9 _8 Z D2 ?" ?% B //------------------------------------------------------------------------------- h9 T4 u$ S& P
//Callback Name: filter_cb% Q$ ~; m: v: ?. G' Y: y
//------------------------------------------------------------------------------( z- h; ], k# {; M6 [
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
% [! ?5 ?1 A6 w( Q, @. |" _8 p( o {) N3 d! h: b! k
return(UF_UI_SEL_ACCEPT);
" Y2 J: C/ [, \9 ^/ ` }
; l" I" X3 {% B& i; y - f+ p) e* u; U
//------------------------------------------------------------------------------
+ Q- ^ w: z( O _2 s void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)4 k# I8 e) D4 L; g! s: X! U
{
/ j4 f( d* t, N8 u try. c& Z9 D* D; l' H8 I7 f- z
{
1 [, v: p! h9 o- d7 k //---- Enter your callback code here -----
0 c% A, @5 Z1 B& I4 H& H }
# Y7 E4 u$ |0 T( G catch(exception& ex)
: e7 t: g/ ?) X$ B5 a {
5 G: T; }# S$ ]% S# `8 J5 H //---- Enter your exception handling code here -----4 j8 U$ d# n6 o- k
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());" Z% Q: m4 W6 _% R0 Q
}
+ `8 q" j* |8 H$ y: R- r) z }4 S) \0 R7 w# P* j+ V! P- e! `
* G4 Z/ |' b- d6 F, n( |" n //------------------------------------------------------------------------------& i1 N$ X8 i( ^4 K! I7 t1 v" D6 j
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
/ i* K, i7 } A3 k1 ?6 d9 K/ H' G: u: `: V {
0 [; w/ U/ o- b) W, s try1 J" O' q1 h2 C$ K" l' q
{
- S/ M. g& k6 r; V$ u //---- Enter your callback code here -----6 f+ ^5 `: y6 G, ^
}
" c; s* L6 N) S0 ~ catch(exception& ex)
, U4 E! k9 C. ~6 S {# K# B! R0 S" e; @% N5 Q
0 w J/ n$ y) s
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
" _0 a- q/ W% M4 m& _5 L1 z4 W! h }4 L7 G/ {: U2 O; A
}% O0 u5 D* e2 I) @
: b: X! r: Q+ [6 Y/ k8 g4 A" o7 f% K. R3 ~1 T5 m6 m3 B
|
|