|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 & I' a. m$ O8 c
8 E# A) a8 E: H6 G: w4 c请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
6 l8 o1 F/ @/ \) g% T0 O代码如下:9 `) v3 ^3 K# ?4 d, G
#include "Shrinkage.hpp"
1 F+ R% C& u- S5 A% T2 ?# o- h& uusing namespace NXOpen;
* j7 l" t' ^0 C; Jusing namespace NXOpen::BlockStyler;
* ~7 T& s0 t; l b* l6 d
; d7 C: [& ~) \2 j0 h3 Z+ NSession *(Shrinkage::theSession) = NULL;8 E1 f' _5 w/ k) Q
UI *(Shrinkage::theUI) = NULL;
7 T% ? ?! @' Q$ q- Q2 q
+ z E* j5 s2 @( d' e p) mShrinkage *theShrinkage;! ^" N/ H. i% ^5 r" r7 D! T, y
" d, b, K/ H+ j+ r3 eShrinkage::Shrinkage()) A0 ]4 K: p# ^
{/ J# z: a# P$ Y' q1 S+ v
try( L, r+ B" z Z2 n6 H3 l
{5 @/ ~# k, \( f
// Initialize the NX Open C++ API environment
" ]+ ~+ E+ O/ C+ o1 P7 |6 N Shrinkage::theSession = NXOpen::Session::GetSession();
) Z" }9 v5 m% k$ o, u7 l Shrinkage::theUI = UI::GetUI();
* {0 B# T9 O. |5 R }6 R+ N- z; d8 A! e( z theDialogName = "Shrinkage.dlx";9 e4 r: V+ t1 W: |3 u1 O( \' q
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());) M$ k2 Q( H9 W9 x# e7 k0 ]
// Registration of callback functions
3 z: v% U. T' r& e/ V theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));4 N4 I+ S! Y. a6 j! w- J. a' K- n
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
# R q( L8 z w6 [, r8 a theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
1 f0 O3 b* Z" @. C3 J# Q- x. M theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
% P% m7 P. p! ]% v8 {$ H1 n theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));/ u$ b q0 B2 ^6 ~! X4 d
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));3 R o, Z% @5 Q7 g% _4 k9 x
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
- C$ i: G+ u7 E4 E; j* o9 H8 N theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));4 {3 {8 ?, s: W# r6 f; i, J$ s& F# [
}
- H0 m. o6 i# B! i* d( s9 F% a caTCh(exception& ex)
3 t8 y" Z' z: o) {! ] y {( }3 g7 Z) Y2 j" r4 d
5 m+ N* r9 m) a% s4 U, B! u
throw;$ f. J( | ?$ W8 R" E0 Z
}
5 s6 t4 ^7 Y: O3 h/ ]}. p' o6 h0 @% Q% T e! R7 e
3 F1 u- j" F# O& v0 t6 ? X. M
Shrinkage::~Shrinkage()
3 T1 k; G% Q+ s, x5 Q& i{
* H" \% }6 E& G y6 J, L if (theDialog != NULL)
7 c7 Y2 G: }2 B. A; d! h {% n' T3 r; C0 n, q* o! ]! ]7 E
delete theDialog;) \+ K, q0 T( S3 t6 a- q
theDialog = NULL;
{+ r, S/ t5 E; [8 M }
3 J7 n" m# V- Z* z- r' d; z# _5 z}4 S* A' C& R5 T0 u; x! s0 M$ s
6 L" @" A6 R4 @+ i
#if USER_EXIT_OR_MENU6 e7 L. e, c* V) o
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
5 h3 s) m2 u% C2 ^6 ^3 m {
- I( U5 C/ V( _$ z try
" t/ O9 C" S f2 [9 w1 P9 \ {" M! h2 L1 @' T) B
theShrinkage = new Shrinkage();
% S& F, O& S& i* _ // The following method shows the dialog immediately
* V# i, i# P {% K theShrinkage->Show();6 n% C" E2 n6 t5 I5 l3 n
}
% u& Y# \; a k! a catch(exception& ex)3 ]+ c6 q$ T' U& E; N
{9 N- p2 K0 b) ]' s. ~6 ~7 M0 I
//---- Enter your exception handling code here -----/ j$ r0 j0 B4 b
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
! S5 W9 X" S& h9 T+ { R9 d K+ O' E5 ? } d! D- i( B- d3 a3 J# J v
delete theShrinkage;' @, U; v. c- X% c, b# H2 M
}# @6 |# ?* U- y6 z+ Z8 y/ y
#endif//USER_EXIT_OR_MENU
1 {+ K' P/ [/ K7 X- Z% D#if USER_EXIT3 a% C: f8 ]4 R4 u) I3 ?2 Z( b' R
# F: _3 h/ r; f$ z
//------------------------------------------------------------------------------9 C3 z) \: f O) q6 v
O1 Q: D% _- N5 V( C( Z4 |4 ] // MUST NOT use this option since it will UNLOAD your NX Open application image$ ~/ i) Y7 e; ]( |* g5 B/ B8 _
// from the menubar.
2 o+ \3 U' y0 Q; a$ n5 t+ f //------------------------------------------------------------------------------2 W; D: E3 c( x
extern "C" DllExport int ufusr_ask_unload(). {7 z: U/ B- R
{
% d% ]9 Q1 k3 s0 E //return (int)Session: ibraryUnloadOptionExplicitly;. Z. B* X1 p7 [- M% Y
return (int)Session: ibraryUnloadOptionImmediately;
- H8 a: r6 {" b# h# p$ L //return (int)Session: ibraryUnloadOptionAtTermination;! E' U8 r) R, M! O! F7 H' _
}% J5 n& o+ `+ B5 {% Y
7 G9 B1 W4 {* H# W4 p //------------------------------------------------------------------------------8 g5 r) O; {* x+ ~# Y) I: f' p
// This method is automatically called by NX.
) ~5 x( b5 `6 v3 f* f6 E //------------------------------------------------------------------------------
L7 U7 D1 f* I extern "C" DllExport void ufusr_cleanup(void)0 I/ V5 y( }7 w5 S( d, p' P; F
{
/ | E3 o9 l- L try- S) f: I6 R: T
{
3 |0 p- t2 e; ^, ?( e% @' Q //---- Enter your callback code here -----7 h7 u' m+ B% S
}7 C; `, V0 P2 b, N
catch(exception& ex)5 v2 k$ R4 J9 x4 p
{
, g/ I; r, X7 b8 L0 O //---- Enter your exception handling code here -----4 C; X3 N% s4 M: ~; K* c, h
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
# R0 K' T8 z1 l7 g; A, p7 |+ U# x; O% y }
, d8 d6 K' q5 _: U a! h }
& U: Z3 d0 x2 l#endif//USER_EXIT6 d6 J2 c& F% m5 r
2 a0 |& C4 @2 ~' w; S int Shrinkage::Show()
9 h" d" T) s& q! ?; d8 Z9 G {4 B- |' k% b- \! @& |8 n
try( p8 `5 o$ g0 P2 b
{) |5 |7 J* K8 g& N* g) y
theDialog->Show();8 q* }& Y' k6 r
}9 c, O; S w. t7 e
catch(exception& ex)& }0 ~8 g2 g; L5 x
{1 T4 W) W0 R+ o, s/ g
//---- Enter your exception handling code here -----
* y4 v4 Y$ L" Y) r9 F5 l Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());* v6 z2 m+ g5 v$ c! M m
}
$ e3 z+ C6 u* o( Z' y; B return 0;
* \+ m0 U8 l! \& K }
" @+ u" b% L# ` O3 G- k/ g! f! I4 L$ ^8 U
$ j3 I5 G6 M9 l$ b h#if CALLBACK
! a9 d3 N0 {4 |2 f, _ I, B2 n y! G0 n4 G6 M0 j
void Shrinkage::Show_Shrinkage()
5 T0 f3 ~+ f1 r {! V# h% H& C- W# G' h
try
8 g+ ^( U( V" [! Y/ R {# E4 {3 |( B2 c" l* I
theShrinkage = new Shrinkage();
5 s. u. v/ F9 q; J. Q
2 {/ d& `$ [& v7 l; D+ a0 W( | theShrinkage->Show();
' ?5 a, S. A- T4 x n }
* }) H9 V$ `1 T7 p. }" ~# z1 l; D- T catch(exception& ex)% \& n6 [& h: N' s5 H3 m! v" y# Z% H5 o
{
! | b7 E6 X) A4 v- D! u' c" R* Y" C6 {
& a9 S% M: `# Y* [$ @ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
8 p. b" Q# m/ R }9 j: z) O0 X1 O: S3 w% j
delete theShrinkage;
& q- U! M# b" n& v }$ ~" X6 ?( Z' a# r' `# a
#endif//CALLBACK k0 S0 E' A0 I" y6 Q
* c: ?) e$ ?8 ]( w c
void Shrinkage::initialize_cb()& H# L0 L& ?; d
{7 k2 H a( s3 r, G1 y8 y
try4 e9 y! u& ~! q4 W: n& m
{
~# M4 C* f- d+ J' H group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
: @( V0 n, u; v, i o face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
% k/ S0 n" K |! Z face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
6 @8 J) u- E5 b group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
$ Y! i) h, l' y/ Y! m( w: z3 z bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));- y3 T% G7 v" y' C
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));9 f, S( n% P' J( K$ f
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
, I! |2 M3 x5 R string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));' H* @/ v5 t! D6 ~2 `
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));) |- J5 v. L4 J9 c" r
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
6 ]$ a: O: H8 A6 x. ^4 v& s: v label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));% n1 V' _$ O: o y
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));2 a G+ R+ s9 i+ D$ B
}" s2 E# l6 }& Y4 B7 v( E0 Y( G) c) n
catch(exception& ex)
: E9 v6 I5 M! N' R+ Z- }; z {- x! O# V4 d0 G y5 G- `0 [7 o
' @0 g% r1 G( p& a/ t9 a Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());9 q" Y& ~, {& V' C3 B) w. u6 _
}
3 o9 r! X" g F9 @' ^) \9 r% a }; K; _( \' a4 [; x* m; I
//------------------------------------------------------------------------------) l% Z) @' J% ?) c4 u
void Shrinkage::dialogShown_cb()
* K$ F- a& n3 M/ S( A {
* z8 H" a: Z3 \4 b7 j+ J try* j( r5 E( B2 `/ K, u
{# @+ b* p) p' ~& u) r% `3 L
//---- Enter your callback code here -----2 b# U7 C3 ~1 O& ?
}
7 b1 h2 S& P' b catch(exception& ex)
! r3 E7 V# r. u4 w/ s {
/ e" n& B1 M7 `! N9 M, ~( h8 M7 {7 D, N7 M- f
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
9 a F& \1 B5 W: B: M }
' K. T6 h$ X; L6 i }
7 ]3 ^6 j4 D- `8 P- j1 ~
4 {, c0 ?1 A2 M4 E; d- R% e int Shrinkage::apply_cb()% ?6 X T% q6 R; W9 v& Z6 j" \0 t) O
{, H. t0 j( W( b! K P
int errorCode = 0;- n: R3 [$ }" Z8 y1 r( S
try
8 `1 N$ l X. `2 ]$ T, q {
* B( n% d3 [+ z) @) b //---- Enter your callback code here -----
, X: T- z. a2 B5 U5 m }0 A" V# ^( i1 d" y D
catch(exception& ex)
% N$ b" G, R% N0 @ {2 N+ j* p% b5 ` f: g6 A4 C6 a4 `- N
//---- Enter your exception handling code here -----
8 p3 O2 {! E. V, _ errorCode = 1; ^9 g! p* {% h/ e& ?4 v" d
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
. O& s4 j, k& y! {7 ]- C. E: a }5 K3 V' z3 f2 {; g* f! a
return errorCode;
8 ^" L* Z2 ]% P2 d% D }
- O6 z/ M" R8 d, e8 [, J' g1 U2 r$ y6 j; y9 l$ ?5 U |" o& A
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
9 }0 [: a$ c# }' r* Y {
' o8 r3 m: I( H9 q& l0 } try% d4 o+ _: H0 o- ]. M
{) P3 B! O9 Y6 w3 ^: ~) I: k! g
if(block == face_select0)' d* F% r# a% g4 E: L2 ~
{* d2 Q3 |, c( L0 w/ Y0 U0 J, N
//---------Enter your code here-----------1 S% c4 q. O7 X
}
* `9 R, u7 T6 S+ N1 S! t else if(block == face_select01)
( |( g; x! v4 V {" q2 {) A7 A0 A) G+ l
//---------Enter your code here-----------
; N" _; Z+ T0 E+ d+ @- [- o" W, m }8 x% g! \3 }6 w7 w
else if(block == bodySelect0)
h0 K- P) C) d, o N$ | {: [% v* D) U: w4 q: O f, X- ?; Q
//---------Enter your code here-----------! m' c' r. t4 F1 b
}$ J0 P' D2 s# f; k
else if(block == bodySelect01)/ ~9 @9 m& Z- o' Y
{
" ?& L. _2 g. j* Z2 U0 | //---------Enter your code here-----------) P" {7 `, C' ~1 C0 V- c; H, I5 z7 c9 y. S
} b1 N2 M3 I4 i5 v1 O
else if(block == string0)
, ^& N9 {, T! o9 o c4 m: A7 H; S8 t {3 @5 e# a3 j; J+ F% P+ x& u) ?
//---------Enter your code here-----------
9 t) l) ?2 v7 `* c" B( s }9 y, u+ |# k' Z x$ J3 ?3 T
else if(block == label0)( X. F1 g5 ?. k/ o: f4 D+ h
{3 ]- W8 h" z1 A8 H+ I7 j: i! w
//---------Enter your code here-----------4 w4 Q/ K. z0 g$ q4 z2 M; P
}
- t2 [$ Q7 b* x- y2 d" ?3 [ else if(block == string01)% k& }. N) G0 N9 m3 Z' g
{: t G$ `) z; ?1 w- H+ i9 m
//---------Enter your code here-----------
( K9 a8 t- r9 W, s }5 @) r. d' [0 j S
else if(block == label01)9 c- `0 }" S, G) D7 L
{- |$ ]* O8 ?9 C. A! U
//---------Enter your code here-----------
+ ]2 H1 ~( C5 q }! h5 y. \# @: _- N6 _1 h" b
else if(block == label02)
7 C2 T8 G% u) T/ i {
5 i2 G- V' W) }+ T //---------Enter your code here-----------
8 g/ g5 d7 Y! Q) B" H3 E }1 |/ ^6 N& K% V
}
. b/ C: z$ M: r5 g1 ~0 N catch(exception& ex)
- a _) \# J) t6 a {
% t+ e" `, c7 s6 k Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
3 Q+ y) a0 L' ]/ { }
0 Z; b) o, L) m2 Y" C5 Q return 0;
5 \9 O% R" M& Z: ] }( X- ?& v' {9 y& a) X- B' l) I4 c- M
; I3 l7 _+ Y/ @2 [! T& c
int Shrinkage: k_cb()6 I! i& U" J9 L D9 h
{" n# ~3 f$ p# C* R
int errorCode = 0;
4 F1 d# A2 F8 j6 n7 D try0 u4 ], [4 M) u- _. j
{
- e* O8 X9 c, c' T errorCode = apply_cb();% R6 `; c" k8 W
}; O4 F. g* \. r7 I9 W0 p2 x
catch(exception& ex); J4 [4 e6 d" ~$ A$ T
{
/ V6 T: E9 R# S) c8 N //---- Enter your exception handling code here -----! ~8 }, \" j6 M( D' J* C+ h
errorCode = 1;
- R# u1 v6 W5 _# {# l Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
+ J- a- M/ F+ X& t1 X7 U% F }* n5 v8 e. _( @ d; y
return errorCode;
4 D+ z$ D7 d1 A+ c1 X5 ?* K* _ } I0 K. R9 t4 y- ]/ d5 O
, Y5 \' F3 J0 n. O9 l2 V
//------------------------------------------------------------------------------
% a- X' d2 s1 P8 v$ I //Callback Name: filter_cb
; p1 T: r5 x1 B5 j- _. Q //------------------------------------------------------------------------------
6 S# ^" U' G# U int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)( d& @& X* d" s* G, ]
{
$ N# d- Y/ w d- c! o& q) f% r: J return(UF_UI_SEL_ACCEPT);$ e2 c! }& G3 l# G
}
3 J$ e" R: n1 }. A+ g. W& j9 [
0 C3 |! l0 t+ P+ ] //------------------------------------------------------------------------------2 m7 T, b3 w2 g. @! S4 M
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)+ d, [! x) F7 {* m
{
9 t( Y+ d8 e" g: A) H try6 n# _. I/ \3 q* l
{
! z3 k/ l" R, e2 ?' x4 [$ m& m //---- Enter your callback code here -----* G* l1 T0 S7 R
}) L+ d' \1 p7 `$ k* f
catch(exception& ex)
! j5 [+ I3 Z1 y8 |" W& E3 F {' Z4 N) @+ g" F- R' W/ m
//---- Enter your exception handling code here -----
2 I' k) Y9 A. ]& h Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());, s3 u+ Q% `/ |4 t/ m9 n$ \0 m
}
; [5 H/ P1 s2 S7 }' w# n* o }
: b; u) y) H5 b! M) _# j - Z. a' M# I/ A- W
//------------------------------------------------------------------------------6 |2 O7 _$ B9 R( M% M
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
" ^/ D& _+ u0 p+ G# y {: g- f: W' D6 x @6 s
try
6 Q1 ?% A, m4 C3 L. o {3 A( q' W. W# o4 M
//---- Enter your callback code here -----5 H! H) p) w7 G" U+ e) e' X
}( x! i6 m7 {; }- m$ L
catch(exception& ex)
6 ]+ T7 x+ _- l1 b P {
5 A. @2 ]3 m6 q7 N
3 s" I" ]7 I# z2 W Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());' P! \+ r* t j; o( c- y
}
; ~' e4 `# ]. o4 @3 f2 B }0 \: h/ W5 ?- J% {
K& a7 I+ N( [; ]+ i! i
2 `2 R% R8 i# d/ T# v |
|