|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 3 x4 I$ H& P( f Y
+ Z& v3 W* M& |4 D请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
1 o/ s2 a% g0 a" \! s1 k代码如下:
* H8 ^6 C; _5 r#include "Shrinkage.hpp"
- @- U0 V1 W; K) G5 B: husing namespace NXOpen;- K3 H3 p V3 n8 r
using namespace NXOpen::BlockStyler;# d" K( Y9 y* Z( X
4 [! t6 x: \8 F+ { U( B- K7 H8 K
Session *(Shrinkage::theSession) = NULL;
# D5 {+ l9 g+ L# `; r5 y2 d# w6 vUI *(Shrinkage::theUI) = NULL;1 ~% o6 t" t! W E; b% o2 O
. C1 @/ V$ A2 ` w( L M7 S9 A/ t
Shrinkage *theShrinkage;; p$ S. z9 J/ j9 t; c
; \+ g0 R/ v* I' ?) x; h
Shrinkage::Shrinkage()
; P, y4 E* J$ l d{. s& T$ M1 D" E' Q3 |5 P' F
try% z" X' M7 y1 p0 b7 Q8 Z" c
{
3 b# M. w6 Z ]/ s, {7 |5 f // Initialize the NX Open C++ API environment- I8 k% y$ K! H9 q$ y% ^
Shrinkage::theSession = NXOpen::Session::GetSession();& M( @0 P- y4 }9 ?7 e5 M
Shrinkage::theUI = UI::GetUI();
; ^( S8 A$ \9 V% A theDialogName = "Shrinkage.dlx";
7 u& ]) l6 F1 E6 L. Q theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
$ `; C0 M: i; J Y; ~0 l // Registration of callback functions6 R3 I* g$ S) Q7 A
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
, q6 z0 [# w; d. \ theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
6 q# y; d% I9 Q- w+ i theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
6 U3 k5 N, u! W theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
, C4 ~( h8 L' V( t- y; A9 T- H theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));* C2 g! K# c+ K' X/ F4 u4 L
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
P- I* p! X7 ^7 q8 K5 t a theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
; r n( Q& i2 V2 Q theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
8 l: Q/ L! d4 g }6 F7 [: A: D4 W, N$ B
caTCh(exception& ex)1 t' @6 p/ A6 d
{: j9 Y7 w8 {9 T. v3 B& ` z
. k5 B* F5 V$ v$ S) L+ i. K
throw;6 z1 {% L" B: ?" f
}
4 A5 T% w1 [) l% f3 n}
4 [( z3 M2 G4 @) P5 W/ V. S$ C7 k$ k. x
Shrinkage::~Shrinkage()* |# T2 u& a6 B- x- |
{
2 r" H+ ], v) | if (theDialog != NULL)) y% O; X4 t: Y5 I3 v5 G$ o
{
( f5 [* t! @0 P6 @; A delete theDialog;1 ~6 t, g Z8 L( Q5 ]
theDialog = NULL;0 j9 C. i1 V" L
}! }& Y/ e2 y9 R8 u3 G$ t: ]; `
}
7 D0 Z: J1 |1 P0 D4 s. q/ t2 {2 d! }$ y3 t) a5 c b0 U9 D2 q
#if USER_EXIT_OR_MENU9 g. B8 x) [( D u) L
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
4 W$ ~! o+ C X% } {% d( v8 Q Y9 U$ }" N! L
try
}, p' g# ~2 M) Y {
- i5 O/ R3 k/ {2 D* @# Q q1 z theShrinkage = new Shrinkage();
8 X; ]' x' V" a // The following method shows the dialog immediately2 _2 U, h# \4 @* Q' E# o+ k0 i
theShrinkage->Show();
+ ]% ]# ^* Q. r/ s0 N& i! s }
! w* R, h1 _8 d N4 z& s catch(exception& ex)
' L; b$ L: L2 r {
0 m3 Y0 B( \* t9 ^ //---- Enter your exception handling code here -----9 }7 `7 T- {$ }) ?' q" |
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
. v1 w# V' T$ j" @( _3 b }
5 B. b# F1 d& m/ X8 z delete theShrinkage;
9 D4 {+ h2 V3 ^. {' I# F }
. r: U' {9 {, t4 C2 g#endif//USER_EXIT_OR_MENU, i5 n" @/ j; E/ X
#if USER_EXIT
; X, V( N9 U8 N; _! C ' }2 Z7 S- r0 y; E
//------------------------------------------------------------------------------
- q) `% d3 `1 w1 w ; i' M3 ^) K* w1 [ Y7 z
// MUST NOT use this option since it will UNLOAD your NX Open application image* Z8 E: W N7 d3 N/ B9 D
// from the menubar.6 y+ o& w+ y7 n& B. u! B6 Z# B
//------------------------------------------------------------------------------
* G4 d4 J8 f+ C$ H6 ^% M" P, Q, h extern "C" DllExport int ufusr_ask_unload()3 G; k2 I/ y2 }) ?: T3 D4 ^9 M3 |
{
4 L" y) Q/ }/ `# b, h. b' r) f //return (int)Session: ibraryUnloadOptionExplicitly;
& {6 E! w$ ^* ?% V8 Q" m return (int)Session: ibraryUnloadOptionImmediately;- D' ]* n& E9 y$ B
//return (int)Session: ibraryUnloadOptionAtTermination;5 s$ Y0 y4 \8 ~, |! u
}
$ S* d! v p/ f) x+ k* f% l7 A
2 U) ]! d) f& |$ r( U( s/ g% n //------------------------------------------------------------------------------+ ^, A2 ^ ^5 ?1 {6 g8 }5 W. T
// This method is automatically called by NX.
8 M/ u1 t& T) W7 r+ {# o //------------------------------------------------------------------------------& {$ e9 ~4 b- }- D' R6 ?
extern "C" DllExport void ufusr_cleanup(void)
6 x& r) K$ `; e- e {
+ b) |9 d, v4 Z try
- `# I; K2 @: R3 s1 P, h {
* {, b/ y" N8 [+ I //---- Enter your callback code here -----5 v7 O# ?) q. N0 }: f* f
}9 j2 b7 }# L; J; I# f9 K
catch(exception& ex)4 U2 m( K7 l: c' H; p) J& X6 l
{3 }3 Q4 k! f$ R# R1 Z1 I2 [4 [
//---- Enter your exception handling code here -----
- d1 i, ~. W w! v( M7 t: { Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());* p7 F! n( O* Q
}( c3 T& l; w5 H5 ]5 c1 H* z5 X# ]5 q
}8 D( V- u& I" B w4 @0 D# r
#endif//USER_EXIT
' F' v1 i1 J+ ]1 o# c" ?7 w
. Y; ]; V$ J$ d! j int Shrinkage::Show()
' q, y- v, { [1 W! J0 O* T {' A7 U7 e3 z% \' Q
try4 I: R1 D% h0 S1 H
{
' d- P8 w, W T6 i theDialog->Show();
, s9 s+ @! {1 G: J d }; A* W- c3 X6 |% k% w: n `5 N( D
catch(exception& ex)0 e! W7 _) M, [/ L4 T9 h
{5 K: t) ^3 F4 ?4 c
//---- Enter your exception handling code here -----
4 g, |7 m) L5 q+ D6 ^; T# U$ x Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());0 D; @2 k9 Y. |
}
" S C5 p9 C0 v1 h return 0;: ^) ?3 ]" k+ p) B3 J+ {3 O
}
9 F+ h7 i. x4 Q' P9 z
4 o1 V6 ~4 D" g7 Q#if CALLBACK, F: Y& Y: H7 W* ^' a& G; A
6 B% [ g( F( `' l
void Shrinkage::Show_Shrinkage()0 T4 L7 v" u! q: d. R4 u
{
" M- w, |" Z1 q6 Z) N/ y% S1 i try
$ \* ^) Q0 N6 g1 P$ t {, O% U+ r# [ L0 f$ w7 A" p
theShrinkage = new Shrinkage();* x9 b- |( G! u4 q2 U
7 U3 L) M* O M# x- c theShrinkage->Show();
h6 g. s* {, a% @) E- P }
6 Q; |1 ~! V& |7 C8 i' H( d& Y+ B catch(exception& ex)1 E8 u' _' M( Q' h1 j. _* g
{
" R/ o# l5 A+ ]9 |) j. G) h% S( [* b7 s% D+ Q
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
& T+ E& ^$ U# u8 [: @/ B }2 S. k7 l% c, a% l0 g2 C; Z, d
delete theShrinkage;
2 F, G8 _# c! ?8 H5 w5 H: q3 ] }
6 H! v4 O! l9 A3 V3 Q, Y#endif//CALLBACK2 G4 ]$ Q" S; @) }8 y6 G1 B, H) e
7 l) ]: i: b; j$ E8 G- G1 s* j8 ?6 [ void Shrinkage::initialize_cb()
' q5 d; U5 Y( H0 v {* ?, g7 _1 W1 M Y4 R& O
try8 K/ H, C- D* M8 N, i) o
{
+ l& u' ~7 N, C group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));2 Z+ ~3 t6 o# `+ D
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
# O z' @" [9 R' ^& b) F2 t face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));7 K9 u8 C3 i; J# @
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
, ^! x, I+ V9 d' e: n bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));3 `% C4 R1 C. A9 p# U
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
+ a5 `2 ]9 ^7 B! N+ q2 {0 Y group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
0 {6 z. x& ~: X# _9 c3 x& [ string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
& }! o# w0 F8 B" x0 n3 y label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));1 s x+ g5 H5 e- g" N+ p8 x5 Y. X
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));# t6 T6 B* B; P. t2 b2 O k
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
: x' {% j: ?/ U; x$ v! n label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));/ r# k, C: q- X# ^
}* b+ E6 j' i# M& T
catch(exception& ex)( @- f9 c' g- K/ m# f3 g# t
{+ @ H) ]* \% f& s( w& {
- l8 P1 l( |3 X+ O5 M Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());( F% X! S k" ` r5 z
}
9 |) s' |; `5 {% j }
: i" `0 K. i( I4 {, m# _ //------------------------------------------------------------------------------9 R) u: Y7 R: s U9 L
void Shrinkage::dialogShown_cb()
8 A$ K/ y5 ]8 [3 T {% I8 F/ K8 s7 H6 p
try
5 Y4 q! c6 |3 I+ s' ^0 t {
[, ]" @$ Q) C7 R: H' C. ~ a //---- Enter your callback code here -----7 k3 t0 H9 @" u. e( o9 G% [% P
}% \' {5 W9 q' Q
catch(exception& ex)
3 Z+ q# w* Z4 f8 ?% c {( S( j4 H2 J8 r5 z
' t/ d( A! W. M( J0 | Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
/ M0 u* c/ c4 J0 b+ V' {: s# L$ H }
0 |9 g4 F& \/ Q3 A7 ?, X }
: u5 C# M/ t: S4 Y 3 y, i; j3 G& B7 x; t6 U
int Shrinkage::apply_cb()5 x: R- B8 n L4 z
{
: B1 P. e, B$ d$ w! G' \ G) K int errorCode = 0;/ `: s1 f0 \% H0 D8 ?
try
6 Q1 c, I1 P8 T {
7 z) t( Z* r" L3 Z1 | //---- Enter your callback code here -----
* K2 S2 X3 u# P) @- } }6 |2 x1 r/ _3 |) t( i: H% \ @3 ?
catch(exception& ex)
' H) [2 j2 R. @7 w {: X: B: o2 [+ E9 P8 h& \
//---- Enter your exception handling code here -----
, B, G1 N; \0 u% _# m4 t errorCode = 1;
6 ^, q8 y2 Z2 C- ?* V0 k Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
6 W& {7 ~7 {6 d5 g/ d }+ X# M. N3 @% @
return errorCode;7 r0 j" f# q" X
}6 P5 ~# P. U8 m: u! X7 \5 t
6 A% R- D$ j7 w0 p( w int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
/ {5 q3 A" ]" ]3 i o8 W2 u. m {
* s% }; r% t9 y% W( n try
- I5 k) I* [( A! g& p( O. n6 G {
) S" Y) u! n+ v1 S5 S" i6 k' y if(block == face_select0)
# K) m0 i1 R }0 T& j( ^ {
: f: G( O) u9 ]7 m1 W //---------Enter your code here-----------
" a2 \( Y% s! X$ l) V ~/ a" m: c }
# L/ k) w) _, s& } else if(block == face_select01)7 n2 L+ j6 P1 Q8 A
{
/ _, A \- l4 s& u% d/ j4 ^ //---------Enter your code here-----------
6 O5 e5 G/ v+ p- w i$ U }
9 ], T! F+ W% r3 p else if(block == bodySelect0)
( r S. H9 g4 N) X, Y$ m/ Q2 j1 x- g {
6 X, A( L- u; M! ?1 f6 s9 h' \ //---------Enter your code here-----------
, s) N t* Q- Q @: n- n }
$ V, O0 a' v8 z3 |* [" p else if(block == bodySelect01)
: z$ L+ G6 m& E4 t {6 E# x: g! B. x% j2 p- N. S/ K
//---------Enter your code here-----------$ E% z; K. j! t. x: n
}
, P! b; j0 c5 h8 K1 P: k else if(block == string0)
# g" H* c$ E; L7 Z$ Q3 p' ? {7 r' M5 Z1 Y* F& k0 K
//---------Enter your code here-----------& R' d3 p, v% p/ D" D6 E
}
6 R/ m: o4 r, Y t9 | else if(block == label0). F1 {2 B: b- L. x. I
{
' F/ ]2 W4 ^5 O/ H7 k //---------Enter your code here-----------
5 U" G% O9 l2 U/ K" s# g }
' N- A! {0 ~# L" q3 ` else if(block == string01)
! W6 G% q9 } w2 r {$ r/ t. S5 w" L# P% q& y" f6 H
//---------Enter your code here-----------/ ~' o/ j) \! E7 i/ n7 Z
}4 q5 e3 \: k8 {
else if(block == label01)
2 A9 j9 l3 m# v {( c6 F8 r5 @, \8 o( J
//---------Enter your code here----------- a# Y" E$ N/ y( K7 w: w a3 b
}0 V0 j2 U3 e; y) w0 }
else if(block == label02)
! X5 q6 q5 Q7 w2 K& j) r5 Z$ T1 y {) c. y5 d+ x/ T. t
//---------Enter your code here-----------0 G0 }+ N# w. y* Q5 F" J
}
4 D; |* l+ K9 t" R# m% q4 W& i }4 o5 B6 h5 a) ?# c( E
catch(exception& ex)
) X, F; O' u: w$ W6 | {
, x" y: `- u/ f% F Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());/ j8 b& v. V8 `
}
, J7 Q' N5 ?* ~/ ?0 B return 0;$ U) ?: J: A; d. z9 l: j
}: Y, {7 ^+ B& Y! z9 `; i9 \
! `1 X4 }/ I; g# B' u' t. I" t: \: e int Shrinkage: k_cb(), e# B. M( z+ n! p; N# m
{
5 |1 v9 ~! ?1 V% W5 g int errorCode = 0;
* {0 C; X J" |* O% A try/ X7 p6 u0 A: g& ~" t& s" R
{; L8 X6 p; C. S3 v
errorCode = apply_cb();
& K% x. i9 |- f! r5 | }
$ e$ L9 Y& H1 \9 ] catch(exception& ex)' y" z6 g2 x3 O8 I7 ?% @
{. o$ I/ l* d$ I: y
//---- Enter your exception handling code here -----
" {/ ^0 d- G1 `% {& ^# N errorCode = 1;1 G1 J, y [9 ]( L0 _2 E# e# P
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
" `" H; w1 B1 o- j+ O' K, s7 Y' r2 R5 \! Q }
: J* D0 B+ S- A# j) Q; L return errorCode;
+ M0 L6 `) Z! z+ r }
- }5 R, B: R& n/ m' e . B( T+ z4 Z, U+ p
//------------------------------------------------------------------------------3 s$ j& [+ \' P& O
//Callback Name: filter_cb1 V' h2 `- b( n/ Y' k6 y
//------------------------------------------------------------------------------
# h) V. j1 Y! X/ T* v+ H int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
+ u* A6 E6 a6 a! g, u9 b {
5 \" A$ I" @+ m3 g0 J3 u return(UF_UI_SEL_ACCEPT);; A( J. _7 H2 g& j- u1 l
}; }1 D r) b# b7 @* p
4 _ o3 Q3 w' Y( @3 X8 ^& C //------------------------------------------------------------------------------
q7 b4 y9 \8 [. ~0 f void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus), d: [+ J( I( |2 K+ u. T% L3 f
{9 F8 R$ L- Z1 I
try
; \: s' f2 U( I {" s2 A0 I$ x. S/ x6 J
//---- Enter your callback code here -----
2 l! f% v9 @. b. U5 C }
4 F$ _5 g& T" L& Q catch(exception& ex)
1 V# \/ ~5 ^8 q) L( t8 f0 M" N {
4 u* B( e. E. k* e$ f //---- Enter your exception handling code here -----6 g' D" D. K) u3 O+ d" q e
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
" L# {3 y- `% o0 o1 ~/ x }! J. ~5 \% O8 U6 e; U* V
}. y' _, X2 q- B. }) f
8 ?& A0 v9 i) P! @8 b& N. ?
//------------------------------------------------------------------------------
4 n/ `# D1 `9 Z! H3 G5 G! F void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)- ]# F! E2 @4 r8 M6 k$ D
{
) Q1 V, [; z( Z6 f' j try
( D3 R8 \( q! L; s* ]: T {7 x* V4 U( b1 e) m5 i8 @1 A$ k
//---- Enter your callback code here -----% Y* X& I- ]. J
}
+ h7 `# Y. h4 s catch(exception& ex) |' _5 w( H8 l- Z
{
: M* J6 B* b# M/ W* h) P: Q5 Q' d3 [" m$ \3 r
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
6 w( j# L+ r3 d- }" o. ~* T5 B }; u" A4 S3 ^) g% P
}! c1 G" |6 `2 O+ B1 k; B0 P. | e
* p2 D: Q$ k8 a& C) \$ S
8 K) [( X7 ~3 j! I, c' F1 F6 q |
|