|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 / C- Q `0 {6 L- J4 e% B' O
8 Q0 G; d! f$ p z7 }请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr( M3 ]4 {0 g9 d4 p: O3 k$ U7 B
代码如下:( t$ Z# B O1 g, ?& z
#include "Shrinkage.hpp"
' b3 z% v8 V& v8 ^! K' kusing namespace NXOpen;
* g& X5 k/ J3 N4 jusing namespace NXOpen::BlockStyler;1 G: l R9 S2 A
: _+ t/ M7 f; Q! ySession *(Shrinkage::theSession) = NULL;
. S; j0 N7 z5 W7 _# _/ W* |+ q6 Z$ mUI *(Shrinkage::theUI) = NULL;. X& @6 T, v4 I& W3 Q& t( c
1 ]! K: P/ u. L! m( a$ ], M- ?- J7 VShrinkage *theShrinkage;
; `% \9 f. n; X. p8 U$ E) _4 N
9 ^/ x! I+ u; T' ?/ W/ QShrinkage::Shrinkage()
5 n e# _0 A0 l{7 x6 D8 P. t$ w3 j! ~: I
try
; `2 S6 F1 r2 R( w {+ O6 E; J" x, N; }$ }* _ W
// Initialize the NX Open C++ API environment, _8 S2 c5 e) h
Shrinkage::theSession = NXOpen::Session::GetSession();6 r2 j: R% @( i, z2 @- y* N
Shrinkage::theUI = UI::GetUI();
3 j9 }5 x0 T0 H5 d Z) X theDialogName = "Shrinkage.dlx";4 _8 g I# b- ~( a1 A" T
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());1 v% \( J8 p. y/ v: v' F5 d0 k
// Registration of callback functions
4 b2 U" c" _- f3 Z i; t& ~ theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
# q- ^- x' P. C1 K8 i: Z0 H theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));* `6 |- a( N4 o3 j5 u
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));3 n( I0 V5 \ _: @& s5 _
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
, }+ Y! P5 }$ B( t0 m+ D theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
" i5 J& L$ u* ~0 b theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
/ ~) D( [* p1 z7 P3 V6 b theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
- C0 D' j. L4 \/ {! E1 t2 q& e theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));0 d& \! `; ~- t6 u+ y" {
}
& \! r& _7 e5 } caTCh(exception& ex)
7 S7 i! r$ @2 K3 F& \$ J# g& ?5 G* \ {, c) M$ M0 D9 J; R5 y5 y
! p! N, h. K4 [1 Y" ]) U throw;4 T3 A0 y9 O3 p% T C5 ]: G
}
0 ]0 f" s& W/ \ V+ c3 @0 c}3 H1 L( n, b' n7 I( ?, j
2 s `4 x- U/ P7 q% uShrinkage::~Shrinkage()
% d3 l! ~ q7 g$ N6 h* [{0 g/ K2 K B4 j$ E: o3 U
if (theDialog != NULL)
7 [9 E: x# n5 _/ ? {
4 _4 R; F6 r8 s, }! v& r delete theDialog;
1 O* |4 Z; L$ i# n, V theDialog = NULL;
. [* g5 ^- g& H8 E" J- a }( A) P5 l( M% |4 d+ t# M, j$ ~
}- k" `0 o6 d+ A2 Q, O
" z( }; g" v7 N$ }( V- ?/ x
#if USER_EXIT_OR_MENU
1 ?2 A, T9 m- v- b extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
2 ?! n4 C. {) u: P& c {
; P+ ^9 y7 E$ | G try
3 Q/ i1 y$ L) X+ U, W; z {
' A' T4 ?% i# P! D. s, h3 k theShrinkage = new Shrinkage();
1 d0 C/ p- P& {- J! a // The following method shows the dialog immediately8 c& Z# ] \6 M. K; D; m
theShrinkage->Show();
4 H0 R ~3 h H5 v: m% I, Z }( B$ B1 Q+ U$ c# W" M7 i/ Z1 D
catch(exception& ex)
* p b- Z: x$ U, q( U {
, ]! S# f3 o3 V! D( }8 f& K //---- Enter your exception handling code here -----$ c G% h8 ^: n3 E5 C+ A8 @8 W0 y/ U
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());8 X& q& J+ D- Q. S$ V7 |
}
, M4 X1 u: a# t& {8 ~ delete theShrinkage;2 C" p, G% [: Z: N7 P
}* k- m" F) `/ f
#endif//USER_EXIT_OR_MENU$ I0 l7 A- I4 Q7 w
#if USER_EXIT' L/ B3 F$ ]: Q/ M
) c! B; b ~: B: C- T& ^: G
//------------------------------------------------------------------------------0 x# p, e# |5 v
# l% M2 h) W4 I* C$ @" t' \
// MUST NOT use this option since it will UNLOAD your NX Open application image2 t. x. C% ]4 M7 p' U
// from the menubar.. c4 G. }' Y0 g# t
//------------------------------------------------------------------------------! [+ }) n8 a8 k* R6 W( u. f4 {
extern "C" DllExport int ufusr_ask_unload()2 G) g9 O# l5 V b) w
{
8 ~1 g+ F2 t: n W- c# m/ g: C* p //return (int)Session: ibraryUnloadOptionExplicitly;6 \' W0 G" p" S, f5 b: t
return (int)Session: ibraryUnloadOptionImmediately;# r- z" P7 h" v5 G" p9 H
//return (int)Session: ibraryUnloadOptionAtTermination;' O6 o7 e9 g5 j& `7 V
}! c) j# O# x* p. V* `. y
8 f; `% m, c/ b+ p: Q4 o1 _7 t
//------------------------------------------------------------------------------
8 s5 [$ g# F6 @7 q" P; i7 w# y2 c // This method is automatically called by NX. d2 E1 g$ b V3 k: Y0 r
//------------------------------------------------------------------------------* G# \" O) a5 ?' I$ N
extern "C" DllExport void ufusr_cleanup(void)
D- `! d" Y4 S {: O. Z7 X( b/ J
try* n. c0 A9 h- e7 H
{
' L5 |$ s' c ]9 B9 o //---- Enter your callback code here -----3 B! n$ h" X! j9 ^
}% r3 r; W; b( }; e$ w2 o6 v4 L
catch(exception& ex)3 @ @8 m+ `2 y3 t# K& T# [ f
{
8 {1 h) t3 U; K( a" B //---- Enter your exception handling code here -----
1 i- j- Y! ^' l Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
) M8 ?: @) P9 } }+ x" C; J! d* K5 a
}
* }3 j7 {! s" @( N2 P#endif//USER_EXIT$ @, R" o/ d* O; Z
& D8 m( {5 i- W' X. S% b
int Shrinkage::Show()! }9 L" u" J, ~. p4 e7 @" L1 j. L* }- r! P% j
{
: V$ t. r; ~) b! R try
& u7 W+ e8 l( l2 W {4 s8 Q6 m+ B4 N+ f" {+ J4 H( O
theDialog->Show();" l) k4 B9 N! G( i
}1 r- a: V) z; v W' \
catch(exception& ex)1 z( `+ Z. g( c6 o; q
{, {( E* x) t% F# r
//---- Enter your exception handling code here -----
( M7 ^# s/ D/ `9 `& \' L" k8 l Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
" P! K3 [7 ]# R. o6 K; v }
$ d3 c1 r) }& `; L8 G return 0;9 {) Q: _( N. G4 H6 a
}
1 N: z" y/ H+ g
$ i/ @, |4 O% H( n6 c& H1 X#if CALLBACK
- |& Q* D" @! W) P0 a: ?- v4 j% `, A9 d1 m% Z) H
void Shrinkage::Show_Shrinkage()
3 c, S, {/ I9 K0 u- x {
* v. R. A0 t2 q5 q; @& C# Q try: {# }9 G, p6 v W1 }3 B) [6 C
{
; m# k, ~1 \, f8 l% Y7 k) o# b/ u+ x theShrinkage = new Shrinkage();8 B' [& d: G( [+ p7 }
$ N1 J; }7 N3 f' H" w theShrinkage->Show();0 j. x( k; J, w; Z# L/ ]
}
2 }; O8 ^" } O catch(exception& ex)
6 V4 X: p% h- D z; g7 M" l {
% I0 n: a* w% L! G* i9 [
* A' p# z) g/ ~ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
' [+ Y5 }, r+ n* E' v0 `; a! o6 o }
0 N. k9 `2 O. h delete theShrinkage;
' o3 N' D) Z( z; r2 R) X% M8 f }
/ S1 z' K$ K/ N/ B6 v#endif//CALLBACK: z9 z& v7 K! h/ Y7 {+ {$ F
7 L% A! E1 e, o% Q' f void Shrinkage::initialize_cb()$ S0 |& |/ V; }. u/ W7 N T9 B5 q9 ?
{
6 \2 \* B% O# k! L3 U try2 C5 ^# O" t: R; L6 ^; |7 P
{. n3 H& k7 j+ F/ E+ }6 X
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
% h# c$ V) @1 m7 l: Y" O face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));- n# l! H; I7 a+ o+ V( N% m @
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));- D* W! }+ S( V8 L& H
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
+ x" E0 d* b }' B- i bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
$ s5 n+ X+ W m: ^0 j. i bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));0 m6 D9 |' _! B" X& K. m1 V; K6 q
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
% _+ I& K4 Q7 ]0 H7 T" X! g string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));$ Z/ s+ F! _4 ?5 f
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
6 N. g! ~1 @" N2 ?1 a* T) d% U string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
# T. `0 W x/ g7 { label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
! D6 G! t( R* S$ k9 r9 a+ R: f label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
# |& _1 x6 C5 c; F8 O, B0 a- T }: h* R1 r8 b8 a1 ]9 Q$ R! l" S
catch(exception& ex)
" s' v9 w2 g, Z8 x {% N' B$ F) S: R0 X _3 ^. _
: J1 U# ]4 G% K6 {
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
/ U; d1 H& C9 u" u }
4 p* ~2 Z. b- o+ G' r5 J* @ }) R$ h9 w# d0 Y
//------------------------------------------------------------------------------% Y8 j" ~+ X: f7 b) a" s I0 T: b
void Shrinkage::dialogShown_cb()& @, j+ a" y$ i
{
( ^2 V* {, G$ Z try& m5 d/ L7 k& E9 _0 n, D! g4 }
{
7 P. `' o4 S& B" X //---- Enter your callback code here -----/ [/ s) t* q+ b/ U
}
! c; ^* K+ X1 _' V0 @, T catch(exception& ex)) w v5 n* Q1 e% Z
{
3 z: m9 c7 X: _, K: D* y
& K! J8 F9 a; M" q Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
( [6 F4 [: g" m }
; r q' w) `, Z }/ s: c! k/ ~. P+ K' `2 {6 c- S
9 r1 R# N- Q8 d' E7 n" q
int Shrinkage::apply_cb()2 b' x- {+ H. M! ^( C
{
/ ^0 A8 f2 S1 Q8 \+ |( S: M; E int errorCode = 0;
$ A# d* C- Y6 a! e0 a+ |9 j try
, y6 b- |$ ~$ }4 m+ T# _ {
! Z& f4 W: A( x1 [9 v( |" U( k //---- Enter your callback code here -----0 G: k6 x! k5 @: r/ Z7 k1 n
}
S# W" U2 \% I f) Q1 N2 k catch(exception& ex)' d; c# y' S* l% n. `# U% ^
{
* W+ |( e3 X3 W7 \/ n //---- Enter your exception handling code here -----
4 W o6 y2 ?/ m% Y$ o: [. v7 K1 F errorCode = 1;0 [: n6 _& d& n$ @
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());) b+ ^( l: D/ k* q$ Q+ ]6 o" Y6 u
}4 Q# i& m! k1 t% R7 L } @. q
return errorCode;
3 h0 g- a7 f+ S1 t/ ^ }
( x2 T9 {; l, O9 } v% S1 U9 \
& @; F' \' V/ Q- R" K1 F int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
5 T4 S) n3 X. r+ r0 p {
9 g0 w0 v5 c4 o; _ k2 E4 i try
0 L0 Y2 l2 l, g% b) d- ], I" ] {+ j' q$ U* w- X# `
if(block == face_select0)
4 X8 m) j7 R7 @8 F {
/ J1 c7 Z6 v7 E5 s" m //---------Enter your code here-----------
3 i8 I! p$ T) u, m+ _* O9 `1 U }
* L% a, q, a$ ?7 { K, @! r else if(block == face_select01)! }- b- ?$ P. ~: @8 i% g% \# Z
{
: I2 {- Q( V8 f5 D //---------Enter your code here----------- @) f" F7 G) R2 _& g
}
5 g7 _" z: ]; m! P else if(block == bodySelect0)
T& T' F. o3 c( B* F, Z* Y {$ K7 q; v3 O& c( S4 B, r
//---------Enter your code here-----------; l0 s/ d( J+ {+ ?1 F" ~& `
}
6 U7 C; k5 c. k7 ?5 Y! A' |6 k* S else if(block == bodySelect01)
' h$ L0 n$ W: G \% x {
) ~, H% j3 ^0 l: O //---------Enter your code here-----------
$ `$ E/ U7 @3 a }" A0 U* z; D: C/ H, b
else if(block == string0)
O3 h( Y3 H0 X+ w1 o9 [7 z0 { {) y' B' R3 M( I* r' |5 h
//---------Enter your code here-----------
* [% S) _% d8 c9 ~, R+ F; P1 v! B }
- }- ]; q+ G& w7 U# @' J* A else if(block == label0)2 w: q) f- Q! _, i
{4 {' h7 Z, l$ }* U N( w
//---------Enter your code here-----------
# u& \" P& {3 Y B1 d& I }
& w0 A N7 s- g( u& i5 o else if(block == string01)
$ Z) i4 x* S/ w) f2 m4 B {
0 ]9 m e: @0 x$ E //---------Enter your code here-----------/ X* e' ~+ D0 S: V; ~' k: [+ a
}# y, d9 W0 _1 W, y" e/ W' k
else if(block == label01)
, F x. i# S" C+ O3 T) b2 {9 N {. S" C+ {4 ~! f; [3 m0 G- k
//---------Enter your code here-----------
& x B' |) \' t2 A. s3 L( A. W* \7 T }7 z7 Z ]1 _7 `* ]- S* }; N% j
else if(block == label02)2 j4 F6 V/ W! K2 s% y. P
{4 t b& d$ a& w0 P7 n$ {
//---------Enter your code here-----------0 o2 o* L, Z* A/ a# `# P
}$ x9 g: ]" H8 a& t: U
}
! G$ l, y, y7 g4 q5 o; m catch(exception& ex)
9 K5 [+ D2 [0 q {
/ U2 d L8 L- i& c Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
; B0 U" R5 i( [% A4 f" |# U }
9 Q2 W( D' ^- l- S/ H return 0;/ F, k5 P! H; v: |) K+ p% u. F' f8 [
}! ~6 n! q" K$ a6 _/ X; u
* k( W% y6 g Z
int Shrinkage: k_cb()
3 d0 z9 N. H3 J {
6 ~$ o, R! I& @. y5 H. W int errorCode = 0;
0 M0 w d. a# G5 E& V try
. w, k- {7 L+ r {) k. e v: q4 c! q. \4 d$ j0 Q& i
errorCode = apply_cb();
: j! H; q t' V/ @7 N }% f6 B9 U' _, ?: V3 ^
catch(exception& ex)" Z* a- S. Z7 @6 @+ l3 i. K- T4 b
{: p; b4 d9 P- I' m
//---- Enter your exception handling code here -----
' Z0 H% X0 u( z [% o x errorCode = 1;
# u% E5 }* j: t- m3 o9 T Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
0 i( g( W4 q2 G( x1 r. H( o }
; X; n, S/ |( ~6 ` H return errorCode;% q& A7 A; O$ F8 D. c
}" X3 `3 l0 p9 H. V3 v
- k. Z9 y7 E- v2 C2 s3 D
//------------------------------------------------------------------------------
. I, n- k5 }0 [. k0 ~; h //Callback Name: filter_cb
- A2 T/ c) A& G: Q: { //------------------------------------------------------------------------------2 o5 J/ k6 F/ x! Q" V. \
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
, z4 i. r8 \- a8 X {4 n" X# D; J+ ~8 ?! G, ~- l
return(UF_UI_SEL_ACCEPT); v {# x4 a& J+ G! H
}* O* g/ y0 P- |
K* Z8 @" J" t5 Q3 p( t
//------------------------------------------------------------------------------
+ f; r. b! B) U* W' z void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus). O5 d! Z9 N/ x% Q* A$ X+ c
{# @! U* n z. J
try
8 `" E G7 G" I0 N$ ~& T5 j {- L* {# n) R9 x. @# R
//---- Enter your callback code here -----
' |! m: {: z) W7 c! E( H }
. u( R5 S6 g6 n+ ?% J catch(exception& ex)0 x$ |; Z7 v( v5 k+ e& ~+ g+ v
{
/ z+ a9 U7 ]: ] //---- Enter your exception handling code here -----% D* M! z# `- U" Z( [& [; I
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
0 W4 m* S/ x) C, ~ }4 s1 O% g# e0 _' P% m6 P4 K# X A: o
}, R( ~5 a6 _# [0 g& o8 ^, H# u& Q
) O7 ^2 s9 A) w( R //------------------------------------------------------------------------------
4 d7 W; U8 l3 m; D5 z. T void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus): a8 [$ n: \8 \1 S: ~
{ ` [5 F$ D3 {) b* d+ z) E: d7 E! ?
try8 @- N" ~) i+ G* K
{
% B* o! h6 p X1 d //---- Enter your callback code here -----
/ {& @- \: O3 |! d8 ]# ] }
& }- r# ]4 t" C; \ catch(exception& ex)
7 k9 }) C( w5 ]9 X3 O {
( l6 a2 y8 L- J* `% b/ C6 Z
# M5 A% ~0 N) ^" `& P4 f# d Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());/ R3 d, x) ?* A! T
}9 k6 K$ ` t+ q0 R
}
+ @$ Q |' `; W$ d! T
6 x6 R% @* F( G; U) q% W6 ~: v+ Y* k# N' m }9 l" v
|
|