|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
; B- h1 d' d( V4 n. u7 [0 O; O$ I r0 l* _3 f
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr3 c. i, e4 t* S3 \- C% D T: P! J5 B i# n
代码如下:; [- \/ s% W2 k% O$ a, Z
#include "Shrinkage.hpp"4 V5 f, L+ O1 I' F2 Y
using namespace NXOpen;
) h- {' `; z3 q5 R, q8 M3 r5 B8 uusing namespace NXOpen::BlockStyler;( ~1 a. t" e, C2 ~& c. I( c# W
* I) X4 d3 s/ t5 YSession *(Shrinkage::theSession) = NULL;( Q& G8 q, P5 o& _/ l- ^
UI *(Shrinkage::theUI) = NULL;
_! m) F7 f2 B: q* L" V
! m* N( w1 F0 `5 \4 E1 Q$ }! BShrinkage *theShrinkage;
( C% Z, g* J! A) y+ ?( X, M. t0 L
* y' H [- ]2 L' L1 ?' r5 R& _9 bShrinkage::Shrinkage()
, W f8 U3 L, C8 @{
- z! m5 |, [( |. `, Z try
8 G- v$ U$ {" b7 j {# a3 b# J4 V/ P2 X/ B' V
// Initialize the NX Open C++ API environment5 @ m6 j% X6 n
Shrinkage::theSession = NXOpen::Session::GetSession();6 j2 Z& R; P. c! M
Shrinkage::theUI = UI::GetUI();
4 _: i4 P1 Q+ q2 B+ f: ] theDialogName = "Shrinkage.dlx";/ G J: H" r3 y5 J6 N
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
4 _+ m2 c+ a! Q8 O5 d // Registration of callback functions
( s/ Q' \* v4 g; o9 L5 _ theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));& u! o# X4 z2 ?5 L5 M
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
2 n5 L' _5 v4 v3 \ theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
- F' \! @+ G0 X2 ?1 ^ theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
; d8 e0 o6 K0 m& R. l theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));9 H- N5 w! _" X" L
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));1 m2 K, y" [; J
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));$ _5 P. V# V! G
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
# ?' A! E8 C2 D3 D5 U }
\4 q; y+ A$ x/ r( Q* \! R caTCh(exception& ex)
- T/ P' f; W2 s {1 T# a( @0 }" O7 U$ U
* T1 Y2 d9 y4 t/ ]
throw;
% ^5 e& k7 A$ S# b% k }
5 s+ g) \4 H# r( r3 u; R}
% k4 o( w3 w' L* j/ t, a( o. n5 D5 ]. e! B6 f
Shrinkage::~Shrinkage()
& g1 x3 p8 |9 P, H4 i A* @. [{
5 x* g: y* l! n& A7 } J* l if (theDialog != NULL)9 H) }" G1 a, y. O
{
6 L- Y: D- j) _ delete theDialog;; ?0 ~7 V2 a1 R# D% g* b
theDialog = NULL;' K- m: t& V [ q, b
}
. k1 R" M _# N) t}+ D# r& \+ r/ g! J
: Q7 N" g9 ~( E/ v7 Z/ N% z& z#if USER_EXIT_OR_MENU
. [5 V- }1 R- ^3 t0 | extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
6 U C# p2 P& c {# t+ D$ l5 S' H3 A0 k$ o
try
6 j% c7 l% Z8 N {1 \5 ~6 t0 \0 Q/ F
theShrinkage = new Shrinkage();' C! a+ A5 r7 Q4 M& k3 O7 h7 u
// The following method shows the dialog immediately
% N E5 ^7 ^2 B% ?% u6 Y theShrinkage->Show();
; K; s. N, b/ |; K }
5 i6 @4 O: l; ^: `# c9 ^ catch(exception& ex)' t& Q% t1 i- A; a# p& X
{
6 }+ M- D. e: @; H& ]& M //---- Enter your exception handling code here -----" N1 s$ ]0 ^$ o
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());* P: }( q2 C# y& `
}
C( z) N. _0 q/ ]5 z t6 l P delete theShrinkage;; p m2 o! U' B- }
}7 ]# Q/ J ^$ Z2 B* Y' q; X" N
#endif//USER_EXIT_OR_MENU
' }) [: Z1 [/ `( G/ J% P#if USER_EXIT
( Q b2 T( u; O
$ X# @. B! |; P/ M+ @& H" e //------------------------------------------------------------------------------
! }4 h/ A( r: J5 D' I0 X
, t4 J0 w) F) _2 l, z // MUST NOT use this option since it will UNLOAD your NX Open application image
' D* B. f% X2 k4 u& z: h // from the menubar.
3 f: a. { ]& J //------------------------------------------------------------------------------ x' K( z {( J9 w
extern "C" DllExport int ufusr_ask_unload(). u% K) }: \ g! v2 h
{
7 q- x- U( |) i w //return (int)Session: ibraryUnloadOptionExplicitly;8 j( `1 ]+ U3 t9 T7 }
return (int)Session: ibraryUnloadOptionImmediately;+ l# l6 a8 a- ~% ~5 q. |
//return (int)Session: ibraryUnloadOptionAtTermination;
, D$ q7 y: X( h4 A6 [& d }# ?% y; R: g% u7 x) X3 I, p j
$ r" t8 H% O& O4 x
//------------------------------------------------------------------------------
5 t* p$ [9 K- p& U W7 T // This method is automatically called by NX.
2 {! [. @; N0 G. u //------------------------------------------------------------------------------" N* x4 {) m h* B
extern "C" DllExport void ufusr_cleanup(void)/ z2 h$ G& |) m: {. _/ d
{
! W, K" m- G2 }: a0 { try
: b0 _- z1 ^$ Q% N- K2 V {
: t) I0 }/ w2 @9 s //---- Enter your callback code here ------ n9 r* P2 r( R/ L, |2 n3 X
}6 b5 @" G6 J8 Y# ^' s8 t
catch(exception& ex)$ g9 G E( t( t3 y# p! s
{
. k, j8 O& o. i+ } //---- Enter your exception handling code here -----
8 r' [$ H; E0 D3 }9 ^- F! @7 I Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
* q6 \" i g, c& W$ x/ ~2 ^. N- T* i }
$ t l, V9 a j# \# O }
3 a* Y1 h$ v# B2 M3 K$ y#endif//USER_EXIT
8 r- R7 [7 o5 f7 B" e) E4 e 5 R# ^' N$ e7 J$ f, j
int Shrinkage::Show()
_+ \% Q: a# }( A- z9 E. K {
" {( m; X1 u- c& i( G% ^( A try! `+ h% o2 l* I% o |& y! }
{
9 R2 [6 R# |# x4 u! c/ K% ^ theDialog->Show();
1 a" Y! w( w( g2 | ^! a2 w }
; g6 h. l. L4 s# H3 ] catch(exception& ex)4 c5 e' S( | A; R. S H1 ]
{+ u- I0 ^8 c8 z& T U
//---- Enter your exception handling code here -----
4 R9 [6 O+ H$ y. E& \. w. t Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
6 |+ b9 x2 a) O6 m0 M }" @2 y( Q$ {. O& {2 j$ n
return 0;
2 i6 X: F& U6 O& ?5 o/ ` Q }
2 b1 s6 ?- t# B% U
. G! v8 Q! V5 m! }% V; B#if CALLBACK
! [7 X& Z- ?6 E1 t @ m) \1 t8 T: y5 V. d
void Shrinkage::Show_Shrinkage()
- C. \5 I* ]! b& v+ i- n {
' K% f# [1 Q: _6 _ ^% \. O! a try
7 ~9 h/ g6 n( s2 o7 e( } {
2 B3 r: V9 g8 E; H, z% x theShrinkage = new Shrinkage();& @" h! y2 S# N) V4 M' H+ d
5 d: e: r1 b) o' P$ ^4 V
theShrinkage->Show();
* ?+ P* E% K9 u }
; [3 E' H2 n( A; V catch(exception& ex)/ v% n( |3 Y0 Y# b" m
{: a& K! x* h/ h( X- Q# X
" l0 ^0 X- b, J# B
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
( O4 c X7 l0 x+ y$ z* E }! x2 \7 Q7 Q: s& m4 `/ W" s
delete theShrinkage;
* B" X% h/ f: ~& G }2 ~0 }4 h: R1 _/ r5 }
#endif//CALLBACK9 z% u p) _% `9 B3 z9 `
9 a* |6 n1 `; J$ o P; V void Shrinkage::initialize_cb()
! H0 P& [$ V0 ? {) b$ x$ ?1 ]( V+ o; \0 T
try
8 r+ [( A0 l0 ?( Q1 E% U* C/ f7 P {
, T, j6 T( f$ r6 a$ d group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
7 P: R/ X. `2 x face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));3 B N. c# u# U* L% ?; }
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
5 x3 X9 X! |6 ]0 I1 E/ m$ u group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
' U8 v+ c1 P; c: _' S bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
# n! A; i( d; I# N) y bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));$ l/ j% `- ^2 M3 j4 e- H, |
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));: B7 e; V! b- P3 [* u
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));6 C* w p& a& s& C
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
$ O! ^7 P2 I4 i6 n5 d string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
9 _8 F6 U. ^3 s/ F* F' L! p label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));" t6 M( ~2 A- e8 \6 Q: N
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
, V# K+ `( d9 a& n+ d" p( t; w, H }
' [$ q. C7 o7 M6 ^ catch(exception& ex)
; g) `5 o( i3 i3 [& n9 p: V/ i {+ y0 S& M# g" l9 @; F* i
1 o3 o f/ L0 |
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
0 n( }! G4 @* `/ m5 ? }
( c( _9 u7 t' m; P' V, S) \8 K }& j# V1 r" l Z! J" W0 }, S
//------------------------------------------------------------------------------
$ _5 b3 s- d) v! | void Shrinkage::dialogShown_cb(). k, g; \! o! Z9 _* f
{
. w$ ]! @1 P& M. W. V try
" j Y @% b( E {
! x2 @5 |9 y6 m `/ ?8 v //---- Enter your callback code here -----
* ^! L2 k7 n' J! ^4 h }
( o8 B# J% C' r3 y catch(exception& ex)
# A2 W* Z% \7 j! r; o {3 R0 S [& N" h5 A5 |, ]9 C% f" s/ j
& Q4 a* G: J% B6 r/ r% B
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
& x6 `2 r% k' j- @$ u" w( [ }- @8 T7 Q+ G; `' `9 P0 E% r. N
}1 }# Y" A% q/ x5 C* K* {/ }
- P2 n# B5 L3 Q$ S1 F2 P' P int Shrinkage::apply_cb()
/ t; u/ m/ `0 Y6 C" h/ @! r {
, [# V" S p7 x9 e1 A" J; v1 C int errorCode = 0;
! C9 z, L6 K O k, S4 i& r+ n try# V+ x: n, c8 w% p$ y/ U# r0 _
{2 x5 r/ Y/ I5 a3 q/ S; X" k
//---- Enter your callback code here -----8 i/ ]8 j* T7 h+ M8 o( c
}
/ A% C: H5 i1 A) e& s: @( I! E5 l, i catch(exception& ex)* _4 B- S6 f, ^% ?1 K; l+ R
{
( ^* a6 N' q8 z0 b' Q: b' l+ G //---- Enter your exception handling code here -----) `, [. a" g7 n$ d. B; j1 k
errorCode = 1;9 [" M* v& t! I, w' S* t
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());3 `6 N; ^) j; M" Y3 B# H
}# c9 G, a [2 z5 }2 Q; t
return errorCode;* |& x7 q3 ?7 r7 u5 n
}8 F/ K4 u. p" m+ g f
+ c3 P2 |0 V! K0 p! {
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block). L$ s- I& P$ f( \4 g
{; }* b) Q# q% h2 B
try7 G8 `& Z5 p# F" T o* X4 s* B
{
A& ^4 Q2 D5 x/ `7 g" o6 {! W5 ]1 f if(block == face_select0)
7 B0 x3 w% ]9 q' t; N& f {5 ? M: u8 J: ^
//---------Enter your code here-----------' p5 r) f K0 w
}. i) k8 v/ p3 A1 }+ ]/ @2 R( @) E
else if(block == face_select01)5 |) p6 K8 m$ n& V2 m1 N
{0 Q* s' F, c( _( ]# X3 {: J
//---------Enter your code here-----------" a( G' i% {3 a, r* _
}
9 _4 @+ ]7 ~8 W+ u' S# Q" s else if(block == bodySelect0)0 c Y% }' Q ^
{+ t/ k: x" X: E g% i( g
//---------Enter your code here-----------
. X1 e, z( R# D: _9 e0 m* a! R2 y }
$ {% i. @% T/ F: M4 V else if(block == bodySelect01)
6 {3 I; Z6 t; e5 E0 R {
9 m! I. u4 y" c3 H: [ //---------Enter your code here-----------
6 |) E8 h. N) z0 t0 W p }% S6 d1 S% s n( J7 r2 M7 c: H* _
else if(block == string0)
; N$ R0 U8 g: }6 q D/ w- [+ _! \, j {3 {$ h0 \) P- o% j/ h
//---------Enter your code here-----------
2 S( e( S# k$ r' P }
& @/ q" C ]9 p8 D9 z5 h$ L else if(block == label0). o% v$ I: Y" ]
{
" D8 T( W* D' v- ` //---------Enter your code here-----------9 h6 _0 w7 z0 }) b! Q7 C
}6 q5 J" x* w5 v; K1 \4 J7 j: j/ I
else if(block == string01)% T5 `: m0 {0 x0 n6 z5 {. B3 v: Y
{# T7 j n, n X0 f
//---------Enter your code here-----------
( g, N; l( e4 M" V6 V8 d6 \2 R6 t }" n% y! @1 {. R6 y1 c
else if(block == label01)
6 ~, m& z, ?3 o {' G& Y% i4 D! Z
//---------Enter your code here-----------3 `5 G2 {, \+ H2 ~- O5 o U3 D9 {0 \: S
}5 R$ t2 f* W1 D5 M
else if(block == label02)3 i5 @# }5 S9 K% j$ y1 S
{
9 J! `/ r/ J% q/ N7 g- m //---------Enter your code here-----------3 y+ w% m" y% J' b
}
% y z4 N- n; A: {" M- d }0 \# A2 p( O: ^8 S) c7 `6 Z1 w) x
catch(exception& ex)& r; ` M5 M% \4 b
{& [* c& Q& o" r0 B. u9 b" b3 M
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
: k0 v/ [+ m- \6 `3 r& G }
. E B5 r& z- W return 0;
" a6 A- X& U9 l: \& e! J }& w. D2 V3 J+ i6 }: d0 s: N$ Y# [* U6 N
0 p" ^* S! \ {% Q
int Shrinkage: k_cb()
0 @- W; N; ^: t5 }* M {
) ^6 J0 B( c9 B8 N4 e @ int errorCode = 0;$ n2 U. J) J* C7 ^0 ~( J) y8 `3 S
try
- f" o( ]6 d2 b {
9 r. _* \3 R$ I1 m: r errorCode = apply_cb();
! V6 }1 d; a. C. f# o, A }
! M- k6 i" c' K$ k catch(exception& ex)# P) w" U- G8 @3 n+ X8 T* j
{
3 B( j' W* D, H1 X" t //---- Enter your exception handling code here -----
% b- |# J N5 }, O errorCode = 1;; J& x1 ~: J4 u) G+ z# y) h) V" P
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
- x m2 E( D; g6 O }; T0 O6 g+ G* ]8 _- _: D: o
return errorCode;8 |% Z3 j3 t. B: M! A
}2 {) t; d- G4 G5 _
% L5 Z- X. H6 u* t2 _ //------------------------------------------------------------------------------/ X( n/ W% D. m5 P( S
//Callback Name: filter_cb4 B+ Y/ }4 l- s$ j }
//------------------------------------------------------------------------------) J6 w) n4 h5 L9 N* l
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject); Y i& E( J+ C+ j W3 X$ A
{
2 a1 W) J5 N+ y5 S return(UF_UI_SEL_ACCEPT);7 U* V% `0 b9 ~3 m# I+ {3 Q( P* f; j
}; F$ v; B" _ H1 b
5 |8 v# j3 O3 t% a; S //------------------------------------------------------------------------------
2 m2 o0 G. c* F' e3 I ^4 r void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)2 n5 I5 Y8 i; L8 Z ?& _
{
1 ], N Y7 I6 _% R9 X- D try
) a! {( Z+ d0 b9 G+ R {$ ~) _0 d9 y8 \3 V
//---- Enter your callback code here -----
2 S& X ^* G. S; n) B: Z7 Z" M }
) w1 i, C" P6 Z7 L& b* l5 y catch(exception& ex)
7 ~, I( {, j+ m- O {* C2 e5 E* `& B N. \5 ]
//---- Enter your exception handling code here -----5 d5 U X+ _6 r% T- Q7 N! X
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
4 a3 H" y/ l5 | }! j, J' N6 X. y8 e0 m7 d1 G. B% }
}
% K! w: f/ v2 p: }4 G3 F . K/ }9 R& V% I$ L, g# Q* J n
//------------------------------------------------------------------------------7 g6 A }& c! y# \+ I$ _& F
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)& y; D( O- g2 ]# ~$ b/ E8 [
{
; I9 K& t' P2 I' I try2 d$ p, Z, B6 W5 D8 x2 _* L
{* n. Z7 F1 f6 G, {8 V
//---- Enter your callback code here -----5 ?; I m2 _1 E3 [7 W
}
$ p+ d H$ R: b0 b3 Z catch(exception& ex)
; L/ c4 B$ l# Z/ o, \3 |: L. S& L {6 F$ \ {: q8 W& b; j5 e/ S
4 O z; a o1 ?2 G
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
# N3 M7 V# J" g }
. p) U6 c+ V* c' S* H) c+ u }
( J% `- E" X& c" E2 U: \8 @( D" ^' n6 ?1 G
. A* D6 q% B6 T' W: Y3 Y
|
|