|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
* A' Y/ V2 }% c) c9 b
3 Q: j$ N" X/ V$ {# n1 B请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
. C$ p5 G6 n* d- m代码如下:: U1 L4 h c0 f
#include "Shrinkage.hpp"
9 \7 g* K9 z% n: s4 Q) xusing namespace NXOpen;
: y0 E8 W' U% o$ F3 ? `& Iusing namespace NXOpen::BlockStyler;
: g, s8 ^. c! l- x" ]' Q: y' W' P# ^7 E
Session *(Shrinkage::theSession) = NULL;
4 `1 ^7 O2 [6 ?UI *(Shrinkage::theUI) = NULL;
% F, n. o2 I: Z( s4 a0 {' D/ \2 G' p
Shrinkage *theShrinkage;
5 g( V/ E c0 M2 @& X# f" w. M, r4 Y! q Y6 V, J9 H
Shrinkage::Shrinkage()* g: \ p) [& d
{
) u) X j& t2 G try
! B& M' B; }2 U& \: ]0 v8 { {' Y6 @! w- Z1 L8 E' b t( K5 x0 H
// Initialize the NX Open C++ API environment
! V& _5 {( Y- c- W; R/ v5 L1 u4 p" q Shrinkage::theSession = NXOpen::Session::GetSession();
~& A8 A$ h4 X4 z Shrinkage::theUI = UI::GetUI();9 p6 m& A ?9 O- e
theDialogName = "Shrinkage.dlx";+ V$ J" M* @- p- H% j# l
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());( R! T7 |3 a4 O0 h3 ?
// Registration of callback functions
3 v. N: b; W4 C' g# ?4 S% |4 y" @& x, L theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));* b, Y# j/ [# W
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));; |. k3 h1 p$ s: d$ l
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
2 F3 x7 Z6 [) F. c7 U& W. G theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));/ x: ~! P" H1 V4 F3 W; Z
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));. i# V1 w* Y% g x1 N. _# y3 f
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
- G! M) c% G8 @7 w# | theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));" }* R# c' I# z6 ^: E6 }
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));# |9 g- h& W' v
}
1 m9 I/ T( T; b. K: g caTCh(exception& ex)6 H( d8 J- ~4 H, L9 Z
{
0 R6 E3 a! u, |$ b! ^3 b8 P1 v ( j5 B5 c3 {8 r [
throw;& i' N9 U! r+ e( Q! K
}. P/ N4 Z, k; q
}* C4 h: u, j: H r+ R
% o; A4 ~; q. P* ^0 I: T* c! ~9 M' _Shrinkage::~Shrinkage()$ J7 f8 e1 x$ _6 K
{
- X- `7 a- @* o/ v if (theDialog != NULL)
7 b7 Z' O- _1 R. U1 P K# H {' ~) q% c5 x* t6 v# l6 Q
delete theDialog;7 f; z( Z: Q0 l2 d6 ?' l* o
theDialog = NULL;( X. L* N, l- N/ E
}
2 ]) x1 x) K0 P}- ^& k& O9 e& |& x& o1 g
2 T) U% n- [) @/ V: ] N9 t) U* V
#if USER_EXIT_OR_MENU
! I5 u% H+ `% w4 F extern "C" DllExport void ufusr(char *param, int *retcod, int param_len). H) m& F, m9 N1 j& U& |! ?' \2 {
{
! I; W8 s- ]) l9 G- ] try
# F2 n( q h' i. i, Q( R {' M3 Q1 u. h* w" U A& i4 V
theShrinkage = new Shrinkage();
( ~! P& c& G& x+ y% ~) `2 g // The following method shows the dialog immediately) r" P, G3 Z* Y/ L; s2 `. z9 @
theShrinkage->Show();' s9 K$ u' z" ^; k$ @) U( m5 ~
}) z5 _2 k7 M0 X9 R* h, ?
catch(exception& ex)
$ N3 W0 t6 m) T" q9 {3 N {) q& I0 b: `0 f. M$ I) \; M
//---- Enter your exception handling code here -----
3 t; C. H( m- ^+ _) i, _ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());& w& L0 ? {# O3 d8 j1 c/ U
}
0 l% `1 r5 p7 o) D8 N8 S" c" B L. q3 | delete theShrinkage;; O& |, s! l" g7 V; n& h
}8 j# u, V( S* d5 z
#endif//USER_EXIT_OR_MENU
5 b: a( r$ |9 \! N9 }#if USER_EXIT5 j. k; |2 F$ R' i
5 I' D7 `/ R/ _1 f% w$ t //------------------------------------------------------------------------------
$ L+ w1 v2 L4 `5 X1 M7 ^6 k
8 U9 E4 l! C1 u& }, M: t // MUST NOT use this option since it will UNLOAD your NX Open application image
, B3 m' O! D9 _( E5 p4 @ // from the menubar.6 H) Z. A" C: d6 s8 V5 ~
//------------------------------------------------------------------------------
% t6 ?" w% d+ X! Y/ | extern "C" DllExport int ufusr_ask_unload()' w; p( F% K, T9 Q
{
9 X! p8 ?, r* B+ g1 o r i8 R4 C //return (int)Session: ibraryUnloadOptionExplicitly; h+ i4 s3 c1 N' E5 v
return (int)Session: ibraryUnloadOptionImmediately;
+ D, h9 H* N) y1 }" l' A s# b //return (int)Session: ibraryUnloadOptionAtTermination;
! v- b+ D, r, h+ f7 s- F: S }" [4 {7 O" a9 Z" I: t! r; ]
5 f; d2 ~7 _4 }1 n2 s //------------------------------------------------------------------------------0 Y: ~. [# N6 R) o7 O L
// This method is automatically called by NX. U5 l$ `7 E3 l/ V
//------------------------------------------------------------------------------
0 a9 R6 n- B5 h, _! H% D9 }7 ~8 ]4 g extern "C" DllExport void ufusr_cleanup(void)3 [4 h! b& `# s: U
{
+ J: V, ~; J; r, B0 B. q* i( h try. O9 s# i! D. S
{( S& Y2 P3 g4 c# E
//---- Enter your callback code here -----( R8 r% |. G X
}
1 {6 {2 M9 x: @+ }, n7 t& r; ? catch(exception& ex)
3 D& e; |! d2 j5 f; F9 L* @( c& q {7 x7 @% a& L# y# w
//---- Enter your exception handling code here -----+ a( a2 L! O7 H
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ M( @& T- O8 c# j6 n) t, ~, L }4 d8 ~/ s% ]; t! t! K
}* W; L! z. G1 K. k: \( \
#endif//USER_EXIT1 G/ I0 K& b' z6 ?+ }- ^; ~
, ^4 ~/ p& b* s6 I, I int Shrinkage::Show()6 t/ l* |4 V k2 _: V
{$ _" P O' D' \# P1 B9 Y
try
/ H6 q. g# q1 M {' T, U3 z0 r, ]! e& d7 q
theDialog->Show();
! o) ^2 m5 n6 N, w6 v }* ?) ~3 h, }. c2 I: p- |4 V. m+ S; s
catch(exception& ex) y. S T9 o# W9 K" q1 S1 m! q
{
1 C$ b/ @ Q; Y. Q7 ~' p4 R5 Q' ^ //---- Enter your exception handling code here -----9 t5 \) J+ C8 Z# x" O
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());8 R% c* u/ V% N+ Z" ~' X9 L8 I
}
, h J3 q0 a( M/ p/ q4 `' F return 0;
& \- n J- ]5 i! p& h4 M }2 W1 @2 ?. R, l5 o/ v. q
: [9 }8 N: ^- c( u8 h#if CALLBACK! W/ r: u0 j; `4 {% F! n
& L: B* v& E. T8 o$ C3 v$ N
void Shrinkage::Show_Shrinkage() z- v6 ]) S: ~) F) d
{
% o3 Z" B2 A9 ]8 K7 ^; g9 G try
3 E* K' C0 L' n0 h) e+ R {% P% i9 f+ _, U! z) r
theShrinkage = new Shrinkage();
( R ?# y7 i% d" ^9 Z' s) @0 l8 ]( y4 e1 y
theShrinkage->Show();
8 j2 S7 `: R% |5 G) l6 E$ t# @ }: B% o: P- B: z6 n% [3 ]
catch(exception& ex)
! I4 f- G& [5 X {
+ `3 J$ T! w6 R9 g- l2 w. b& D- ]* D0 I. i" A
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
+ f6 y, r' U! G7 s# K8 v8 { }- v I q' X9 i$ ^
delete theShrinkage;
( d8 b$ t0 c$ W: I8 \% m7 W }* \3 I. M+ ~2 `9 A: h. F, Q1 P
#endif//CALLBACK+ D" `6 K* n' l1 v9 v
8 `7 \; v* `; u+ e; g
void Shrinkage::initialize_cb()$ `$ w" t+ w$ Z8 K
{% V/ Q: z* e8 |& \2 i2 w, t* E
try6 `; V4 X, B8 u
{
; G/ {7 k! E" | `- y; q group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));: b3 _3 U K5 ]1 t- q/ d
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));7 V2 f, E" p& l' o# X6 l
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));* O) P" V$ S3 i/ V3 M
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));/ o( U- K. A" K3 n9 \2 |' ~
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));% x5 ^1 D( }3 i q
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));; P4 y4 ], E6 s1 I3 {8 T9 {! M
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));0 _: t7 q, ^) } N @+ G7 m( N1 P# l
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
- n# D4 k% G3 i* v1 ?! ` label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));6 Y+ e% o5 R0 l- L5 {- g. r6 H
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01")); ~* L- @+ D- L/ B4 G- P
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));/ T8 B+ A @* V+ B5 S
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));1 U3 {$ r/ }- s0 b5 ~- a5 F
}
8 ^6 a$ w/ m8 C4 u2 F) }7 Z catch(exception& ex)6 Z8 p; B/ T4 x$ p" F' n
{
2 f/ f1 R+ {- ?) f& e ) \3 Z# X' _: Z/ H
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
7 q7 ]8 S$ J0 _" Y- p }
9 {9 S; P+ M1 U) R, S8 m }: y1 R+ H) E3 z- x2 P
//------------------------------------------------------------------------------
6 M) t0 X( C9 o/ W b$ u$ B void Shrinkage::dialogShown_cb()
1 W; R/ P7 X) Z6 ?" p& J {: a6 C9 S$ I' E
try
R! i9 Q3 X9 |# L6 V9 v0 t {( f; ~4 s4 a7 ^4 X( o/ G2 r U
//---- Enter your callback code here -----
8 v# [6 x9 `7 d, _3 L5 P" f }" Z+ r9 Q6 a) Y1 L
catch(exception& ex)- A$ _& n3 C9 O1 s6 ?) l; j/ S
{2 \, ^: F6 w! f$ q+ @
/ P# ]2 O+ ?& O* X
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
5 Y! V5 i% O2 t2 I% G }
& N3 m, y: u8 Z t4 F7 e* x) w7 c }
/ U1 w3 \! L8 w, ?) \
: v X/ Y: o$ F3 U" f/ s2 k: q int Shrinkage::apply_cb(), q, C8 M6 U! \) D' b! E0 p
{
4 X* g) @, f( {% J$ p; j int errorCode = 0;
]& p7 s1 ^" M try
. n! N. d* g* f' P: x* ~( s* F {
5 Z* x& L3 {; ~3 Z$ i I //---- Enter your callback code here -----
3 d- R$ ~/ n+ m% r0 W7 a }$ H3 l; Y2 ]1 ?9 f
catch(exception& ex)
2 y! R/ L( V: g" _4 g. k ] {
9 [& q, w0 z% P/ z( d0 t' _: V //---- Enter your exception handling code here -----
* {0 h/ p( R1 @4 ]: F0 |9 k u errorCode = 1;
6 ]9 {( {7 J/ L$ R, V Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
1 m7 n& p2 i, o }
0 F$ k7 A; l9 G return errorCode;
! X# g8 G) D5 q }
2 C' R/ ] I( p1 g" \* |6 W+ Z8 y# q
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
' v5 l8 X8 h& M! R8 i1 t' n# j {
6 L0 U* M* f2 \( @* m7 o, V try
+ [" N: w! l% t0 V8 g {( h# B2 I# z( b
if(block == face_select0): Q5 j- \3 T; ^" F: X; Y" a m
{: J9 n1 U, h# L- }+ `3 i
//---------Enter your code here-----------
. ~5 i: Z: K9 f4 |/ B5 f }! V/ }& E. U0 [ x4 f X0 A, F
else if(block == face_select01)
8 x& V1 M; z1 \2 | {% X6 m8 C: \6 o3 v; k
//---------Enter your code here-----------+ U" u/ z1 B# t6 M5 j
}
# E( L+ O0 y" L else if(block == bodySelect0)
$ T" n, ?3 M* E2 r {
4 M# N; F, d1 o0 v, ^- m! _ //---------Enter your code here-----------1 N( C i1 ]0 _/ i7 ]
}
1 `% b! g# U' Z/ Q; d else if(block == bodySelect01)
2 c8 H9 H" U2 A9 | Q {- w" e5 {: s' c X; O
//---------Enter your code here----------- @2 {& v% L* t2 P& y
}4 A0 g9 ?+ I5 {3 C- l( a+ p) n: b) Y
else if(block == string0)( ?4 v+ b# i9 ~0 ]# r
{: }( }# U& T p% V
//---------Enter your code here-----------
* p5 _9 q, c: u4 R; C8 @0 a1 t }' h+ l& C+ P2 {& q. M
else if(block == label0)
$ k7 _1 Y0 B o3 ~0 s$ S/ q {6 I! F) ?2 @- ]0 N) I1 \
//---------Enter your code here-----------
4 b8 v+ v! w/ d9 \ }9 _. R, `$ y' m- Y' O
else if(block == string01)
% }4 z7 A5 w7 I/ u/ k {: k n$ C" m. k
//---------Enter your code here-----------
! I' M" Q! h' E }
0 i: I7 ~- w5 W/ g: A else if(block == label01)
) x) R& Z+ I) c% t7 m# }8 \5 N {
0 g- s* s) a& l$ O# ]8 G //---------Enter your code here----------- C& E" }9 o* i7 Z
}7 e( z& W1 o4 f/ A1 a/ ~( O
else if(block == label02)
# r4 {8 B' Q1 ~ {1 W' d% g7 K' l* a% Q
//---------Enter your code here------------ E& S; p j- Q. f
}
+ o% }) P- t: ^6 R1 ~ }9 w/ ?+ {' ?: N6 L. f
catch(exception& ex)5 a7 n! o9 c$ Y6 |/ z8 L
{, R7 r8 S8 G5 O8 Y- X
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
. X$ m q% h9 t; v }
% e( T9 g( F* E$ E return 0;( A, D) Z+ \- L0 L
}% K; E1 h6 \$ V3 |
1 M; N2 p- }" O( Q- I% N int Shrinkage: k_cb()2 U$ o4 `" {" E1 q! D! b
{ R% [6 B2 c* d, R3 j' G
int errorCode = 0;
/ a9 S1 x# Y5 A# H @0 @7 m try
" @$ N @2 a6 h {
) b _. E4 u( s; p errorCode = apply_cb();- S% t, }, m! a5 `$ e1 y" W
}
* ^9 s- m2 v5 W4 L$ ? h catch(exception& ex)
7 W' {* c; e2 V: U6 l' T {& F/ S) t, n0 _. N$ s& N3 z
//---- Enter your exception handling code here -----6 Y& Y0 D% ?% q- Q3 Q
errorCode = 1;
! G6 O' V, `4 x. p7 Y/ Z Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());: o( `& R9 T- V( ?) }$ L' ^% H
}
+ F/ B; h% h0 L/ J; } return errorCode;; ]2 w( |" S4 y, x! m& I& S$ Q
}
' ]2 w6 S- `, P- F2 `! c 3 b: F" R$ Q) i$ u! H
//------------------------------------------------------------------------------
: o/ Y: e4 z# ~: A2 {. Z1 J //Callback Name: filter_cb! s! E M/ Q& r- Z( {; i
//------------------------------------------------------------------------------
4 Z' V" ~( J% n: _3 P int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
* \9 v' H9 a9 z/ b1 a& b k {3 Z) h+ p8 b2 ~8 g- y2 R1 Z( y' |
return(UF_UI_SEL_ACCEPT);
* w/ h+ p! j% p" V+ Y* G }
; M# ?. V6 u, ?) U % M5 b+ m' p; E, O( f, \
//------------------------------------------------------------------------------
# o; Z. k0 q, [2 l void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)5 q9 ]* V' x- u( O2 M6 ~
{
5 } b5 E1 h* A5 h$ y+ Y try, |$ k( }: S0 G& G
{
, ~, n: ~) n, m/ b+ f //---- Enter your callback code here -----2 X6 p4 G8 V ?+ X% t
}8 q& _9 h. U8 d7 f. z# I/ W
catch(exception& ex)1 `+ |' a: I& J; m; x' x& Q$ r5 ]
{$ ]6 h; h1 v1 i; c- A v0 {2 c+ g4 ~
//---- Enter your exception handling code here ------ d" J' |% E* U* o0 X0 S
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ d! U9 ~7 d2 U0 B% C* N }
5 q3 Z5 R. a: x# X( v0 y ?6 x }" `' B6 E( m! R; m: d- m
0 a) N2 J9 u$ m* \
//------------------------------------------------------------------------------% N% {" z/ L/ J9 V3 i) L6 k
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
V/ f( Q8 ]3 O+ L" H# d- p {
1 R1 x: {' l# h try) z! t6 ~7 q; b! F* A9 ~: m
{
1 J; y* M% n3 \ O //---- Enter your callback code here -----5 N- B4 H3 L( q8 C
}7 v, y* B, b/ l5 O E7 S) r
catch(exception& ex)
; p4 u+ Y& D3 f$ g {
, n n. } N$ z& W3 }' \ a
8 {8 w: v* |0 j7 _4 x1 t Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());$ ^: b& m- [4 O8 c( X
}
, f- u! M1 \' J! w; d }
! Y8 ?1 E3 w; t+ x
/ X T6 N& ?7 | H2 I
1 ^4 @# s+ K' ~; m- M3 {& ~1 I |
|