|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 ) L" V- B5 g* y4 x2 t, y
! n: d- {3 X0 P请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr2 H4 E7 s9 S+ D, x3 p d9 C5 z$ [6 L
代码如下:
1 V. T/ Y( `% Z' _% j#include "Shrinkage.hpp"
5 G- |# J4 G( G/ vusing namespace NXOpen;8 k0 C* X( P+ {% @
using namespace NXOpen::BlockStyler;5 q" t# t" c- L
$ @! f3 } w8 N" \$ T& B
Session *(Shrinkage::theSession) = NULL;
% f% z: \1 j0 |$ [6 ~2 |UI *(Shrinkage::theUI) = NULL;
% h7 @5 X1 ]- _8 ^! [
`; {5 }0 Z0 C) }Shrinkage *theShrinkage;
' I' Q; ]9 M! ?! I7 G( ^# _9 F0 P h9 N W( K
Shrinkage::Shrinkage()
9 w( ~/ |' i& P! {7 h{
, [" n# A( Y& E/ m0 z# C0 J try/ q$ e* f" t6 x6 \; Z( F! m" G/ g
{5 i5 @ T% c% G" m$ h. r2 v
// Initialize the NX Open C++ API environment
; j0 M9 k( s/ Z. y1 B Shrinkage::theSession = NXOpen::Session::GetSession();
6 i6 T& s! b- Z$ |- o Shrinkage::theUI = UI::GetUI();
8 t3 F3 I8 _# H0 ~. j& Y$ ^1 S/ E theDialogName = "Shrinkage.dlx";
% H- g- q. i5 m6 ~% W theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());( V: T. _$ c0 j- d& B( r+ B: T) c. J' H
// Registration of callback functions
9 M4 w0 N& b: E' N theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));- q7 |$ k/ u' j/ f# F2 ]
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));. Y4 p; Q5 }6 W0 X% i2 y
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));# P5 G8 y+ N7 \& x3 ^, }
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
7 @* G5 e5 e7 s: ^& H theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
! D3 @+ W' |1 x5 n% _0 `/ U theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb)); p ?0 {1 G- j+ b2 R9 s
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));& l. p1 L$ Y$ L* k, i
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
8 m2 O3 z" |' J' P! m# W( W }, \, m0 J8 X' p$ w2 ]! q
caTCh(exception& ex)4 b: S6 c! }* o* K4 \4 ~
{
! {2 }7 b0 ]$ q2 l 9 s5 j! V. F: k" [
throw;" l; e# Y& J1 f! f' e
}; W8 s) {# L4 ]+ L* x' \' [: u/ v! U
}3 n1 i* |8 @9 d- A. h
. A) N- u* d$ N
Shrinkage::~Shrinkage()
5 m# _1 T4 P% l2 S7 F2 M/ V{; f0 y4 _$ g; O% f& X
if (theDialog != NULL)/ l* k& x" c2 q( ]* Y# v
{" y( C2 c+ V. `8 t0 E+ r8 }+ J* U/ ]8 W
delete theDialog;" [ B, M" f/ [$ _0 W- G- s3 ?: Q
theDialog = NULL;
7 V5 H: m0 i& n$ O }
- U& ^5 i; v- G}
# y5 A3 t; [4 G4 O' b; z9 Q3 ~5 F: Y1 f! e) l C7 F8 A
#if USER_EXIT_OR_MENU
* U/ f4 t1 n3 v3 D6 x7 Y extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
# @' b, w8 {, T/ R, d! Y4 V {
8 ^/ j- I/ {" D9 P4 B! u5 z$ f7 d try1 V9 h" s+ Z# a5 T9 p4 q, d
{. L3 g3 Q8 n- e# s# s
theShrinkage = new Shrinkage();
1 q `$ X0 Q9 n" u3 v2 D // The following method shows the dialog immediately7 y' k) E9 k Y) z- {( }/ J1 {: k1 _& \
theShrinkage->Show();% D4 ^8 l* M% K; n8 j
}! }3 K, M* U$ g
catch(exception& ex)
! s: D3 z. n8 v {! r& e8 h( }$ z$ @9 J
//---- Enter your exception handling code here -----
& B$ l# u* b2 I5 u V. K8 Y Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
2 n8 O3 }/ x7 d2 ?. F }: C' s# t8 y& M" ^. T! P1 X8 u
delete theShrinkage;9 }+ _ I( c, p4 _4 G R# H. s/ H9 n
}
/ V7 H5 I7 f) t$ F9 v6 i#endif//USER_EXIT_OR_MENU4 L; G& s) y1 p* C1 y( a
#if USER_EXIT1 a: \9 D0 Z3 g/ u1 b3 U7 R7 T
F1 Q6 f* @3 [: A //------------------------------------------------------------------------------
! j7 s5 W* K" r; T% ]5 m! a6 v ' n( G' ~. v; ?# E; s4 \# @
// MUST NOT use this option since it will UNLOAD your NX Open application image/ _8 a1 f0 e( _5 R( q6 i
// from the menubar., S6 p( l& a* _) Y' O+ C
//------------------------------------------------------------------------------, B# @0 @, V* w1 m0 h5 M# d
extern "C" DllExport int ufusr_ask_unload()0 l$ @' s0 B7 S5 F
{' k$ j; ^$ X3 G# B( g! e9 q
//return (int)Session: ibraryUnloadOptionExplicitly;: r% O* O# T8 r, c4 R# ^1 w
return (int)Session: ibraryUnloadOptionImmediately;; Y) q% i8 \: c% d& u8 Q
//return (int)Session: ibraryUnloadOptionAtTermination;- U$ p% m( z1 h, _
}
; H" ~4 j$ H+ ~- x- ` + e% s- p- T9 M* ~2 j: `4 U
//------------------------------------------------------------------------------
; q5 v: x9 p9 h3 U& r+ s. _5 `8 t // This method is automatically called by NX.0 e7 g( A) _8 t: E9 S6 M
//------------------------------------------------------------------------------* i8 ]' M: V* r U8 C7 @
extern "C" DllExport void ufusr_cleanup(void). h, O( n" ^9 R
{
) T" {# b$ L% ^5 Q try- H7 @' M9 z5 o& f; E
{" A- k3 {7 X) P2 ~8 [+ {9 o4 E7 A
//---- Enter your callback code here -----
. c; P' \( t, L' a }1 |3 [/ ^& P: s
catch(exception& ex)
5 Z7 [1 o! S' C: @ l% | {
: I3 _' Q/ N3 n6 \( y2 M0 M" t //---- Enter your exception handling code here -----
6 I0 z% {& U0 U) x/ f Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
7 s; R- n7 O; N, E: N% h }
) a" \2 A7 y* n9 @ }
$ u7 @$ W. c" j4 u, f#endif//USER_EXIT; X2 v! c; b$ N
+ g& h( ]/ j3 W+ b% Z" w5 h# p2 T int Shrinkage::Show()
) w$ ~9 E; B: R% p- K( h) B {
3 ~. [* [) X' F8 F; [+ T% G try
; F) j$ m o+ `" y4 h {- K7 k: A# X" x: G
theDialog->Show();
. X; W3 L/ p( q1 c |! G- s0 U }
+ M4 L" @, E R# W5 V0 y& a9 J! N catch(exception& ex)
) t6 z7 q j$ v+ G8 q+ S( H5 {) C {
5 N: n7 H. {6 J2 r //---- Enter your exception handling code here -----
/ y% Y _' p7 P Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());. W1 T5 n% i/ ?8 @" P( z
}4 v) F# T3 u2 u7 U2 T8 J
return 0;
- w% V( _+ b, `# X0 S) D- H }6 c5 r/ \5 s# W; w5 O
! U) U) ?1 V: n9 `% d
#if CALLBACK+ f3 C6 x" @/ E# b& O0 M/ J* \. Y
+ W, f0 ?. i! J- N1 L9 N# ]
void Shrinkage::Show_Shrinkage()+ x/ K( m1 H' H% z3 ]& x
{6 T" t" D9 _' s0 I% e' n' P) ], l0 K
try) S. s) Z9 n7 l+ r! }# m
{
( ]+ ]2 ?/ E+ A; m, x) j theShrinkage = new Shrinkage();
6 y) x+ V7 y! b0 T. Z1 A1 v
" f8 U0 W* h% |' \% S theShrinkage->Show();
@* [6 I: b" u3 H. ? }: C; M. c5 P) r- L! Y- s' ?7 p* L/ \& u
catch(exception& ex)1 q j% h/ C3 R$ }8 D
{
: N- `1 S( w9 P: k4 @ C* G; E
& Z0 g4 P: K; g3 F8 [; d# C1 w2 m Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
# S' f) Y6 b# i* k0 j1 b) p }( @! U! v, M: W( C
delete theShrinkage;
2 e8 N) D, z5 T7 {, f2 J }3 I6 e: @7 ?! ]' n) a$ @& _1 S4 i. B# u
#endif//CALLBACK
+ h7 w0 W4 o6 d ^, V8 \
7 r) \- m, X1 M) h void Shrinkage::initialize_cb()
! H; W/ D+ Z* r% F5 ] {
* n: p5 s8 k" ^: E) D8 N+ I) J try
! V% I1 w7 ]0 J. b2 f {3 S7 z) M# L S) ^9 L4 W+ e
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));3 K; R6 M3 [& s$ ?' r8 r
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));" [8 ]* P- Y0 R2 A0 Q, b
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
0 ^7 Q$ O/ ?( p/ t4 G4 }7 v group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));/ I/ J: K; l" g/ U$ d
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
" \' O( A0 l# i* @. q) g& N% q bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
$ Z. Y* _+ T7 {' L* ~. s M group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));" |# d+ r* m; T" @' j
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));& W' t& \5 Y2 k3 v7 m+ y& T
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));0 a. X- g) b5 n
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));, V+ m. r+ g E1 J: O0 v7 e- N( @
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));' J/ P8 m: U5 w6 c: W" s" m
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));: B; W6 ~) m' D( ^( r, U+ K
} A/ Q$ ?* d m. M& I$ D" w+ U. u
catch(exception& ex)
! } p5 s7 H' t4 p: ~6 r& a: } {
/ S+ } b" P, A2 o' G5 S + v7 w' l) L! ~1 v( y! V' Z) g
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what()); B9 l' a- Z! d6 i9 z* @
}
! m& C, X$ T( M+ ] I: e }
+ B2 v% I% g I //------------------------------------------------------------------------------
2 a0 J% B! L+ H* s' a: ^ void Shrinkage::dialogShown_cb()& ]4 x% R5 \/ L5 D: a
{/ c: F- `( J5 h
try! h$ _3 f2 V f. r9 n7 L; ?+ W
{1 j$ G0 i' O2 I/ H
//---- Enter your callback code here -----
6 V. Y3 `: n' \% H0 j }0 t! k C. ^1 ^- f) Q4 M
catch(exception& ex)
. k/ ~5 d" B% l: J4 n. h: {& d! U {
- s# o1 |5 }4 o( m
3 T! @$ I9 a: l0 x7 w/ [( ^# u Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
% U* [+ U9 O; I9 U0 F }
; D0 ^3 h' I4 c/ f }
) |$ O, d, _' b! ]8 o, Y
. u. @+ v' Q5 D3 f- ?+ W int Shrinkage::apply_cb()
+ a' k7 u5 a+ V9 x6 x9 W+ B6 F {
; h, _6 |, b, S% G8 n int errorCode = 0;
- B2 y4 ^( f2 m try0 r, p3 M0 }( X6 z
{
2 P! p7 P$ m4 G" p* H //---- Enter your callback code here -----
# v$ a" C) u1 O% C$ S } w3 H( F- x& @0 ?3 j& Z; J* A6 u
catch(exception& ex)
+ ]& K* ]8 T5 g# C {
! [- N" x" ?9 h0 i6 f4 L7 x( i' K //---- Enter your exception handling code here -----
5 O6 U( h5 S$ t0 ` errorCode = 1;
( r( ^- k u9 h7 R" r Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());6 T a# x5 Q, g$ D' D
}1 m( l5 v/ J( U: @ E/ y: N
return errorCode;5 F( A& Y$ Z0 N- ]( u
}
- k; o) o7 G9 q! V3 p) w7 [" q
; r) O6 H2 x- T# _2 ?3 T int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block); z7 x: ~* d# V
{, N+ D/ ^! d6 z$ t6 U- }. x
try8 s) D" f, t7 K. t, d
{
# P! T5 u1 @1 p$ y* `8 T. R if(block == face_select0)
% l6 J' K1 Q$ u. H. u$ Z {
7 C) J/ t8 n' ^8 F9 k0 C //---------Enter your code here-----------
* D* p8 I( z: V% b }
# S) ^4 n, V( Q0 e6 \7 @1 v else if(block == face_select01): {7 H+ z5 e8 b* g/ j/ t
{, F; u9 g" F( O1 j9 P
//---------Enter your code here-----------
( y, Z+ f7 o8 G1 a/ x$ P { }
7 `0 x1 f& B6 j# Z* D$ w1 H% e else if(block == bodySelect0): @! D* o7 s: S
{
) B9 v% A/ ?' Y& @1 C$ |1 W, e7 v9 A //---------Enter your code here-----------7 m' z7 [7 J0 p$ `/ P& j
}9 C; e" D; z Y% S- i6 Y
else if(block == bodySelect01)
2 o: ]' _1 m( q3 _; c- K7 k1 v {4 M0 L. U3 H& H& p$ n
//---------Enter your code here-----------
( g5 l3 D( G6 L, W; C- _ }+ ?4 E7 b; Y8 O. K* w' B+ j+ A* ?3 b
else if(block == string0)
& n' `1 \/ d6 j& U( a7 s {2 c& g6 h* R- s3 l- u6 b' g
//---------Enter your code here-----------
1 n8 }9 L: c% }7 ^* w+ R9 y }
$ W7 z4 S9 L( F; L else if(block == label0)
$ g& S; J8 R9 S! Z& ?, C {% M' W8 |- h! [ S7 \% }$ k( {
//---------Enter your code here-----------, q8 b" b% `6 b6 d
}# B- z( Y# k9 W9 y* K
else if(block == string01)
2 v- x: d& o9 W+ t {1 a: R7 f- z& O4 ~
//---------Enter your code here-----------* d2 ]8 U6 u' ?) N2 ]) i
} M4 O6 U' q3 w+ e: T2 {
else if(block == label01)' X( I. q, [1 _( v- K$ ?
{2 E2 y) ^$ Y! C/ i# r5 s
//---------Enter your code here-----------0 J" W+ C2 D* x# h. o1 h
}
4 L8 P% i5 _* F% z2 q else if(block == label02)
$ q% e! R/ c. j# K {. ]. @+ S9 N( T2 L
//---------Enter your code here------------ J) J5 K" J) J1 R7 x$ m
}
2 y( G/ Q) N0 @7 t) s% l/ d }( W# t2 ?" u& T0 Y
catch(exception& ex)
% h k+ S9 Z# A7 N4 q {
6 |0 H& c9 I3 |3 \/ b Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
/ G" `+ y2 }4 Z, c, F2 n }& j$ P3 r9 ~* {# N/ C! m
return 0;- `( ]: x6 \) Z+ b8 `% u
}
& f3 U$ z- d: Z# H1 i 5 w9 y9 @% ~% N$ S! M8 i( Q
int Shrinkage: k_cb()6 Z% q8 R& ^) i J
{
: D3 r. \% m% L/ i7 J int errorCode = 0;2 a+ b, C6 q8 ~5 N0 ^; M
try4 h4 }% b9 x7 z+ w1 K) @: V9 A
{
3 O, x4 S# i2 N+ M4 J6 | errorCode = apply_cb();% W/ k$ o" x1 c. A6 j& _- ?- H
}( X7 W6 K0 F& m! b8 S
catch(exception& ex)
1 \, w* z. x2 j/ I" v1 y {8 y% k5 O: ^: W3 v O
//---- Enter your exception handling code here -----0 V2 _$ Z0 I! a8 \# h! U2 w8 w
errorCode = 1;9 c) V7 E1 y( a2 G, O. X4 N- C
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
9 _. z6 J/ J9 H: ~( a c9 S }% E0 c8 \9 C6 [% |' K4 \0 f
return errorCode;
" p- t3 C) [% S }
" s' H* L# m0 Z9 n% I: J ' H4 E' T% v, K* b8 f6 E* a
//------------------------------------------------------------------------------
# K7 G' ]/ E# }# u //Callback Name: filter_cb
4 B/ E9 S* h0 G //------------------------------------------------------------------------------
$ p0 {) C' b L" {! v. t: d int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
) E- P$ ^4 N: W9 V {
: G4 e2 `% N# i& Y D6 [ return(UF_UI_SEL_ACCEPT);
) ]5 |/ Z% o0 a/ B! q9 F }* ]( [- P! ^3 ]3 H! U+ j& @$ o! h
5 K( |' Z* d/ X# Q' {; z! p //------------------------------------------------------------------------------
7 ?! D& b. }" N void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)2 `+ X& Q* R0 _" x7 z
{8 _+ [0 ]* _/ \8 p
try+ Z0 V& f2 j$ l) J Z+ Y Y9 t
{
/ W3 t! |4 n- f$ X8 P* p3 A //---- Enter your callback code here -----
1 T* d( ]1 n- A* ~) h7 r }6 J4 ^: w* H: S3 x" w$ k( p
catch(exception& ex) q; e5 B: B& a
{
% e+ c( Y- a# N9 B& x8 k/ r! ? @* j //---- Enter your exception handling code here -----
4 f- d7 n( u# K; t" @3 H Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());4 p" U0 ~0 C8 F! Z& V$ v
}9 _& f0 U1 i$ V+ E K* `
}
" c l7 d4 Z; g " |9 K( G$ }: X v4 p( X1 H$ Z9 b7 V
//------------------------------------------------------------------------------
, c- Q" p4 v$ Y. j% y void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)9 e: b. v1 S" p" k
{
+ V, L. c @ T; c try+ o6 M9 h- b* U- U k' N
{9 K1 {8 K+ _, l& o8 ?4 X$ y
//---- Enter your callback code here -----" h# V$ d, }. M' d, }
}
' {. I- H( E* x1 I catch(exception& ex)
! C! [0 B% u' a+ |" O {( q: F! ~* T) m1 u- O
" v6 H! H' t* J0 |; W
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());, S# @4 r' K2 N
}
+ H: W# R" y, p- t, k/ T }) J# z! P! p' ]
: b& t& v$ t# u2 `1 C/ {5 _% } \5 n" n" h8 |
|
|