|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 ; x& [4 W2 a8 [! Z
0 A, Y, N- B, o5 Z' K
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
1 N r+ o( c1 D" n5 ]( U代码如下:
& Y9 Z+ L$ k! B#include "Shrinkage.hpp"
/ u5 k3 l X8 k( lusing namespace NXOpen;: w/ N, i$ x% G' e T: e1 d0 {8 z
using namespace NXOpen::BlockStyler;
$ O% V# o* S$ C, J+ e/ a( v) W
3 r0 U. U; A# ~6 A- C6 ~Session *(Shrinkage::theSession) = NULL;8 S% \ H5 c& p* `! J& Z( A% h2 T7 G
UI *(Shrinkage::theUI) = NULL;! }, q' W3 I0 W: q# X
( K7 J5 l: ^! f) w7 J4 [Shrinkage *theShrinkage;
9 M5 @ Z$ p# l; G6 d J7 b. y$ c8 S) k* B
Shrinkage::Shrinkage()3 u' d: `. J, O. R- r
{# k, ]" s0 I' P- V. A
try% z" c9 d0 e j8 _# a; {9 f" d' y1 _
{
7 |0 m4 X0 F# {5 s; H8 M- u // Initialize the NX Open C++ API environment
2 P. ^5 f: ^% m+ T, R4 S, E; o; Q Shrinkage::theSession = NXOpen::Session::GetSession();
# Y0 |+ m0 k2 b- g5 ~# P Shrinkage::theUI = UI::GetUI();( u7 x& b* a& y5 ? L" p5 P4 R y
theDialogName = "Shrinkage.dlx"; B, J& V" E" L% B5 n. A5 ?
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str()); S% V/ ~: F9 W$ y& Z9 o* v
// Registration of callback functions) p3 j, ?8 ^- v
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
) t4 n7 L! p* A% Q& y theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));( H8 v# Q8 d7 c6 H, Q
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
, @5 O, N. m. K3 L* ^0 T theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
. c& E+ ]/ Q: T theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
( m+ |& e+ D- S/ k4 z7 ^6 ? theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));' A' k* T7 \* l- i
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));$ l' p" m w' B! U& _7 ?
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
6 `1 [! \0 d" A R }
- q- w, b0 K, W caTCh(exception& ex)
! }& x8 p& j s1 N {
5 P, F" u! P' Z2 ~4 ~3 S' Q 1 `/ w2 y8 H4 S: ^- F
throw;% t9 O. o/ {1 B( D; C, \1 s! v9 c
}4 B! _ c8 g. W& p
}1 W6 W" |6 k% D7 m$ o9 G
: h) O9 }7 c) W
Shrinkage::~Shrinkage()" `# J5 t8 K& E3 f; y
{# W! T) {1 C2 K+ E# m. L
if (theDialog != NULL)
- }% J, I e- ]- D {% Z3 u' P; z2 `( Y$ O0 ]" L+ s+ @) h
delete theDialog;
L0 T5 v# ?2 j theDialog = NULL;
5 r! q$ ^( C* K# y, e8 s }) G! I; S$ t8 ?* R
}
: A' ?! ?9 j4 G; f8 S K$ X6 m/ M
& t$ y$ G' K* j#if USER_EXIT_OR_MENU
9 K5 ?2 E! E. k4 e5 f extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)- b8 U, r, M% q' x! o& X
{6 H& `5 t9 T# c+ H3 y! D5 T" W
try# w' X! P" N5 k7 m3 M' E
{
: `4 a( ]' k( J/ A6 |8 @) @; ^ theShrinkage = new Shrinkage();! R% u* o' C) i# C$ e
// The following method shows the dialog immediately* ~% p1 o% ~, e3 V, y' H1 O! j
theShrinkage->Show();
. S4 Z- b" B! Z/ _4 T }; F; [1 ~+ Y9 n! O* G' n
catch(exception& ex)
" o' d( J" j( u+ n) n {" b" _, t9 M% p8 D0 E: |
//---- Enter your exception handling code here -----
4 w i& i" O, _6 y# S. l Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());5 m0 I& f+ m5 ~" p( }& E# @& N, Q
}
( d# S) z. S, K, f1 m6 _6 x4 V- C delete theShrinkage;
0 z) g! S+ c/ t }9 x9 S G# A3 Q; O7 B* U/ P
#endif//USER_EXIT_OR_MENU
" E8 W1 ]: e; T6 O8 \#if USER_EXIT. ~* c$ b A" K2 J q5 X. l" s
' y3 t* a- [% g3 | //------------------------------------------------------------------------------
D7 _, a5 A5 |
0 v `' t% T2 k. V: P% o! s/ S // MUST NOT use this option since it will UNLOAD your NX Open application image/ Y" P, G/ T0 y$ c) n! c, i
// from the menubar.% P- @8 u! z' h W0 B1 ?
//------------------------------------------------------------------------------& I+ i) [/ M* j9 y+ j+ ^1 S
extern "C" DllExport int ufusr_ask_unload()6 y. Y( \9 G4 W
{
) O7 m& a, F' x" D9 B //return (int)Session: ibraryUnloadOptionExplicitly;
1 g4 m" U: l9 g! S return (int)Session: ibraryUnloadOptionImmediately;
6 ?, [* n$ ^" X/ h- k" V //return (int)Session: ibraryUnloadOptionAtTermination;
2 `$ ~, H; C) m } ^$ Z4 e; ?9 V' |
0 ], [4 Y5 N" I& B) ~( b0 Y //------------------------------------------------------------------------------6 ?0 I& R/ W- S& P) j
// This method is automatically called by NX.0 c% W- P" t. f' j- |: l r
//------------------------------------------------------------------------------
1 d: c, H9 s+ Y2 g) }8 x, @* c extern "C" DllExport void ufusr_cleanup(void); W7 r% A/ _; H s0 \) i3 |
{
/ g/ r# z; R }7 b. @6 V try' c* M7 [% M$ ^+ Y/ c% k( U" w
{; H4 h0 l* v5 N$ p9 f+ C
//---- Enter your callback code here -----
3 _* R" s' i- {% ~$ X5 u. r5 s0 r }
+ p9 [. }" q! ^- V catch(exception& ex)
" r# p0 r! _& J. I {
2 Q4 E6 |% O" {9 E$ e+ K4 j //---- Enter your exception handling code here -----
4 |* Z' l4 P) Y( W Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());4 W6 X/ a" x# X4 U
}
3 u! a! W- o5 ~2 J6 g! ~! J$ { }
1 Q1 e; ^( Q3 P! o$ {2 [/ O* O& L8 }9 M#endif//USER_EXIT
) Z6 V5 v3 t- B: s/ ^
6 v6 K- I4 U/ {. b; u' ? int Shrinkage::Show(), v7 N5 Q, p4 f$ _. W& G. q3 I
{
% }: f( ~4 \& B& j try
" c! \: M9 x7 E a- \ {- N4 u- M) {4 W- p( E
theDialog->Show();2 b" K5 w2 ]" I2 L/ w. r
}
5 k& {2 \; w8 ` catch(exception& ex)
0 o+ r9 r4 G1 h5 s- U- A" T {
* v/ f6 m! b( y7 \ //---- Enter your exception handling code here -----
4 g; p3 ^3 o$ Z; i7 e Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
( S3 k+ U' p: b% G$ q }# | C# r3 p8 Q8 Y
return 0;
8 p5 |+ c ~7 k* b {1 }+ Q }6 m3 k# u* }, J0 C2 N
# i5 M; F6 U. Z. D% o/ b
#if CALLBACK% R% Q$ n. e& D
; Q# j; V; V3 u3 f/ a void Shrinkage::Show_Shrinkage()
. k. c8 T& d5 ~: N$ r8 J0 @ {
6 ]/ f. x/ r6 H5 g- |% A- x: Q try
; |: S0 R+ ^. _' h8 j {0 \9 X1 d+ ^ T" U- P% L; D1 h/ R
theShrinkage = new Shrinkage();1 o) z9 e1 R! R& L2 A6 k
9 e. l0 o. R* ]! u7 n9 I theShrinkage->Show();
U7 z! `9 ]6 q. }% o6 B; r }, L7 U" `# Y; }2 C+ C
catch(exception& ex)
x: m8 e B0 X) B0 b( C& q) o5 w. g' ] {
3 l9 X& R3 I' h0 V6 [+ D
) q( h: x. U" s; n Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ z n( O. W% ]3 ? }
2 h P4 s7 {& x delete theShrinkage;
( N6 t2 R0 ?. t: w' ]+ V* { }
; d) y0 d; G j6 T5 Z4 K#endif//CALLBACK8 x: R" r' O) {5 @% `- l
1 G+ L9 e; c9 l
void Shrinkage::initialize_cb()
. m4 M! M1 V, S {7 R- s- j8 U9 Y; J
try9 W- C: E, N; g+ o" }
{
! g4 j% V/ \& v V4 Z1 x& @ group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
. k3 }) [, I) j) G2 m. E face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
& R) l+ C- B/ f# @ f( l face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
& ~2 D# r2 d I/ t/ D; M) M group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));7 U/ i; D6 ^6 b% A7 Z/ ^
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
5 g7 t% a% \: U" h& f7 S, ~/ i bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));1 v S1 h5 B+ N/ m2 i% W
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));0 k1 v# ^+ G; z: G0 c1 C
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
2 i; h% ?) j% S3 Y2 u/ u1 \ label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
* x2 n# S! x( E+ T* C9 } string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));% [. G: k7 o G2 L
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
, v1 V6 @. x9 i( @9 e( ^ label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));' u( w4 Y+ A6 P* _( O b
}) a9 Q, @4 x, t' O
catch(exception& ex)1 B8 z- y2 v3 ~. F' z$ C6 u
{- M8 C1 G$ B5 R" S6 O
4 L4 L8 M3 }5 q" Z, E$ ^" g
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
- s. R! u' a+ N+ D) O6 J6 p }0 L, R8 y5 {/ _# c: ^
}
- D$ b$ Y2 `/ X7 m //------------------------------------------------------------------------------
/ \6 o. p! @$ B3 S& H void Shrinkage::dialogShown_cb()
/ J3 g; ?* }# C# P {
p" {3 ^; }9 Q4 S* B try
1 I" L3 D" q/ D: U: W6 d6 F6 B {
0 y# P: L2 O. L' m9 n7 D9 W4 v //---- Enter your callback code here -----
/ x- `- |2 A; {# n# D) }' C1 x }9 {) S& ]) Z, n/ |" D
catch(exception& ex)
$ @4 `& F9 v5 { {1 Z6 ]4 j7 I8 a' {
# T" U( T6 i1 O1 Q Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());; F( _9 l2 H* K3 ]4 r
}9 I1 [7 j& U3 V+ e2 g! w) t) c( }, j
}
$ y, h! a' C2 |2 | @
" B) E. E2 Y: `6 [/ y9 m int Shrinkage::apply_cb()* I; g, S3 Q# Z+ J
{) J* T) I$ E" I9 e4 z. |9 F+ ]
int errorCode = 0;
3 l* w& b$ j2 N5 r% B try
V" d5 Q L9 q5 m! ]; M {
& k3 C$ M p1 i. r+ f! E* t0 P$ A //---- Enter your callback code here -----) B$ `1 P; Q1 @$ k9 e A" ~( c
}
# |! n) e! E/ m$ I( C! Q+ M catch(exception& ex)' ?! x, x6 m! N& Y) e) c) m1 p: O
{8 V2 U5 E% ^ D1 q# _
//---- Enter your exception handling code here -----
! y. r0 g/ z8 C! J errorCode = 1;# x5 T' e, j, v* q; ~, ?6 ?3 }
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
& N( e* w0 E9 B# d9 b }
) M- b9 K' W! K' X/ h return errorCode;; k! G- g0 u4 o9 j
}
# q4 H; t) _4 u, c I% A8 q5 c3 p& [
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
0 q8 P! V. b2 x1 k. f8 b# Q/ h0 U/ j {
/ K/ x0 M) s( o8 D+ ], _: D try- y. x4 p4 g2 R5 H( P7 k
{
$ k! y5 I/ e1 Q) m# c Z6 H if(block == face_select0)' x8 l3 z$ t$ K* k; A
{
+ L5 A" R. j0 A8 J7 \$ ~& w+ g //---------Enter your code here-----------: s6 w4 C7 M. q* z2 |. u
}+ O3 x' |; F1 b0 Y+ K( Y5 j8 K
else if(block == face_select01)
: j5 y% @5 Y" q$ i' }$ {" M {
3 @7 e2 m- c2 I6 u! \9 V( ~4 e //---------Enter your code here-----------" u- n& }! M7 z( K8 u' g& G, _
}8 E) k- l* c" B0 t& s/ X N
else if(block == bodySelect0)' a* d' B G$ A, \
{; e: J e% V, r2 t* C: b
//---------Enter your code here-----------3 }* i* y7 [* F% n6 W; h% N
}3 l8 U2 _* y k' G' x+ z
else if(block == bodySelect01)
2 {1 ?: U% ~: _ {
$ c# [* p, I. C0 Y b( F( b //---------Enter your code here-----------$ e; \& V6 d5 Q! y
}
& ?1 `3 \, Y3 e0 q x1 P# c else if(block == string0)9 ~3 Z9 l) @. ?2 Z
{
' c- ?. H( i J5 V! s //---------Enter your code here-----------+ K+ Y, M) y; v
}
0 w* R4 x" f$ l. h0 z0 M else if(block == label0)
' O# O$ R8 L& I3 V: h+ B {7 V1 P$ }& [1 _. V
//---------Enter your code here-----------
/ y, @1 L* E" Q+ v8 D) w }3 Q2 F& b7 G+ P) @, p
else if(block == string01)
" ? m5 Q- M4 A( Z$ G! j {$ n, s6 l9 v! k" B f
//---------Enter your code here-----------
7 |8 M2 g% j' ` }0 {) G, ?' J# v
else if(block == label01)' o+ k( I0 D7 L& ]: g/ @
{5 [+ e6 t7 l3 k) T) v E( `
//---------Enter your code here-----------
! z# a/ y3 O6 u3 K* d }
8 l, S2 {) A) L7 G( n' h. A! | else if(block == label02)
; E0 T/ M" V3 G, q: A" Y1 J {. {: M. ~" Y! n3 J" l9 w
//---------Enter your code here-----------
7 Q% m H7 p, S5 s/ J }$ N1 b( D6 q+ ~
}
6 y+ N; o" Y0 I- B catch(exception& ex)
4 I. u$ G& s$ e( Z {" G7 r/ J" J+ Q2 a
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());+ y# B$ y6 c# s" f( C% e7 C3 t ]
}/ m' U8 X j c# f
return 0;+ W' b7 N- v% X) A4 x6 h" |6 [# b: j
}
2 m; k% f$ T) H* A1 |6 F7 v" T # Y8 ]7 v ]5 C6 s% y; N
int Shrinkage: k_cb()* I5 s1 H3 q3 z4 T
{* c3 Y' O" x9 |
int errorCode = 0;
5 i! ], `; d% P5 L try* U! d- n6 O1 n5 J- m* @
{
& ^8 i! F+ B. ^ errorCode = apply_cb();! L! \7 ]) ]/ }
}
2 o4 W# c1 G& H catch(exception& ex)) X- r2 S; t& t7 [4 h
{& Y0 E) D3 [! Q
//---- Enter your exception handling code here -----1 t9 s/ C2 Q7 r6 q: F
errorCode = 1;' l$ v+ T3 [+ ~- t( C8 Z
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());: F, k( ~ ]# T( P
}+ ~' P2 V! J) M, w& I! O
return errorCode;
9 v$ }! L, Y3 U' E/ d0 U }; n+ O* p. `) B" C# [
" H# _1 V/ w0 k3 J+ R //------------------------------------------------------------------------------5 E8 Z5 D/ t1 y# r" Q
//Callback Name: filter_cb% v& Y7 N S8 g* t
//------------------------------------------------------------------------------
# }& h, m( Z/ `7 l+ _* x int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)2 c1 h) V) \: ~# Z# \. a. y
{
! ^0 R9 L2 j8 _* g# C return(UF_UI_SEL_ACCEPT);1 B( R. e% r+ T
}8 |+ l% U/ d& v" ^
- i" c6 r; n Q' \7 V9 Z
//------------------------------------------------------------------------------7 p9 y' {5 l5 {
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)$ s# r2 n5 ?8 `, H$ l% x
{6 s: V e8 l0 F. O! R
try4 m/ J1 G+ l2 Y
{; A/ `8 f f& V6 J/ B
//---- Enter your callback code here -----
' `: Q3 i; ]4 i9 x ~; M4 K% p# G$ O, E }9 O+ _, Z" k: N. H; W
catch(exception& ex)
7 F7 o- s9 }( u0 o {4 n. u$ |; \7 M: H2 E3 h' H, z
//---- Enter your exception handling code here -----% u+ @- Y6 w8 C; ^* J( x
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
) v# s: P( {6 M+ g, \ }
Q8 v$ v$ u/ k9 r }
' J# L% {( }: y; M, Z; P/ h. [
. o4 }% n$ z/ |/ w; M //------------------------------------------------------------------------------1 t* K% b1 S3 v, H0 n
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
; q, K Z. k5 J9 m T {
: ^, W# N% F% J# z try
# S9 g8 e9 K! w2 C8 Z* { {3 C# U. `/ ~6 q: ?# ?
//---- Enter your callback code here -----6 ?4 Q& \) |3 `$ b) @5 f
}, l+ S$ I4 t, L$ e; T7 y
catch(exception& ex)$ e( ]5 Y! R$ h% r& S' D% p
{4 ^, f# n( B6 W
- u, O2 `, E+ u& ]/ p Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
; @- o! Q% S, B' f- ?7 I+ ?( r }) T7 p( v8 M3 i `! W5 U5 ?
}
' q1 T) ~$ {% e+ e
9 L$ J7 E7 K" b
0 ?) B5 X H0 w6 E+ A% r |
|