|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
% {5 e+ m% b2 M$ ~0 u: ^0 L0 i u) R" G
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr+ }0 W2 D& T" p( g
代码如下:0 O! S q2 c& s
#include "Shrinkage.hpp"
) L5 D6 T6 g; L" L% F- E, y8 ^using namespace NXOpen;
0 [( Q6 p$ I& R* W3 \using namespace NXOpen::BlockStyler;
) ?& Y9 U) A+ ~! K; f- ~. p% \ b" b
Session *(Shrinkage::theSession) = NULL;
! R0 _+ c1 V# M5 w4 Z( v' U2 @$ I9 oUI *(Shrinkage::theUI) = NULL;7 V1 S9 H' H) M" X
9 x( a0 H6 v4 ~3 |1 xShrinkage *theShrinkage;( P% \0 D% l; G- E: C/ Y' K0 Z1 P
- k! m' y( [: \1 ]
Shrinkage::Shrinkage()
0 E: b& ` q. s+ f{* S9 x3 `+ w( [1 A- d$ u
try
6 D. }) Z- O# }3 a4 a9 Z {
9 i: F9 z3 g1 C4 |& [. e // Initialize the NX Open C++ API environment6 ~% b; u9 O+ L
Shrinkage::theSession = NXOpen::Session::GetSession();
/ l' f7 F- n: E3 Z) C; z! ] Shrinkage::theUI = UI::GetUI();0 C" q( \0 ^! K) ]6 J- k$ B+ z0 x: i
theDialogName = "Shrinkage.dlx";, v! x3 K* K! s/ g: u
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());0 o- I1 ^0 X8 O
// Registration of callback functions
. u# w$ n% u( ^/ q- X theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));8 ^% c0 S8 U2 k q
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));+ k) z1 Q" E' Z) o+ @" v
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));/ {: H& {) i$ V: Q) `, n# p
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
7 y0 z- [) G" b theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
5 v o4 d- z6 O& X theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
* A6 D: j u. x theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));7 X; o8 z6 S! V4 l! |+ I6 |
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
, h! s; L! q" ]! c! } }
) d, f7 F5 v8 u# |4 k! D- b caTCh(exception& ex)
G+ M- m$ k5 R5 T1 p {
7 l/ ^1 p: o: U% g% R, S
9 S, ]5 s \( u, k* a throw;
8 g8 O/ Z' A: V3 f" { }
, Y* D, H( w9 z! F$ A}
: R5 W& s: h/ g0 i. U% K1 A/ a: ]# F7 ~2 V9 _/ j; n. D5 }
Shrinkage::~Shrinkage()3 I) m- L' P' M8 c; o
{
0 z, s4 W+ W, [3 N3 }9 r if (theDialog != NULL)
' _) `7 `1 e1 F; k7 Q5 e+ p- H9 Y6 A {
) o6 P6 I3 D' _4 ` delete theDialog;+ f Y+ V/ a! w# A7 V( }$ x
theDialog = NULL;
# ]2 O4 q9 J& O& f, | }
6 L+ }4 v% {. a}
?% x: f0 w( C* S+ j% L: l
; C+ |! J# q( c" x$ `* ^#if USER_EXIT_OR_MENU& g x! S5 k* x, I6 e2 M2 N
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)7 ? s+ T7 M3 ?% H: s# H) E! [ m$ {
{$ ?" B: [5 \+ L' n2 N {' |# _/ f- r
try
: r7 D e7 t9 [; z; ~* W {; Y! E1 _% ^) B" |$ Q8 ] Q- R
theShrinkage = new Shrinkage(); O- i' P1 y }$ d
// The following method shows the dialog immediately
6 _" o0 D! [3 y" ] theShrinkage->Show();
- N; y, P1 i8 u }) G& p% v, v" w0 V5 b
catch(exception& ex)1 Q" a1 w5 L& Y
{, d2 a& q: Y2 x) S$ T6 f( L( X% g
//---- Enter your exception handling code here ------ N0 K9 m2 D- O1 \% J* v
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
3 E9 B9 n' f& Q+ K' { }" T3 Z6 i7 Q9 B: G" [
delete theShrinkage;
! K) R( r) x, O }
9 ~$ W" H2 `: q#endif//USER_EXIT_OR_MENU- {4 s- L* o5 F" m- d, Z# q |1 |3 f- Z
#if USER_EXIT
$ `+ d* @6 I8 Q; |4 U' p, K: u & O4 R- q3 q+ m% v; Q$ k
//------------------------------------------------------------------------------
" E% T- I2 N$ L# { * v7 _9 M' p- C
// MUST NOT use this option since it will UNLOAD your NX Open application image- n0 s/ N, u( Q5 w; A; H! t% o
// from the menubar.
2 l6 O! V1 ]$ [- H; i9 F+ ~ //------------------------------------------------------------------------------7 n+ P+ y, g' o* ~4 S1 b
extern "C" DllExport int ufusr_ask_unload(), z0 E% n4 `% i8 n
{
* E9 t l+ v8 `8 \ //return (int)Session: ibraryUnloadOptionExplicitly;* {1 v5 k8 N; R6 Q0 _) e3 y: Z
return (int)Session: ibraryUnloadOptionImmediately;6 |' D& t; J: s6 W4 V4 R- r) g
//return (int)Session: ibraryUnloadOptionAtTermination;
+ ~, E8 |9 \, E4 r }' `3 d$ q8 ^0 a% O; K
+ _3 F& x3 @4 X3 w9 Y3 c( @
//------------------------------------------------------------------------------
2 I& \0 R& g* {: o // This method is automatically called by NX.
. i) R% U0 b- F, D //------------------------------------------------------------------------------
+ ^" P' ?) z5 F2 T4 L% X+ @5 x extern "C" DllExport void ufusr_cleanup(void)
0 d0 @# c3 g* ^ {0 l* s+ |- z+ X7 G
try
6 K! u& H& T o% f- Y5 v {
; d, P. E- X8 N- E& C //---- Enter your callback code here -----4 @& R$ c' t6 c/ t& A9 K
}
- ~5 t9 |! D6 m2 b3 c% O$ c catch(exception& ex)
& h2 A2 r" y6 B* A, ^ {
: g$ H" }8 ~5 ], d; p7 v //---- Enter your exception handling code here -----
( c$ ~+ j) N0 c" I* v Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());3 b+ y: n5 x9 w; v( ?
}# e. {# y% A T. l y2 X* ^1 G% L: g- V
}/ p1 x3 [+ M5 z z; l
#endif//USER_EXIT2 [7 n( I- m/ W2 a0 k
$ x v# B( z# A8 Q
int Shrinkage::Show()/ F" u, n. q' H. ]. w
{$ H/ }! E' t, M) w' G" V$ ]. R m2 R3 L
try
% p2 R+ k5 J. M6 }9 r$ o& r V {$ W" B) R' Z/ z \
theDialog->Show();: k# M. o# P ~
}& T0 S$ L1 G6 W6 C8 L4 B
catch(exception& ex)
+ d* r; ?9 p2 ]0 K {
% u( @1 e$ \4 k" e; y& E: C1 Q4 { //---- Enter your exception handling code here -----
# j0 Z4 _8 H6 t8 @ u9 E% F! t Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());8 L9 {1 w E/ m+ D
}! a% P; F6 @- _+ _( O. X9 l
return 0;! W+ d) N3 Y |5 |8 m( K! z% t9 y, M2 b
}
. J# t& Z+ l+ d, w2 G& t8 O* o 6 o4 u0 T- u3 J: v
#if CALLBACK
; z6 ]6 n0 g5 x! K# G& a; A! z
- A, W- m* ]* S i/ i4 H4 m! i/ m void Shrinkage::Show_Shrinkage()
% S- X# s# w( p {6 m: o; _! X! W% z
try
5 R, I# H+ A2 d& v6 j6 ~ {. Q5 @ M* X4 Y5 S3 P
theShrinkage = new Shrinkage();% z/ Q' u5 H* ^& C/ x
% J! \6 w+ V) x4 j0 y b, @ theShrinkage->Show();
# ~' \8 S7 ]" N: j: k3 U8 ^ }! N- ~! x/ \: r) p# k& _( q
catch(exception& ex)
% y- ^7 \# d$ z { S Z, I( P- D; `) f$ S
8 U# l! h# X2 @) r% b* v
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
' D8 z6 m6 A" Z0 g/ K }
, F/ v" k$ I# c& r delete theShrinkage;4 x! P) g" I6 a# c* Q6 M8 A, c% {) r
}8 G/ [" d- [+ e5 ]: n4 x( m
#endif//CALLBACK H8 c8 B+ Y4 H2 B& r, y$ m
: U" D. k7 [5 E0 G) w& ?! W void Shrinkage::initialize_cb()
6 Y/ d, a3 b$ o9 U9 i1 X {! m# M1 D/ Q- W3 z. d) [* @! z$ f8 h
try
- V- G3 y8 @+ ~0 y2 H2 | {3 V0 U3 }$ D: y' \/ H. @% S2 F
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));6 D5 f0 ~5 F& y( Z% p
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
1 \8 F4 Q& s' K7 j0 ?9 T3 Z. _ face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));7 e l" o% g* |, \& J
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
) r, n+ c' H- c% y& Q9 d- V9 E6 t1 s bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));6 W8 e1 S5 v6 h( Z7 ]9 c
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
, z; i# J3 t. q/ _2 h* q7 u& L- I group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
0 y( G/ ?) j! }4 ?$ H( t! |: ]5 \0 O string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
5 F9 t% ^; {* K' h6 } label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));. j* ^# a j% ~8 m" w+ |" i
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));( n4 O4 Q* b& q3 l) V" t
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
S$ S) _ V1 P+ n8 M) M8 } label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
1 A( N# a" q8 x/ z$ {( U3 u }
. h: b5 q3 A0 y" R2 |" h) f catch(exception& ex); ?5 f* L$ r6 v! W @( Y5 A$ N
{" N5 W5 O: P5 W9 Z& K; h
9 h7 d0 w4 Z4 h x1 [0 E* L
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
3 L# S. w1 _, Z+ E' p( ~ }. U9 G# g! N& V& Y
}
& {% r/ L8 B, A% z: c9 ?* q //------------------------------------------------------------------------------
; j) r; D$ A( }, u" G void Shrinkage::dialogShown_cb()/ |+ E+ C. N8 p! _4 }! L/ I& S# t
{
9 I% v0 Q2 t! q9 z try( C4 B% s6 d- j) U5 \
{
; M8 B5 l9 {# U3 s- N8 d //---- Enter your callback code here -----
! D& z, {3 ~; [; y y( F, }& x }/ H+ w `& }3 A) G; ?5 U$ ^
catch(exception& ex)
: [9 f) X- ]/ b8 Y* A' _ {
5 E& \: B! p. S. q
i* o: a9 _. X4 w( `% ] Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
: L( m/ e$ P) C$ G$ o# R- Y6 d }
9 f- ^3 ?$ u$ g( D4 j i }
l" h d1 V6 u$ o& g) U" p& ^ ' ]. E3 u' ~( F: Y
int Shrinkage::apply_cb(): X6 } H; Z& }$ l4 q
{
( J. g9 i/ C3 f3 w, n/ i0 Z int errorCode = 0;
5 |* ?0 j5 C, W8 j% q try
+ p$ r! Y/ x' x1 c9 U- e c {5 O9 y& m6 [* A8 }; r7 |
//---- Enter your callback code here -----
- b9 H* D" Z7 f) V9 _! w }8 @9 k' `& x. O
catch(exception& ex). J3 A, v- f- y3 G- g8 T
{
' |$ a$ i6 Q/ k) x& C. Z+ a //---- Enter your exception handling code here -----
0 y- w/ f$ F5 F6 ^+ Y) D$ s errorCode = 1;
* G" \! S$ ^7 G) f, f } Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());( d( C% d& p2 d# w5 ?& \
}
( d! l8 [ K6 |7 J& ]% P% K return errorCode;
7 y. L k" G/ _* b ?6 E% A7 \ }8 v8 I1 v% D5 m7 `1 T
, K$ D. x: ]' E- [& {/ N int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
, v( A7 w! K5 A0 M* B6 a9 h! S+ ]8 k {
* r- v4 N7 y) P- X' V" T try
2 }) O I2 Z2 N* f/ \' |, t {) d6 o. t9 X0 b4 @: y# S
if(block == face_select0), [' B1 \# f* O: e; X) m- \/ [
{
9 F6 i. P# q# f& ? //---------Enter your code here-----------! `/ Z2 U M$ A% B4 B9 R
}1 J; W+ b8 [1 M2 [
else if(block == face_select01)
# { Q0 {0 u; j {" t! p. m3 Z; r3 B' @
//---------Enter your code here-----------
" e5 X u( n" _% Y }; d2 R0 {3 M: {: k2 A
else if(block == bodySelect0)" U9 J7 C& J% s1 J7 f- U
{. s1 u5 L) }+ v* a$ u3 p1 ?
//---------Enter your code here-----------
& A7 S7 o$ N( X8 L }8 i- n6 A$ T2 `- O! N6 O+ {
else if(block == bodySelect01)& _6 v1 O; u1 `& H, {
{
6 A, C1 R! b! d) d: Z! c7 o( ] //---------Enter your code here-----------
& E2 f# a! Q, `3 j6 H8 F }
9 w' \+ F, i/ b6 o+ l else if(block == string0)
! @1 v, e( ?8 U+ _5 z b {
7 q: L2 x# z4 @, [$ v9 v$ N //---------Enter your code here-----------& ?& v" B }# \1 f, A2 W6 c) Y2 T$ F/ f
}
7 e2 j7 Y4 v2 b5 A% t6 o else if(block == label0)
5 q9 k3 g1 Z& n) A {
( |2 I" D, R+ u% P9 p: X8 L //---------Enter your code here-----------
# q$ ~7 h) B8 w4 z! T2 h }
8 a1 D9 C3 x. M else if(block == string01)
) w6 x, r1 l; ]' k) a5 S {1 _) O& }& k8 o- A% j% c
//---------Enter your code here-----------+ H# j, Q8 Q: `& z
}8 ?3 K- W3 V2 E# Q# b1 ]
else if(block == label01)! i3 I9 |7 O% b- `
{( ?1 v1 `4 \! {; S
//---------Enter your code here-----------8 S. e. d- w& U9 ]7 f8 r' y
}
) a, ~4 F2 E! I# p: [1 ?, ]+ B else if(block == label02)( h6 t$ c7 A: x6 V) d
{
! Y) O# e) d* I) X9 m //---------Enter your code here-----------# w7 ~ I; k# ]: p; w' q( o
} H+ F+ z: B( F
}0 d' a& ? C+ B; `6 S8 ^% A& w
catch(exception& ex)6 I2 \0 B+ A. Q& ^, a( k9 O# q
{4 L$ W n: f) |% Q: g
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ `6 v4 G2 j2 n }/ ~1 e5 W7 |9 T6 q
return 0;. u- H7 B$ y3 B
}- x! E0 R4 Y4 o1 T7 r
: N1 D$ t; y' T* P+ X
int Shrinkage: k_cb()
% j& u$ G% `* E6 w/ U0 } {. U2 E# s3 _4 b2 D5 p
int errorCode = 0;
! l( c& S0 U1 h( V- |- g( h try
1 m) o. }7 c7 o9 s' M {. y" C. P) w( }) }7 M
errorCode = apply_cb();
" Y' h) A8 l5 j9 q2 _ } Y' M6 t7 e2 _
catch(exception& ex)' [% Z/ x' \/ N4 }" l
{* }+ M1 j2 Q) n& \3 D
//---- Enter your exception handling code here -----2 _; q% P7 O( }
errorCode = 1;2 ?# _ s. }8 U6 {/ |9 M- H
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
- i) L6 `: ~2 y1 r }
' ~5 O3 n5 P- Y! K return errorCode; n1 e; L8 H/ {1 K7 L: I% E
}
5 ?1 ~+ r4 P: |' [ $ @+ J) r( {1 Z0 A0 }3 W; o# T
//------------------------------------------------------------------------------0 M1 O) |1 e+ h! ?( w" m
//Callback Name: filter_cb
$ q0 ]: g# m2 D7 W7 j% B* ? //------------------------------------------------------------------------------+ P0 C7 r0 Z) s' K) z* e
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject). j8 ]& I. Y+ G6 ^+ k
{$ |! g/ b8 i f6 f
return(UF_UI_SEL_ACCEPT);
n1 O" }6 ~1 ]9 w9 r# ]5 ^- V }6 d4 k0 c: q( @
+ `8 e" e8 K: H) f, s9 o3 R //------------------------------------------------------------------------------; r1 O) l! r0 g. O" v
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
: \9 u7 ?9 C, y! k/ f5 s {" y8 @. T% ?+ o( G8 ?; E' @
try
7 g6 G4 w( [3 H% S# w {
- Y6 ?* D* h* I$ h: k7 j+ h7 M //---- Enter your callback code here -----) ~3 K# j. K7 w9 M! H
}6 S& w8 ~. f9 t3 s4 p) H8 {% ~
catch(exception& ex)* y& q6 `" o/ H8 h2 b
{
3 p: Y7 n# @. j5 [5 x$ O v //---- Enter your exception handling code here -----
' ~8 u% F1 d5 s0 I Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());8 g' q/ o8 C- l2 t/ e4 B
}
7 `7 m) b, F" p. m+ K }8 @! p" ]/ y% w: B
* v. l; `6 c0 M5 x //------------------------------------------------------------------------------
5 R" l: |. n" Z+ q void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
5 |+ w6 g2 j, {# C {5 _) z. v0 ?; T6 e! T, u) }4 J
try- b" O% z7 ^8 k
{
4 D7 X9 Z$ T3 k( R$ i1 M, I+ M //---- Enter your callback code here -----
! y; ]1 _2 }# J L% `! F }5 ?3 L/ P7 U( ^+ ]6 g, {- m
catch(exception& ex)8 l: H# d2 ?( [2 C
{
8 X% S, V, [& C9 b$ L3 K5 E& ?
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());" ^9 w) A5 N8 |# o5 L
}, K5 H- f& y3 C3 D: g9 Z% I
}
9 U3 n5 `7 l+ C6 I% [, n$ t5 m, x0 D2 E" X! Q7 O+ O; X
/ {# O9 R0 l Z+ j
|
|