|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 / |5 H# @' T. n" C- Y1 ~/ [
- N1 [8 m4 i) E
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
* h4 e6 Z/ t, `; W! I代码如下:% C' Y, c3 O+ c; G5 W5 i
#include "Shrinkage.hpp"
3 p4 a3 q4 y2 p& I5 U [2 U7 Ausing namespace NXOpen;
9 @& i- O% f' E/ X6 f4 Iusing namespace NXOpen::BlockStyler;
# H6 I# Z5 t6 p# X" r# u" w, W0 L
3 H+ T; M. [7 U S$ CSession *(Shrinkage::theSession) = NULL;' ?1 ~( l3 Y' W' U4 |2 }8 c
UI *(Shrinkage::theUI) = NULL;
/ N& g2 j- ?' _$ K8 q6 P% H! C
Shrinkage *theShrinkage;1 ]' G, \0 F* ~) g& ?
* ?$ i) q2 L: r* [0 _
Shrinkage::Shrinkage()& Y3 W5 e2 y8 K t
{" r! q3 b# f' [2 C, I+ L8 E
try/ o4 H' k0 s" R) h9 k5 A9 w6 i
{% `1 z3 _: g) Q/ r/ K3 G
// Initialize the NX Open C++ API environment
1 T+ Z2 `3 r, J' \ Shrinkage::theSession = NXOpen::Session::GetSession();
. J7 F- P# [, g3 U Shrinkage::theUI = UI::GetUI();
' i y& _7 `8 W3 R& v! s _& q* R theDialogName = "Shrinkage.dlx";
4 g0 K3 X% W/ j# p2 i theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
( B6 B B. x7 Q' D9 j // Registration of callback functions
7 A! P4 Z( k6 I9 `$ O B7 V) p \ x theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));; y/ p% S& P# `7 S! ?
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
/ K; I* Y8 [- F% g" P# U" r theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
3 t9 l1 Q( g5 z) k theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));* |. s5 _7 H9 j
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));8 X& g* M8 O7 J( a( M, J( F+ H" s
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
! k/ r5 J6 a" n1 @ theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
) L1 Z+ a; t- o theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));' g0 Q' N Z/ H3 w- R; [! y
}
/ J1 J# Q9 {/ _ `+ v7 S: f caTCh(exception& ex)1 b e& }5 b9 B" s' y2 E5 y
{+ a$ Q: h1 F L' _) f
7 M, X* y3 i- R V0 C
throw;
3 }9 k2 S3 p! g }5 A" S) i7 [) F2 c
}- {( d: n$ A' l; n/ W. L7 C
% t5 C/ p B2 Z( h2 ?& w
Shrinkage::~Shrinkage()
: p9 R7 _$ w( a+ l1 ?7 e1 c1 F{* R9 L+ ]1 A$ Z" V+ M
if (theDialog != NULL)
; l y% A0 k) j {
+ e. @! |4 G l' D9 E% \/ c' o" h delete theDialog;
6 p8 S# m! R1 v& s theDialog = NULL;- I, f/ z ~( {
}
0 z3 G, K. o' r. n}
h' W2 }& ]5 T$ w! D( K$ r
X7 F% I: M6 q#if USER_EXIT_OR_MENU
( l* F0 P) R d$ c7 Z T extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
/ n( D7 O8 x; W: I. _ {* a% [! @0 k: b L; c5 h: N/ h
try; l0 R: T4 F0 o& b& ^
{( j* A) ?+ m2 C5 t7 s+ y" H
theShrinkage = new Shrinkage();
- m" J- [4 J" Z" V# d# z // The following method shows the dialog immediately3 o: I/ V1 L. f7 a; g
theShrinkage->Show();
# V ^' y8 \3 p8 b9 z }* @. d, k* ~. G
catch(exception& ex)
g3 [: j! g p3 C7 X; k/ F {
3 q+ N/ U$ X* ?" M8 t7 n //---- Enter your exception handling code here -----
/ Y) @+ a- e: c/ `# B Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());5 |7 h; D; H) _7 y3 b- M
}
/ x6 q3 X" e( [& L, a, a delete theShrinkage;7 o8 I7 J# N" g S0 s
}
0 p/ Q5 k1 x4 R- [" O( r# I$ b#endif//USER_EXIT_OR_MENU
- S0 i& j: D2 O7 K1 e#if USER_EXIT
/ g. F' O/ u& p * p# p) ^# A1 C: u; u
//------------------------------------------------------------------------------
" ]2 {7 C& c$ [3 p+ M) J # B. y1 s) k5 [% J8 i
// MUST NOT use this option since it will UNLOAD your NX Open application image6 W0 G) J) O6 n% s
// from the menubar.
3 C r- O6 }( {) _8 ~2 o+ N //------------------------------------------------------------------------------8 U6 J! M2 y2 o4 W
extern "C" DllExport int ufusr_ask_unload()
# ?' h* m; [; k; R$ T P {5 ^ M* t% t: _7 F+ C* D
//return (int)Session: ibraryUnloadOptionExplicitly;7 }% \3 E. }4 T% S
return (int)Session: ibraryUnloadOptionImmediately;6 n' }1 f& P3 I& H0 P0 }: }
//return (int)Session: ibraryUnloadOptionAtTermination;* u# ~- a# W/ c7 t- Z
}! ?* s/ R! u! B, _6 U; q" z
; x% {2 c6 M& k/ \ //------------------------------------------------------------------------------ {: a) t! _* o5 I% s2 R
// This method is automatically called by NX.
% u. D6 F7 k0 J F4 b //------------------------------------------------------------------------------
! F6 K8 h: y/ N4 U e# n extern "C" DllExport void ufusr_cleanup(void): l# J0 j# x6 G) W1 x2 z
{6 U& U( w2 Q2 ?. b$ [: R
try
9 w6 t. j2 A5 x5 g3 I$ d+ x {
8 v5 m6 q' e' S8 y% o7 b) S //---- Enter your callback code here -----* Q2 s4 `9 q' N. S9 V X$ R
}
s6 _& S: }( G ~' X& ~, U catch(exception& ex)
4 E/ |+ C4 o* y# C- D6 k {! I/ D2 s) Z; d
//---- Enter your exception handling code here -----% K( C6 q4 a5 y6 X/ W3 Z4 r, p
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
0 x' O7 w4 c. ^, Q8 G6 f* B0 t( y' M }+ d: K, d/ F; {" P
}
& t% `; | r! F5 R+ \, J- T6 z; b#endif//USER_EXIT
' W( a6 N R( n' p/ Q- {/ v1 T) {0 n $ f) T" U4 d L, j
int Shrinkage::Show()0 k" f ?1 _( [
{
+ U4 G5 f& K4 _( M. r. A- J/ g o' [1 v try! q2 K0 l$ Q7 K$ j) b3 \1 @$ t
{' F1 Z% u) i2 |# F# d
theDialog->Show();1 L. L( p& B( U
}9 j- f+ l1 j: h* M- {0 B
catch(exception& ex)
0 E. @$ n7 _2 {# d# S) V {' g6 y) G+ F' Z' A" w# O" U
//---- Enter your exception handling code here -----% l' V5 {0 y( l, Z. ?
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
9 i0 p. K0 v% g! [* K }: j7 W. U) T* {# F1 c) m
return 0;7 ?/ w4 w4 E* M& }* B. t
}
5 q/ e( T# i& Y3 r5 k. j/ o1 s $ u- m5 i( ^/ c- K3 O/ H
#if CALLBACK8 \) p, i; e8 d* A& D! B7 t
& H! { D/ o9 `' u+ S; J% W1 e void Shrinkage::Show_Shrinkage(), x; `& O/ W a$ k
{
* J y2 Q! }( \ try3 r0 \* N+ d% d) e8 h
{
7 L6 {7 @% o! T) y theShrinkage = new Shrinkage(); f6 ?2 [$ k# x4 Y. S
% ]3 |# S4 _$ @* _) _5 C. D2 U
theShrinkage->Show();
$ o( @2 R' r3 z7 d }
8 f' s4 K! g- g catch(exception& ex)* H- ^; {0 O6 D, x) r- N: S
{
& \2 ]+ G9 r: S" |* W
9 T3 \0 a9 z7 g# Y- |6 E Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
@5 T9 c; ~! l; S; d L }5 I/ t2 B6 ]# [, G8 D" H. m
delete theShrinkage;
Q9 h* [1 D4 s) k) ^- X* Y% O }& o1 d1 G1 B" A C7 P5 S( c9 Y# d
#endif//CALLBACK
5 d5 {9 b# i7 \" v9 d. v3 g( W
8 e3 R! N4 p5 ~ void Shrinkage::initialize_cb()
: x5 |: \- M, g* ?5 P$ S2 v' u {" \. |4 n0 V2 }- _, g& u
try
- R" P' { u! T* g: M {
. ^$ U& M$ I u$ E+ y; @ group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
) o# J0 y% `2 z. d8 q face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
9 o: K6 t6 l3 t face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));6 |5 c5 u0 Z$ I) P2 ^
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
) o6 k4 h& m* r! k' k9 G3 A, e bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));$ ?! `" u% M% R
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
3 u g. @! n* P* g' c- }2 u/ G) } group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));$ w/ a% W) R7 n! R4 N2 i
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
- l3 \! V0 S7 @- M5 @! |$ q label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));, e! s2 k" ]# b" A9 n
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
; o9 X* e- _8 J9 _+ W label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));" ^5 B# B5 V! y& F
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
7 C2 ]+ k3 f+ }1 o3 v } f0 ]6 u; u' P3 G. E
catch(exception& ex)8 r& Y( v$ Y. M: U( ?! Z$ E
{, m* ] Q8 s% A; c1 x
5 }' w$ a- w) s. n8 ]8 y
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
6 w% S8 N9 v+ V# u* P }# g6 V- a% Q Z; w
}4 _5 d. Q/ f. P* w* `, g) s+ z
//------------------------------------------------------------------------------ Q$ S, c- V7 v8 { p
void Shrinkage::dialogShown_cb()5 ?/ B7 _& i$ T; R# B* ~
{
" I! `! \% [/ I. B: e try9 c; q3 Q( }% Z. n2 C4 k: k# ?
{
' s3 e z4 X9 z5 J$ V //---- Enter your callback code here -----1 f7 \5 |/ C6 P' w) t9 M
}* R ~# f8 v# C6 C
catch(exception& ex). y, q9 e6 C/ ]* k) e
{
2 o3 B2 R3 F# I4 L7 s$ f; O
4 j0 J) X8 @) M Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ K" A, T( S/ i9 F9 y }
7 E! A% D) L c }4 U! J4 |) \; H
$ q" A0 l7 X# H; A) f/ G
int Shrinkage::apply_cb()- j& l# R3 O" i' ~, t+ Z
{
% u3 l4 m: h3 a/ h' k int errorCode = 0;0 b. P4 H% S7 `: Y! \* w
try, J L. R) T) l5 J# S
{, |0 h4 M2 Z _
//---- Enter your callback code here -----+ p* }9 h8 g# ^, ^/ V3 }3 `. F
}" s* |: Y+ D1 e1 f
catch(exception& ex)
/ M3 W& N6 d+ B) f- B {/ e m6 P7 W0 T0 R$ J2 I7 M
//---- Enter your exception handling code here -----6 y1 I( f: j( Q
errorCode = 1;
, p, V# i, K9 P! ^9 d) s Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());7 o [! B, K( ~5 q
}
/ S+ q3 Z4 X1 N0 G6 T return errorCode;
\9 x% n+ J( ^- L }. u5 n3 L. A3 _1 u9 b
2 d: D( m# ^; r$ U
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
* \2 y' h! I0 Q, |" G {
' G; U G' c' g) o/ t/ n5 `0 t2 I4 S try# t; M7 }/ c* S+ G$ P6 H" `
{1 e/ I0 H$ n! } l+ ?
if(block == face_select0)1 C" A* l3 l: S
{$ k$ J/ |( _/ D4 ]! |
//---------Enter your code here-----------
$ u, r5 o+ Q7 h$ a }
# g: I( Y% u# `0 m8 L' f/ G else if(block == face_select01)
( B) K5 }( S2 O6 u {( ~: }, p: t/ F1 h% e$ y4 q5 N
//---------Enter your code here------------ w& W+ H: z$ j% A2 B2 s7 W* O# u$ \, y
}1 v* n! _5 u! x% m% ?2 s5 `5 ?
else if(block == bodySelect0). D, }& ]: Q: M% D
{
; z" `, o* ?, v3 d9 { //---------Enter your code here-----------
6 D* p- j& ]( C }
2 Y9 K* [/ P' k4 e+ ~6 S else if(block == bodySelect01)
* M' K/ W4 d l+ ^ {
: R$ ]+ y8 {7 }( O7 Y4 O //---------Enter your code here-----------8 B- M$ t/ X& Y$ r1 G
}" d4 ^( n4 z. @% y# t: W
else if(block == string0)8 u) k# \4 i- V2 }$ T
{
; b8 e$ N5 R5 {6 e. C5 ?! {/ w //---------Enter your code here-----------
7 o9 V5 M; f/ ~ Z }7 u; R* h0 W3 t1 T5 d: H
else if(block == label0)
- X) ^6 b& h/ ?- H; \* ~ {
0 K3 {5 J8 n3 d+ ?% Q) E( K //---------Enter your code here-----------
4 n% m& q% `9 t) r5 x* C/ {3 l+ f0 I }, J( O2 N8 ~" i5 m g ^3 P
else if(block == string01)# \- K n; d' L: S6 W( s
{
% z e& S$ ~. t) w1 x! x1 r //---------Enter your code here-----------
. d/ y, b0 x! f% x! P" Q1 m) X }
+ j* q9 n6 p6 o9 ^+ V) ?1 h else if(block == label01)
: m. f) [0 N, G {( M% t! F* Q" K2 n+ O+ j8 J
//---------Enter your code here-----------
* M/ S& Z' I5 p3 t$ Y( A } [. H2 I4 K& e0 I' G- L
else if(block == label02)' a0 l- `6 y( i6 P9 h; ~* L
{& b$ t# l9 c( k- T
//---------Enter your code here-----------
* m- c- R7 ?- T' T! X8 i8 X1 @ }
% z, D* c" L9 w& y+ E1 t k }
% N: s6 H# {: H# o6 A6 h# } catch(exception& ex)7 b5 \+ T$ W( P# c
{ M2 n6 t$ ]' _. k
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());+ M/ ? ]2 p/ T+ | ?% m
}2 N+ k# G8 T; Q* m# y+ j
return 0;* ~% g A, ^( ~; `. g- M
}
( n- N) G. \3 a5 s; a/ P* e
0 d9 F& e) m* L9 o5 m. A int Shrinkage: k_cb()! V9 b9 k1 F6 C# {( B3 m
{; c9 h: Z! \ J- g" _9 a
int errorCode = 0; N/ \. N6 L' k/ v7 i
try7 ?. `# F2 [( C) y8 u& v5 n
{0 e p; M3 j. y" Z! f; I
errorCode = apply_cb();
/ U- O4 L# z9 L+ l }$ Q, ?& L% r: Q- _; l& M) {* ]% B( t
catch(exception& ex)
$ [( |' a3 y* S5 m; E {
5 O" a) s* J$ e# E$ } //---- Enter your exception handling code here -----
' \$ o1 [% v8 W/ n; P1 b errorCode = 1;( Y8 X3 |4 Q* \$ i$ z/ O& ~7 h# A
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());8 u( K. m( X& y, B* w4 O' H
}# a2 A& W% g$ L5 c: h
return errorCode;' S5 n$ N/ p7 k7 h2 m; q5 Q
}4 c- V: y4 B% q$ t8 h
6 d5 b7 C9 [! @7 Y
//------------------------------------------------------------------------------
8 a# i( p. F- n( }+ d# S2 k3 V //Callback Name: filter_cb
: P1 O& S6 A( F, j7 Q/ M( J //------------------------------------------------------------------------------
: r% O7 u, p' p int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)% f$ ?! P7 j% X8 s! i
{1 ?- S9 g( a8 R9 i: e) l1 q
return(UF_UI_SEL_ACCEPT);4 T; d" x D3 l7 r
}0 _3 O7 s ^2 U5 E5 J: P
5 l- Z( o' I$ J$ l# l9 n
//------------------------------------------------------------------------------, q7 Y8 ~" A8 w1 K
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
& J2 D) f; \' d q' u$ x {2 J$ k$ [3 N: C( \: M/ G
try
; T s0 W {, B& H }4 B- s+ {8 X {
6 B m" h" f: T8 r# H- l1 F //---- Enter your callback code here -----
7 ?8 a/ h9 L4 d+ ~) Z }5 F3 A3 G8 \& j: ]) _
catch(exception& ex); W$ s) o) M c9 E) E9 Q
{
7 `! K: a! g, e, D, Y- O //---- Enter your exception handling code here -----
: }, s% V* |/ V- v* v Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
3 {" F5 }; K/ j b }
2 U2 f' h& v; W" g$ x }
# w# {0 t% O7 {, }6 @ l* R 9 L4 U* s* |. l# O6 f
//------------------------------------------------------------------------------
# j; k7 C9 I7 j7 m+ u void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)7 u0 x* K8 R" v5 q' ]; `0 N, ?
{
# @. d) h1 `* ~ try- b# ?! x' J% X
{4 ^' r& a3 G* Q' v
//---- Enter your callback code here ------ t {$ G. m) I; n
}
. ?+ Z! k* D" D7 o catch(exception& ex)
7 M7 ~# f' u! M; ? {
* k& d+ P$ K, I8 r+ b: h# S0 M$ V
3 H \$ A+ H+ p Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());2 W4 z; y3 |5 ~. n5 \
}
* d) U/ }# Z' M }" O1 [2 s, l& ]& w
# Y* y; C' X. k5 b' D7 M
8 e3 c# ?' s+ ]5 ]- E |
|