|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 4 C9 [& p& ^& T+ E6 x: d. S
; `" p' v" B* X, J4 c4 T
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
( s$ ~* V6 }# I! e* H5 f" J代码如下:
( b; j5 Q/ e8 \#include "Shrinkage.hpp"
9 ]7 f, o6 P& Husing namespace NXOpen;
6 |& E% ?1 Z, o; x8 |% c8 Uusing namespace NXOpen::BlockStyler;
; N$ E$ J& L z' b
6 z1 |5 U. ]+ w$ _Session *(Shrinkage::theSession) = NULL;
9 [7 P5 o* v: f( p0 z+ B) HUI *(Shrinkage::theUI) = NULL;
; P8 O9 O- D; T, A ?9 e9 q P! v/ f) J/ S
Shrinkage *theShrinkage;
7 ]( t" G" h9 E- m- g
% {% Z' W$ Y; k4 LShrinkage::Shrinkage()
. R! n+ D, Q- s, G% F; @1 ~{
: y: d1 e, C$ J try
! V7 I, h, x) R$ n' v4 n {1 M, F# P$ k! r5 l0 q$ h& g
// Initialize the NX Open C++ API environment/ \$ r+ M8 O6 `- F& a
Shrinkage::theSession = NXOpen::Session::GetSession();
+ m# J' E, \ o* p, Y* { Shrinkage::theUI = UI::GetUI();
1 E: n5 L b, R5 c5 p- Q1 w0 } theDialogName = "Shrinkage.dlx";
- v6 o1 @3 ^. h3 S theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
9 S8 e( }, B4 O) n* b% e // Registration of callback functions
9 t3 l( T' O& X& N a7 X theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
! w$ u, i5 V+ l theDialog->AddOkHandler(make_callback(this, &Shrinkage:k_cb));
( a: j4 ?% ^1 z$ D% } theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));$ R; }; x# f# c2 w/ D4 P
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
: j8 m e6 m1 Q" I+ B' Z0 V theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
" g9 P& | s# d6 l. E theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
; Y. l: F0 U9 K theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
5 a! b5 ]$ v T9 A6 U: ] theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));$ ~4 [! f8 K3 Q. t
}
% s& e6 L" T% e. B& G( ]8 E caTCh(exception& ex)- u- a9 _: T, J3 K W/ o
{8 S3 `/ U& v1 `
o( D* ~- v! I; V
throw;8 d, {, L! G6 C8 O/ x- h; U; ?
}
& |6 t0 e0 b6 K) _}8 b; m" n5 P/ c8 m
5 G8 A7 {7 L; w9 |- E) o+ `) x
Shrinkage::~Shrinkage() w9 ~7 J. e9 M! B+ E9 i
{4 m( j+ h8 }* A' t! O. Q+ c7 c
if (theDialog != NULL)
6 Y; D3 n; \+ f+ C2 n7 ~ {
- ?0 z7 U! ^* {3 I$ H7 X* R2 X delete theDialog;
" {8 ]) z! l0 G3 j5 a! b5 i theDialog = NULL;
- G# s# C9 [/ ?0 \, S! s$ D }* V5 x1 ~7 D9 x/ X" v ?4 z/ ]$ |
}
, T: Z: d/ n8 } h7 A1 L6 @9 B/ i L* V- y
#if USER_EXIT_OR_MENU
& k1 e7 M2 U# q% T6 A9 M extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)& _! p8 r9 @- w: f
{
% c$ P# p8 m2 ^; W try4 y- u2 l# X9 V2 c' Y i$ d
{, ?# Q9 K( A' u, C8 c* w/ D
theShrinkage = new Shrinkage();
" R( i' x1 p2 d% Y& s- m% P // The following method shows the dialog immediately& U, D/ }1 P; r' l: Y& m
theShrinkage->Show();
. S& k: f$ |6 i& L/ d }1 W. X) z% g8 h& q" {/ v F
catch(exception& ex)
! s1 [& i/ g/ ]. Z, K6 t k {4 S2 {5 L. E- T l3 X' t
//---- Enter your exception handling code here -----
# K/ B( A9 _7 U A4 S* t Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());: |8 ~; j) q: M5 u6 {
}1 v/ U2 W* j& n) D
delete theShrinkage;. A7 ]& R% q" p" u0 P9 I! l# P4 I
}
& A" M" _* d/ Q* i+ K$ L#endif//USER_EXIT_OR_MENU2 k! E9 F- w) H
#if USER_EXIT
/ q1 d/ ^7 p$ r: Z& K+ y9 q0 }( t 1 g* k' A4 }8 a; y: Z
//------------------------------------------------------------------------------* D) o$ x' E9 E+ _2 u1 L
3 x( I% ^/ r: R! s8 M
// MUST NOT use this option since it will UNLOAD your NX Open application image
/ P9 D- m4 @& _4 A+ g2 ] // from the menubar.$ E$ E* {! B" w7 T; O9 h
//------------------------------------------------------------------------------
5 o3 h" l- l) a% ^ extern "C" DllExport int ufusr_ask_unload()
! R4 G K$ o, s' w) g/ o' m {- ~9 P3 a' m6 V
//return (int)Session:ibraryUnloadOptionExplicitly;" t5 P6 ^- C8 A$ m: A
return (int)Session:ibraryUnloadOptionImmediately;1 V9 I, m! {) w# L, F! b$ a
//return (int)Session:ibraryUnloadOptionAtTermination;6 e. ]/ W% R( d5 [
} ]2 o8 e& L0 @, \
% e) x; A9 F0 ^/ g# A$ M# l) v //------------------------------------------------------------------------------
6 {1 ^& h2 b1 H7 k' l4 y // This method is automatically called by NX.. R0 q& Y. J. i1 R
//------------------------------------------------------------------------------
( p3 t8 ]0 o1 N5 K8 Q; N extern "C" DllExport void ufusr_cleanup(void)4 U& A5 _9 Y3 J
{
: N6 m+ a. D, r8 k; P$ ? try
$ ]8 k; x9 O, v$ e; n3 _3 \ {4 [6 o4 c) U$ c9 ]$ J$ d
//---- Enter your callback code here -----
1 N* m" w# d& [$ n }
1 a0 k3 ]# R! r$ \ catch(exception& ex)0 Z K- T' t* ?3 U4 e
{
- K" @( V# E1 h5 u) T- J: Z" A //---- Enter your exception handling code here -----( Q8 Z! V$ `! {6 s4 k; T8 @
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());2 G6 v( p0 S, v
}
/ n5 u% y7 ?+ S3 }2 s }
- V: {' a% t( s/ e3 q" ^#endif//USER_EXIT* _& u% J% H. J) _5 [- m. e
$ t+ C% s+ L( o- W: P- _
int Shrinkage::Show()
' |0 g6 o9 n# h {! I, @* ]5 }$ d, j/ g# s. i/ @
try3 m& ~ G/ ]7 ~ p
{
: X+ S! R9 d$ z theDialog->Show();
3 M( l7 n) L; i* u }0 \3 d0 r, l- f, k
catch(exception& ex)2 ]6 d) k' D3 p1 E+ o5 M' o9 o% P: G
{: b# L" O4 J+ W6 b5 V# w
//---- Enter your exception handling code here -----
8 r9 A6 i+ S. B- U6 E# S# _ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
0 [3 g: J* c5 Z) v7 T/ W0 T6 z }
; d# |7 y1 u. O0 v3 T) Q return 0;# k. I2 l2 A* _
}4 c4 I' Y2 X6 t2 E& k/ M
' T/ r8 T8 W" [ y1 @9 s) x#if CALLBACK
7 B& L' Q" y, {, B1 t
2 [7 v& g1 C0 ~3 [0 k void Shrinkage::Show_Shrinkage()
% g0 B8 V9 F4 A t {) \* b/ d# A2 ~; R9 N- ^- A( F2 c
try
: D. @: W5 R; S/ s% X: @6 @8 k* e: B {6 O5 m- T& H; _: L" t
theShrinkage = new Shrinkage();
( k ]+ N+ a& w& s* R: I$ {4 J# L, ~# E4 E9 R# {/ d& d4 D
theShrinkage->Show();. v, U/ b3 U: G
}' R# d$ l. q5 T- A' e8 \4 e! N' r
catch(exception& ex)
6 o1 K% v4 @; C! V6 c9 g# y) u {
# f' V5 t1 k; M6 I% n0 I1 a& Z4 {/ Z. q4 N0 h* N9 X4 Z, g
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
+ j9 ~2 m6 v ? }
+ J/ b6 l; T$ |2 X delete theShrinkage;
* P9 ?7 X; {& |- Y }
( ~) x Q1 J' }& ~& n+ g#endif//CALLBACK
$ a# Z5 ^8 b* o5 s6 z/ ]3 c1 S0 z
% B& }8 E* g1 m( V void Shrinkage::initialize_cb()7 P; l; u, \# l7 c. c' A# J6 B
{+ U) V S6 D$ W; u
try" G- u3 g( @3 E; |
{
4 o' {; V, k, T) Y6 G) k group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
4 M7 L" @$ L& U j% O face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));; q, D# K/ }+ k3 p3 S) t
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
; w/ w: D% T( A group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));+ L( W. N, L2 M* T; h1 C: v# l
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));' J# {% c0 X3 k% y! h c, |
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
2 {" b; o4 M% X3 X$ Z; Q4 G group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
" v+ Q' C; v/ ]& M+ d+ ` string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
; C1 R+ J! @8 l* Y' U+ X label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));' ~7 w) L$ C3 i
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));) e7 |$ c6 q1 e8 w" n) V& U
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
, S! m0 g* |2 C2 T; K: r label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
# o V+ y/ U9 I& j8 {# t! U4 H M } L+ g K" w/ b9 E
catch(exception& ex)
2 q$ ~5 E# z" U+ [ t {
2 W# z0 `, _* H2 J& ^4 z# J
( n9 `7 u6 C; Q0 p# V& V! P& R Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
! Y% v) c# d% C; @* E" b5 { }' S( q, _7 x: a1 q0 S3 K
}
3 ^, j$ l9 |4 K8 I' O6 @1 \ //------------------------------------------------------------------------------
: {! P+ m: o! \2 K void Shrinkage::dialogShown_cb()
. M: V, v8 ~ _& J {* ]/ c1 v$ ^: m% g: F3 l$ Y
try
: C. y" e+ o! T L {# W9 e8 G) i6 C& m
//---- Enter your callback code here -----
' Y% H, }9 ^) N) d }5 r$ H7 [ U$ i7 q
catch(exception& ex)
3 S" ^+ I! b7 u6 a {
' L* G' H6 j$ E h: R
) g$ E" @" s( |1 v+ F Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());: W# f7 a; U6 f: N$ Z" `$ }3 U w
}6 ^; F! y5 E2 e2 }2 C* ?
}2 I$ T: l. I* N2 ~, r8 O+ a( N! R p
% ~0 |$ {& \9 s- T int Shrinkage::apply_cb()4 [0 W/ ?. Y" U, t
{3 S8 X: D. d8 t
int errorCode = 0;( j1 \) k; u, ?
try
9 s/ F: f! d3 {6 z5 V. d4 @9 L* d, d {
1 N# }, m0 N) ^; W2 _5 h6 g+ a! O- b //---- Enter your callback code here -----5 H0 V# ^+ Y+ j0 ~' H
}
$ ^# _ [! I2 F3 N' T, y catch(exception& ex)
; z) g4 F6 z3 }, I7 T. } {
4 f S8 ~9 j5 Y( U* { //---- Enter your exception handling code here -----
2 Q" p' M0 a5 h: m errorCode = 1;: X- `9 c. ]2 H
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
8 @8 t7 u' [6 z6 p! h3 ] }0 _& d" B1 V% j) e; q* }3 N
return errorCode;
( ?5 U h& A: _! [% [! o8 l( G ]4 e }
/ | L. ?! s% j- m+ y/ i u. f) \; K0 I
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
) a l% j3 y9 L5 \ {
- R- V0 ?# W$ Y: |' k try
+ i( w, t9 U: j6 j2 W {* Y, H3 ^1 P2 W% x% ]( S% f
if(block == face_select0)& n& K0 d4 }; f# c2 I
{
# K8 a* f% \. {. x2 |; H& k8 G& n0 | //---------Enter your code here-----------
: i1 `3 R5 D+ v9 n( V, R2 c }4 s- {: H# @9 [
else if(block == face_select01), X0 O5 n7 c+ L) X# q/ S' ~
{4 e- M- T1 E' q; S
//---------Enter your code here------------ d+ B9 t3 \* ?( p; s( t
}
& X% Z% v1 q: u" O' ~ ]# T4 n9 Y; n else if(block == bodySelect0)
( P" }$ T7 K& c6 {* ?! }; }2 d {! [5 M8 P3 X6 M; A* P l$ Q
//---------Enter your code here-----------
. ~6 q% m' i" W7 h1 C* b+ q }2 Q4 Z, V6 U! F$ ]
else if(block == bodySelect01). _2 Z8 W3 B2 K( k' b
{/ Q& R$ l9 t2 V$ T+ u+ t+ z1 @5 w8 T
//---------Enter your code here-----------
5 v0 A0 H' ]6 x" j$ | }" V1 C+ j2 P& ~/ T4 O
else if(block == string0)' n2 k8 P. m; X4 P* ]* k
{
' N2 v8 }; H! j1 B5 a# e# R //---------Enter your code here-----------
# c8 e8 Z G6 m' A }7 |, h) h f) K y& _: t3 Q, M
else if(block == label0)% U( ^' R/ ?4 q. a$ W3 n
{
- {( S* |3 _) `: s) L" t4 w7 r //---------Enter your code here-----------# O6 q) |* a# S3 a2 i2 l
}% y. R! X1 V- j) i/ |: I
else if(block == string01)
4 e G" B7 p' J; N! W5 g {9 r* j6 W! `% y& @- o9 ~; o
//---------Enter your code here-----------
6 \. v8 O: E3 L5 K' y- K }! }# T& W) V3 j- c: ]- _6 Y( Y
else if(block == label01)( M+ ]1 C8 f% N3 U/ D) u
{ k7 [, U/ I2 U z' A, U1 U
//---------Enter your code here-----------" q5 T5 ~, Y; {4 D- `) K6 x4 k
}
7 @( M p- n y0 i else if(block == label02)
4 }! _4 n1 I$ R+ ~* \" R {! `! W3 t( l% t9 `, y
//---------Enter your code here-----------2 `- l% k2 f9 Y9 i, B! a" w6 a; Q) `
}
/ M2 W2 b. @3 `# F }& j) k; o) p# j/ L1 u1 |
catch(exception& ex)
. W8 Y6 y6 i: G _ {. Q" D' x F7 @+ A7 r0 \
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
6 G- I2 Z" }. T }
! E4 S6 f7 e. x* D+ I return 0;' f, j5 e0 I* N% F
}
% G* D ~4 M. n( `2 |) w, Q/ m8 l 9 {4 D7 O& f3 c
int Shrinkage:k_cb()
# l2 T: t. P8 E {
+ Q( \2 t5 Y2 W5 @1 v int errorCode = 0;
9 Z5 c( c! s1 r1 W9 `3 I M try' Y2 L$ [' D- x" s6 p
{! r7 X r$ }( v+ \- q
errorCode = apply_cb();! H6 w! P1 B) Z% D: X6 O
}
* ]7 \% \' k6 ^) |1 _ catch(exception& ex)
2 A l3 m* g: M5 ^ {
$ c% u, x; i9 x //---- Enter your exception handling code here -----
% p" y% x1 r: G$ { errorCode = 1;4 W: T: v0 U. d: ]1 m6 `7 F
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
6 O% |+ `6 e, f | }
" Z9 d7 U, ~ n5 J return errorCode;
! J5 ~5 ~, Q% B- H) B% R }+ X6 I7 d% M# D1 n5 Z
3 i, H. S5 V/ {: A: l. \& [ //------------------------------------------------------------------------------
3 u6 m9 g& O1 ?+ o8 I, }6 d/ P/ C //Callback Name: filter_cb7 A2 M, b2 o3 @
//------------------------------------------------------------------------------
7 ?6 k4 N3 L/ ~. \/ Y2 I int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
6 m* A* Y9 I+ y, \+ | {
$ |! [2 |9 Z8 q7 U$ ~' ~; L return(UF_UI_SEL_ACCEPT);
8 D% E8 F7 _1 u% w }
; a- Q4 P* U) j 9 m: i; ^9 @& \$ X8 ]0 T
//------------------------------------------------------------------------------
( k; G) P0 y+ m; i1 w void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
' h* R& d7 Q- I& L {* p+ a* J/ U, l+ T; ]8 K
try
. F& Y. \) G6 u/ m {
, o3 P3 ?7 u7 W, ]9 z //---- Enter your callback code here -----! |2 L) ?8 X4 u' |' Q( E
}; I. x8 R4 C B# y6 \
catch(exception& ex)
% A% x4 J+ V6 i I4 t# m7 g {
( I# w9 ?- E K. q, N //---- Enter your exception handling code here -----5 T9 X9 H, b% u: n% k" I
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());: X- T1 w" f+ k* F: b8 R4 ` i
}
0 Z, p9 S/ [7 V0 w6 f6 O }
! r: w0 x! M$ f! B1 h
, R/ X1 Y. ?+ [ //------------------------------------------------------------------------------
# i9 R% p1 O2 B9 A+ [ void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
( E- ~! G( y7 {" J& x {+ ~: d {
% x! [; |6 r' W6 [; z6 c1 P try0 L9 T+ y: u7 A" l) w
{
; F8 B* M2 U& e a //---- Enter your callback code here -----
% U! l& s5 K, r4 Q. B }) Z; {' r7 o* |, L
catch(exception& ex)8 ]; [, |- S6 b4 u! Y7 i% Z
{
" ?: _ P# l) ^( @- [# W/ I
. T. k) k: c! s: b( p, C5 m Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());. u% t7 m& P B; u$ l4 {0 T* m
}
/ U' x b+ @: ]3 H/ D }
& h0 _- ^) f( y, t, D( E- y. G+ h+ k3 H+ L
; E# i: J0 _: W' m" e1 H
|
|