|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 5 f. {: `' X3 M
A2 _, |+ r. V4 v1 l y
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
2 O2 f4 z) S4 d Q/ K代码如下:
1 r) @: n5 N, {#include "Shrinkage.hpp"# R% W5 \) n8 W
using namespace NXOpen;: }3 } q& V( g: `) d" E* E) G
using namespace NXOpen::BlockStyler;
@3 P; i' @2 L4 e' J( l: y) c# s4 o) _9 s
Session *(Shrinkage::theSession) = NULL;
8 m2 C( O4 C* Y! A9 T: ^. ]" {UI *(Shrinkage::theUI) = NULL;
. X0 p0 g8 q4 Y, A! N& t0 ?
* `- p: q! j3 L [% z! L" aShrinkage *theShrinkage;: \4 C" F: x" C* i, |' y
) w" e9 i( |3 [8 x; B2 G7 k' B1 zShrinkage::Shrinkage() v4 c/ I' J* F3 }/ g
{
* G+ i1 X# c- ^9 g2 K7 q8 q try
$ S. x" g- o: C$ h i0 B {
# y8 n6 w9 _/ t( T6 Z# Z+ `8 ] // Initialize the NX Open C++ API environment" X* U @' r" ]& N
Shrinkage::theSession = NXOpen::Session::GetSession();0 N9 @( c! \# R: [; g% l! R
Shrinkage::theUI = UI::GetUI();) t; t& F0 n8 q4 v7 Y8 o' c
theDialogName = "Shrinkage.dlx";3 N, s" h! {) {+ Q5 `% O4 R" B
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());6 r X5 L4 r; A/ T" }
// Registration of callback functions/ ~& u8 J/ |4 ]9 L( H1 ^5 p
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
, A/ X! L* l8 O5 s9 I* t theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
8 s. P* z% r! S* _ theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
, c1 k: q5 S2 O theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));1 C: `0 ^% ^# p7 `4 G+ V7 k
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
5 j+ A& x: b2 T. O0 d% S- Q/ G: U theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
9 E1 A Q& K. n8 ~ theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));6 n% w% q: v1 r+ \" s
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
6 l6 u) A$ |+ s( F" v1 a }# A, [9 r" u# O, g7 x( y
caTCh(exception& ex)4 \- J4 f9 P' P, ~* l" e X( f
{
+ F# f6 J% x2 e1 p- y( R8 F . k% A/ z- l" B( k5 ~: [
throw;
`7 q0 a1 T3 E, H; r; I }
/ t5 R/ W. |/ x$ m}
9 L& Y1 }7 \/ T
& p$ n- M" @' r9 y2 qShrinkage::~Shrinkage()) P% @2 j* n& @# \
{! H* H5 `9 N: z! A- [2 b- }
if (theDialog != NULL)* f" K6 |, \( w8 |4 }' T1 Y' @2 r
{# _8 Z- y3 t. E; z2 q
delete theDialog;3 J; Q9 ^) a2 T8 ~
theDialog = NULL;6 w; X/ c+ Z/ E4 h& e# ?' H
}6 u6 U2 `; { u
}/ _0 x. _$ m( k, o, k8 w1 F
* [" c: c9 n+ d2 x
#if USER_EXIT_OR_MENU% }! B* D$ X. ^+ i# E
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
, G# z/ B# P; a; Q4 K( H {( j# ` R: {# I. [. f# Y* X6 u/ E
try7 H! k9 M. @/ n/ T& O; y
{
* Y0 M; q8 s3 e# F theShrinkage = new Shrinkage();
, J! p6 x- v4 l // The following method shows the dialog immediately0 I, j7 V3 }( Y
theShrinkage->Show();
# Q" c6 R: V" I. w }
. Y2 n5 ^, c* k catch(exception& ex)% ?5 v- s, E% V0 o
{8 `. u* f) x# F, J1 M r% H% {
//---- Enter your exception handling code here -----
7 C Y0 M: w1 o% o1 Z Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
! r3 i/ N' p( S$ D B8 v: j }: k/ F8 N# k/ y- r' C
delete theShrinkage;
7 ^+ f; j/ W! n }
- u. R& Y; N" z& U8 t1 q2 y#endif//USER_EXIT_OR_MENU
?- n: I, y3 N#if USER_EXIT
" F- a: U/ y* U: o$ |, R& W
+ n6 L/ h# c$ g$ j( [" K //------------------------------------------------------------------------------
/ V- ~/ k* |! o& v7 R( s! z W0 x
4 L) a4 J# w0 X# \: z // MUST NOT use this option since it will UNLOAD your NX Open application image8 \4 v, b1 @4 |
// from the menubar.. s5 _" e4 J; s. Q* Y7 v: F
//------------------------------------------------------------------------------: S' }# E8 u2 B$ _9 F
extern "C" DllExport int ufusr_ask_unload()6 |9 {9 Q) ?2 W. E( {$ N4 X
{; ]( Z2 Y+ l7 p R1 T, I
//return (int)Session: ibraryUnloadOptionExplicitly;
: B7 Z. i7 l2 X' }' X return (int)Session: ibraryUnloadOptionImmediately;
" g& \- r) h @! E R //return (int)Session: ibraryUnloadOptionAtTermination;2 y, J7 A+ `& P1 K3 G9 `) s0 C
}
( m/ E% K1 R. a6 p# E: ?, x
6 T! o' Y; p. p //------------------------------------------------------------------------------% `* U4 g Q5 g+ u8 F
// This method is automatically called by NX.
c1 N; F3 @% R7 \8 O9 i* L# T! j; R //------------------------------------------------------------------------------# D8 c& G5 L( U5 @5 {
extern "C" DllExport void ufusr_cleanup(void)* K0 Y. x/ Z2 @+ ~% m5 o- v
{4 ^* c+ B+ H7 A, W3 l4 j& E
try' ~7 E" E( i4 ^5 O6 M# B* u
{
* T' `+ g" i" e2 H% y, y- r //---- Enter your callback code here -----# E4 K: g$ j) `3 @+ _6 H& z! X" c
}0 m9 M$ E1 e F/ E, K
catch(exception& ex): A* {/ E) T1 d) _
{' s* G+ Z4 I9 x0 i8 E+ ~
//---- Enter your exception handling code here -----
& L6 n/ i: e5 U; |+ B2 U Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
4 j8 p, m1 G0 D( X1 H5 } }4 {% \6 x x, P+ _ Q
}
. W+ \5 Z9 D/ L( E/ G7 d# ?: Q#endif//USER_EXIT
- V) s! l) [5 L8 B6 h / Y) n! d2 |7 ~- f Z, e- A& l
int Shrinkage::Show()
* M6 q- ], `/ g2 u {
( F) C& Y( a- S8 s try3 d% J0 {, d% c$ R
{/ Y% `- ^% |% i1 _, |
theDialog->Show();1 S9 V8 {- z! U4 {6 N) }
}
: l. q* B) I# n. d. U' ~3 F catch(exception& ex)# J& } t$ ^; J# d
{3 ^2 F$ ?3 `0 K7 S1 W) @0 N
//---- Enter your exception handling code here -----" S, `5 J3 O, H4 ?* i, S
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
! } m7 y5 j! H& G6 w) L }9 ^, r# o" r1 H0 P& Y
return 0;6 \1 m+ T9 L$ h5 T7 m- R
}
; H& ~, V1 |% A1 a" j
0 s& u0 k, P) S9 j( N#if CALLBACK Y" Y* K* P. ~7 I6 g, T$ L% h" N3 h
+ L" {) e& y) v" {/ ^+ T( O( ] void Shrinkage::Show_Shrinkage()# G; ]( y( x. P, o, f& h5 f$ }
{& ~9 Y2 _8 s/ j) L
try
# y. @/ c9 {& K! d) c: a {
2 s+ D0 E+ X. i8 E theShrinkage = new Shrinkage();* g6 l3 f4 V& p1 l1 |( F0 |
7 g: N6 T6 K" z! H+ ?0 h$ l
theShrinkage->Show();3 ~8 e& b) K% d" H2 V& k4 y
}( l# n# p3 Q) q5 e- G
catch(exception& ex)
/ i1 M5 q& `+ w+ o3 |0 x {1 q1 Q; @* ]. h$ U9 a2 L) m; u* c
7 i* f1 x% I# y* n+ X# g Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
3 O( \# I' s. d }' o7 V% a+ s% I! V
delete theShrinkage;
/ _% g$ ^* {) j }
- Q @: S* V* d5 E+ F#endif//CALLBACK$ m% f: w/ S2 ~6 l! B7 r
( \/ D4 w/ I7 \9 r8 h( ~* P. V3 }3 B% M
void Shrinkage::initialize_cb()9 R( S$ ?- _& [! z1 T
{; M$ e9 F. L) A. a. [2 U
try
G5 N0 L! `( M5 C$ `4 v {
0 L& M+ k' t! |" o! S5 I$ t group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
3 p* q2 f* e7 H$ C& l8 ?% s/ p8 ` face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));7 ?' J% z7 [# H. `( t
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
; r; T) c4 X' V% l: f group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
! q& p4 f& {$ S5 O9 u2 Q: ?$ @- [ n bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
: [, b2 ?* V2 _ bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
4 k$ N; I0 ?% o& ^4 K3 s group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));2 S& W; s/ v3 E1 g9 L8 S
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
; V' D# r' L+ E6 w- F9 | label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
. n- I. l: t' n2 h0 @ string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
" b0 u4 X7 U h- ~: j, Q$ ? label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));) w+ N x1 [! E+ l8 i* H
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
0 B6 `/ x$ F. F( Y I$ O/ N ^ }6 E q8 c* A4 D- [+ a" b
catch(exception& ex); G T" q W5 F& L7 Q6 e6 _
{$ _5 w6 g" a8 m2 W* k
' s; ?4 v R3 v2 r0 p
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());" n4 R5 k" K# J0 z0 @0 k
}
4 N. E" a, m& K# j: ? }6 h1 h3 x$ x) z6 G3 x
//------------------------------------------------------------------------------6 b: z0 F9 d! c9 c6 r; a" Y, ]
void Shrinkage::dialogShown_cb()
. E$ o5 b$ ^7 [- m2 H, ? {/ d) C3 A* O/ [) M
try
; {5 }3 V( h, A9 l# u* ~ {+ s ]1 t3 L; c6 i- D. o' }% S" M A. f/ R
//---- Enter your callback code here -----' N6 ]- R Y7 S* q4 o
}' C2 {/ ]2 ~5 W) `+ c& l" Q
catch(exception& ex)
% ?9 @; E3 d) E9 i {
$ j# N, e+ x9 N' I3 {4 }7 A) o$ B$ [9 c! u6 c* C) o( }! O
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
1 v# i; q; e4 ~% a( Y }
1 E1 _" L- {, m6 F0 ` }/ V7 I3 W# @$ ?- n
/ d$ t5 D. K/ D) R
int Shrinkage::apply_cb()3 D/ c) @6 \4 @& p6 u1 d; ]
{
2 W" A" N4 F( \ int errorCode = 0;
7 P/ `" ~) z! M. j' v try
. E$ w5 }$ c7 l& K" _# ^3 j( ] {' K) N' Y; V# L4 u" m9 x0 i5 T/ T# Q
//---- Enter your callback code here -----/ t2 t# E9 T$ F% X: m& T8 q) `6 v
}
7 E; u: a5 e% h2 M8 F; Y catch(exception& ex), X1 S- y: p$ v- [8 ]' R
{$ v* t, q! B0 J: a6 Y6 `
//---- Enter your exception handling code here -----4 x0 r* g$ ]; @" @! x
errorCode = 1;
& U9 N4 [& t/ ~( e$ X! V y# { Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
) Q- q$ H5 @2 O7 w! A" l } F, g- p- ~6 Y9 Q" O. ^4 n- `
return errorCode;
8 C& ^; L+ a( n+ c5 _ }
2 H/ c4 l9 H2 P2 O* \' P$ c
" O& ~4 n& N g. k& L int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)# S' S2 L8 P; Y# E. ?, i
{
2 N P- e& m9 o5 U try
3 h9 P ]* A- ?* ]# f! @2 }0 I {
v5 \" ?# o+ Q( F8 g( w if(block == face_select0): u' [. \% y+ {2 \4 x
{
' r! \. C. o, w- {6 { //---------Enter your code here-----------( z# y" J$ g6 K$ H) p0 ^
}
: O) T$ [4 e! ]: t3 A; D3 E# P8 X- A else if(block == face_select01)$ p- S) ~& {$ m- S
{
! g/ U6 }. i5 Y' n7 f# h- l R //---------Enter your code here-----------( N5 Z0 x4 v" y5 j+ G( C
}0 V: u7 B& E% q& D+ g s
else if(block == bodySelect0)
: y% M1 P- B9 `! q/ @% ] {! b3 Y- g! Q* ^2 n
//---------Enter your code here-----------0 g( f8 J A; s8 E' u5 N
}
% N5 l0 Y6 p2 d' b4 ` ^0 e else if(block == bodySelect01)
% s; w2 v, p( G4 x( L {( S0 ^$ K# m3 Z! U0 E, Q+ B
//---------Enter your code here-----------4 {2 G& e2 V" d5 G2 u9 E
}
) p& M( n1 K$ ]0 ^ else if(block == string0)
3 g. L4 \) p& G: }- Q- M {6 ~% o0 D' Y3 j" t5 q' D
//---------Enter your code here-----------
) T: L( |1 \8 M& P% y1 e7 J }
; D% P* O8 L" I else if(block == label0)0 r+ X# c3 y- d2 B
{% O7 B, r# S- l2 S+ c
//---------Enter your code here-----------# J) F* ?* u9 I9 j' h
}
4 p2 E" H+ ~) T$ | else if(block == string01)0 S# ~& ?( Y5 L/ E
{
4 R/ J& p- O. D1 @( _- l4 G //---------Enter your code here-----------, ?, n2 ?/ f; @( O
}# `8 ?. O5 M9 O5 n
else if(block == label01)/ {' ^2 I C7 `2 q
{# E" L. Z0 G: a Y
//---------Enter your code here-----------
/ n5 F8 z! }3 h& w2 ^ }
- t: A7 z5 m m ~/ R3 i# n else if(block == label02)6 B; R, ~- u- R8 Q
{
@1 r) h' F1 X7 n/ _7 a //---------Enter your code here-----------3 k* f* G4 N' {3 E) s- w
}/ E9 W$ }& N9 z5 { |8 b5 C
}3 J3 z4 o/ u2 F6 {+ Y* l- R
catch(exception& ex)
: [& Y- n% m% j2 s- H* R- @' p {0 K7 M- Y0 `1 z9 d4 A0 _
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());% Y$ h+ r3 R: B$ e6 H! F) b
}
% {" c) k) j+ R0 T$ G return 0;' d& f( N/ W+ a# }" `$ Q* l
}
$ c1 z) M3 Z/ k% c% [- s: E 1 p. W" a2 ~; {+ g5 Y/ V
int Shrinkage: k_cb() b0 ]" t4 X7 A1 m7 I/ W
{
: o/ @& i- {- Q3 {$ r6 S' o( W int errorCode = 0;- {( l( b! [' K& J$ i9 j
try: F) @. s U5 ]2 \
{; A+ e4 M9 P# [0 {$ j+ w3 ?- t2 K& [
errorCode = apply_cb();
' w+ z2 V ]4 w" C) x& L }2 d# I) z/ _& N' `
catch(exception& ex)
) \2 Z$ N" O; g. ? {! X7 e a5 y/ @, q( [- o3 s! Q
//---- Enter your exception handling code here -----
1 v, P& p# E5 D0 f errorCode = 1;
7 h& x! c; U' {4 k; q+ g Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
# f. f6 K ~! C6 h9 S: H }( c+ x! }' w5 I2 B7 h
return errorCode;) f! K9 y4 S' b- N1 O1 ^
}
6 |& [/ z. S# e: }4 u 0 A9 ~- N# Q$ d2 @
//------------------------------------------------------------------------------3 C& E( N( B) T6 g9 m' c
//Callback Name: filter_cb* G. Z. _9 A) o9 X6 }: ]
//------------------------------------------------------------------------------8 N) D" o9 h, }: R( u" L6 ^
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
1 I* L! G! M$ V" {4 \" X# r" [ {% O' ^0 {9 @2 G# |1 O5 {
return(UF_UI_SEL_ACCEPT);
6 ~2 {3 A6 G9 ]4 a$ K; E7 q }
# U7 `% }, Q* n% S9 m E3 a! \7 y: I' J
//------------------------------------------------------------------------------: ]+ V6 r6 y/ c) y' ]0 h
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
8 C1 F4 a5 [& V5 v& A {- n; r9 R4 X3 a5 p T
try+ j) r6 |3 t6 t8 S
{
& E/ }# D4 K1 A- P5 S& U: X* O //---- Enter your callback code here -----
, Z# i! M7 z" C( ] }/ K1 ~: E3 c9 `% ?1 G
catch(exception& ex)
y& g7 ?' H& \# M {
+ s8 U- x3 N! E$ Q5 W/ M: ^) { //---- Enter your exception handling code here -----
8 Q, c$ ?8 H* H; z Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());: J5 M9 W$ ?1 I0 V6 o
}
) F5 o" X# X2 H, Q% S }
" I, I. h& ?- [- m6 L5 y( ?- r ! R* @7 L0 N) }7 _
//------------------------------------------------------------------------------5 v3 U, A' n; d9 w5 D$ G
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
" |8 p9 s/ i9 a ? {3 o8 d2 V. ]; Z3 ?" a; ?
try( m4 D' `+ e3 C, m. C
{
4 ]6 s# P+ O! E; Q //---- Enter your callback code here -----
F; E$ ~% ~. X8 {; t& S; w- P }: F6 }& k! j1 l; ]. G
catch(exception& ex)* y; J! Z- E4 G) c" |- ?
{4 y; E6 b5 _- a7 c% P; t) |& S& C# x
/ R U: o* F& Z Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());5 G! w \. B4 G" ]; h- G
}, }4 _& E) \$ X5 h$ C6 ^
}
8 X; c4 o2 j5 q3 Z( ~
4 h3 x3 g' m/ \
* P) k7 D& K/ O$ B) ^0 m$ v r |
|