|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
], \# o0 y" ^0 r" ^# R9 [6 }0 i6 ~
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
1 W8 e' n- f; i) a代码如下:
1 H6 R) c9 U- j#include "Shrinkage.hpp"- y" G9 _. ~9 Y. M
using namespace NXOpen;" T7 x" q, Z% @4 ?: C
using namespace NXOpen::BlockStyler;- q2 K4 P! n9 ^# x. W! }2 J
. S" b, D" g2 R" |; G! ]% S% fSession *(Shrinkage::theSession) = NULL;
; [, \- b) Z- U& ]3 W" Q+ CUI *(Shrinkage::theUI) = NULL;+ {8 @0 g3 u0 k8 z9 F) o3 O( ^* a
5 `) [5 j, m5 L: q: F
Shrinkage *theShrinkage;# S1 S |8 W7 B' D
9 l/ y$ E- @, v
Shrinkage::Shrinkage()3 f8 ~, K( m1 u% D: b
{
4 \9 |# q C) d! A try, w1 o; U! x% Q: o; Y6 ], S3 E1 c
{( O7 u+ j! H7 `3 B! g7 W
// Initialize the NX Open C++ API environment
3 o5 _* s7 @) n w Shrinkage::theSession = NXOpen::Session::GetSession();4 N/ B" _# d r3 V
Shrinkage::theUI = UI::GetUI();5 s6 w; T: I! p
theDialogName = "Shrinkage.dlx";
( {0 A' f$ q6 L2 O- M0 H6 T theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
( t# E0 j& I, b3 \9 s( k5 V( v // Registration of callback functions* p+ ?3 b! k& ~; j+ N% A( t7 W, j$ S
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));: M* Z7 d4 L- G) o: l: J
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
) E. z6 H' _* w: g- N theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));/ y3 {6 q# x+ k6 B; E
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));# ~+ O! F7 d' `0 s2 i% w2 ?5 a5 h
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));3 i, C3 E3 T+ [
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));9 {' H# x# \6 b3 [+ B: ~8 W u# |& l* X
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
3 H) v2 w. ?' E! X2 n$ @7 j1 m theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
0 |) b- I( H3 m }
( U, c- x1 V& L' _! o5 ~ caTCh(exception& ex)
* B) ?- G0 s* {1 ?& g {
( ^% W/ m6 f5 ^5 R/ [$ F r) X" P' q5 A
throw;
" V5 |. P/ I" n- ~: d5 G }
( q Z( c- s! T0 w+ {9 P}
' c: p/ @% U' u
, V# ]# ?* ~& [* C6 p! o+ |4 XShrinkage::~Shrinkage()
2 k* \ h/ c5 H+ C{
@" K F7 ^( C if (theDialog != NULL)
2 Y7 g( e/ t" [" a! H- b B U" U' F {# |/ J/ d7 [6 \, ^# ^
delete theDialog;
+ Y8 U, B. R" J6 P6 M- K" t L/ k theDialog = NULL;
0 @" U+ l6 ^6 w* e }8 p0 e$ j. X. ]9 W2 F8 i
}
) ?8 k( _1 i+ w( b5 ~. v
, K7 S. U9 `6 ` V#if USER_EXIT_OR_MENU
' l/ s* a+ v5 E5 K h( b! p extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
4 n9 K) h; w' x! ~: a3 O {
/ J6 n/ T* ^7 p- y, U8 ` try( f. \$ y( Y& N1 ?
{, I6 i1 S" b: W
theShrinkage = new Shrinkage();
3 D# [: Y$ o' j i0 U5 `4 \ // The following method shows the dialog immediately
: B( y/ d$ Z2 t+ a theShrinkage->Show();( W( F* S* `9 d' P
}/ ^7 h8 t/ S, T) _* n
catch(exception& ex)7 S/ @. e, F, s7 {0 _2 Q0 A
{4 ?" U1 Y/ H# O6 g
//---- Enter your exception handling code here -----
5 D: s% ]4 g7 L1 m, _ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());8 w' I5 P. ~- z" F6 T+ C9 v9 t
}; r5 @& u1 ~* E; ~
delete theShrinkage;
) q+ D+ }3 }9 S u/ ]8 J0 c }
/ R3 }* d+ p& |# j0 O#endif//USER_EXIT_OR_MENU
8 y! |5 E9 y4 }0 K#if USER_EXIT
$ [" q% o! S! B& f! h+ U $ U1 A- \0 G2 ]
//------------------------------------------------------------------------------$ P% c( b# E1 ]) ?% Q" \% n5 m
# D2 C+ D4 C1 f8 ?' F
// MUST NOT use this option since it will UNLOAD your NX Open application image
E9 p) ^0 ^6 y6 u6 ? // from the menubar.
6 ]% H+ [( N& z6 z //------------------------------------------------------------------------------
3 z3 Q; x( M0 e( ?5 } extern "C" DllExport int ufusr_ask_unload()0 \ y2 S3 p. f: l/ N
{# e( U9 Z0 ]) g- S7 c9 C8 C
//return (int)Session: ibraryUnloadOptionExplicitly;" B3 {5 j7 z" y+ M3 C" W
return (int)Session: ibraryUnloadOptionImmediately;2 g# v" Z1 B( ~
//return (int)Session: ibraryUnloadOptionAtTermination;
$ m8 p8 g% [$ l! q& \2 `$ @ }
. H! C$ k- S$ j c f% F% u% K$ V( t. a- h
//------------------------------------------------------------------------------5 q2 p" [% d2 Q
// This method is automatically called by NX.( s% u5 M4 \3 q, i# l
//------------------------------------------------------------------------------' o! |$ g6 @6 S
extern "C" DllExport void ufusr_cleanup(void)
4 Q: }2 U& Y+ u% M {, b# q$ r& o* v3 s& H" f
try' {3 l$ F6 K V4 Y
{0 T. K9 x; Q; a) O5 h
//---- Enter your callback code here ----- v5 j% U$ {1 e. x9 r
}& E6 G. t6 T% J5 ~; S
catch(exception& ex)! j7 X# d( \ o; O
{
- m3 E4 d, Z$ Q2 L+ r8 E+ |) q //---- Enter your exception handling code here -----
- i7 z& H# x. G6 w9 s2 { Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());) c2 k$ p' y, A/ n" Y" T
}: {+ ]! Z2 b0 N9 c0 E9 E. v. r
}! F1 j6 t( E/ Q( U* p$ ^# `
#endif//USER_EXIT: k4 `: X* n* r* }* f
7 [+ n9 N8 W; S% O3 i/ l* f4 B
int Shrinkage::Show()
% Y: g* @- w3 O/ y" y9 B# ] {
, f1 _) M; s5 H" ?( l8 Z) l try3 q* {/ H2 T: W" |$ z
{
/ f; l$ Z0 r: }4 y* r theDialog->Show();
1 Y% l6 b) K1 H3 y# `0 H8 o2 v5 g }# w. X4 w: e' M
catch(exception& ex)
: E# ]! i: V/ p {
" ^( h3 f A7 l4 B! I# l5 O //---- Enter your exception handling code here -----
9 c) e# U" ^9 k# v* V Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
2 ~9 h5 I, @* H' I }
4 @; y9 _4 u& u& A/ u0 s6 |, T, R, i return 0;
. K) Z- ~. c2 j& o' C8 D }
* z, v; Q! t: _- h+ e ( r8 \7 R# T- O8 ~+ R4 `
#if CALLBACK3 y$ q0 d z3 w4 |* ]. {1 i* Y
R v. b" D+ W
void Shrinkage::Show_Shrinkage()$ i9 _, U( @5 u6 }3 d/ u2 i
{
( ?- o' v1 |6 I6 `+ M- ` try# }& j0 O( s \* i+ I
{, K% K) ^, k: {3 J$ m7 ^
theShrinkage = new Shrinkage();
- I0 g) c, [- X0 q
% w2 z: o1 |& k/ X6 t0 n5 Y2 \$ v theShrinkage->Show();0 {( Q; t' Y6 J) }+ @
}' f) z; @% |+ W4 m
catch(exception& ex)& F; k. _5 k2 p9 ^/ `# N- a
{
3 F7 B) B5 r# b+ _" U+ W8 C+ i( o& L3 @' z" F: V: i
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
7 m8 ^+ J) U9 F3 c, O( c6 y } T* \$ L' g: K
delete theShrinkage;
2 h, d2 N, h- L+ D }
4 P6 o/ Q- R* E/ D8 R1 |; u#endif//CALLBACK
7 K$ ?! Q/ ?( h- |6 `9 P' r: E
' H$ z; l) b# Q/ W5 I void Shrinkage::initialize_cb()( V3 [1 E; @( g0 g# Y8 H1 I |
{
' y5 S2 T1 n) k3 K3 |( m$ s W try4 E: _; s! }. p5 F1 r8 _4 T4 i. T
{
+ z ]7 H/ n2 ^% [8 Q2 m2 ?, X0 F group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));7 K# [$ x7 H, G, ~" q" }: p
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));9 s6 u; ?: L4 @& ?1 J) z
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));% O: U2 t8 i% w( `. J* z
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
+ n: Q# v7 I4 V bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));0 U9 u' h+ `$ H, q) `4 k
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
+ ]8 b8 @+ v9 m( F4 r. ?# X( | group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));( Z3 m8 {( M, K! Y" J
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
$ p2 n5 c! y2 ] label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
" x- w) |& J0 j$ e" Q1 {6 h' A" V string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
X% ]4 u) |5 N$ N* b label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
: K: K1 y3 Q. |( r) V0 O label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));5 v. k- e, s+ g9 f3 o
}
2 K Y8 }+ i& ]9 q% o catch(exception& ex)* D2 }" b0 [ W& j M& w- m
{
1 Q" M: v/ E1 v3 S2 p; z 4 T$ t" o6 `4 Y4 I6 B
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());! Q( \' \4 {: _* j& G/ V) f1 D% _
}
7 d/ s4 U, @/ I& O/ ]) Z }% R; W% ^5 X/ k. H
//------------------------------------------------------------------------------$ B8 a: d2 I; ]1 g, j: I
void Shrinkage::dialogShown_cb()1 { c8 g9 e# d
{) D0 C/ s1 i/ C6 C8 V$ q* Z
try( k( H1 E; I0 y. C
{# |3 t+ Q: F n, \
//---- Enter your callback code here -----
8 F# G9 W- w. o8 Q$ @4 O2 p }9 W( D: N8 A7 n$ v" d9 Y& c; u8 I5 E
catch(exception& ex)
0 d7 C( c+ V+ b `; g) M {& Y2 U6 w: A C4 q8 q, S
( H o4 v" f8 K% c Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());2 P9 B( f) u- U" F. a/ T
}. J0 R0 y, P/ E5 \3 G# H
}( ^! `0 X! z; C- ]3 y; `3 \" ?8 a
/ @$ o# P0 x& x. V int Shrinkage::apply_cb()
/ b, R; o5 b* F* p, o {
0 [, m, B1 V' Z( v int errorCode = 0;: Z/ C2 T' G" {
try, A4 W5 @4 N7 k# X b* V
{5 M. l' L4 e" c( g) D4 f! x0 v
//---- Enter your callback code here -----9 _6 b) @/ R" m2 W% _+ l& I/ U
}+ Q% Y' R6 f# V {! h+ Y
catch(exception& ex)
0 ~/ T0 B+ l. D) s# a {
$ u) l0 v$ T, j4 L5 W8 Z4 T$ ] //---- Enter your exception handling code here -----+ Z* X& @9 k. K: V% r3 C& Y
errorCode = 1;5 I! W, u5 n7 x- v9 O+ |4 g
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());4 F8 U! n% p' U& w* O1 O0 J0 R
}
" u4 N4 I- G" B+ f5 y% j return errorCode; v; G/ N, t3 L! |
}8 M! j3 _$ O' {6 T7 k: J
8 @+ u, Z6 P: E9 T
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
( t: i( y/ i9 C {* v7 [9 w" I. g. {
try
& o' ~1 O/ N/ X; }6 u$ ~7 { {. b- b+ Z6 u% K# J2 X% O2 r, b
if(block == face_select0)" j! K1 ?8 R4 [! S1 j5 `
{! B" O# N) d0 c( x+ f1 t
//---------Enter your code here-----------
: Z1 l; s% h! P" S }% F: z# U, s/ M, N
else if(block == face_select01)# C4 q5 P3 L7 e; N/ d
{) t% Z, }, ^4 L. l
//---------Enter your code here-----------
" ~, {. `- q+ m4 m+ h9 J }
; z6 y0 t+ [8 n" m else if(block == bodySelect0)% @2 a+ r! v5 ]" l( M* m
{
* W. B( a v! _ //---------Enter your code here-----------
* x3 |* z8 C4 {) u }/ v' C- c: x! `" J' O9 D
else if(block == bodySelect01)3 T- `# r, m; Z. r) G# M
{
b3 l5 F0 O2 ~* a! v! \ //---------Enter your code here-----------
2 Y6 F- }& ^* _% d$ i }
$ L3 E6 r/ R& h6 t/ O else if(block == string0)% h3 H4 f0 N! h- U5 i7 S$ v3 ^* I
{
3 J" W; _( l( `) D |1 B //---------Enter your code here-----------
4 {; b2 |: F: _0 Y- H8 X8 k' N }
: b; [6 \0 b; Z t S else if(block == label0)$ h- g: h; c6 v% A- R
{
$ Y7 o" q% _" H. O+ j //---------Enter your code here-----------# z& g4 u" T+ F3 b
}
! A: C" p1 B6 b: u& L9 n* Z else if(block == string01)+ f% i# E) I% G, [
{7 {6 K% g8 c0 E! K- i, g% H
//---------Enter your code here-----------9 a7 t/ }+ L4 H% k+ P4 b' J
}% D6 `$ Q# v* o# u [3 E
else if(block == label01)7 |- Q3 ~2 ]4 q7 P& H- U
{- y( f+ J5 R. t# ^$ E- a
//---------Enter your code here-----------0 e; l$ A" N2 Z ~5 J/ o a
}
2 g* `' z# l- i else if(block == label02)
4 l# A7 X# F+ y7 D; d. g {
# x! H: j7 ]/ P9 ?9 b0 ~ //---------Enter your code here-----------2 }" z9 f1 m! ] {
}
( s- {- N0 ` q$ M* W9 h0 h$ ^$ T# c; h) W }" M+ e6 i" Z* m' ], a
catch(exception& ex)6 H9 {' J; a* o% ^* E
{
0 T7 k# P. z' f C0 N! P+ g Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());0 v" t( C6 A4 A/ L: V# e. x
}6 `5 K' g' V7 U9 ]+ a
return 0;
" u& [' z# X, Y. t B }/ F% r' ~' {; Q4 u8 P* w# n
4 W4 N4 Y* ^1 d/ ]5 w" s int Shrinkage: k_cb()8 G# }' i% v7 p4 X# E% J9 r* H% G
{* B/ q) P/ }" N
int errorCode = 0;/ _, ^7 P+ d9 a: k+ s* G1 w, p: z
try
# J( X o7 U4 T* { {
7 ?( X. ~) y& I/ q( F errorCode = apply_cb();+ t/ r1 V$ L6 N" I. L5 U# I4 u. y/ F
}
$ z2 ^% w* v6 h5 W" Q4 q* U catch(exception& ex)7 \, r2 g& H) ]0 W0 c( b
{
! ^" x: {& t$ k) i" H //---- Enter your exception handling code here -----
6 }0 e: e9 D+ y& Q+ g! Z errorCode = 1;/ O' x1 ~. q5 K' u) E
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
! t5 T% k- H/ M) w }/ Q* h- C9 T6 v2 B9 v% V0 i2 Q0 \" f
return errorCode;3 c6 G. T6 G! J
}
S4 N) O) d7 v 5 Y' i+ w# J0 Y
//------------------------------------------------------------------------------5 n8 D6 G' Y" _& ~' D, g, d
//Callback Name: filter_cb
. S) i% F) V5 s' \5 o: J7 ` //------------------------------------------------------------------------------+ h0 X* Z: U u+ X$ P0 P
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
2 ]) C- b7 G4 u0 G {
) ]5 }9 O1 J. M9 s9 |( z$ s% } return(UF_UI_SEL_ACCEPT);
A2 Y! F4 B$ ?' }6 q }: t# k( E# t' p! P; x2 ^- ?! w2 d4 \
" z9 F2 A$ c( B( h! U$ E
//------------------------------------------------------------------------------
: J( K! U% g) F( A2 ` void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
( O2 n8 }% Z! i0 H8 ~7 k {
% Y( l8 I' x" @) Z try
' r/ E( u* Q2 B: r4 U' F, c4 D( P {
; n1 ~7 `' Q8 s //---- Enter your callback code here -----
- x- {/ n* A' E2 _% E1 O8 Z }) c# f$ ]1 H( Y* ?+ F9 I. o
catch(exception& ex)# j$ Z" P2 W, R: U6 E
{
3 f6 [% i! }" V+ U0 Q" x' i //---- Enter your exception handling code here -----
; r5 P% n% J. u% [7 `: d9 g+ y \ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ h0 ^! x) e+ _- m, d8 B$ [( e }
# O4 |- B& n$ I- P* Q: T5 d }
6 A+ c H% u7 F5 d+ I7 d3 }6 V6 m: B
% L3 n8 L2 g4 Q' q- A7 q; M //------------------------------------------------------------------------------, e- V* k$ ^1 E: J( C5 k. G6 c
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus). c: c( L3 C2 |9 m7 _
{* n& m' c) o3 S O- m: O' _
try
6 ~5 y3 h3 k' T, E* L {; Q; R4 ~+ Y# |" D" {' s
//---- Enter your callback code here -----; P7 Q- s$ a ^% P' u
}0 W# O; S2 |6 L; w. U5 s9 F
catch(exception& ex); v/ p% Q" b( _$ K
{
) _8 K" {% ~ D& a) r6 D) n
( M0 n) [8 g, H$ m& v Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
6 U, X% w! w+ y% }% Q" a4 o }
: k5 Y9 C; ?/ `, X9 d/ A n }
/ l1 y: y6 t9 z% y6 J) t7 A N5 o# F8 m' k9 q! D }8 ~0 Q
( b( w b& Q8 f6 A k9 o& f |
|