|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
+ l; c/ w- K% d9 V' S. S
* I2 f9 u, z w# d% q, \( E' z请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr2 a( L! ~: O5 [$ [
代码如下:% d9 v/ _# Q9 V$ y
#include "Shrinkage.hpp"; v; O' |; C: G8 |( p
using namespace NXOpen;4 y- j4 M( x; v6 q* ^& l! b% o
using namespace NXOpen::BlockStyler;
% W4 z+ f9 q; Y
1 H1 c" `# X& L8 zSession *(Shrinkage::theSession) = NULL;
5 k7 f3 Q7 Q5 N8 @( [UI *(Shrinkage::theUI) = NULL;
. @! O+ H x$ k9 y4 H& g% `. O- s& ~* {
Shrinkage *theShrinkage;/ I: q1 z0 c9 F8 }
# B8 l9 M. c( z# k. I) I8 [* M
Shrinkage::Shrinkage()
+ p! Q% |* _/ m% x0 d{$ c2 w' ?: z& B! P
try( u9 o, h2 h- l% c I8 w9 Z
{
" u! l- g! Z& r' B; I // Initialize the NX Open C++ API environment: I; z/ u" y7 E( W T. {
Shrinkage::theSession = NXOpen::Session::GetSession();
9 W$ t( A% F! c+ M6 N' g) ?2 }1 b Shrinkage::theUI = UI::GetUI(); O/ j8 Y* ]6 a9 l" d
theDialogName = "Shrinkage.dlx";: f: | b* w2 W
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());, u' H6 |6 u( V' ~) {& S
// Registration of callback functions% k- a5 ?) V2 b, _
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));( T, q* \: g9 C' |
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
0 S, [- `) ?* z1 A7 q1 ?' @" K; C theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));: q- U5 `+ O$ o! l) Z( D
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
D! W1 O) ~8 h* \% o: I! G theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
) w/ a9 q$ X1 J& {& H2 W theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));. F) B/ R/ O% B# D' ]
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
4 e) l. c9 F. l. W" y theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
% s- i4 q' m) }' J# M1 ] s }
9 | C9 D e6 a* K caTCh(exception& ex)2 q( m( I! q3 g5 z. x( b
{
: ]! z W* j ^7 ?6 f( ]
' l O- ]7 t9 N' s$ N( M5 E throw;
1 \2 q8 l6 x5 a5 \, @/ ? }
# X* F0 d' S2 ^$ C& n7 p}7 s d2 v0 ?$ ?: X( i' ^
+ K+ v1 w2 I3 \0 F, K. w/ ]4 }
Shrinkage::~Shrinkage()
& m$ p& Z4 A( u+ i- X{5 m+ \: o' m9 t H6 e. L
if (theDialog != NULL)/ H7 ? m0 W% n: w; q- w
{3 _9 R' D3 _3 t& A
delete theDialog;
4 i l+ D$ u0 p( ^ theDialog = NULL;3 \1 K+ g$ w; d. P! C. J* t
}
, H; [) N: |( D0 M4 ^7 u}
. {1 Y8 [: a: u4 s* U! o5 @5 z$ Q; \
#if USER_EXIT_OR_MENU
. b/ F9 ?( G g; } extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)/ ^; M# k- ?; I
{
$ y ~0 u) C( d try5 | k/ u l" X$ b' `9 `$ l
{4 D- `; O* e& f8 d, y" E6 @
theShrinkage = new Shrinkage();* Z+ t2 S; a/ k% E7 Z
// The following method shows the dialog immediately: G. y4 C0 E' }. b
theShrinkage->Show();& U; U/ E: V* U' C( |- F
}
& t! l5 y+ |) U, h3 z. G catch(exception& ex)
* E: |% V, H5 ]; Z6 | {% @3 r0 N' m" R% W( C+ J* r3 b
//---- Enter your exception handling code here -----
# u0 ^- w7 s0 h! H: Z. z& q2 i Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());# I8 K6 m" C. v x/ S: Z5 N) {
}
2 S: c; Y% `$ u z: _/ Q9 { delete theShrinkage;8 N* d7 n; }- }
}$ t. `1 E3 h, s! L' n
#endif//USER_EXIT_OR_MENU" q) O$ a/ g! g5 _3 u% ?7 c
#if USER_EXIT
4 V' k4 r) h8 C% v- n8 Q
1 H2 |5 T8 o) R! N //------------------------------------------------------------------------------
9 \: Z3 o) D, I) b4 K- i" Y
- y( Q% p) k) b! _ `# P // MUST NOT use this option since it will UNLOAD your NX Open application image: \1 _2 l( v, }6 c* n/ w' g
// from the menubar.
3 P$ p. {5 q6 k% J4 C1 K //------------------------------------------------------------------------------4 Z. R, X+ y8 A; c0 P6 _2 B, @+ u
extern "C" DllExport int ufusr_ask_unload()
/ m+ H# Z9 Z$ [, y* K {
+ x+ o, j! a, i0 K //return (int)Session: ibraryUnloadOptionExplicitly;
2 ?1 D% Y/ X( Z% Z# A return (int)Session: ibraryUnloadOptionImmediately;. _1 m/ K! n1 ~) O, B
//return (int)Session: ibraryUnloadOptionAtTermination;8 x: t+ a9 U: j8 B% S- w
}' k2 x' b5 r. `# }8 `! y4 r9 l/ J
1 F, O3 \( p4 W: P% V
//------------------------------------------------------------------------------
. L$ b$ p% c2 j- G/ i) ]$ j // This method is automatically called by NX.6 Q. j, d7 Z8 G7 M
//------------------------------------------------------------------------------* q$ d5 T7 G8 f2 z$ |# F
extern "C" DllExport void ufusr_cleanup(void)
3 h% i2 `; X. Z" t {2 E* P2 ^: y/ Y6 d
try
6 E, A1 r- T, x2 o- o {" W$ {3 J6 K; d3 |9 t+ d1 p% k
//---- Enter your callback code here -----
* v8 C0 G; |$ C3 n4 T6 R }
/ X9 p! H# O% [- D9 x catch(exception& ex)1 P% O+ S! Q( |+ g
{
% R) \; m" Z P1 y9 v" t! b; ?% X //---- Enter your exception handling code here -----7 Q; z) R/ i X( U( `: {8 S9 L
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());; M2 r7 }$ s/ G2 S, L# Q$ D
}
/ A5 Q$ b" p. ?0 w5 l0 L% X( {1 F }
; S7 J3 @: D* J: W5 a `0 q, i#endif//USER_EXIT
& F- J8 n' v2 b5 M
l; o8 o4 g3 ^7 h3 l int Shrinkage::Show()
- _9 f$ O/ Z( U3 v4 I {
% W0 [* p0 C5 h7 [: L( q try6 W* O' A/ J( L z. [
{
K4 v9 c2 Q& o9 i( M% u3 Q theDialog->Show();' R4 o3 R4 r) @( W
}9 {4 ]0 n# G( M3 l1 Y$ T! T
catch(exception& ex)
! D, g6 T0 S4 N8 W- I7 H {. ?& R8 m3 D2 Z
//---- Enter your exception handling code here -----
- |4 c) J6 y0 r) ~& v/ k( e Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
( a5 e2 R* ~9 l4 s+ K+ r F1 | }
" P. D% v7 j" @5 p( V return 0;! [% B/ ]8 K# T2 p; k
}
/ Y( X+ b* M8 G& ^4 y8 R7 b% S/ Z
" g8 W8 e, z. P( P$ |#if CALLBACK
% O3 e' G* E- n& n9 d# K3 m1 p' ~# S. A
void Shrinkage::Show_Shrinkage()" T( H$ g1 H9 }+ Q) r
{
) W8 N1 G% [- }! e6 H8 U: [6 b4 Q' G try
* h: M* y/ N7 @/ \) k( `- ^ {
5 y$ v$ \; ]: z8 i' o& P theShrinkage = new Shrinkage();
6 }" d$ w8 ^! z. G0 Y
" m. ~( W9 `7 f1 t4 T5 C5 G theShrinkage->Show();- I; d8 \2 ^+ [$ z. f3 h
}8 n }/ r# p% }) Z; v
catch(exception& ex)$ A4 p0 S0 y( j' k3 d& W
{# r f" ]2 v5 p: T9 A+ x, y
% H4 A- E, E3 {2 e
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
7 B: H0 W) R) Y, i) `% b }
: Z! \9 o9 r- m* T2 Y! t, C' ?& Q8 g2 h+ t delete theShrinkage;
6 i5 H5 m: v5 } }
q& D! U6 Y: ?& H#endif//CALLBACK: Z% C- f" Y1 u% M2 G
% o. Z9 u+ n3 i4 z4 ?: V0 P; l- W8 @ void Shrinkage::initialize_cb()
1 C! W/ l4 {0 |6 G: E- m/ C {
+ a1 c( C" U' g try, C1 t& A% I% c+ N3 k3 J( p- N% A
{
5 w; @8 `- G" Q( n; G7 B! t; N group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
5 q, b! T3 j) Y4 d face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));2 P3 |) G- S* w& M$ m5 D. b
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
4 P7 P' a, d' ?2 _: } group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
. k( V# e8 c7 S u# m/ M& E bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
7 ^# z1 G: C: w bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
$ U* Q0 M: {- x9 E N group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
) g5 x9 h5 P* x# r' f string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));& F! g2 J: U* d& q# y D8 @
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));4 b2 n6 x3 e! g$ b" y
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));8 b' }' c1 ]# ]9 x' _
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
$ u& A* H: A) j6 l4 W label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
* g5 S9 @! J- R% [: L$ n }$ h: P. |7 y z
catch(exception& ex)+ y0 C* m, q, k* f! i/ `2 a! U
{
, s% `- _ ~& n# `
4 E9 G0 \8 ]0 i7 J) g8 g Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
5 W* `5 L) E4 D' ~$ P, l }0 u) q# B2 k8 d$ C, b
}8 w; t( v/ V/ [$ B( Q
//------------------------------------------------------------------------------2 x6 x6 y1 m7 [) A2 [5 k2 U
void Shrinkage::dialogShown_cb()- m5 |: {6 o0 n2 s. L& q# T
{
( H. y" h5 b" g ~% e try. |' J! S1 i! g+ ^8 [0 I8 T) M
{, j. f: w/ z$ I4 H1 ?4 |) y( q
//---- Enter your callback code here -----
+ [& V6 w* N" ^4 X/ F }
# W( o' c6 w$ f, @- w catch(exception& ex); g3 i s) }5 x: X$ L4 z: M: J
{: ^# [0 | i/ ~+ i5 X9 J" ~$ v* T( s+ `& w
6 a& l/ ]" u; F
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
( V8 e" j7 A/ h9 a, B }
3 }. V. ]% G E `0 y! c- W! S }
' K, I" ^+ Z4 L) `8 [9 M3 e 4 X) G; _$ s* U7 d$ y! N. v8 A
int Shrinkage::apply_cb()9 B5 f! Q! N: u; c/ U' c
{( d0 L. b( h0 [" ]
int errorCode = 0;
R! r; S, W4 i1 j& s, \ try
$ w& x- ^6 {1 g6 s$ F) T0 h {- Y8 @0 ~2 F( a* A. K1 o$ e
//---- Enter your callback code here -----
" h) L5 v0 ~+ [" X }2 T" F1 p0 O7 M( v: `2 {: Z3 b+ x% x
catch(exception& ex)
- V( Q% ^5 Y! }/ m* Y6 L4 y {
. D6 Y1 u& Y6 u+ Q //---- Enter your exception handling code here -----
0 `/ ]0 p# {+ |2 q+ P errorCode = 1;
1 m6 f& _4 `8 u2 w& I- \ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());( ^9 a) d6 o# D$ _
}
) q& u! _' K! w) L, F4 i return errorCode;
4 z! q; z0 m8 ^$ O }+ |- |+ c- J8 O3 ^1 C
+ s$ N- s& \( _5 d/ j6 ^ m
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
8 M: R- w5 q4 e3 c( ~# d {6 @2 e% M' \7 y% l
try
* @: w' }7 o+ U" D: t { D' J1 X: ]+ S3 r. t
if(block == face_select0)
! K' b$ H" p( j6 R# f! g {9 r# j6 p( p( Q4 i4 I3 J! Y8 W: h
//---------Enter your code here-----------% c* G. p. V( P; \
}) X h7 |+ a- t' ?0 c$ N* c! G- m
else if(block == face_select01)
/ ?8 P) V6 `- @$ u: K! H, h( n! t {, t1 d2 J8 B' ^
//---------Enter your code here-----------
' V* Q9 `6 X2 A" N }7 t! K5 t; X1 Q! u; M0 m5 o
else if(block == bodySelect0)2 v1 F/ T* v' T( r
{
/ o6 Q3 F$ J9 N' C+ E" p1 k. d //---------Enter your code here-----------, C7 \8 K% y) u; l
}
* B5 h. y" T H5 Y5 P else if(block == bodySelect01)$ }" C7 T6 o: c6 w
{) ^1 Z/ y$ Q- C* l0 q# v+ ~
//---------Enter your code here-----------: U4 S7 X5 M+ V, I3 s
}# M3 J* S$ M( t+ p% J
else if(block == string0)
! ^- N) m B( W' v& Z! m3 @ {
3 l- M$ w' u4 ~: [" ` //---------Enter your code here-----------( I9 A0 ?2 K9 r( \) i
}# i& U: M: { M; c$ G
else if(block == label0)# P: z' N0 M: C6 h! R0 r
{
! A! P6 Y( L6 L; ~) a% Y //---------Enter your code here-----------
2 H. L' ^3 i6 y3 t* q }& F3 Q }
N1 E7 y' J: o' O5 o else if(block == string01)( x N2 H1 }: ~2 j9 [6 K; j
{
8 s% e. R+ J" x: r) c* k- L( t //---------Enter your code here-----------# k; p5 z- E0 W# n$ q/ _
}
, ? {8 n" j' H7 k4 E* X" B else if(block == label01)3 z" I, {* _3 I9 F7 J# V' B" g
{
; v- G9 O c$ b! j, z2 b, ^3 _ //---------Enter your code here-----------
0 t N! J4 R4 k* z N }
. d5 `/ F& I1 w else if(block == label02); `0 H; p1 t! u, c% H
{; _/ ?, N; I$ w! x9 [% \7 \4 N
//---------Enter your code here-----------% Q9 j( {5 f. p# I4 p8 I6 r" t
}
& v% l$ j- H: W+ ^7 {) n }: \# [: V' u% A( f5 R
catch(exception& ex)
- M6 x& F, a9 c2 Z8 F/ t! h; { {
0 q% Y6 c4 _) { Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
E% z9 m$ m7 u0 ~7 s7 U }" Q& t2 }( G0 F1 ? J) I
return 0;: v3 `+ X& e. D' i9 P) m* c
}
4 ~' p! s1 g2 g8 e/ u
& J, H! y) ^) z u) ~( u int Shrinkage: k_cb()
4 M1 J6 F- B1 U' K# c2 r4 i2 q {
' B6 m- Z5 o# |- Z( ~0 N, E int errorCode = 0;7 x2 R9 i: v! I
try( P+ F; I& X+ _: ~
{ _: ~( O0 M9 H/ W+ ~
errorCode = apply_cb();; |* t X; j, V! Z" e( X
}
5 _$ h; y' t+ S B* A6 j# z0 ? catch(exception& ex)! F! Q, G: v$ c9 [. W* r4 G
{
( n: M/ d* x0 j" I L, q' H g //---- Enter your exception handling code here -----2 F+ D6 @. L1 ~3 U6 y$ o; R
errorCode = 1;
, g' k2 y: P/ P5 `7 S/ b" _; F Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
3 i8 K# C/ f3 o4 y* h }
) _- P& m& D+ T e% k8 ~# ] return errorCode;
/ f5 x" n! ?: T: e' K3 T" f1 S" r }/ l$ | L% H, n) f/ a
! z6 I" j1 {6 s9 h6 L //------------------------------------------------------------------------------
$ D8 C- s+ d# V8 {4 r; x$ @ //Callback Name: filter_cb4 q- h) T7 n) a$ k4 J$ f
//------------------------------------------------------------------------------7 c' s p* B) T3 L# E+ I
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
1 L2 m$ g& K; r: d {
# V3 M. J8 X+ k! g* H return(UF_UI_SEL_ACCEPT);
& B2 P1 h0 a+ |5 Q }
" n. m+ M3 _- [0 A! I ; C% p- H) a/ y/ n
//------------------------------------------------------------------------------
3 [# p2 [" M B void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
8 n' y. w. S' C2 g& N6 X {
6 Y" ^8 B" _! @2 A ?' S% d" g try2 b' y0 F5 O: H+ J& v+ D
{
8 C4 u1 n" x# R7 q! N //---- Enter your callback code here -----
& @% C/ t8 n5 t0 K' o& n }) i- B# _( x$ q7 j1 ^$ _* m* l
catch(exception& ex)
6 S' r3 c: i! \( p& x {
, @, L" r1 g% B$ L4 l% x: r4 @3 K //---- Enter your exception handling code here -----: j4 I9 z3 b |0 D8 Y
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
' i- d2 i/ [! ?1 J" j, ] }
+ h8 m4 K2 U2 M. p$ Q }
6 W" `0 f( }$ ? p & @ j, \ b* J
//------------------------------------------------------------------------------
" G4 W8 K4 j! y+ x C3 ?+ f3 O void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
# J! V( W: M- W( }2 t) J! A0 y {4 D4 N. d: n) y
try
" I! Q# h4 b+ O% B% b; w {
; K; `# E4 p* d( y //---- Enter your callback code here -----
( v/ r+ @6 P5 k }/ O: d5 M. T/ W7 W2 ~4 m& L% b
catch(exception& ex)
* Q0 K$ K' u" `$ L {
; x+ S$ {+ }- [9 {7 b
- o) n0 Z. C% ^, t Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
2 L3 Z$ l, b+ E$ `* c }
( Y+ m' _+ {. o* D' Q }
' \! G) F s# v F( c8 V: g3 u% g9 _) @) v4 y
4 M5 A2 r& B& h3 W' ^. A( ?/ [+ M
|
|