|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
1 Q0 z3 c" G9 [. ]) a, ?: K- o4 t+ T8 v) X o
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
. O7 N! T6 c t+ j代码如下:
$ o( Q& e: _# l0 S: T0 ~5 }#include "Shrinkage.hpp"
8 z5 x; z& ?3 l; m+ Xusing namespace NXOpen;1 Q9 e- Q! v* c, I; `* t: y
using namespace NXOpen::BlockStyler;" E4 A6 U; K3 k5 R) x8 f8 @& q/ Q
4 M, x8 d9 M' D* @Session *(Shrinkage::theSession) = NULL;. j1 }! T: c. O* O
UI *(Shrinkage::theUI) = NULL;: P7 L. @5 S. n# }3 M8 v. ]
* B# J8 w- G" j3 P. u" U
Shrinkage *theShrinkage;! s2 Y% |) Y* t R4 R2 Q8 U
3 }8 H/ c9 K6 W* K, ?Shrinkage::Shrinkage()7 |7 D" A" _" U0 I8 ^, L
{
; ?/ I/ E' [- Q% T: _( w$ C try
# c8 U5 x! ]2 | P0 Q {- B9 G' `) t9 t. g2 v
// Initialize the NX Open C++ API environment* F6 [) d' c0 n: h! v
Shrinkage::theSession = NXOpen::Session::GetSession();1 K% I1 u3 ]! n8 B( l% V7 y
Shrinkage::theUI = UI::GetUI();( ~9 \ s% f. f& U9 {0 o' s a- x) H
theDialogName = "Shrinkage.dlx";' n% W) Z* z# g. y/ d6 W1 N$ L. F
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());8 y* ~. P4 i2 C
// Registration of callback functions( N; a+ r/ d+ j0 z( U6 W! u
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));/ O8 _7 n3 r: A
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
$ t l7 M" m Q( U1 b9 f theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
Y* k! R) I" Y0 H% d. Q7 l& n8 q theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
2 p5 g. t" g2 \+ \* t1 B2 _ theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));. G" Q3 t2 a9 F! E
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
) `; E$ h1 A2 N u5 g6 V theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
( n! x+ [0 h8 Y8 g( M! S theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));) k& V0 \% s+ D. W1 I
}4 y* d2 M% | r; ]1 Z0 k
caTCh(exception& ex)1 z/ Q; Y$ c, h) _* f; b
{" a; ^* r4 A$ A
" T) ^7 l: ?2 k2 w, {1 u2 p
throw;
& m* u2 D& e) ~" m) j }6 ^% B2 e; s2 {# i# V
}) y- G9 e! x! _. f& G" _
$ a. a3 E9 B" w
Shrinkage::~Shrinkage(): W% o- y* u6 A5 E7 _, o: x
{, g) X* i) d' W3 [/ O: x; ?
if (theDialog != NULL)
. @0 E& ^* I5 Q/ ` {
9 F! h: U( a8 q& Y delete theDialog;* _2 H* f1 ^& P9 }( N) A# o
theDialog = NULL;: @+ H# [# T, _) {, y
}
& o0 W) u9 I% b5 Y}3 _' g. r! B# t3 t# n" V
: k8 D+ |2 y! i0 @
#if USER_EXIT_OR_MENU
* n' I7 k# a) c, Z4 a) D extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)" A4 w/ T- }: h! A, ]
{
" s5 y+ u# o9 ~ try
4 m' G5 r' `; A" I3 M {
3 c# R4 k6 X* F' S theShrinkage = new Shrinkage();2 k. f8 y% E' ~3 q. O9 U% P
// The following method shows the dialog immediately& z1 {) l$ o1 G: c7 m" V! E% s; e5 U
theShrinkage->Show();2 ` ~6 j9 V( W! W8 k0 F8 l
}
: v& M) b% g* z" o2 ` catch(exception& ex)" L# F9 }' v7 a2 }
{
0 I/ K! q* `. U! o. { //---- Enter your exception handling code here -----
C- i2 Q; J1 N5 D% D( P6 D/ x7 C2 o Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
" w: S' v0 n$ |( F: m3 X( S }
# r' N9 L. k) c# d7 L delete theShrinkage;
; N1 g7 d2 d9 s* h }/ S" R3 Q! ] p
#endif//USER_EXIT_OR_MENU
' q/ w( J A) e% D5 D#if USER_EXIT
& Y6 }& f7 I& e& m : f3 |& v. z7 T, y" R# ?
//------------------------------------------------------------------------------- y5 V5 w4 |+ v7 X
% b. k' N' t) v" g$ ?1 D- J* O // MUST NOT use this option since it will UNLOAD your NX Open application image
7 I! c1 _1 i& _ // from the menubar.' b2 Q) g& y! H* i# M2 F5 s
//------------------------------------------------------------------------------
, w" G; m/ \: |3 M0 z0 {% i extern "C" DllExport int ufusr_ask_unload()
% e5 Q- R5 r1 J6 S9 i {
0 w) U) ^$ C5 r Y5 U- n6 |$ Z //return (int)Session: ibraryUnloadOptionExplicitly;. y( I! \( u0 }" T ~- k! x# E
return (int)Session: ibraryUnloadOptionImmediately;
( a) H- l6 ]/ Z: U( @3 b3 w* R6 h //return (int)Session: ibraryUnloadOptionAtTermination;! V' U3 g. O$ P: c
}
6 R+ v8 l! D- j" q! @. x& n
5 N9 ^8 s0 z2 e% Z; h' A //------------------------------------------------------------------------------; r7 q F4 Z0 r$ h: Z% f
// This method is automatically called by NX.+ ?% Q5 W3 b3 Y; I4 U
//------------------------------------------------------------------------------& x, {+ S8 C' |' l2 \8 A
extern "C" DllExport void ufusr_cleanup(void)
z- P, z* e, V$ y* H3 _7 m {3 M8 L2 l0 K3 Y; F+ ~1 V3 K
try
. p" D. y' U6 E t% ]. {2 l7 f {
7 u& ~0 f% |6 z+ A& C* p; i //---- Enter your callback code here ------ {4 Q) d. o E. w7 x& Z% t7 q
}9 x3 n" f6 R+ q- L' K. K
catch(exception& ex)
0 n8 O7 N2 ^6 m* y% E {- C6 o4 J# x- p( X& p
//---- Enter your exception handling code here -----! ^5 x5 F! M9 k: t) o C9 g3 Z
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());3 v+ I% |+ l& m/ k5 r! p! c
}! _: U+ x+ z2 a$ Z
}' z$ e7 F1 E) L/ Q: a% C. d' [
#endif//USER_EXIT
& ~8 ^( i5 g6 C
. b+ y: N4 u( @/ p4 i int Shrinkage::Show()# s+ {- D" n# d7 K. Z
{
* @7 W9 A( U) r* K! g try5 r9 @( ?- h2 e1 M7 G- ?+ ^
{
1 g9 ~8 \8 M; b$ j theDialog->Show();& i e7 y$ u# U
}- T Z+ X, ~) s) g; C
catch(exception& ex)
& r4 G1 W/ a0 W9 j2 o {" W, I3 H8 X# @4 B; }- W3 A9 x
//---- Enter your exception handling code here -----3 U5 _4 e% K; r, i+ h
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());* n% Z- ~" \3 h
}0 @" a9 A# _# w/ G! d- Q
return 0;( I/ c0 z& m' e( X Y
}
( }# p3 s$ `2 s% Q* Z, z
- G( E' H5 a6 q+ r- ?/ t3 n, o* I9 `#if CALLBACK
% E% b4 [0 w6 e6 i( q5 q
: R5 i8 l# G2 F7 v9 n& _) r6 p G0 m void Shrinkage::Show_Shrinkage()
* f! O0 G. a+ I' b {
7 C) ^1 q5 O6 v5 @( C, S. D- Q try
: {. Y- x$ s4 q. U @* _ {
+ e2 C: K4 n( M7 n theShrinkage = new Shrinkage();8 F4 M( E3 A0 z, C
$ W( J- k/ r. M5 L5 |
theShrinkage->Show();
) p' Q4 g2 H$ b- G }- S& j. Z) q( j. D N# }' g# L5 I y
catch(exception& ex)3 A/ a0 w3 T' X& V( F( I4 g
{
2 U- S! Q1 Q( @' [4 I, b
5 T8 e1 \5 h, W& F" d* @' ?( c& y Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
0 x) M6 E7 {' ^0 r0 w& Q }
! a9 ]- p4 b( l! {( b: E0 s: { delete theShrinkage;
8 V0 f0 t [; I7 t }$ U! a# [% z* Z- ~
#endif//CALLBACK8 x1 S) ]* E# e8 v, o; V8 E) [
' e0 d8 ~2 _* p, n& t3 |$ P
void Shrinkage::initialize_cb()
7 ]9 x: }6 F8 ~ V1 V {
6 o4 p- X, A1 L. t2 c, C" _. G! Y try2 T6 ?7 s# [9 h9 E+ R5 d- X
{/ N1 C% q# b3 c# Y" a( U! h
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
2 ~* ^7 d+ @) z- I0 f; y face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));) c, x2 b* @5 u, M, W- {* v
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
2 ]9 q0 h: q: D$ I group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));# R9 l; I z1 X5 x* V8 i
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
. D; Q, Y/ W" x- l, I* @ o bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));' o3 v3 O. V/ a4 I, j. H# }
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
x3 ~+ V) z1 v; [. T6 q) ^ string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));( O+ }6 B+ u1 X6 d$ @
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));- R0 ^% j# l+ Z
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
6 K A- z3 E9 Y1 ]0 N r label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
! z6 V- C5 O( |, Y0 ]1 G label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));5 y. L4 H, `$ E2 n
}% S, O% x& Z8 v7 Q3 A- T( K
catch(exception& ex)+ `/ E+ }; i5 d! b/ e0 F
{9 J4 f: \2 E5 B h: W8 k
5 K3 i0 r/ O5 E" p- f Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());! D5 Z- |3 h' B5 O3 h
}. L0 ?1 q# D) l2 |6 U- N
}4 v) y' c/ y( C# A) [3 ~' c* ^
//------------------------------------------------------------------------------! h) G% ^9 S& T! G3 |! R
void Shrinkage::dialogShown_cb()1 s/ S& m6 S7 o
{
6 o l) I' ^: y4 H! E try. F: @: m' n! y" t) j6 N2 x
{8 q% f! z& Z" ~% R- S7 w: i+ {, k- @
//---- Enter your callback code here -----
4 o4 Q9 X% \9 Z- v* f7 |, ~% f! I }
, L t; ^1 c { catch(exception& ex)
- X5 c- [( f5 x% | {
# e: Z2 o- s8 u% @6 \; [
Y5 v! ?% @0 d1 y Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
4 e& I3 Z+ f6 l }
4 Z# q8 C6 h4 j& i. g: s }$ J8 F# [1 \+ @
; e" |+ ]# [; I2 |6 }$ h6 }
int Shrinkage::apply_cb()
2 |8 T' K3 `% @7 e. ~ {; \) m3 [" z: x, E8 m4 x
int errorCode = 0;( E5 h3 O) `2 S3 ~4 e; y5 W3 f, {( i; g
try3 E" b( n% b, f# {3 l! }# P
{0 F3 U3 Y, @5 E2 Y6 h$ L
//---- Enter your callback code here -----9 p/ X1 ^4 e* I7 W# _( j/ B
}) Q# J# y$ n/ G
catch(exception& ex)
2 D+ I7 V0 R) B7 |) O {
7 _ }) G) r S8 k6 u; F //---- Enter your exception handling code here -----& p+ Q7 O; W' u; N) l. p1 i2 ~
errorCode = 1;
+ S2 b* m2 c9 U$ ^% L Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());6 }: M3 R! B: ^& v
}' W/ |' z) U; o# n6 S2 `) m$ z
return errorCode;0 w/ g. T" g# Y7 Q
}6 \0 ]0 o5 [1 r$ _4 |
0 q8 G+ Q; V: W. M: J _
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
: D4 w& G: m9 v8 @" o: [& \ {
4 l1 \# i1 e& @$ D' t try0 b {5 P$ j$ O* I1 S3 k: U
{
2 J3 L$ N0 d: L3 c$ O S2 ~ Z if(block == face_select0)
1 e0 c" G$ P3 b n {
* \) z0 N' C+ g% [ //---------Enter your code here-----------0 M- f9 @- Y! P
}* J( O2 t% }4 {! e# W7 b, w
else if(block == face_select01)& G! {7 h. ~0 W8 |
{6 {% M( W3 E( d0 k: B8 q2 T+ u' W0 _
//---------Enter your code here-----------' q f( V( l) R
}
; g- s/ P7 i3 c) h& u& g: l4 E else if(block == bodySelect0)) N, E+ G: f- E5 ~
{ H2 J( D! g' X+ H) q
//---------Enter your code here-----------/ A) P* F' Z" b. P, ?- E
}; e) P+ m1 R2 z: F( e% X
else if(block == bodySelect01)
+ j# A1 _. P2 S {$ c+ R) D$ h. d5 A. u
//---------Enter your code here-----------% O0 O6 K0 }) {4 J8 P( `. o7 O
}
: g4 |% ?$ v; m- J" L* H5 E else if(block == string0)
# P' D8 F7 C/ T/ ~ {
: c" ~+ }! R, m5 f1 J7 E% p //---------Enter your code here-----------& b& y' m2 x4 g* e, O
}
+ w* L6 Z- N9 G& j else if(block == label0)
9 W; V: E, A, O k) [- z- b! |5 f { ?, c. h3 S7 d8 ^# v6 [
//---------Enter your code here-----------7 l% j7 K9 e/ B$ V
}3 C' s% I1 o" g
else if(block == string01)
/ J7 O5 `0 t5 l4 i& _ {
: r0 K" C" y) G1 M //---------Enter your code here-----------
/ ^' ~* u O3 h) V& _. M }" @9 e/ y2 B$ _$ H0 i
else if(block == label01)
# A% Z: Y7 W, _9 q6 e {- ^! B: T: n) r8 q8 ~
//---------Enter your code here-----------! {, Y9 x' Y: p; K! u: t: J
}* n4 ^/ J8 I/ Q6 {7 _ v! n
else if(block == label02)6 o, ^5 ]& Z! r
{
4 L: M3 s/ M: t //---------Enter your code here-----------
; }, B: {. w: a! T: o }
6 d! N- o& g. d; w/ {) R }2 a1 ?5 U- Q$ h3 b% _
catch(exception& ex)4 V: S& i- ]% R. x' F' ]0 m1 E
{
& _- u; V* X* K* M: R( p9 l8 } Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
2 {, x0 t1 p% v) s, l }
- B5 t/ H) I2 n8 ? `+ N return 0;
8 h$ m7 D* W9 ?: |0 I. J8 W }2 v T8 S+ h8 m% k( M. ~& R
8 R/ x7 T" F1 E' t n
int Shrinkage: k_cb() ?# g, X2 o2 R
{
' T2 k3 ]+ @% @/ K5 R5 B int errorCode = 0;& f# n9 v9 t3 M0 }1 {: J
try
/ w& G) M6 y& v, Y |2 E" Q {
! d2 h+ \! ]( r" w errorCode = apply_cb();% a+ S! X) y8 `: j$ L4 b5 B
}& @( [3 @9 w. G+ z# G! {
catch(exception& ex)
/ z) [( |: g& _6 c) E0 W! t" A {
0 X$ T- ], u; v7 Q( M9 T //---- Enter your exception handling code here -----
; N" z( G3 T, Z$ W' o errorCode = 1;
, S! z9 g7 s6 ` Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ E3 \0 p4 s. B7 L. {9 e& w }
& ?/ o4 B+ W/ e; f# W, J7 m& ]5 v return errorCode;1 ^- M) p5 }! {0 {3 ?2 C
}9 d" O$ v1 m" g6 V" `: A
1 r- X3 z' C- W //------------------------------------------------------------------------------
8 h# f3 f; M; l! g! ^ //Callback Name: filter_cb% ] Z7 N% b$ u+ [
//------------------------------------------------------------------------------9 S& y: z5 C, {
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
2 A4 d/ |+ N9 q: N9 P9 C {, [: e% x6 f" t
return(UF_UI_SEL_ACCEPT);; j* `' [* T- r. d4 B
}
" G# n6 Y6 j' j! S+ S" k 1 u6 G) `' n# U( j n F6 n
//------------------------------------------------------------------------------
: A0 u$ ~6 c; f" P void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
4 @/ r4 Z$ p# a4 }* S, G5 C* [ {0 w* q3 A J& t5 `- R
try9 K1 A# e3 @, C4 }9 m" t
{9 ~+ X" {" g5 [% D* e
//---- Enter your callback code here -----
5 m# A6 Y4 O" e$ y }
/ J# o# j9 o% p6 ~7 c, M7 D$ V' ]8 P catch(exception& ex); G% A. a7 g3 K! r0 L4 G
{
* D7 t% G0 ?6 ^ p) U //---- Enter your exception handling code here -----
& |! v1 U/ s- o4 G: y Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());( Z b# E+ u+ x' p! Y" r
}
! b* m" m, v! ]$ E x3 W! w% W }* ~3 v5 H1 p# ]6 A3 n4 S" q6 J
( L* t5 W: ?* ], G
//------------------------------------------------------------------------------' g# N, ?# Y/ J5 _$ u3 ?
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus). f8 f" x- G* v
{
- W/ [2 D6 { C2 g3 F3 o' H try
1 E0 t* Z$ \1 L5 N" x. o9 i {
9 e3 Y* W H4 Q, i% z+ D! u //---- Enter your callback code here -----
, y9 n* m* s' x }4 S6 n3 i& }) m# z3 `! X' A
catch(exception& ex)2 N2 E4 ~" Q+ X
{, v' g" C, L9 U
: e8 X. p- X+ \/ i
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
6 k1 W% f# W% C0 Y' I. x- { }
6 s1 a+ s9 j7 ^ }
( y1 h" g# p$ Z) E& @8 t2 P# c, N) f U' h6 A
( `4 b, R& }7 {
|
|