|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
/ x( l8 M v! P: a, f$ l/ q: b/ s4 R$ Y9 X% i+ ~2 p
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr1 x% r3 v3 J' D# g7 J
代码如下:
8 G8 [1 [4 p$ a; c9 J" c#include "Shrinkage.hpp"+ c. E1 w: E1 g! a
using namespace NXOpen;, A! G$ `* \, |& e
using namespace NXOpen::BlockStyler;4 b6 w$ {- |2 n0 s! m' |4 l/ ^" A
9 i9 X1 l- q R* j4 bSession *(Shrinkage::theSession) = NULL;
/ i- d2 F. i& V7 P& `6 M2 WUI *(Shrinkage::theUI) = NULL;
: o& _% M1 m+ e5 C: r: F6 w& w0 w+ d; P
Shrinkage *theShrinkage;7 D0 u/ m8 Q5 C' i0 X3 g0 w
5 K5 `% T0 s; n [2 s! Q7 k, ZShrinkage::Shrinkage(): l z( q* e+ W1 I; J. T% W
{& ^& B5 c- j& E" k* c) g# R
try
* f1 o$ [* O# G7 K; j/ X4 x# Y {
3 [/ r5 _ m7 `: \+ @0 o; I5 Z3 b/ | // Initialize the NX Open C++ API environment
: u$ z" P. N& O+ Q4 ` Shrinkage::theSession = NXOpen::Session::GetSession();8 d0 ^% w8 X q
Shrinkage::theUI = UI::GetUI();
% v/ E0 Z2 k+ l' D( ^ theDialogName = "Shrinkage.dlx";% o/ w! W8 D- E6 J
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
% O& c& l2 z1 u' L // Registration of callback functions" T1 z1 h7 M5 r9 [6 [
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));6 x2 {1 t; C* M
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
- n7 e' |% D1 S2 A8 C theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));7 o0 t7 [8 N% ?+ f }, `
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));; q' B, e) e, i% Z
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));" x% ], u( ?3 y8 h0 O
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
: u8 _! A" S' r# S* G theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
/ f2 d3 |# l/ G1 C( `* o theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
# f6 y% J. j4 g6 N9 R) A }
1 Z% z& O- i, C w0 g" M4 j6 e caTCh(exception& ex)7 ]/ R9 C0 \" g$ n$ C
{
3 d t2 `* X' r L v- @6 j/ ]& |
% b( g% H" H% j' ]2 U throw;
: P/ F3 j7 E g9 S5 i }2 Y0 i& Q4 i1 ~ i
}9 q# ~1 N3 Y) e+ K
% {7 p. c. J) W. e) e) uShrinkage::~Shrinkage()6 y4 i) T! A5 w/ l1 M/ d3 {
{# r) L7 g( a: y3 u+ M0 c
if (theDialog != NULL)
1 z3 Q8 s" U {# c3 X& } {7 Y& z- F, I, M6 d% A9 C+ U
delete theDialog;
' ~! v# x) J w4 h2 K theDialog = NULL;0 d3 V3 R' A- Y0 b6 v) n8 _: B
}
/ w) ?, b2 M2 m) `) T/ X}; x. `) k, u7 G" ?) I- g( L
0 }$ q6 F9 {* O* w' M, Q. ?#if USER_EXIT_OR_MENU
; i) n( z( f7 A: Z, f extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)! G- s- ~9 b7 W$ q/ [0 J% t: y
{! J, M2 o2 ]" W f& T+ l
try
4 y# u; Y6 U4 y1 @: h {
. C. R! C3 O6 ^* j. l0 X theShrinkage = new Shrinkage();
# R& t. g7 b1 p8 U+ J/ ? // The following method shows the dialog immediately
' o- t2 k0 J- i theShrinkage->Show();
. k) Q/ v# ]) u' G) S }: q$ y( {) n6 I5 D! `
catch(exception& ex)
& I8 E& q/ j! z" `* y% { {. j, `+ s X# ?8 T, F |* g8 h
//---- Enter your exception handling code here -----
2 a5 U3 m7 T9 h3 G Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
5 D% r9 m$ o3 n$ v$ ^+ r }& `7 h; Z) O+ H' \3 j' V( ^& Q
delete theShrinkage;
, [! q/ e6 j. ?+ N8 J' k }
8 @0 l+ m3 L" Q' l1 l( ?#endif//USER_EXIT_OR_MENU4 p5 W( l$ t" J t
#if USER_EXIT& ?4 j4 J! w; g2 K; M6 U! e
$ l& d& p# V- Q! `
//------------------------------------------------------------------------------
! |2 |3 z4 }1 W$ O# X! f 7 Z! V! f1 d( G+ w
// MUST NOT use this option since it will UNLOAD your NX Open application image- e! f* T0 b2 [7 b9 `" L8 l5 w% c; L
// from the menubar.
1 w! t; j) }, F //------------------------------------------------------------------------------
5 E: C( s+ j& V8 n/ m extern "C" DllExport int ufusr_ask_unload()1 f W2 ^/ o0 G* L' [2 s$ F
{4 \0 R* i5 V- P0 {, N, |
//return (int)Session: ibraryUnloadOptionExplicitly;/ o8 H6 p2 d1 [$ s
return (int)Session: ibraryUnloadOptionImmediately;; D! K( b9 F: m4 T
//return (int)Session: ibraryUnloadOptionAtTermination;# S+ W* _ r5 P: b3 S( B7 I: l5 I
}
% Y5 t1 Y/ S6 a) x2 \0 D8 ~ 4 l b v9 u% m: @1 k3 |
//------------------------------------------------------------------------------
" w5 W, s. d+ U$ {8 \# o: Y // This method is automatically called by NX.6 o0 X, T- s" i! f
//------------------------------------------------------------------------------
" W1 ]( j0 T! L) ?) m! I extern "C" DllExport void ufusr_cleanup(void): l( V; B* Q$ R* ?( N1 M
{4 K3 } v4 G9 F! Y* ]* o; D
try
- j' }' W7 F% R$ G {/ p7 u; U5 y' ^9 x0 l
//---- Enter your callback code here -----5 q2 B; I8 B* |0 Y, D$ U
} j: j! v; ]0 g
catch(exception& ex)& N) R7 e( E ~* q$ B4 V8 D o
{/ e6 ^' e' ^" _ o% ^) E2 j8 Y
//---- Enter your exception handling code here -----
- o3 P8 I9 s& E5 O) C; M! r Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());7 @! [" z* |" Y3 s0 X/ A$ k# @& A- ?8 w
}
+ n# \. s) e- A; l5 P u }# j1 L8 O2 I2 w) U2 N5 ]/ n
#endif//USER_EXIT2 K5 M5 S* P, _, Y$ s
6 f1 b+ @3 ]2 ?% w) g int Shrinkage::Show()
! l: b. P4 t$ Q+ U/ a( P {
* j9 T& V- I" S9 ]3 p* I/ o try: Z N b( }$ ~; t8 Z | j
{7 a7 o6 t7 e; M% f* G8 L, J+ M
theDialog->Show();, }9 w% R0 F- b. j" `/ e
}
" \) }# g: e% T+ h& i catch(exception& ex)
+ Z% ]% q+ [& u8 h: p F/ ]2 D {
: W' V, F9 z& \ //---- Enter your exception handling code here -----5 h1 `# \% F1 ^" y: q5 _
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());. m! R: z# t/ u( y
}
: i2 m6 u6 }. H6 M6 s. t5 l" K return 0;
6 Y1 F( K! E( J6 K8 \1 Z }
- d. Q: L8 h$ N8 X7 M7 ^/ Q+ {
$ |! \1 a4 @1 V0 N4 p2 x7 P1 z#if CALLBACK1 D0 t( ^" D! P; W0 K
5 p$ Q2 `3 ]; |0 ?) |( b
void Shrinkage::Show_Shrinkage()
6 ]' H. @8 n0 M: g3 W& Y {
" G. h1 Q0 C4 S' m try
$ @/ Q& |2 a4 E, w r {2 s {
- k' l4 F) { P theShrinkage = new Shrinkage();7 |# C0 r+ R7 U" O
; I, C8 b0 I, _ A3 C$ E1 ]$ E theShrinkage->Show();: k, C. Z& |" D3 v, }9 q
} c; f4 M. `. T
catch(exception& ex)
6 m6 m; G, e5 Q6 S# H! D. n* H3 x {
+ V7 g2 v& b8 E1 v1 X, ~1 {7 U9 S
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());, X4 c% b: H2 b8 ^/ b8 \! P
}
5 r# k; T2 z$ A delete theShrinkage;0 P# A( g6 n' ^" f$ K6 C- O
}
1 W9 J% s1 ~8 g& } u#endif//CALLBACK* R4 @1 y! m/ F/ P. ~" }
: w7 j- j- |: i3 ~+ o3 }! t* g/ } void Shrinkage::initialize_cb()
! T8 A9 l9 a# e5 [1 g {; y6 v8 e1 p/ Q; M" G/ y
try
, @/ F t% c7 s. S5 E) [ ^8 Y* { {0 a2 U$ i$ R& ^ n4 v* N
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
9 q% g2 r- |& g" i X face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));9 ? d* ]; f: d& C& j
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));- t' u' I, ?( e+ B5 J: q
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));" P0 |+ x0 D2 N7 v# {: q5 p9 g6 R
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));3 S, v- D8 y8 T/ W* y/ v
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));& q3 l3 x( x M' q6 B
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
7 y+ ~" }' o) D) j: B string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
7 h/ o6 k2 p8 h' @( s; r5 j label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
$ o( q7 C3 r. b! h3 Z/ A2 t string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));# |+ s& N/ \4 J3 F
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));: N1 E9 l" ~! S( N
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));. G. m9 G% b4 I) q$ x
}. F. u& ?4 Z. `3 j
catch(exception& ex)
/ D4 z. s3 g7 a. j5 w {
9 r4 T9 O0 v& j0 ~+ Z ( n% K- a# Q6 d+ ]
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());2 h P! ]" A& S9 V, m) b
}! ^6 `3 J3 X* \
}! H9 o% e% t f, R, y
//------------------------------------------------------------------------------
$ p G! S+ ]* o1 V" G: c void Shrinkage::dialogShown_cb()5 y* Z1 u y5 ^: g) k
{- H; H" u! R7 X+ B
try" V8 Q1 R1 g9 o8 U8 }9 z
{
* M$ J' `: w) E' g //---- Enter your callback code here ------ v7 Y: c$ u9 {. G9 Z
}
5 m5 f" Q' X$ L9 a# }5 w1 @8 a" g- ` catch(exception& ex)
3 p" x" D8 ]. }* N { \7 l1 A6 U! N3 O7 `
- ]6 | U% z! k, M4 Q) }/ e( H Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());) h. [" w( }1 E
}: G- m( Y! W( P; E7 }
}
9 Q2 n; `; C( ` Y% V. _- _ ! ^1 e4 W( Q- I8 K1 f
int Shrinkage::apply_cb()
T+ r+ f& d/ {2 ` {
, g+ M- H. a' E. [2 r int errorCode = 0;
% d: M6 l" b3 P5 g3 e1 R try4 s$ T5 M. ^& I, c
{8 D* g& {+ s, [/ d/ q* l
//---- Enter your callback code here -----
( W: ^. |2 k- I) f. @( I0 ` }
7 T# ~5 S: T. [) Z( i catch(exception& ex)
' e: c1 x/ ]( r# R, F {
8 L$ E2 M+ I0 R //---- Enter your exception handling code here -----. I6 j k# }; v0 K8 `$ a
errorCode = 1;1 E5 \/ }/ S% \& V- f
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
: `' Z' @/ S" m5 I5 j }
( _$ S L: I2 S4 p1 b& f return errorCode;
! Y- J7 k- c* d7 ` }
# \% j1 w3 T* m1 i# H$ j& Y/ ]8 E8 D
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block). X' y- D8 Y6 O& G( P1 g
{
# l5 P. k8 q6 `# U: s try
: \# O2 s/ Y3 ~) ~# V4 Q c {
2 V5 \" T2 H& d. q7 g3 i* ?, P. } if(block == face_select0)6 R0 k: D% l' c- z$ Q
{
1 M7 L8 ~1 }/ R% O //---------Enter your code here-----------
6 ^* ?, |- ]' z+ u" A( `/ u }! c$ x* p( q! J& H p
else if(block == face_select01)( h' n0 ]- ~+ y/ ]3 h G& i: _
{/ l$ K' ^3 l. v
//---------Enter your code here-----------1 o, y* L; H* q, P1 [8 [1 \! y
}- q* p+ w) i4 K/ d5 \& J/ }% m5 h2 T
else if(block == bodySelect0)0 j- g6 C; [, P0 S; v
{
) Q! ]4 h- r+ i" n- [ //---------Enter your code here-----------3 i& s4 U& S9 Y. u; R0 m
}3 j% g+ N% Q6 [- l8 v* P
else if(block == bodySelect01)7 M. f- q. N" W$ R
{9 s7 w# c/ k2 a
//---------Enter your code here-----------* i$ q* d1 a. z/ `) e$ `0 S
}
( ?6 i* L$ y* G0 |3 L else if(block == string0)
+ u1 j: ] y( o% c: t: c {
! u" d8 ?& m' i8 I //---------Enter your code here-----------
3 v' U6 U- _* u# F: Q- H }
3 Y% y& V$ t0 M0 x2 P else if(block == label0)
% ~* B' D2 v# f, {5 B, f3 T6 W; m {
; ^# J' ]3 X; ^, N, O8 ^ //---------Enter your code here-----------. l" w- F, U6 Y+ Y3 O0 o
}
. n" a1 \* O2 ]- E+ ^4 E; P else if(block == string01)* M5 N8 k3 h% e2 ~1 g5 Q7 ?
{
! M; q! n. i$ l9 e+ ]4 N# ` //---------Enter your code here-----------: x7 a% J+ l/ ^& d: s; e- o* m3 Z
}* B& K' T _1 Z9 I0 o
else if(block == label01)
3 b1 I4 o. p, v5 S {* r4 u$ D* r& J
//---------Enter your code here-----------. O1 r8 V0 P0 h+ n; Q0 q
}8 D2 q; R7 J* J' G. v8 @- b9 G3 J1 F/ c
else if(block == label02)
* ]7 Y% w! B7 C& I. \ {
1 u# ^) C/ F+ y+ m. {1 h9 q i //---------Enter your code here-----------& s: o+ g; M3 w# p! F2 p
}3 B6 I3 I4 n' Z
}+ a7 H$ @% O7 i" i
catch(exception& ex) f, E$ t: v( R) R
{
& s' l2 M; U' C! p Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());+ D- ~8 |4 ~* g$ g! O! ]
}
% t; Q3 U4 t5 Y4 @1 O return 0;
8 F3 x+ B! V5 [0 I, H }! i" t$ d# W9 T5 U0 \) h: F q) T
5 M9 \ [$ _6 G# w
int Shrinkage: k_cb()
2 S% I3 D3 B# t5 I {
/ G2 a& j, `8 y; w+ }0 U6 B5 g int errorCode = 0;
% [; t: ~9 D* l/ S% D9 ] try2 L. y% I1 A9 i0 A' \/ [5 [
{$ H' J- @- l0 D: E8 x
errorCode = apply_cb();( i* K4 N$ u2 m7 g; }$ K& p
}" V1 G6 s6 S b: W
catch(exception& ex)
0 V5 x; }6 e( A- x! s) h {
$ i9 K; S$ m0 W; u //---- Enter your exception handling code here -----
! o) ~" f' K" w) H" n! s errorCode = 1;
: G9 u b/ ]/ c; [6 M Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
A( {$ N6 q2 w+ i9 K" U }+ q9 B- A0 q) Z6 M! w1 G" X# c. z
return errorCode; M" X( u3 s# b$ X( A2 w
}
2 [8 H w8 W$ j8 t 3 `6 b4 O/ h7 J' V; j4 I
//------------------------------------------------------------------------------$ F* D, G( n3 y5 L# |& d: m
//Callback Name: filter_cb
. @8 G1 y9 d, W0 _ //------------------------------------------------------------------------------* |6 S. F6 H" i/ h' S
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)3 u% Z5 j2 [7 j4 |# v$ V7 h
{) o! I5 m* k4 |$ L9 B
return(UF_UI_SEL_ACCEPT);0 G% ]8 i1 y, D! |9 O& K) G
}) S5 i9 q* V" b C9 t+ i
, ~0 a9 b- z( I2 [/ w4 f. ~5 D //------------------------------------------------------------------------------6 `$ N6 p4 s. l- L- \( j
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)6 p0 h; ~. m7 X
{
3 p7 k. }6 S7 Y! R try8 B8 B6 @% g3 |# O' r
{* \3 K0 O K" g1 L j
//---- Enter your callback code here -----/ T7 E) B( x7 @, l0 e
}
{; f9 f4 h- G } catch(exception& ex)& h3 [. y: ]$ R: K3 X4 C
{
4 }) ~ R- x1 I0 ? //---- Enter your exception handling code here -----; N# L' }) u2 l* @: q# n/ K
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());- d$ m- W8 F8 @: t
}
! N/ b) d1 U, Y5 {/ a0 k/ S7 D }2 K+ f U* c3 O1 K n
+ L( Y+ X, P0 r, x5 {4 n //------------------------------------------------------------------------------
0 }) h. ~9 F+ O; n. \9 ]! O: J void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)# R) s# d7 v/ e/ ~* O, h6 j
{5 G* P9 o/ l3 Z
try
0 U) ?" b! y1 ?4 Y( w5 K8 j {$ R! w' `9 W1 t' W( P1 @% Y
//---- Enter your callback code here -----
5 B& Z7 |4 q% M& i' x4 P }
2 z6 {7 j5 g1 Y4 \ catch(exception& ex)
# s% r _+ g. e9 R {
% w6 o3 C: E2 v% w" C" n: W# O- D1 n( J
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
5 C6 q' a4 C; A5 |5 X! B+ I5 ] }: K$ i' c0 |; c5 R. H b V" P3 \! I
}
( U: P8 U. v L$ H
! y, V( i8 c% r2 @" r; f, i% \( X
|
|