|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
( Z, V7 Z) K, Z# @. q5 B: N! Y$ U$ M9 E
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr2 u/ C4 c2 Q) a
代码如下:1 Y$ c5 _/ m$ U/ [( ]
#include "Shrinkage.hpp"6 K: B' a% |* Y' c; _% v
using namespace NXOpen;
9 I9 j% \6 R, o% J L7 d h! _7 tusing namespace NXOpen::BlockStyler;- D& r9 j `4 d6 u5 m0 Q$ U
& h, n0 s- M( h
Session *(Shrinkage::theSession) = NULL;
: U/ a( n$ W7 W+ E$ aUI *(Shrinkage::theUI) = NULL;3 J( j6 E, x$ T* G
; g2 r9 {% H. M0 h. }Shrinkage *theShrinkage; _1 G) G; ]' u( r$ ?
* h9 B0 E4 y" P' {8 Q3 ]# D; @6 M- y
Shrinkage::Shrinkage()3 I6 G, n) o4 A* G
{ q+ G4 p. F% z5 K9 I; B; }& }
try
- O* j# B% j2 | {
0 Y& c, {- L6 z4 \3 i1 ]; ?: x // Initialize the NX Open C++ API environment& E/ ^2 b9 w3 r4 w# ]# C
Shrinkage::theSession = NXOpen::Session::GetSession();5 E6 V+ I* G5 {% L& m
Shrinkage::theUI = UI::GetUI();
3 U2 ]* J8 G8 u6 B5 u& Z theDialogName = "Shrinkage.dlx";
; D, N: i) `2 C! C5 A7 { theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
8 R: j e3 v5 y# m" S // Registration of callback functions
, g, T+ z4 i- E9 p3 M' B$ W theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));9 Q. ~& N& }: \0 w0 D; J* a
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
; C6 j! g3 W. h0 k9 C! x4 O theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
$ D- u8 H- R, | theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
5 F7 H' u2 e" p- O+ {9 a theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));) z' r) \3 j) S" Q1 e
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
3 I; h4 C% D4 C0 I theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));' j' W: p2 s4 R5 s N+ T
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));% R& Y$ W/ H, K, I
}
, O- `6 b4 `5 M( W+ e caTCh(exception& ex)
, W8 K( N: D- k7 Z5 y/ s: D; c9 P {; v6 j$ O0 K# k7 j ?; F
; [7 U1 q& J- |: s( v8 j0 K2 c
throw;
3 Q! S5 Z3 V4 b; f4 Q0 h. J }8 \3 S: e. P3 o
}8 p; ]1 {* \% f7 g" ^1 B- u! Y$ B
+ U! r( L5 N: ^- E1 l
Shrinkage::~Shrinkage()
8 |* e+ e" T8 z. A/ K' N6 Q2 V9 ?{- H) @" {3 V3 K& s2 O8 K
if (theDialog != NULL)
; g2 k5 f9 b5 I {7 e2 w- W9 _0 s; C
delete theDialog;
* P! K1 x$ D. h# Y* B theDialog = NULL;
8 f. K) B* _% u, \: {7 A }
# K+ L8 t4 x! F* a}
" W. B; q& l; d P8 E6 F+ |) A. ?) C1 H
#if USER_EXIT_OR_MENU/ _4 K2 i! d9 R$ ]
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
/ r \" M; _5 {1 D8 y {" h1 F6 u6 W9 ~/ }7 a) R
try
0 {# D" X) W! A* Q5 ^* ^$ m4 j3 m {( [( x, x% }- w% K) A: t. K
theShrinkage = new Shrinkage();7 h) Y! k. K+ l9 X$ I1 }! {
// The following method shows the dialog immediately% F: q& T* w! u4 L
theShrinkage->Show();
. [8 H3 L' W) c" S5 L2 n$ n }+ C0 h P6 R4 f6 {+ M S
catch(exception& ex)8 W# z) p1 O3 P, P5 e3 A) t
{% }8 ?6 u2 O. T4 ?6 ?# ]
//---- Enter your exception handling code here -----' J! a( t3 j& Q5 ]9 T, H- X
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
. X" L( b, x) c. P }
. |! b, q A6 E2 [# e2 y5 b" v) p- @ delete theShrinkage;
$ y7 d& i( J" S1 \ }
; Q B: U8 T' w9 V# h, }$ c#endif//USER_EXIT_OR_MENU
1 m5 x) }6 \ s! l5 \#if USER_EXIT, M" g Z* m5 U+ k% u7 T
1 q& x, W |2 y4 v6 b7 u //------------------------------------------------------------------------------0 H/ {! |( t, w* l! F0 F+ q6 s2 G6 Q
G# w' i; m/ a' b( U: C9 U // MUST NOT use this option since it will UNLOAD your NX Open application image
$ ?4 M6 y& {8 I" e' l1 k // from the menubar.
/ U1 F8 R4 ^0 J' J/ A //------------------------------------------------------------------------------
$ l* y: y' {, \4 X8 l& H+ q+ v extern "C" DllExport int ufusr_ask_unload()
1 n2 d) i4 ]# ^+ I$ P+ _ {2 t: X- J2 J' X1 j1 H! L
//return (int)Session: ibraryUnloadOptionExplicitly;- ?6 o8 Q7 z: b* u) t% B
return (int)Session: ibraryUnloadOptionImmediately;
7 J- _ S u3 p9 j" r, j //return (int)Session: ibraryUnloadOptionAtTermination;+ a: ^0 v0 A2 ~1 W+ C# R# }0 l+ R
}5 L1 N( H# B2 U
: _4 s* t0 ~" f1 B# k. S# M; c //------------------------------------------------------------------------------
0 c$ W w5 [6 z% c- B // This method is automatically called by NX.
# T0 G3 { B0 Z //------------------------------------------------------------------------------
- S& X- @8 n' l" z& Q9 _ extern "C" DllExport void ufusr_cleanup(void)
2 x. C2 ?1 O6 y1 W( _) N N {
$ J1 w* @' T. c, K5 E0 F try3 ^* I: Y" O% Y6 e6 Y8 Q# g
{
5 u# K* X' U# \2 ? //---- Enter your callback code here -----
$ k" J+ G" U% Y' W1 J) L( n% b" K }0 i8 j+ ?0 K# ^6 Z
catch(exception& ex)0 z5 g' d( p; ?' a
{ J* M- A! I# ?* w3 I+ L
//---- Enter your exception handling code here -----
8 ^9 [4 ~1 m5 v! F! \+ _ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());" D" ]( W; a2 I8 \- q7 ?, ~% ]
}
# P8 D- f) q: [* I' A8 z, k- p6 m }0 N( u2 g1 y, y/ p7 S$ M
#endif//USER_EXIT6 k- ^. U! H* H" A! B
5 J& P, r# W2 o8 t6 [
int Shrinkage::Show()
+ g+ y$ U- ]# Y( _ k {! S s9 F. h) @, `2 E8 w( r8 e
try6 M8 S' q) ?" i
{( C! I/ C' i' w; {
theDialog->Show();8 l1 S2 I" `* q6 A4 D$ U
}
' V# p/ K4 e3 m" T catch(exception& ex)
( S4 s: R$ N2 Z1 P( q9 _ {
6 ~9 L& c1 d1 f/ b1 |" t //---- Enter your exception handling code here ------ [# |* A3 h6 Z: e- p% u
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());0 n" X8 D! f7 e3 Z, u
}9 B/ H" h3 b+ {1 [" k# x, e4 a
return 0;' C# b& l' Z. R3 X1 k: |' i
}
! a @5 P9 L' t9 t, W % ]7 ~: b, Q. W9 S: X
#if CALLBACK
( z8 b9 Y: e+ p7 y6 U" z4 s# E- X& B% d. @9 Q
void Shrinkage::Show_Shrinkage()
8 L! D5 s5 N" _ O" ~ {
* y4 u- E2 w | ^5 F& D& x try
1 q, }. T }% r7 K/ o1 c {2 u- O8 i- u% c1 @+ t- w9 q
theShrinkage = new Shrinkage();5 M9 L5 b# S4 z% Q
( \' c* U; x, k
theShrinkage->Show();5 Z" O7 y* r1 u
}! i" L8 U4 b+ H& I( P
catch(exception& ex)
# }5 h x7 T7 t9 n& v8 T1 e {5 k i8 i( g' T9 W. t: \* ^
8 g( w8 \9 W3 E( u( m8 ? Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());* u' G7 M/ i' X/ q2 C" L
}3 g) w6 C# |, p' V. J
delete theShrinkage;
8 h9 X1 d1 o% D$ Z5 W }
2 j& T9 K: G- _' j1 r0 Z#endif//CALLBACK
. F# p' P* k+ s9 A2 p1 X
+ F9 p7 k$ l* y) _3 R+ J void Shrinkage::initialize_cb()
4 b1 J' U5 j5 s$ c E9 G6 O {
$ [- B$ {0 ]( l try
5 g4 D* v8 `% G" \ {
5 R6 P) J: G: j- g' u. c; ^2 a group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));+ G. a0 f: L4 p3 I6 K: J
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));% H- M; E* Z, A" S$ Z7 @: ?4 ?: y
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));6 w, {* ^" w, F9 _* B
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));' N, V9 ^ x) W- x2 i$ r. @6 i6 w H
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
1 ?6 _3 \+ a; D0 D bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));% ]) j* ?- U$ X( ?8 I1 L' q) l& z
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
+ s a6 T" H) F$ ~( e string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));/ \+ k; l& s, p7 N+ `7 O8 D' ?
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
9 I* l m0 ]7 O) m* |, q string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));! C) R/ x0 O- _' e5 u) H
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));; n! `; L" k3 H" Q
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));2 ~, f- _1 J& [9 C B
}3 b& }" S, g. W1 M
catch(exception& ex)
$ |& H( Q2 W5 Q* F+ o" A, S {
# H$ e5 e# [/ K, B" e' ]
* p$ Q+ j0 r, p; t Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
, h3 w/ ?* G* w% i( w: I. p }
9 |) s3 v+ }+ X7 ^- V$ S# b" k; k }) C6 I4 q6 [9 s: G+ e6 {7 F: A. k
//------------------------------------------------------------------------------7 e# m# A5 x1 H- m' S* X
void Shrinkage::dialogShown_cb(), P7 @2 y7 d. \! m3 Q
{
2 O7 ~! g2 S9 D7 i/ f2 i try: P" I+ Y2 p0 G
{% Q! j/ q- H8 O$ _8 S
//---- Enter your callback code here -----
F: g o0 r- \$ r! {# j5 P: X3 y } Y- b7 _) b) C
catch(exception& ex)7 p. N2 K4 ~; _0 {- i+ Q# m
{
& e( n0 I; `* D/ M9 p' w& s, g" K5 l0 j3 K6 e8 k9 {6 w
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
2 u1 [) S: ~$ n7 X/ b }
% i" o9 |2 H$ W; | }2 X- k* y U3 F) b/ y3 s& v: D" o
& A. P3 r6 g2 y" V
int Shrinkage::apply_cb()
. B, K5 U+ k- p. I b. P# V0 z {
# d' x5 u r- b8 N6 @, t int errorCode = 0;
( y8 g& B1 k: N7 H try
3 H( H; U: w$ B2 T! F6 G- ^0 e/ K {. ~% }9 G- O3 ?2 F* x! F8 F2 t
//---- Enter your callback code here -----0 V# _$ S, [- S6 P2 {' x/ l( e) L
}2 n4 l- {% W4 D. k# j7 x
catch(exception& ex)9 ]/ U: } R D$ y
{
, |4 D/ T$ a& ~6 a+ W //---- Enter your exception handling code here -----
& M9 h5 @$ K& I9 j3 y& \ errorCode = 1;% V& y* X% j( L. T& [
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ @5 ?! i! M4 x+ K+ R1 ~5 X* Z6 _' @ }
$ d. P9 _) f& I/ D5 O return errorCode;
: _" W7 X" L' |& R) U9 i) ~6 u }& X$ U& s, \ W* [, V8 s
. A/ F6 p8 } |+ q0 R' I int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
( L/ c* M5 [" y; W- d: w {) F3 \) D" z* M) R$ v0 E* f
try* D9 I% ~6 J# o0 v t, S
{+ ]) ^$ r* _& R1 `
if(block == face_select0)
7 J7 `# x9 p; m {9 b, H; r& g/ r) R1 j$ z# {
//---------Enter your code here-----------
+ H. J7 r* }2 A1 q }
; m2 b, y3 ~$ P/ r else if(block == face_select01)
+ o- E3 x' ^) p {
/ T; r @, |2 S N6 q) \ x //---------Enter your code here-----------
5 d& S. `, M- z; V% u }
: V4 }3 Z" d9 Q. f( _ else if(block == bodySelect0)8 M4 x T4 ]) Q0 z9 J
{
2 M0 k6 t; _; B1 c //---------Enter your code here-----------5 @# t i' |% ~
}
6 ?+ ]8 x r7 j' ` else if(block == bodySelect01)! ]$ ]4 _% ]$ Z; t' O
{
% N' u' k4 @ r# [ //---------Enter your code here-----------0 I. O9 J) B4 @# j
}
4 A; O/ I2 e3 y+ N; y else if(block == string0)
) a' R" Z4 C4 |4 `- C {+ I" k0 i" ^ ~5 o. g
//---------Enter your code here-----------8 u9 o4 x# L2 I
}
4 K' @# G) V1 i: I4 u8 B: b else if(block == label0)
5 [ Q% F, |! J3 d0 ] {# {+ ? F9 k7 B* Z1 B1 e9 }
//---------Enter your code here-----------
5 q7 T, Q* T0 i" S8 p: r8 m }5 |2 J: }4 k/ z8 x7 n" h9 M- L
else if(block == string01)
+ p* J0 }. a6 m; m0 P. q2 G {
4 N1 | h* X8 i0 v) P) Q/ q //---------Enter your code here-----------' ~- G! d0 Y! V" M
}
1 D8 p3 v% ^; y/ C else if(block == label01)
# y! ]9 F2 E& k: _ {
: Q) [- g$ E( L* A //---------Enter your code here----------- [" j8 A- J9 f0 z* X5 a2 ?1 b2 L7 s
}
3 N- I, {% u; k1 [0 }; C1 Q+ X else if(block == label02): ~8 u8 Z1 O, b5 q" w! f, Z
{- @% T9 Y+ v5 P) Q" P/ k- ~5 c& ~
//---------Enter your code here-----------
7 E. @! n# A4 h" r9 o/ Y& ^ }: j: v M- ]5 V- `4 Z9 D
}' Q, A' K% l6 r3 | c
catch(exception& ex)
- z, E, {0 i& m {
7 Z# J1 Y+ i$ `# H Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
2 ~+ s. P8 f" E ? }
1 o7 c2 N3 G7 x: p0 t return 0;
- A {0 @+ m" ?! z& g2 A7 P }
# p% H2 l& P! N& E- b2 B
& T, G B) Z+ D int Shrinkage: k_cb()0 |7 R8 }, |! G& f. a
{# ?* {. v) D% x! Z% ?3 ? a
int errorCode = 0;
$ B, b/ a, J& p R try
8 ]: W/ g- L# G9 ]) U- n8 c7 U {
_* u. g* W: I; v) @, Z errorCode = apply_cb();
+ p9 J; |: d7 G. N }
* `4 ` S2 [3 @( [, F) o) r catch(exception& ex)! {! F. L2 E& S3 P6 d. p' g
{
" M: o! a+ o6 J: a: o- d! i' k" j //---- Enter your exception handling code here -----
5 k9 f( L* a- W) ]4 T% ?! j errorCode = 1;
" d4 Z- c( L V4 k$ C Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());' R4 m. R# d! g
} N9 l, c. X$ J$ k# a9 h
return errorCode;: \) a) \# I5 m" H) Q
}
5 }9 k1 B3 x5 O/ {
6 y/ @9 h% l0 j4 u6 |) L' w; q //------------------------------------------------------------------------------
- u$ a0 X6 h* {2 h) y //Callback Name: filter_cb
. U: ?$ {$ J; M1 Y //------------------------------------------------------------------------------
, x$ Z% a! E3 ^2 ? int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)/ s1 A! S: O# \+ W" x9 Y
{
. f! b. g: |' [! g+ S return(UF_UI_SEL_ACCEPT);
2 K& t- J! B* l }
! e3 h- B: `7 F' r 4 {3 y9 P" [2 n
//------------------------------------------------------------------------------6 R0 U% |2 B7 B4 @: {- F& m% c
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)7 @3 V3 B; O& ?: U/ Q6 V: x- f
{
9 R+ `" D3 l) U$ s- ~4 Q( l6 ` try
" a; _6 {6 Q) x# `( D- j2 A- Z {# }. _& s& J2 W, }9 B; P. _5 z2 |
//---- Enter your callback code here -----" u% a |) [+ x4 G8 p3 ]
}! y8 i5 b% p U! o; b1 `2 R7 P
catch(exception& ex)
. H9 |# v2 R; [1 Q$ T {
+ b* [( n5 k# r9 N! m7 @6 \ //---- Enter your exception handling code here -----& B' ^2 v% j1 ]
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());& Z* s% O9 C* \( x2 W
}
0 k+ w, E) r5 r* u! x3 c }" X3 }$ z( F: x' N% V
9 f8 L+ S8 }+ R% o+ L$ w! v //------------------------------------------------------------------------------
# o/ v, |$ k! w void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)7 f4 k( T) Z& @3 A B
{
8 {* j S# h a" U# C9 U try
7 x4 ?; t9 }7 \ {
$ W0 F* F3 J4 W; \. H. L) K //---- Enter your callback code here -----
9 N# b+ @1 r4 B% z$ L, N }- j0 P2 m# }: i0 N% U' h
catch(exception& ex)3 A5 P8 c; A0 Y9 k
{
9 g' A- E3 T8 a2 R7 m. N$ H2 `9 ~! }; p
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
6 o/ o- K1 `& Z& p3 Y/ E$ t }
`+ x4 L2 C, {+ o }
' r/ c9 J/ T) r' S% E- v2 K# L: b0 J1 Z- R, V. c5 q
1 f' d) o% w5 [! e |
|