|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 8 ^4 |0 U/ J/ h) w$ {
' y' x2 V" x! {5 ^请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr6 l7 k* `: ]2 H" l( }
代码如下:( f8 [4 R$ |7 b) V% W( D7 b
#include "Shrinkage.hpp"
9 [ N6 @1 @9 b2 L3 l0 H) qusing namespace NXOpen;
& Q8 m0 ]4 N' I& L+ z, Iusing namespace NXOpen::BlockStyler;
/ t5 F8 s$ j- y' r! f4 O( @% z( a8 L4 i! [% S( a
Session *(Shrinkage::theSession) = NULL; B8 B1 o* b& C% |& x
UI *(Shrinkage::theUI) = NULL;. F6 F% D2 N: w5 Q7 N; o
4 O9 Y& \ } T/ P- S5 G* k2 h
Shrinkage *theShrinkage;
* Y0 d, o# y9 |3 V& q1 h& r( l; c0 e* G2 @# o- _
Shrinkage::Shrinkage()1 B- A9 T/ \0 D) e, t$ N" y
{
$ r- s% x: G4 P( E5 V try: x9 u. F( Y7 U+ h
{
9 D( ?* e i |# t5 V5 G( Q5 o- A // Initialize the NX Open C++ API environment
& W+ R/ J# G% X- ^$ e! D) r3 o Shrinkage::theSession = NXOpen::Session::GetSession();7 |$ ~9 ]9 i8 F: h
Shrinkage::theUI = UI::GetUI();
' j6 @- ~3 S0 r theDialogName = "Shrinkage.dlx";
' h9 c b! I/ c, v- z2 s% @ theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());& f0 S/ V& k5 T. M. d
// Registration of callback functions& ~3 w5 |* e& j- t) \( _3 q
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));/ i; W& K7 O, V! q3 y j
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
/ H% R0 r; G0 o- a7 p1 b theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));1 `7 n/ ]( Z0 r8 m$ ?
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
5 V) C1 `/ y+ R* ^ theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));9 W) M! @# E ^: a* F7 V
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
% m& Q9 r( v1 |$ D& \ q theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
- ^+ z5 L# i* e0 b# U4 L$ X theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
% o& t5 U# X9 ^' d3 _8 k8 B8 U }; ]# R9 [. x. i2 g/ M7 s: s% ~, ^
caTCh(exception& ex)! D7 S6 y) v' d& Q* N s
{( M; l. b k* x$ E3 Q9 `
6 N1 v1 \8 H1 U. p
throw;
2 v# g9 o8 B1 {! [" R }
# V) a; A3 o: G, [/ l2 H3 Q}# c. Z) F2 B% J
- J& W8 G! O) [. p! VShrinkage::~Shrinkage()
& _7 l* S m. G) s1 J{* v, p/ C, Y6 ?9 i! b
if (theDialog != NULL)/ D# f% o1 T. {$ b& `3 w
{
% D1 \4 ]5 K1 _1 Q3 E delete theDialog;; W) N7 p* R1 K2 p
theDialog = NULL;. B& z9 Q) L5 V) K+ D: j9 n f
}
/ B( l. ]( H6 L, ^* d; D D}
3 W4 ^0 h2 ^ g S ?+ N: N
& r& X$ v0 o1 B#if USER_EXIT_OR_MENU4 D' ]" i! n: ?% X2 r, M+ C3 E
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
) O2 Z7 p5 M2 Z {
( S0 k- m4 ]6 j' D' r" U try/ B. ?4 j) E5 u- P2 {& h: s: k
{; O0 r* Y$ O0 w1 O) U
theShrinkage = new Shrinkage();: x" C, J6 r7 b, ~7 L
// The following method shows the dialog immediately% x. X% r$ v. D
theShrinkage->Show();1 a4 ~/ Q" C1 R; E. N; w6 K
}
1 S( O0 }7 P6 @7 A/ | catch(exception& ex)4 _" Q8 ^; U4 ~7 x$ K
{
; ~; G* }( R( ^* {) B0 w //---- Enter your exception handling code here -----
0 b8 W7 B- `2 r Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
- o6 E8 R( k) Q5 z }0 |1 ]$ @. n. Y: d( n
delete theShrinkage;
7 N# b3 z& G) y; T3 A }: F7 ]% w- A. ]: E
#endif//USER_EXIT_OR_MENU
0 e) o5 I/ }, g1 [7 Z#if USER_EXIT
: W8 p: S7 c: g4 x6 J3 E) B& R
/ Y7 E7 D# \, N$ H, I //------------------------------------------------------------------------------
" K( H' o2 I) P, |% n) Z 6 R9 Q7 M) n; n& K0 V5 m
// MUST NOT use this option since it will UNLOAD your NX Open application image) t: U7 V D5 ^+ \9 u. P' t
// from the menubar.
% b) L2 l# N4 E7 I1 n) Z; ~! a1 l //------------------------------------------------------------------------------
: i2 j, q& l5 d% p, N. G9 V extern "C" DllExport int ufusr_ask_unload()+ ?+ G: v4 l) O/ u
{
. g3 @8 O: U& \) V- U7 y //return (int)Session: ibraryUnloadOptionExplicitly;
8 z! n0 a) c3 a8 G return (int)Session: ibraryUnloadOptionImmediately;
( q F: |% \5 y; ^, I' d //return (int)Session: ibraryUnloadOptionAtTermination;
" p% x3 \; d- R2 y" u5 K' p' P }
' ^- A. m1 k2 o! A- Y1 |* f
7 ?9 W! u3 m% t //------------------------------------------------------------------------------
5 c9 t, H1 k; R // This method is automatically called by NX.
* |! ~. z1 J/ Y# }. [ //------------------------------------------------------------------------------
5 O2 Q$ y% L3 Y) k! s extern "C" DllExport void ufusr_cleanup(void)6 K) r5 P8 l- }7 n* l" V2 _- O
{
; ]& X' Y* B! k9 E try- W; g% D% T2 U, R* C" R) C' |
{5 @4 N8 g# X' o! m* A5 X( x
//---- Enter your callback code here -----
% Y( {# n5 _8 `9 \0 R/ }1 } }% e- F o' ?8 {, y' ^8 \7 {
catch(exception& ex)4 X/ ]2 d* E! q2 r. {
{
- U. ~! _% i0 p3 e4 n //---- Enter your exception handling code here -----
+ k5 y8 U+ H* { Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());; I7 L8 y5 @0 B+ \9 N0 F
}
* ?. @. r: {* R( I: G4 ~9 }. T }
# f# x2 H6 E' d- `$ }#endif//USER_EXIT
0 l9 |( j. G1 U# m$ p9 h' E7 U" [ ; z! f# p& ~. S, R) h- Q
int Shrinkage::Show()
3 S9 Y5 q) {" s$ c3 W, a1 ~ {
! [; Q/ Q$ M- o6 p try
7 v/ y8 e+ |0 k0 y {
0 _$ R- V3 b$ f, q theDialog->Show();
0 C, B5 i" O% F7 r9 f% F }
5 O1 B0 b- K+ p3 H1 F catch(exception& ex)
9 \# D# t; F* v$ p' v {
0 b" H3 y9 K- [. r //---- Enter your exception handling code here -----
$ g' E4 o* O: u( P" z7 G5 Z1 ] Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
9 f1 W+ u: x; M) u1 o3 j9 ^/ V# @ }
, q7 i, ^* P. ^. l, y9 w+ e return 0;
' i @3 |. k% @3 |5 c, e" m }+ C, d' \6 i, }% ^5 z- R, W" f1 Q
) A0 q# k+ P+ q3 W9 j& @# p V% x#if CALLBACK
5 [1 }6 j: s8 u& \' c6 a9 K2 B9 T# M% E$ y* s3 K M" Z
void Shrinkage::Show_Shrinkage()
: S. B5 ^8 X4 m' C' P7 W {0 }# z& L( v' A4 H
try0 I0 O4 l7 y9 h
{
) f; d2 _, I" g1 ~# C$ b theShrinkage = new Shrinkage();2 V7 {5 U# ?; q/ P
6 ~/ b2 `9 R6 b2 S6 k$ n theShrinkage->Show();
% d% e! y4 n1 @ U6 h3 R }
, u' u9 V3 v" k% K catch(exception& ex)" O5 X* d' n. k7 F* Q6 B
{6 N6 u' q& O- v) f
% y8 u- k2 S1 X6 A& G) c& z' n Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());$ Q% m, Z. {1 |3 G9 C7 g! f5 a: y% {& ^
}
! n3 w& A E9 A7 e( x delete theShrinkage;
2 P1 y. S5 s+ S4 n2 ~$ t" q* v" t }
1 l/ r; e; O8 f1 q7 B' }#endif//CALLBACK# v8 R* D) g; K( f$ n+ b7 u; M
1 ~$ x7 u/ H7 G) `
void Shrinkage::initialize_cb()5 s; ^0 y% A2 k, y6 p$ U' G* F u( [. {
{
& C3 e4 t' g. r' O8 s x+ n: r try
6 V/ x- k- r' l6 v3 d. L% ] {
1 `# Z G* g( M3 _7 }7 @& { group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
, X& ?5 P3 A. F2 d* `$ k face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));" P* ]& l3 m$ `
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));$ Y1 u' E8 h9 t; Z, T4 j
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
% b& l. W& |8 u1 }$ n( I( X bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));! B: k) P- h! R" N5 Q1 y
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
6 X" t K6 }9 m5 w8 b0 C& _: y( c% o4 k group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
V& q% ~4 P) r }" L* f$ W string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));( ?0 C5 f4 x" z! @+ Y& [
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
! t6 W$ F' r- E& b string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));% E8 F# x5 l# f' J; m
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
9 x1 T( ^& C; } label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
" _# h- E1 j+ I }
8 `, H4 ]' |3 h catch(exception& ex)/ B+ q8 x6 ?4 n( S& b
{
8 P2 ]1 A0 D9 J+ d X 2 r# t7 H1 V& y3 C: E
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ @2 g) F" x |7 K0 Z) y }) F" d6 K) E V4 M1 z. \
}
/ u* e* n4 i8 D //------------------------------------------------------------------------------
. l5 w: f% z0 i( ?% x1 h; q void Shrinkage::dialogShown_cb()5 [0 }/ ]1 J5 [" q- r
{
* s2 b. z5 t8 w, ` try
% s2 D2 h2 r/ E, S: q3 M/ m* \ {/ d/ Q. ]7 U/ S9 W+ Z
//---- Enter your callback code here -----" Y$ t" U( m) [6 e) k. s5 M- l; N+ r
}
( E" b3 b5 a) n" y0 ?3 x8 _. n: K catch(exception& ex)
9 Z! \' o3 s0 f3 o {, Q" a8 a; O1 P$ O, W! K
! S) o' u& Q: b$ s/ }! M6 p
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
F1 q0 T, U8 r A- {2 @, E9 w }
$ z0 y$ s+ v9 z7 a9 L- F }
: x* A# U- u% [3 n/ F
" Y* j8 @3 i/ ?; q4 l5 A* _ int Shrinkage::apply_cb()4 [) j# ^6 f8 @* t+ V7 l6 E! O
{
7 I' o% F3 d# N0 o+ G int errorCode = 0;
3 p: q8 f' |7 X! i% @9 p try2 c5 \: j" P1 k5 D4 p2 @
{
( a4 E& I4 `/ t4 s //---- Enter your callback code here -----1 I2 s2 [6 f% q1 B, f2 v& U. V+ C
}: Y6 I9 i) C2 \
catch(exception& ex)2 V5 U( b7 Q) {
{" }2 K8 u4 ^) z$ K b9 q
//---- Enter your exception handling code here -----3 s' i: u& T: i) X- r- A- G
errorCode = 1;
6 [, H+ s; {* |, `- q Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());# O4 X) F& ~; L5 I: w
}
/ Z7 r/ A$ f+ k$ k& d" ` return errorCode;# Y- `! Z* e) _" A! v# A1 A
}" e* w6 O6 r# p
1 w% L% S$ U# l, r
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)* b1 F, r) a5 A& u: N0 v$ U, V
{. w3 E% ]' T7 Z) ], Y* ~& }* i+ ^
try8 K# s! s3 A( l
{5 \& n1 z) \5 w2 C5 N7 M
if(block == face_select0)
, [! L( r) Y: L0 h+ q! g* z7 }" c {% S& I/ u4 N. c+ B$ X7 n7 n+ K1 e
//---------Enter your code here-----------8 P, {5 W6 ?) _# z: P) @
}& T$ z: G g% h9 Q8 z1 y) \
else if(block == face_select01)+ [5 X2 |1 L! U% _. m
{4 B! ?9 Y" A( V" `* \" {( q
//---------Enter your code here-----------# ?, [- g2 Q7 X0 H' b
}
7 v: K( W$ s/ Q8 r0 j* M. [( d9 c: l else if(block == bodySelect0)! l. k: ~) r7 Y% m+ n& `
{+ X/ Q2 w" A7 [9 u* d) w
//---------Enter your code here-----------
% x/ \+ X/ g% S3 { }
c5 Z+ x$ u i, C" a& l else if(block == bodySelect01)
+ n& V" I a, M. N9 Z {
e( {1 l, X. {' ]1 f //---------Enter your code here-----------* X4 A/ K0 c" G' m) H' e) d
}1 R' r3 d7 Z( M. X$ ^! w8 l$ N6 x/ d
else if(block == string0)
* G6 t) E0 J; Q7 P {1 g, ^% Y! e* `/ K5 c
//---------Enter your code here-----------; }3 y* }2 r! w% k& y
}
% m+ C( |1 t8 W else if(block == label0)7 t7 }! f5 o4 f5 I/ S% w! v d3 `
{
3 l# x- Q( h) t2 g //---------Enter your code here-----------) b! K3 z- u, ~6 e# J% T( R/ q
}
, x" J& X+ u c; S6 z/ r else if(block == string01)7 k% O( f& M$ s2 x5 T( x
{
7 L) k" ^. F8 u2 t$ w6 b9 f //---------Enter your code here-----------; B9 z+ J' X& x: A+ z8 Q
}; y0 e9 {$ D6 J3 w9 T4 q* @3 b: |
else if(block == label01)
) j7 C' c3 h y {
' g, P& C; m9 u$ |# U; O5 F //---------Enter your code here-----------5 y4 y& V* z4 X
}
. J3 f3 B% H L: M: N! A/ j else if(block == label02)
2 E: ?4 I& d9 w. e4 \: F9 I! Z9 J/ W {4 c) i% L7 }' E
//---------Enter your code here-----------
0 F: Z4 l6 Q. v# o# Q# S" Q }3 x% N4 a4 b7 k
}$ e5 t0 v1 D, D6 i
catch(exception& ex)2 w6 W2 d0 d5 e o) Q; E8 r9 l
{1 y9 l# u9 E P: K
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
; P- h% L& |9 G }% p. a' i+ \' V# g
return 0;) o" f8 a* z5 T* v2 u. u
}
5 G5 H0 `3 E. t \$ l2 w$ M
+ @+ _$ n3 \6 M4 Y9 y5 z( I int Shrinkage: k_cb()
( d& M9 K# u j; P# [ {$ E2 f, Q) V. c' z) G
int errorCode = 0;" V1 D# F0 ^4 j0 J
try
! q5 Z" ?4 K; B/ m {
, k5 J* r8 F; r4 p1 V1 w errorCode = apply_cb();9 _. d/ U4 [8 ]- `- z
}
* ^8 g* |# X, W9 k' a) a catch(exception& ex)
" v3 K. U9 Z5 ^3 L5 P! A2 d2 H; E {
, D& b# M. o+ J //---- Enter your exception handling code here -----% [' ~ y) D% A5 E7 B
errorCode = 1;+ c% c: c4 O( r/ X+ k8 o- _ ]8 h
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());7 f" c5 _/ f, g+ O+ p5 m& L8 e
}
5 Q5 q4 N% g# x$ } a6 c return errorCode;
; @1 Z( K! w, t }) [$ {) g2 W1 a9 [9 |; q
) a7 u2 }, |( _( {8 j
//------------------------------------------------------------------------------# M& \/ r! B. Y0 J6 E
//Callback Name: filter_cb* f% F) k; C+ b/ w" u- ^0 b
//------------------------------------------------------------------------------
1 v. x+ y. X: W5 X' C2 d/ a& M6 P int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
+ q( ^# c6 X" o2 s {
$ ]' Z+ J: G* v, G2 N9 s1 s; |6 c return(UF_UI_SEL_ACCEPT);
6 ~* p% U8 U$ e) t- X7 E5 R% ^ }
0 W- v5 n8 W8 l8 K6 ~% X! F ( s3 k+ J- ^& C: v8 ]1 [' p: n2 G
//------------------------------------------------------------------------------& K# a3 U, B0 M' U
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)! ]1 u f& C" z' v5 m
{
0 w8 P }5 |* w) q8 e try9 S8 f6 E6 l* k% T; x8 `8 z
{* V2 h' X6 |) r" a. g4 @7 O
//---- Enter your callback code here -----
2 l+ ?7 C' ~: c3 w* V) r9 h }
2 k' d9 y1 z+ \1 d8 ^' w0 |: u catch(exception& ex)
6 P# {) \' ^1 g: F5 r; p {3 d3 W3 ]# _2 l
//---- Enter your exception handling code here -----
' _+ i; m U, o- ~8 n3 b( K& D Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
; w9 W6 M$ M! T0 I/ P# ?! x. y2 n }
# e8 S5 m& c, ` ` }; |/ f% t: l M; @8 }
) T4 f8 C" M) W* ?( H; G/ t //------------------------------------------------------------------------------
/ L; z+ k( E9 a$ g; `+ W void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
- f. v% G- A6 F, V" ? {" R f" i# g& z3 |3 i/ U
try6 v; a" w2 X# u( x4 m* ^
{: f1 u# L0 I% Z7 D/ W# V: y
//---- Enter your callback code here -----
$ g; k7 T! q' r% _* \& T }
5 S+ D- E* F. Z; K catch(exception& ex)
4 u1 k. b7 u8 ?. L8 m b8 g0 p2 C {
8 _; d4 d! k* N6 G7 {- u0 [0 {2 \5 b4 G7 x8 d
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
# z' P' w( E2 j9 A+ k; ^/ A3 v! e1 Q }
, c3 D& `- P! }6 g }
) \+ J5 r7 X) v2 F! |3 v4 s* }8 Y
: N2 M* t4 V: e, M8 |; `8 x" i7 C4 U4 C
|
|