|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
3 W* i( n- u. \3 \6 n' Y( M. q' `8 e% ^( D7 K# `1 Z6 T# k$ y) O% F
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
3 t( r6 ?% P- z2 P* U代码如下:; Y9 R/ S! D0 A5 c
#include "Shrinkage.hpp"
% s( |0 F! P; ~$ s; C) Yusing namespace NXOpen;
# I8 o3 J: e: Y2 }using namespace NXOpen::BlockStyler;
) e; c6 `3 O( k2 z' O1 a
1 F' g6 l' t/ s5 K) @ dSession *(Shrinkage::theSession) = NULL;
5 M7 b8 o# q0 iUI *(Shrinkage::theUI) = NULL;' \% e' z0 U0 U7 F' W. P8 p* J
9 n7 q) x9 T" T. U# a3 v3 xShrinkage *theShrinkage;" i# w% G3 C% f" B' z. E3 _* G
% k: x8 u- W! s6 vShrinkage::Shrinkage()9 i# s( k) N( i. _
{
- [/ J# b$ x) k5 Y1 S try) h+ G; {) s. w' r; F! R: s
{
2 V3 ]4 n4 E! s& i8 v // Initialize the NX Open C++ API environment
+ i8 T& e+ v9 ^ Shrinkage::theSession = NXOpen::Session::GetSession();
, R; g" p6 U, N5 G Shrinkage::theUI = UI::GetUI();& `& d; Q/ s% M+ H; Y
theDialogName = "Shrinkage.dlx";
, k% ?( U$ V$ b4 R3 U' `( X theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());5 {! B3 Z& k1 a# r: Y8 F" w
// Registration of callback functions" [6 c6 z2 g% z; Q# }) t2 F) f
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));: X# h8 \' s6 ~/ m
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
" Y, ]' w6 I% I" o theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
$ H% v7 Q( t0 e% M2 @$ r theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));3 L6 ^) S& d F: {/ t1 k
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
l8 g6 G% K5 p9 B- b2 V/ v theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
) I$ Y9 h& L- V* P/ W( A& Q theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));+ X2 J8 l* u; w! ?* r0 w8 {
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
7 a! L9 j' T3 x3 q8 f }5 p1 f4 O5 w( L
caTCh(exception& ex)
7 ~3 ^1 l$ P+ R) J6 t {
: W5 U4 v* [0 }1 p4 p 7 s/ p7 U5 H: D, J) t" B- ?
throw;
+ A9 x7 y. J7 X ]7 V5 G }
- v- O! X1 o& `1 Y' b6 s}- y, h4 X0 _; T( ~
0 B g" F8 K& n0 [
Shrinkage::~Shrinkage()
1 v8 p0 y* M' ]" i$ D+ k{
8 s& \0 b$ s7 g. _4 H if (theDialog != NULL)
1 E9 }- ]+ [& i {8 u. L+ `/ N* }8 y1 ]8 K
delete theDialog;
$ V5 T3 [" U- M. B4 P theDialog = NULL;
( U/ s; I, Z+ Q8 E1 ?2 ?* S }
3 {- z: @. L' T}
, w5 i l# A' @; E! N
" N6 p1 H. k5 U) ^#if USER_EXIT_OR_MENU- b. u9 r3 t9 D# f% ?% t
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)0 {+ |4 Z! v0 U# z2 I/ G
{0 J, v# w/ d9 h8 e2 ^6 p' d O
try9 `3 `+ S, L$ h; ]7 e* r
{. Y6 L5 u# \* T, N+ i9 P& K; O/ j9 }
theShrinkage = new Shrinkage();
$ A+ X0 G8 p# l: x0 `9 s+ Q- E0 J" S // The following method shows the dialog immediately2 \/ q, {9 i- k2 d
theShrinkage->Show();
1 s# ~9 ~) n9 }$ ~8 W( t8 |+ b }
' F4 f/ d* E, l* T# [7 m/ P; | catch(exception& ex)
- p4 F# v8 d& W {
8 P- l/ B! u* W5 M2 k8 W# q, I0 @ //---- Enter your exception handling code here -----
9 R5 q1 w7 L, t# L" q+ i Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
* v6 e+ q6 r( R& m, b }
( {( C" o: k0 P" ^ delete theShrinkage;3 |+ [; q6 w8 o! c( s9 A0 V
}
- {$ s9 S3 _/ Y9 A% v#endif//USER_EXIT_OR_MENU
" K- N& G+ S, ?7 S$ s6 y#if USER_EXIT
$ [1 d' D N6 k* A3 s- T 2 Y0 }/ c# y& b2 Y
//------------------------------------------------------------------------------
) d5 X( M" G6 [" {" g, k, h4 b
% I- p& u5 m3 o- v% h' V // MUST NOT use this option since it will UNLOAD your NX Open application image
' b4 y( |; \: ~9 y // from the menubar.
1 S4 E5 d* N/ J* K7 \ //------------------------------------------------------------------------------# G8 T! ~% j3 `$ i) r+ x
extern "C" DllExport int ufusr_ask_unload()* v# g; ?- C, q4 Y. b7 b
{
7 u& J" y% ?; R6 g: z //return (int)Session: ibraryUnloadOptionExplicitly;. r* h, J3 T0 L; [3 `8 |! _! u
return (int)Session: ibraryUnloadOptionImmediately;
T" e% P1 \6 P: h# w. x0 d/ n //return (int)Session: ibraryUnloadOptionAtTermination;
1 k+ E( G/ i+ N6 t7 Z) R }! t* A" E% s& z) q0 E
& z* u7 p+ P7 {. E1 X* ~+ f //------------------------------------------------------------------------------9 k7 W* c L, v5 _7 F
// This method is automatically called by NX.- } ^) K* F) R6 u" \9 j& @
//------------------------------------------------------------------------------( o* r8 L. w2 O/ h6 `4 R/ ~( ]
extern "C" DllExport void ufusr_cleanup(void). }# M E: ?" k6 X+ s* `
{& A- R& R- O- [
try
6 @5 U+ k' }% p N( q5 Z% ^+ W, K {8 L# O- q0 i y5 X9 P! e1 K
//---- Enter your callback code here -----
/ X9 ^& T; a( s5 A }
& `$ I& S# w+ n6 a7 K g. D catch(exception& ex)
4 ?9 c1 U% H% U$ A {
, y; K& }! S1 f; j //---- Enter your exception handling code here -----
/ q' t; `( k/ z; ]# O1 I9 ]1 Y Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());! n0 p: k: }1 B+ G. u, P* b
}& G$ C1 P8 L$ f! J6 u3 h
} n# k0 t0 _) e' d' Z
#endif//USER_EXIT0 g, y$ i: {+ r) d
: f7 P$ n( @' \* Y
int Shrinkage::Show()* A( F' b% f3 a) s# T
{
/ V, |9 u9 W) R9 k4 _( T try( U, S4 A1 K! x3 |9 G: I
{ `; V p$ T7 m+ X V( r
theDialog->Show(); e0 h# s! L6 {8 f
}
+ Y! B7 v! E5 ?9 o6 X; S4 T catch(exception& ex)3 L1 ~* v3 M- i% s/ ?5 U( C% e
{
. P1 N( U5 D/ m. X8 w0 r; S //---- Enter your exception handling code here -----
. H& \0 u" p8 q, H+ i Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());; x/ t/ r& Q- i5 b6 C& F1 W w
}5 z I9 O, n) M a! C
return 0;' j6 ~$ p Y1 _! l
}6 D$ r% o& Z, [, r, v
$ _( L M1 L6 @( B, \
#if CALLBACK2 i" y: J" W$ z9 O% |# {
1 I, X! w; L) c# c5 m
void Shrinkage::Show_Shrinkage()5 [$ d0 G, g4 W( o% U* |9 ^
{
5 Q5 q2 ]5 O* B5 \/ G try; v% [8 I' Y: ]* {
{
7 P" m7 l9 t' w, d theShrinkage = new Shrinkage();
% U2 o4 r: p& x% z% W$ B) E: n% _4 t& M, m) x
theShrinkage->Show();7 I, [7 `- s& X$ h+ v' m8 E
}, t( X' R( ]5 p
catch(exception& ex)' |( i$ {* O, J3 i, b6 M
{. `& P# t: [: m- Z+ ^$ H3 b
% V* j7 C1 m! g7 @- T Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
7 O% a' {2 s, h }
3 A; d1 {# r9 o( \ delete theShrinkage;
# [! @/ l& Y5 H2 Y+ i) k. t }
! t5 G8 H5 e& Q8 x h#endif//CALLBACK& d) C: J! Y; U, n6 } { |8 b
& q8 V% `" g. _ x; u r! u) B; V
void Shrinkage::initialize_cb(): E/ v( I% i; H7 ^4 w
{' A3 [" }1 r+ f) v2 k5 L4 |. b
try \* }* L3 g+ X0 O
{
- h N* g" b5 c5 W group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
; F3 Q+ X1 L& p) y face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
. p/ p2 p; W, M& @! } face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));. \3 t$ H8 o0 m9 }: V: ~- N, y6 @
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
) J7 t) [1 A4 y( C' ^4 ] bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
; v' g8 N9 H' H; m8 E( N bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
' f& k% C' F0 I4 I group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
$ U1 _: m0 g" k/ Y: O$ c5 i+ C, A1 N string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));# j# k" M) q% w, m
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0")); S* R; n) Q- d" l
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
R; R/ v6 D3 R' y* Z1 v label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));/ L; M( v7 P8 C, @. X) c
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));. n) D# Q/ m9 r* B$ `' S" |
}, D5 b5 ?1 c! M* o: k5 W
catch(exception& ex)
# c. `# g; V' Y% z {
A% r1 A: l+ k- }- z. Z7 k0 O
4 ]+ G' Y, s4 l1 n Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
, l% N2 y7 t( c9 M }6 o- s& \4 P4 A3 ]& ^2 G
}, J& }' F1 D6 x0 `& ]
//------------------------------------------------------------------------------
9 R& ~" G! M% t, e void Shrinkage::dialogShown_cb()6 ]' x: r! M* P
{
9 ]* ?& c0 c# T( Y try4 N2 P* Z3 G! A4 Z1 i) i% x8 M
{
/ ^0 b j; J5 I6 l! L) _7 `" M //---- Enter your callback code here -----
. j* U/ y9 y- e& j/ I }
) `- `% d5 d3 ?. v- p$ Z catch(exception& ex)
% B$ }1 J9 K! j# B7 S& c, a( D" z4 Y {
6 M2 Y$ _8 G* M
3 v& B a5 W+ z, `7 P2 M9 C Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
! ~ s6 l1 H, y }
/ \& x* k I; N& f1 ~ }
2 k" J$ v, j8 T& d
5 G& J5 a( `! t8 B% L9 ~, j int Shrinkage::apply_cb()6 {, c2 l" @ M2 P
{" G: ~7 ]$ \" j( Y
int errorCode = 0;: M4 R; J7 i) I$ n9 f) [
try
: M! N+ T. @' v {
% U, f0 ]9 |5 L- I3 n K8 t //---- Enter your callback code here -----
$ L; d' m5 M) Z4 G7 i }
3 i8 Z# L) k" k( C- G1 Q+ j* @ catch(exception& ex)1 e5 f: F2 x# r5 c V
{
- p( T7 j/ e, J+ N //---- Enter your exception handling code here -----
1 t# @8 U; [7 Y1 K7 S+ D: h; s errorCode = 1; K) K# j" k% C3 H
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
# @, X1 V7 U+ } }
6 ~* j, ?) O. h) ^3 z. H3 ~ return errorCode;! m2 b! @* x4 X! Z( u' P2 ?
}
: _4 F- {$ t7 h4 h) H& A! a& C: T, }, W) t( ~7 B
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block) z! Y! v) `0 P( y
{
$ A8 J" R: D( w- K* ~' V( S% D9 h try" u6 F# F b) G8 j- n/ J. z6 \3 c, a
{
7 v! q, c- N8 k& Q) f& G: V if(block == face_select0)
: n) ?% H& {" S8 G8 X- k H2 h6 { {1 f2 p3 A1 i' D& L
//---------Enter your code here----------- V$ ]8 }( R7 R2 s( r$ q: ]) I( i
}) x9 O0 c2 i/ q3 z# [2 [9 k
else if(block == face_select01)
2 s: P; T, V: L { C3 { p5 K7 l5 S, N
//---------Enter your code here-----------+ D$ R, h- ~/ J5 C
}
( O J7 S1 O: A$ M3 s+ a else if(block == bodySelect0)
8 f" G0 O/ R% w- y' [2 ] {) y" k# X; c, W! H
//---------Enter your code here-----------$ U& j3 T# |+ L
}
6 {: ~$ [7 C. p, v q% Z/ p. L else if(block == bodySelect01)
3 d/ K1 s( C. X# y {. m9 L+ E7 o s0 D2 {/ ?
//---------Enter your code here-----------
5 z3 t' ]* I8 @3 i3 D7 l0 [ }
1 V2 |3 R& G6 g. v: Y* S else if(block == string0)
; o9 |! {) t0 k* E/ Q {
& I, y7 t* X, r; ^' y0 \& i5 L //---------Enter your code here-----------
% d0 i8 Y& M* j' ~. ~ }4 c/ U7 R9 k, E& O
else if(block == label0)# E8 d" Q* `% L% ?: Q, I) u1 s( ?
{
' v+ O9 k6 Q7 c' n* C7 { //---------Enter your code here------------ \+ t5 m, _4 E1 z% l e
}
9 w$ i0 N, Z9 l* f2 f2 s! e, u else if(block == string01)
" `$ `) v% r5 J' V {' Q+ J6 ^7 G7 B6 F/ P3 P
//---------Enter your code here-----------% @. q* z2 F: `3 @( t7 {* X( D
}
( x5 T/ T/ B% E else if(block == label01)
. g5 ?7 N y' C0 x* M- X {
/ b' N; j5 }' y //---------Enter your code here-----------8 i; B3 ^1 c: G5 ~0 H, r% b/ \
}
) \1 V8 g8 Z4 ~. o else if(block == label02)$ [% d: s' Y: ~! c1 t2 l1 B/ k
{
5 T& @- y; c- V! B, [/ X //---------Enter your code here-----------
+ K6 j F8 ]8 f) Y' h }
: J8 j7 c- Y" D5 q9 a- X }
4 W# f" F, T8 A1 x catch(exception& ex)
" K/ U, d5 B/ D) Y' D: J9 k {( T4 I' \! q% A7 ?. \
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());9 v; w* w5 g& `$ V1 [# t4 `
}
0 _* L8 X- M9 d- F7 J6 b return 0;
* j& D: h, j# L! E# q$ ]6 s% D }
K+ o( e V3 @2 ^& g
) M, Y2 U$ z# J' Y1 ~ int Shrinkage: k_cb()$ A: m5 s/ z8 g# P. f
{
& X5 g8 J9 R. K% I/ q- ~ int errorCode = 0;
% v7 b) c% a# j/ k try
: m5 ~+ |8 l8 D1 @" B. E. C {
1 x ~7 k0 F! i9 f% b/ ?$ j2 D$ s errorCode = apply_cb();
, A3 ~: t. ?0 \9 b }( g! h, q, w7 q. \
catch(exception& ex)( M: h( R j6 M6 y9 i, ~* _
{
# n1 ~! O4 R% s% _$ ?2 x; i( j //---- Enter your exception handling code here -----% J# d1 t! L# T o! |
errorCode = 1;
) h G( c+ S$ h- K Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());$ ~. \0 R. Z( U7 f* Z$ ~$ |
}
7 i0 _0 C& S* L2 u& k1 d9 } return errorCode;/ p0 g1 D9 w3 \5 B6 y: Z' A/ t- g3 I
}! l' i, ^! d- b# t; m9 g. V
1 G& ]1 q/ j; S# s
//------------------------------------------------------------------------------& e# o/ M6 j/ K- V+ v
//Callback Name: filter_cb7 I$ H. z+ n n! \& i4 u
//------------------------------------------------------------------------------
+ [; K* L) A4 @! H$ w int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)) l( ?& o: W$ b" R4 l' u
{
' F6 {# {8 u" D* [9 g+ @ r return(UF_UI_SEL_ACCEPT);+ I5 M6 `3 k6 @* K. t& c
}
& z: ~& S: [' r* a/ Y. l 2 i& ^% Q+ [+ e) n+ k& |% O: v X
//------------------------------------------------------------------------------! T9 Z/ U+ N7 n* ?7 W' Y
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
2 H2 E2 R" v3 s O* r {8 m4 E! A: h# b+ i' A+ H
try8 K; u: L$ ~& r3 ?4 H6 u3 J
{
- l. k" q- R. l4 P //---- Enter your callback code here -----0 X% y- G9 m' D
}+ P `! {% t* F4 g. W
catch(exception& ex)
. \. M: y8 j: z- {0 J* e* F b {
9 X# D. P i4 X0 `7 V" { //---- Enter your exception handling code here -----' c* A B" B2 [+ e
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());0 R, `$ L# E, t+ E9 L
}% B) x7 \' O8 x6 ~( x [
}+ c( g% P2 w \5 ~4 t* x, j
! Q3 a5 |# n' C; E' V+ n //------------------------------------------------------------------------------% l( U& O* }) N( I9 J: i
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)8 V% U* A8 [( N# i
{
( n5 ^$ U0 a, x" ? try t+ U- @$ q0 K- ]3 V5 Z8 P4 Q1 F
{' w) @* @- z8 x
//---- Enter your callback code here -----/ O% h! T/ x5 E
}
' m& q' ^( f9 O' H catch(exception& ex): E# H8 v$ T1 H
{) O( u- k: ]9 N( }
# U3 v* l7 a: y! L. ` Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());4 |/ v3 N+ p+ L& f
}
6 U. J/ E+ q( j& j# x! W) K& b# I }8 U: g" a+ q4 V; h8 q. \" z% U
U6 o. g% D6 X; s9 A4 m1 i- X4 A$ L
|
|