|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 ! y/ R( Y- j Y3 |. @
9 N" Z! i, H9 d/ l" d- F {) A7 X
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
. e' S: R- Z$ a" A' q0 R. i代码如下:
0 Y7 L& ]. Z4 G' J1 P( @ y#include "Shrinkage.hpp"
6 _7 ?" X& V5 m3 d4 y' l, O4 O* Gusing namespace NXOpen;
3 U4 a+ W3 u# C2 T6 Uusing namespace NXOpen::BlockStyler;
! q8 f' B4 C" ^6 y4 F: B: T+ j4 N: H7 O7 N Q
Session *(Shrinkage::theSession) = NULL;: M1 l$ R& I# C
UI *(Shrinkage::theUI) = NULL;
3 P- {3 n0 _( R) r( i8 y/ `5 ~) W5 X. }7 l
Shrinkage *theShrinkage;" p& }; W5 }1 H: j, z
9 t" @' d+ @& }$ Q' r- _! W m
Shrinkage::Shrinkage()
7 X; f* N S- q! c& b" |{
* S0 @5 K, }& x& C try& o# H+ G7 a" u2 N8 _% J
{
/ ^- z$ L2 q9 I1 H; n6 U+ c // Initialize the NX Open C++ API environment
# f$ E* j: a |3 Q; i3 T5 a Shrinkage::theSession = NXOpen::Session::GetSession();
6 n1 ~9 A) I! u/ j2 {, z0 g3 }* L Shrinkage::theUI = UI::GetUI();
. B: v: t6 q& K# [ theDialogName = "Shrinkage.dlx";
/ y- U8 i; b1 C/ E! D( y+ t theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());. R% _2 t- ^% h6 ?, Q
// Registration of callback functions
4 j5 t/ B5 F! r6 I" Y( o" i theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
* H" C: R" N4 s4 g8 L theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));3 S m; {' Y; |. A* v
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
! }( Y$ A( f/ t- W/ U. F4 N8 W! y: D theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
! s: B H* P0 @ theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
$ {6 \, O5 b& q2 \% }: l theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));" @/ L# [5 Z6 R8 J, f* d7 g
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
8 w" R* l6 O$ p theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));& P: r, g9 v8 }( ~
}' t! Y9 \- R/ [) h2 Y
caTCh(exception& ex)
. @; O( d" l$ p+ }7 h5 J, s {
# }( F5 U$ D: f: A
( ~# v( O# K2 H L6 _. i- j$ n& T throw;
4 p0 Z$ X; {+ P* ?' d& \" e5 u }
+ V* h8 @; M! W$ }}
) z7 ]# ` ^; Q* U. U* p
, B. d" p* O' r1 ]9 r3 J2 X+ @: HShrinkage::~Shrinkage()* P9 D7 M |8 \* t: v. J7 j
{
' ~$ H" `, k: O6 [" C' _2 S if (theDialog != NULL)) V u X: c* S* q( D" ^6 s
{
5 N1 P2 p# Q4 j# j' x( l0 M delete theDialog;
9 B) }1 Z0 L6 A T% W2 J theDialog = NULL;4 \# c4 m4 u b* a( W5 z
}5 B& B. A9 C) K+ l# x, k7 ~
}
5 j/ i) A4 K' ~; R. J/ L3 G
; F+ \, G# g/ T$ o#if USER_EXIT_OR_MENU
/ Q# E* U$ Z& Y2 i- N7 @( k T6 c extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
3 L7 L$ [3 A; [/ e3 U) W {
; I3 d: H5 c. Y0 R1 e h try
; S: |' s' u& ^; m% } {
# ~# o: Y" {. _7 H2 P theShrinkage = new Shrinkage();
) x6 u' _3 @& O, r // The following method shows the dialog immediately
( S2 w- V. H: V5 G theShrinkage->Show();2 p9 L+ o9 n% f% {, G9 E
}
) G% A9 {4 w- R+ W$ u catch(exception& ex)% F' m- `; k- u, |6 K: t
{
( V, O D% B' K5 A8 T //---- Enter your exception handling code here -----
2 d4 f% T7 D5 I- _0 ^- Q Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());1 O4 L, m6 {8 z# i
}
' ^3 @# U% p. X4 F. H5 E delete theShrinkage;
9 A# |4 o( Q- G. G6 Q- E; ]4 B }5 r" D) t3 U$ I: e9 B
#endif//USER_EXIT_OR_MENU9 A- e" T" R$ t1 U
#if USER_EXIT
5 u D- V: u" c c0 M; c
+ B- j; f/ E7 e* b: t# ^1 g //------------------------------------------------------------------------------* A3 b" ]6 ]) [/ p! N
8 H2 d6 O( E( m/ V3 E
// MUST NOT use this option since it will UNLOAD your NX Open application image
6 i: T3 g4 x8 h' h, Y9 I. Y" C // from the menubar.# U' Z$ P# S& F, {2 Z H& T
//------------------------------------------------------------------------------2 Q7 |- C7 ~1 }3 ]* e3 g! J
extern "C" DllExport int ufusr_ask_unload()
* B7 \+ o/ r7 e7 @ {* J! @% ^, }9 {. ^* f, h
//return (int)Session: ibraryUnloadOptionExplicitly;" J" x3 k+ n L2 e
return (int)Session: ibraryUnloadOptionImmediately;+ [- ]& O2 J; I( u
//return (int)Session: ibraryUnloadOptionAtTermination;6 F7 y9 X" N# b, @ U7 J! g
}! R# b1 A, I( `5 S1 l( r0 Y; ]# O
3 q M+ ]& @2 R) A0 d1 I
//------------------------------------------------------------------------------
) J Q. C G% R5 N/ v // This method is automatically called by NX.; G7 ~6 M P5 d* X$ p, J% N! x
//------------------------------------------------------------------------------
7 z6 a- r- ~$ L- s7 _3 i extern "C" DllExport void ufusr_cleanup(void)
* D; Q' @7 z* b {
$ \" j* \1 m( _+ `! n, Y try* D& v9 o" @$ A2 X
{
/ f. z. K5 s: \% O$ ~8 s //---- Enter your callback code here -----
; u( Z) l$ \& S7 Z6 Q }% h$ \! i$ b" w) U, l
catch(exception& ex)
2 B5 Z' W! H1 W& T; a& S( O {5 t& y! |3 N @$ N8 O0 t6 X
//---- Enter your exception handling code here -----
" C6 z3 [! f4 [$ x; B8 ~ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());" k2 i! c! n* H& d2 U: G
}
X. t" }4 K: }4 M5 T$ t: @ }% o, l9 X( k8 T( t1 K
#endif//USER_EXIT
" k: D3 b" l: [3 V. ] . n# }2 v s$ I, a
int Shrinkage::Show()+ p+ e! I8 K, `9 G" }3 o
{
! f3 y+ {9 h5 e6 P try* @" v- c- {2 w. ~) X J
{7 Q* F0 I0 \: x" G! K
theDialog->Show(); L# f# i4 E: ~1 {( \6 c: R
}
+ c0 f9 o2 C! Y! Y, C, o catch(exception& ex)
% t2 [ v4 g6 B! I {1 D: k" I8 j+ t4 \. a$ d; |
//---- Enter your exception handling code here -----
$ F1 \) @7 ?: ?! d) x. K- V6 |& T Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
1 a1 z4 `6 N) R" |9 o1 V! ] }
8 l4 I; q/ S4 i/ [2 p: } return 0;5 {# k; q5 S L; B2 H
}0 q, ?) B% r0 Z* L+ ^
# }8 C- b- U1 e1 L
#if CALLBACK
0 M8 o+ N; m( W7 C: Z1 r. i8 F9 g5 \: D
void Shrinkage::Show_Shrinkage()+ O7 O" B/ i4 K# b4 h) \& z% V
{
( w1 D% T( o$ m3 f( ?; W try
, ~ M' z3 ^0 K, P {. ^8 T0 N3 }5 W G5 N
theShrinkage = new Shrinkage();: K' H" T1 n4 r
$ A2 ?4 F; }8 h w2 Q$ x8 U
theShrinkage->Show();
- h& b3 {0 I* {' M! X }- V3 z! B: s( X% G: R
catch(exception& ex)1 V& s C$ V. q* i7 F
{
( n% w+ j! a. x5 f/ r
1 m# f$ k9 Z7 a, _ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());6 k9 d \9 p2 v& |
}5 v6 ]3 I: h( ]# N
delete theShrinkage;: Y, ]7 L+ x3 ~/ w: w) R# G6 v
}
+ v' ]2 u/ p" a. k' k- H3 l#endif//CALLBACK
' M. B+ o0 A4 a8 w8 p: o 4 ?, z- B8 U7 P9 w4 ?% b7 j
void Shrinkage::initialize_cb()% `$ _- d0 E E0 j! B
{& U% Q5 y* [* t/ ?0 v
try
$ S: l6 c7 c& h9 b/ D4 e7 [ {+ P7 a7 D7 z* Z2 p
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
$ `% v$ `' ]$ m9 u1 R face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
* [" |" r- i2 w% ~ face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));6 N/ N# |0 X2 O" `" F( [
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
& |2 p3 L" F( l3 Q/ o6 g5 ~" o' h bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));3 D. _* T6 U/ b r8 a9 W6 p! M4 }
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));3 ?$ s5 Z5 C! L( N* T0 N
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));: f" [4 }" ~9 C6 o6 p
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
3 h s1 ]. a8 P; H# c3 N; | label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
1 T: R, Q) H; ~7 r string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
: T+ L: \9 _0 f/ I7 z2 g label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
" _3 O. R' H8 G! E- z4 j K/ c/ s& k6 \ label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));2 v" g. T6 L/ Q! y: K
}
, X) `5 E" x+ @' R( D catch(exception& ex)% e) l0 m# ~' N5 D7 J2 N
{
- `+ g6 N; w7 M5 E 4 Y; v6 Y" b+ q0 \/ `) p% _
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());2 [( F; r2 H. a/ d1 x
}" r0 E1 U1 D* H7 r: f V. ?0 x# S
}! r- D3 N7 E t2 D
//------------------------------------------------------------------------------$ G$ P W# X/ {+ a- V) ~8 w
void Shrinkage::dialogShown_cb()8 _: i4 h+ P8 |( v% o
{# A0 {2 v8 e0 H0 N
try# X X1 h7 w. A* a* f* i% v
{+ B( v# o( t' K) r# h
//---- Enter your callback code here -----
8 M P% Y8 J [' |/ f6 e2 i5 Z }
/ H8 t& D; P) g9 j6 H5 a1 n' i catch(exception& ex)& j! B l! y/ f
{
) p, t7 T- a! S2 K6 Q% }* F' L! l8 M0 j. T
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());3 h: Q3 K& H$ _) z
}2 B% W& r# k. X i/ h, D( P/ T3 Q
}
) v% X: w/ t) Z. S" t: I/ S& p
5 D$ g! o+ S c6 Y) v int Shrinkage::apply_cb()- X9 u2 ?+ ?! {7 K
{( Y, l: y2 Q6 O1 B' A
int errorCode = 0; Q0 \& X) W2 ?$ m6 w# b: Z2 C8 t
try
0 P8 t4 ]. v# p9 ^4 S( d% P# d {
! y+ _& n+ [6 D! R //---- Enter your callback code here -----' r; V" G' I9 ~
}. l! m, j0 y1 \
catch(exception& ex)# C7 ]( o: ^6 v7 U- M
{
8 m" w9 M/ d2 i! A+ ]$ Z/ R. @* @ //---- Enter your exception handling code here -----
9 I4 @; W. N6 P) M. i M errorCode = 1;0 @, T7 G, t( s, @1 q
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
9 o, k0 d' P6 M0 b' P }/ c: F4 X0 _( R) B, M2 F5 S
return errorCode;* H; q* A! L. z4 q& R8 z5 r7 f8 @) K: x
}
5 t6 L( S+ {( o# \0 ^- h. ?6 q0 E" U4 i
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)# ~* U! H$ R+ D0 A
{3 a. y7 S: p: ]+ K( P6 [
try) m: o9 B& W2 p" b, j( Q n8 h
{
# u! [3 S' d4 |6 `( Y if(block == face_select0)5 |3 n4 y4 n! y+ t& b
{
) y9 T1 v) ?1 X" D" o& K //---------Enter your code here-----------
* X5 a- @; Z% R6 n% |% @ }
% A& e7 P; q# F6 |2 W8 m5 x else if(block == face_select01)6 T9 S! y7 c$ V; a1 _. ^% H% M
{
4 M- N4 Q4 Y9 l: T3 O //---------Enter your code here-----------
; [ B; \: n8 r8 O# r }
. g" C) @$ T! Q2 Q* Z5 h1 w else if(block == bodySelect0)
" y' a( X: P) o$ J6 C" h {8 m- e1 L6 a: Y7 Q( o) e& F1 a1 s
//---------Enter your code here-----------
- w4 l3 x$ M- @1 |% n1 Z }5 }% |$ p8 g* \3 H' s
else if(block == bodySelect01)
7 w! Q2 @! d. f( X' t; m8 } {, ]7 F4 Z& W: u7 H- S
//---------Enter your code here-----------; Z4 H% t, _3 g" K) x1 ^
}
J2 j* _ c. ^* V4 l else if(block == string0)
: g! j4 T. m. D) R2 Z3 z4 }0 p {( i; Y. W; X7 h- c9 J* g5 U
//---------Enter your code here------------ d; h X; R( {% p7 J* a# P5 S
}, D o( m1 H: ]
else if(block == label0)( C$ l. _9 D T, e2 P
{
% ~& X6 R$ t0 |9 ^5 ?* |6 e //---------Enter your code here-----------
/ m* H7 Y4 {8 N( `6 I }
8 k# Y/ x" |) I) q; K% w else if(block == string01)0 U- d1 d5 F( d8 y' [- U. ^1 A; j
{- [( U h$ u" J
//---------Enter your code here-----------) W. l& A ?+ i4 D3 G
}
, D) }% M, ?8 t7 Z; h# i else if(block == label01)2 l/ ]! c; R1 F: j9 i* a- r0 ~
{
6 |4 Y. ~3 y6 ?# D& ^: T //---------Enter your code here-----------
$ r: {: ?( \; ]* ?/ \ }
1 @9 W: o! L, |) R else if(block == label02)
" C% I' D, b. ^, ^7 T8 n {$ L: ?$ L. f4 z' }; `( q1 h0 t
//---------Enter your code here-----------; e$ Y, B8 o [- R2 w' N g* C
}
6 f6 J) A( T/ r9 D2 r9 l# i }
. R, M2 a7 y: [ catch(exception& ex)
- e! a8 d6 h" N, d4 _0 x {
) X7 G C; \: A+ E7 d. ~ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());' p' P0 [5 {1 O( Z
}
- u( U9 _/ I0 R7 `2 b5 U$ f return 0;; O7 d# m' d( L @
}. a" m3 V, K3 m Z# x
- n, G" @" g; L8 J int Shrinkage: k_cb(): ]4 }( H6 D2 @/ }7 J
{
1 s) J- ^, h$ j int errorCode = 0;5 Y# o( ~" e, d" W, r* v. \6 l& }
try
7 ]# S3 O% m- t% S" X {
: j7 }1 J( U$ A1 m; q% z9 n8 X errorCode = apply_cb();
2 p. ]8 ~; f# n6 z; s3 M }3 }" c" B: ]3 N7 D2 ^ i* T
catch(exception& ex)
2 a, t- N$ y V! y- B5 y+ v* g ] j {
/ c( G3 U( c, {6 h //---- Enter your exception handling code here -----5 y+ \$ _* u/ x- h. Z* n. d
errorCode = 1;+ s/ v2 ~: u, O4 y2 r9 e4 n9 j
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
0 s; w5 |: ^2 s4 j }" f, f/ }/ M% Z& J/ U6 K+ c
return errorCode;
/ ]0 r; W% Y+ H" c! M( r+ c9 v }
' M7 f" `% @! k5 ?" J2 W
4 Z+ e# h5 |' `$ q$ S //------------------------------------------------------------------------------( v( k4 o5 H4 a
//Callback Name: filter_cb
! q! G6 {6 W; R& Q //------------------------------------------------------------------------------4 O: G8 @% d0 a: {; {
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
' Y6 W8 @6 G# A' L5 g, C' } {
; k1 ]/ ?8 g' j V8 s return(UF_UI_SEL_ACCEPT);
" E" j+ W$ a/ a# v* |, Q }; [1 s- Q# f+ }7 e" R& X
0 Z, m! d s, Z8 R0 `; f" ], E# V //------------------------------------------------------------------------------
9 m9 J& H+ e& z void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
7 F; D+ i7 c8 y# D { k* l; x) i D( o- B( }( K
try
: S0 E4 ]# d/ C d% J: z% K+ _ {# `; \7 r/ t9 r& M- F; y/ A' A+ z
//---- Enter your callback code here -----
$ [8 h3 l$ X3 X0 H8 J }
- ^+ c# I0 Q7 y" `5 s2 i2 |2 t7 L catch(exception& ex), Y' F0 {; I; ^5 E: g1 V
{/ H1 p4 t! g) k
//---- Enter your exception handling code here -----0 w5 ~' J6 B0 ~: p$ N
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());4 h B' m" |& h; `9 `( {/ Q
}
" g( F) a: W! O1 X( Y }0 i# b3 ~/ \; D5 B
" H6 \5 J3 m* M U3 c
//------------------------------------------------------------------------------2 p0 o6 b6 Q6 q8 j; b2 ?* ~
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
/ E2 s4 I0 ^' \* ` {
# Q) N( f1 u* M$ D try Q' F7 I+ N2 s, |! M! q
{) \" |. v9 }9 {6 m
//---- Enter your callback code here -----) |' H9 k% H' k/ J. P
}/ p7 z7 Z# S0 H; o: l, u: [
catch(exception& ex)
4 l+ o& R# [ M! Y1 O+ h {, _5 n- O( o% x( w3 z' ^
5 ~+ W' m9 f! Q; g" _
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
( `# X2 q2 j) G, R }: T( ^* V% A3 y# V; ~/ I# f; e+ K# p
}
: X1 i9 A$ g8 Q, C$ X, ]
]7 c; b4 h2 ^0 l: u8 S: a
$ t6 ^; T. V5 Z; O) K- j |
|