|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 ' J! ^5 _8 v2 Q: ^) ~
. I2 w$ ]4 e* ^8 K, a
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
! ]( l7 L4 j) F9 v% S- A4 F2 T代码如下:% }. D7 M5 x k2 o/ k
#include "Shrinkage.hpp"4 G: y: j/ n" m% e
using namespace NXOpen;
6 |* b3 \- l9 P5 u, @( R2 nusing namespace NXOpen::BlockStyler;4 v/ ^7 {1 k0 w( n' L; `- k
6 t5 c+ i' f, d0 ~1 V4 TSession *(Shrinkage::theSession) = NULL;. Y5 v! M& E2 P0 ]
UI *(Shrinkage::theUI) = NULL;
! |% r# F; {, S+ U( G, R7 a. Q
+ y/ M# _+ c) s! Z# C, m' ]; u lShrinkage *theShrinkage;6 m4 C% m" p1 X; j& }% z. K7 B! A
4 `$ d& v( C9 g# ^6 Y4 q
Shrinkage::Shrinkage()
# ]: R1 o. P1 |8 @: W6 T' l4 A- t{! x7 j& i: x0 R) m3 k6 u$ ]
try+ P5 x; B, |9 u: B4 b; u
{. t: b, I" _2 G! J1 }0 \
// Initialize the NX Open C++ API environment( h8 P# C" e* g: E2 b d9 ` e
Shrinkage::theSession = NXOpen::Session::GetSession();
/ P$ `. Q. d" S; f# F1 | Shrinkage::theUI = UI::GetUI();
1 B9 H4 Z H, P9 o& D" T \3 C' H5 ^ theDialogName = "Shrinkage.dlx";# K' I' R! S5 q( T" t
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
$ Q0 p7 S2 ~* ?3 O6 I // Registration of callback functions$ T& T9 ^) J; }8 Q) c O8 i
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
1 ~) J1 Z! c* h+ x" j% _, v# [ theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
2 d. J& A, r$ w: r; K, r' C1 l3 y theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
/ X* n! W: o3 o1 | theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
4 W, D t' R* Y6 b9 q theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));% G' A$ C8 S. y* {4 [# k8 i
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));9 h- l1 J* [# r' x
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
7 O) n! e/ n! G theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
6 T' P# k$ v- _! z# e }6 ]" x/ v# t4 ?* l/ [3 _" z; i
caTCh(exception& ex)7 F8 X* m7 u: Y) O3 N
{
+ @! l& b4 q3 u% S% t! X3 P
' g" X. u4 |! v2 q7 C6 x) ]9 a( h throw;& c4 A& | O9 l. I9 K. X
}
4 V/ C# P1 d; d}
. B' w7 q1 n9 } M3 r( A* e/ m3 h/ i& o
Shrinkage::~Shrinkage(), d% s4 e6 z* \' j
{( e$ {" U0 I& {
if (theDialog != NULL)
1 E- @1 W! @! P# T8 a3 R) J0 t {# I9 ~ A l- a/ U% T! f* }
delete theDialog; |7 m3 u8 Q" y0 S9 B$ O
theDialog = NULL;
% j7 k8 d5 P+ X% }/ \( z% H5 J: } }2 M) H& Q" a Q& H1 l8 f* t
}
" E- N0 L0 N" T4 M6 g B
4 j7 N. U& j* ~4 F! ?#if USER_EXIT_OR_MENU
, g; L8 J; N7 K7 q extern "C" DllExport void ufusr(char *param, int *retcod, int param_len); w) u& d$ l0 {' B% G; P
{
B. v, X1 n R! h5 ]% d5 X try
' G: t& q7 y/ B8 P {9 Y- H& ?5 M6 O
theShrinkage = new Shrinkage();
0 A4 g1 [, A- N$ I7 I9 O // The following method shows the dialog immediately* O) k( l" m$ I
theShrinkage->Show();( D( |- Z. h k- G
}
+ x* } }8 R, I9 O catch(exception& ex)& I0 J5 F, {& y1 N4 @2 k
{$ O6 Q8 K) }* y, X4 N
//---- Enter your exception handling code here -----
9 G0 }' K( h: a, T Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());8 ]2 |$ F7 c! c1 d9 [
}1 x; T% A9 ~7 A; A( l
delete theShrinkage;
) O* t# `1 q9 Q3 H5 ^7 M, Y }
/ w% P" i3 K( C% |#endif//USER_EXIT_OR_MENU( p2 s1 v) m7 ]$ M# F. [/ h
#if USER_EXIT) T- w1 y0 d% c" {* ?' F
5 a9 Y- }+ P6 e/ O; | //------------------------------------------------------------------------------% I7 z, m8 v% @* }4 I) |" n L; x$ l) g
5 b* d% A& s |/ F3 } Q I
// MUST NOT use this option since it will UNLOAD your NX Open application image
/ w! f& q" q0 w. Z // from the menubar.
! U0 l/ @2 w1 o3 R) ^( }2 I //------------------------------------------------------------------------------
/ k* ` x- f9 C3 u) x! [0 V extern "C" DllExport int ufusr_ask_unload()
1 X _. l& S7 n) X0 ^( L {0 `3 X+ ~% v: O, D
//return (int)Session: ibraryUnloadOptionExplicitly;* i' s& ]; G6 y
return (int)Session: ibraryUnloadOptionImmediately;" q" ^/ D2 @) T- s4 u9 M: ^# O& Y
//return (int)Session: ibraryUnloadOptionAtTermination;( _* N( K, F& f: D
}' G6 _! R0 t. q# c# n% Z
: }5 u" X, P0 J( F //------------------------------------------------------------------------------
6 N% ?! d. u* N1 A // This method is automatically called by NX.: L! e9 M+ p. T+ g& _
//------------------------------------------------------------------------------
* T0 C! e, q# ` extern "C" DllExport void ufusr_cleanup(void)7 A F# S2 q; y$ R
{+ A [5 h. j% ^9 `
try# G& K& A: J& C3 x6 Z
{& N6 B8 I! b& j5 d% l4 h
//---- Enter your callback code here -----% ?, l8 M; f% c7 D& Y+ z, k) R
}
& P5 }$ d" k, u' U' s# g2 ` catch(exception& ex)
8 |# N3 F5 B" }$ G7 O3 [ {
/ t$ g2 W9 G) \4 G% l //---- Enter your exception handling code here ----- W$ v$ r5 I) L0 d! ]" M
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
. s3 ~+ l" ^. p! g* B }8 o( r b6 v# J# t) `7 f+ E/ m: S
}9 \4 x. i! l6 o6 o2 b* c
#endif//USER_EXIT3 ~, C7 e; h( t
( f0 X* T/ U5 I4 S3 H }; C4 _$ r
int Shrinkage::Show()9 H8 N- Q" \! m
{
2 G& {6 a5 n( e; r0 \' u try
1 a5 j1 l5 J# x3 T5 b {
) O/ U$ p! H+ q7 v9 F/ v theDialog->Show();, [5 f& n9 J; a3 s. I
}
' X% C0 N2 F. K9 n2 X2 y catch(exception& ex)
+ ^; x$ V5 v* Y$ g' p8 q {
% n+ H5 x$ u. S2 A9 x& m" C //---- Enter your exception handling code here -----9 r H8 L2 o% F
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
* L' k# d; L- W- c5 T }0 F2 _% u E1 {
return 0;
' [5 U- Q2 H* I }% f# }+ p S( W- N
7 M9 A6 m# k0 d4 \4 J
#if CALLBACK" i! @ C- I C8 S9 x2 F1 u/ Z
% \' {9 V( W: }1 w# O; T" w; _3 w* I
void Shrinkage::Show_Shrinkage()4 G7 ~# I! O4 q" R
{9 H! N6 i8 ~ d9 ?. U- B Z
try
4 R$ s7 y& A' h* l0 ^7 {6 Q {
7 A, `$ y4 S. I% K theShrinkage = new Shrinkage(); i: i6 h! t }
3 j+ E2 y2 o% z4 x9 J% l( M
theShrinkage->Show();- J p! `7 ?9 K
}
9 A! p. v$ K7 w* w1 F+ Y5 B catch(exception& ex)
* Y- Z( t! O* E! h9 J3 Z5 x {7 ?! _8 ]) D; C
$ V/ u! s+ ]' u
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
* v& r6 c# V# P) t y. V }1 h% S0 c: X$ N) R, T+ I
delete theShrinkage;1 H+ g" I. }& C$ M/ Y7 e ^; |2 H3 t5 `
}
g) |/ Z F+ u/ S- i. M) V$ { B+ l#endif//CALLBACK
" x( e( s" o; \+ Y - M0 f, Q6 T2 N, Y
void Shrinkage::initialize_cb()
; H' I6 E& n' U3 u4 T) [' ~. O {
7 \) r9 Z" F7 n% H h! @2 P9 T try
6 |7 [+ b( v: @1 Q, O6 K9 W {7 y6 H/ U: t# C$ f1 d& v$ ^
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));8 I- S [# O0 C1 I) p% z' K1 R
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
. y" A% \! r3 [# q" A" Y face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));7 I- \& u) L6 Y* Y0 L
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));, ^, D) O# M2 u3 o9 `: I
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));4 J8 O7 K+ _% s% j) O/ z5 |
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
* t: F0 N& F+ n group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));$ |) x* q% \ a1 M5 ?9 j5 G, f
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
1 Y# i4 L% u/ \1 a0 H4 ] label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
& Y% ?0 K, v8 o5 H string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));$ K, m1 m: Y+ G4 t
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));( I+ T4 q2 r r8 m
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
! X0 Z# ]$ b# l+ W% s* N0 V }! l9 m3 t1 m9 x+ D! r6 t; {- O
catch(exception& ex)' g$ L m) \# u- X! ~3 N. t
{( h1 Z/ R+ ^( d/ A& o7 p+ u
' O1 ^6 ]$ P |9 h! H: c# o# i
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
) o2 e6 L. W3 i. j2 U }
% j! ~! R. v' A9 i }
2 C7 t. n: |2 _3 x4 H) H* k //------------------------------------------------------------------------------ N. ~7 @/ y3 Y7 p) T
void Shrinkage::dialogShown_cb()
) _- a6 K3 Z* z7 P7 `2 g% ]1 a {4 L, X. x; F' X8 R( r' w" h
try1 k* W5 N8 d/ p
{% d \5 |; @; _
//---- Enter your callback code here -----7 M0 `5 h6 b" q: c- s
}8 Q" ^0 b0 P+ e5 x! y3 b
catch(exception& ex)' v5 Y6 Q& N! ^4 a, o$ S8 `9 d2 t
{8 x; b# k4 n) F" b
" e/ T* r0 l8 [& {7 G: e" C
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());) I0 y$ x% r% [( h
}% Z2 o' s& y0 ]7 ~( C, r2 E
}
: o$ ]0 j$ R O$ B: I0 Y2 s$ k
% P! A+ P" \7 u, s9 g! s int Shrinkage::apply_cb()% f u( e- ]+ q* T* V& b$ \$ y
{
* H6 Y3 W' r3 W- f int errorCode = 0;' _# G: k2 I3 I6 `2 c
try* R j# x0 L) D5 g
{4 q, g( b/ g. p7 | Q0 z' O( A
//---- Enter your callback code here -----. U6 O9 v2 |! h$ v( w, e
}
2 \* L6 N- ]" s( }* r) S catch(exception& ex)4 ]6 w6 P* l6 x; P* H; G
{
$ m' z$ t$ R( N( M' a- B //---- Enter your exception handling code here -----
$ R! h9 H1 A5 C6 X errorCode = 1;
" ^$ Z! I' n& [- s Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());2 s! K9 Z S' F. v9 C
}
( U, x8 P' b" r return errorCode;0 e u( ]- C3 Q: @2 o
}: u ~4 g6 @3 A" ^& Y" q
% U4 B4 ~0 p: G+ ^4 ]! R. Y: P int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block). a4 _; r/ {# D2 I
{+ ~, Q$ a2 q/ o+ Z! E
try
" r g( w5 L$ x( z9 P {
2 \4 a4 h( x: a- A" {: T if(block == face_select0)# r2 [/ {6 U t1 G$ a- ~" H
{+ N) P* ]0 a9 A6 }
//---------Enter your code here-----------
' ~8 C0 w! G. t+ y }
% G0 D% f1 m" Q p; L0 q else if(block == face_select01)* A( ^7 w- ~3 b8 W; a
{
: y0 C3 v$ U" G$ T //---------Enter your code here----------- g+ l+ b# t6 Y0 n
}
/ \" S% r. ^/ j t U" h& p0 X else if(block == bodySelect0)
' B0 v' k; x- w: }: k3 I {
/ d" H4 |9 ?# @! j% n$ ` q, b& ^ //---------Enter your code here-----------4 T8 X7 `- Y, Y6 n2 d. i* T6 f
}
: v4 Z& M3 n( h* ^ else if(block == bodySelect01)6 t4 c) X0 e. P$ z2 j4 v' M0 [( Q
{- O: E' y) K; ?* S0 b
//---------Enter your code here-----------9 ], @/ O" g' @9 O9 J, A& e& ^
}
, k; _3 t) j+ G+ a: h/ u else if(block == string0)* |8 Q7 [" ` m) i9 S1 I( [
{$ l! e- T" q1 e" H" V) X
//---------Enter your code here-----------0 F# O8 G# X* W m" U' w
}0 i& y) X. b* n: w; V% e
else if(block == label0)
* L* \, b# k6 | {( g- E2 o6 G7 h
//---------Enter your code here-----------
/ s, U% P& d# K1 }8 K }0 z$ L5 K) G, B
else if(block == string01)) _2 P! E/ S4 z$ W7 b4 X- B
{
2 s. p$ _) }+ z- \4 S3 G //---------Enter your code here-----------
' q. J6 H- }. u* _ }
1 K9 j2 o m0 z- @$ F& U else if(block == label01)
; E& J* u# b$ S7 c4 m {
2 Y* r7 l+ B# Q7 A" ]4 l7 N- j //---------Enter your code here-----------
" B" I4 {8 j( O7 h- d5 H( c: ?& s }4 i: R7 N" \. w0 @" r
else if(block == label02)
+ h5 K, J$ B" W3 g. H# A+ t2 g {: Z) |! O9 e9 \) m) x- E* p
//---------Enter your code here-----------/ Z* L/ w# G: a% h* @9 `* K) h5 u9 A
}/ K8 P) @/ C' C$ W: `4 z, f: ^
}, I( T- F: L4 w* t* N
catch(exception& ex)
6 j7 C7 ]* W7 a$ C- S6 o {% k! `- s$ w8 I/ n/ d
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
% f! X3 h3 l* c$ y3 s }
2 q- @0 t: J, j+ a& J- M return 0;! D4 `8 S6 J% f6 ?$ _
}
( }! K/ G, H# @6 F/ z: _- j
+ T) F$ `: o, N# ? ~ int Shrinkage: k_cb(); Y$ a" V. H7 Z7 |" S/ p. V
{5 g7 _! T( c/ U: \* M1 X' s
int errorCode = 0;
( T2 G# ]9 `3 h2 V try& x* O3 C5 C# f/ X
{
: Y7 H9 U* }2 ]& e* d+ u$ T errorCode = apply_cb();
* H8 o+ a& W4 X7 B8 F, b5 P# s }
. g* W2 L8 Y. {' W catch(exception& ex)
2 }4 n( f% b; F {/ b/ x; C. e% f P% A) T( M
//---- Enter your exception handling code here -----
$ E4 J! A5 V, _ errorCode = 1;
$ V% H8 x, m9 @/ ~ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());6 f3 F; J/ W5 N5 | K: K0 ?3 ]% `+ X
}
- ~" @5 R/ e* `6 C return errorCode;
4 g L: w$ _, y5 a }
7 O) F" t! d) S; {
4 F5 d) m9 M% T5 r //------------------------------------------------------------------------------2 P3 {5 {% k( n
//Callback Name: filter_cb5 s8 D$ ^& n: ~. r; |- Y7 d& _
//------------------------------------------------------------------------------
& D/ _& B' Y) k9 C! O int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)8 S/ l1 g9 L2 e
{
+ x6 O* Y! O1 J- F5 { return(UF_UI_SEL_ACCEPT);4 t. a Z Z4 e1 S! v' x
}) p- C4 q" I& N8 j" |/ ?
0 }. E! g- [+ ] j" S& X q/ K //------------------------------------------------------------------------------9 z- a4 p a8 h$ H
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
, v m/ x1 B8 u4 Q {
7 w8 x! a4 h) v4 `6 J try
/ {3 n. ~% ?8 J2 q$ [; z) X, q) } {% Y8 z7 i8 `+ m9 h6 y/ @' k
//---- Enter your callback code here -----
5 T, K$ f- A$ o( k, C* g }. a, w: t+ T& z! {
catch(exception& ex)" Z: H6 O# R* h) f0 o
{
$ A0 [, c4 e* C5 M //---- Enter your exception handling code here -----
/ G3 n( D7 _( ?( W Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());1 q, {$ H9 z- @( E; c5 Y
}
/ Y& K n" |( g" Q }
; x: ?( `* y" R3 ?' n
4 k" }; l8 Y7 A$ M1 f8 ]. o4 v //------------------------------------------------------------------------------
4 r1 @2 t9 Y/ I% _* b void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
- a! h4 X8 c' Y- r* U! X {
, h! h2 D* J, ^/ ?' s( t: u5 U try/ d" V% b8 h3 b/ r% c$ h6 g- P9 l
{
5 s% U2 H B* g/ w //---- Enter your callback code here -----3 ]- R4 M3 |. V9 _
}! O# j0 L& O0 I. J
catch(exception& ex)3 s! F" p9 `' m0 m; a' B- D
{
/ W- s0 ]9 M: C+ r; K& P( G/ ], U. ]/ S' F) k/ ?- V0 v
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());5 l. g6 D# D2 e% z/ g, m
}
0 d# c Q$ t/ `7 Q& G X; @ }- \ u2 _! N/ Y" _/ R0 V
* [! k" ]! A0 ?3 N1 G# I$ w: G. v3 j, Z. @" w. w b) a
|
|