|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 ; G/ l8 Y; H. \, c. M5 S/ | c6 }
* T) z# v$ K1 C6 E4 h6 y. r
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr1 [7 P2 `1 @9 r) U& w
代码如下:, W C3 b! @) G9 ]* Z0 S8 W- T( l
#include "Shrinkage.hpp"( r! d1 [& G# H, a- a
using namespace NXOpen;
+ W* B8 t# ]% a4 G' _using namespace NXOpen::BlockStyler;
7 O; d- f. j* ?0 M( Q% V: y
* t) N- l* g K+ H5 _( [; zSession *(Shrinkage::theSession) = NULL;
$ _* ~4 }4 D' J oUI *(Shrinkage::theUI) = NULL;. c8 |. i+ B @( o
2 t) N6 @+ v9 O8 IShrinkage *theShrinkage;
, n- v! s# q! y
( _. H6 Z% V3 j3 Z5 _# PShrinkage::Shrinkage()( [* ~1 @6 z9 \! O; h$ Z4 \& P8 u
{5 g, |# i9 j) c( P% m
try. S, m$ u8 `& Q2 s0 E
{ w6 m& l5 o+ f# \
// Initialize the NX Open C++ API environment
- T: i0 t* p, l; M$ n/ f% f/ T Shrinkage::theSession = NXOpen::Session::GetSession(); J6 X# B! @, R4 D' s6 {! N
Shrinkage::theUI = UI::GetUI();
" Z$ G5 M0 j/ z$ C7 U theDialogName = "Shrinkage.dlx";
' P4 F% v# i% n& b% W: ]) l4 U theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
5 ^8 r, [7 `; l! w6 I7 H // Registration of callback functions
u4 F- G" W8 p theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));+ E4 L* Q: G/ s- `. P
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));7 b5 k' I' b" j# Y" P _ V7 R
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
2 ?1 ?4 x+ Q X5 d" l$ ~( w$ F theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));1 q5 R2 ]! J" Q" R
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
; ^% u" y$ z+ K theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));/ V4 I6 O6 B1 s
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));0 t% u4 g7 T: f s1 n
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));. _7 L+ s0 P: Q' [9 J0 ]
}
' ?' p( M+ Q, ?' }( P2 l" \# s" J caTCh(exception& ex)
2 p) V$ }$ T, F/ K {$ Z* H4 A" }- z, p3 [! ~
2 i6 i0 l* D3 O' g, V throw;
# d. U' G: s8 }4 F' s }, S0 `4 t' b' F4 A y
}( C2 j6 {9 D& Z( W3 B9 Y
% T+ e6 Q0 j/ u5 L7 p7 V
Shrinkage::~Shrinkage()
; w! ~5 E' m: \% f; b' \ A{6 k! o, w8 n4 R7 ]
if (theDialog != NULL)1 M5 J* r+ \ g, b+ i; s2 `+ t: I; L
{
& Z) [- @* K& O& h4 U delete theDialog;
. p6 m& H, e/ n2 z" K theDialog = NULL;7 p$ C. o. M$ z! d" V
}
+ J6 B8 U& M1 A* U5 U}+ q ]4 S; S* j
X" O! P* P1 S i7 R! e/ Q
#if USER_EXIT_OR_MENU: [, w4 a# r/ r+ J$ B# v
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
/ a* e' J7 i, I9 @/ D {. X5 z# q) A3 M! \$ \' M
try
. I$ p. K# B0 ^+ `7 x |) y1 i* G8 C7 q {
: C; D i, _ S# l0 s6 I theShrinkage = new Shrinkage();
' a" s, x0 ^! h8 z // The following method shows the dialog immediately$ _- V0 B) q# P8 Y% @& J1 L
theShrinkage->Show();- U! _6 D3 N% o' x4 z& c
}
8 J c5 p- y! E# F1 P# x, }' S& ~ catch(exception& ex)6 q1 S C# A) l
{
/ O) K' B( l7 @! p //---- Enter your exception handling code here -----" W* G6 [ B H
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());2 ~3 P- ~8 i8 F: T) u7 F
}4 Q6 ^, ~& u* U1 d1 Q
delete theShrinkage;
$ @ D6 C, O. s9 N, K }
% g% L- k( r" B) p5 V- X1 d' G#endif//USER_EXIT_OR_MENU
. e$ T- a$ V, Z* g+ x# o#if USER_EXIT
8 e9 d- `$ D, w6 i% N k
4 y+ x( ]) [, H/ A& w( j! r: K* P //------------------------------------------------------------------------------
: _8 n; }3 D a" Q3 c; I R
" M8 Z6 z9 N2 H4 e8 J; U$ X // MUST NOT use this option since it will UNLOAD your NX Open application image
4 a b- W4 O0 }+ \! m+ P // from the menubar.; K0 [5 w. k. ^, V! x
//------------------------------------------------------------------------------6 t5 t# s# P% T$ ?6 V1 T
extern "C" DllExport int ufusr_ask_unload()2 l& a+ p2 n+ J" K. r/ k0 d0 h
{
" }) I* g& \9 l. A) U6 ]" V //return (int)Session: ibraryUnloadOptionExplicitly;, i& V; C& U, p/ [$ t: z+ M9 U
return (int)Session: ibraryUnloadOptionImmediately;
5 |3 x5 w1 t2 V+ q. ~ V! C //return (int)Session: ibraryUnloadOptionAtTermination;: D( b8 e+ N; P9 T! m
} u, Z# R) B- c! o! F+ \
/ T: {( l3 e/ d6 c% {8 k }
//------------------------------------------------------------------------------! E7 c4 I( N) k3 \( \
// This method is automatically called by NX.( s m! \# @$ r
//------------------------------------------------------------------------------! O% k5 \, |1 D, x) ?
extern "C" DllExport void ufusr_cleanup(void)
* B1 V2 l3 U1 m. R. W: F+ t! D {
5 l+ h% |, S/ E try
" y p# L0 L7 D! b: {, e- Y {; g- _5 h. o0 q: q% a
//---- Enter your callback code here -----
- B# h/ z. [0 b }
1 o" Q' r# [- J* W: o, T' g& H catch(exception& ex)+ w& e4 c* r1 x3 t. U/ S4 X
{
3 g/ a/ _9 B, f* x9 h z //---- Enter your exception handling code here -----& L( h; i# S$ ~1 B. s+ j
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());9 T- K6 J9 k% T1 B) w* Q
}
2 n0 S$ o' t0 _" ^ @) { }
p- I s; c0 v0 t#endif//USER_EXIT/ N8 [ ?4 S5 K
6 t, [4 `! [8 B5 O int Shrinkage::Show(). O: ~. ]1 l: R+ g- f. a7 R
{' Z0 K% E8 N& {! h
try1 X; ?! `' f& n4 ]+ [9 h. o
{) W3 m0 m) Q; k6 _6 B9 z/ @; C# Y
theDialog->Show();
2 \* d/ S4 B6 O" P; D }& k3 Q A# X, ?9 n
catch(exception& ex)
: ?. i; N# U7 h' G2 d- O {# b8 R, O1 m: N9 S+ Z7 }
//---- Enter your exception handling code here -----
; P" q* k/ E! Y5 s Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());& f2 d! m7 j6 `# M+ K, Y* @
}
! ?+ ^& v% i, o4 @, k3 X+ C return 0;
# G z& t! t4 H9 D1 r5 Q$ c m" t }
/ s# I, `' C" A3 q: H # j4 f4 Y1 T6 O' M- E* R
#if CALLBACK
5 i/ S+ V; H' A% k
' E: e" o0 z) D& z4 W: D void Shrinkage::Show_Shrinkage()
! `9 t) |/ \" h2 J- X {
3 |" \$ F% S2 ?. X' Q7 g' x try& [! c; d1 c$ N" e1 ~
{
3 E, }( X+ O3 Q+ w- P. n theShrinkage = new Shrinkage();
1 x; u* i& B" P& L
5 R+ L1 }3 Z8 ^: X theShrinkage->Show();/ ]' m5 W* T" _+ W
}2 \# ^+ k: J' b. r0 B
catch(exception& ex)
: P6 |0 T" f) D& H8 S) z1 V {, i- T8 w8 }4 C$ b' P3 A
% s, J9 ~7 b$ F6 ^. V) n7 l
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());9 M; S' I' c0 t; [7 e* N& l
}
% L, h+ O4 V/ j! C9 {7 j delete theShrinkage;
# n s4 ~1 Q3 U8 z: d0 g+ M& z }
4 ~+ e5 K% e, |#endif//CALLBACK
% N8 |, U$ f# O; q+ ~ 6 Q/ Z" d' c6 Q
void Shrinkage::initialize_cb()
1 S# V2 ~! C; Q& k$ X& w {
$ N& \; [% {! R' Q& \4 F* x try0 Q8 A4 U9 ^; K& ~( ?0 s
{
! o8 r" E/ [; d5 q* d; K9 z group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
( U- ?7 j3 F- T9 M, u face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
: [2 V* U8 @/ v7 z! O face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));, X6 X9 R) E; ~ V' M+ P
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));* S: T3 q3 \' c' @
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));) B: O3 @% k) S- v
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
$ Z. u8 e7 c, ]5 N( V- [ group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));) k& h# B0 a$ c- Y5 [1 a
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
1 P: s3 `" V: u0 x5 { label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
/ _0 x: J: H$ p4 Y! \7 _ string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
4 Y( F1 _! d) R label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
. v; ~* U* P" [8 \) U label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
6 ~' z/ q2 w! h4 P }5 W4 @% _1 Q3 H% E* k! }- N% R
catch(exception& ex)
9 `& h3 v; g, z {
* _5 z d) @; O: ]
) G) R. f/ p' m2 s' u% t Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
2 b' [$ S) E' `0 N( h) E4 t1 o0 x j }
) I9 U5 ?, o* @! V' B }
& Z6 g$ M6 w! F3 h7 d- l- x% b: c //------------------------------------------------------------------------------( y; t7 @) Z) d7 m7 s0 z
void Shrinkage::dialogShown_cb()+ D }* y" m* _3 k
{
p5 Y6 I2 ? u3 H, ^# G0 G try
# L( g& a) j% N6 e" w$ Q. Q {! |+ z! D7 Z1 h; k6 U: { h
//---- Enter your callback code here -----
& ^6 Q9 g# k( e1 b$ ~, [0 G+ g0 f }5 p% A+ b5 @# F, a) J
catch(exception& ex)* e( Q9 b3 W* ~2 h
{
7 I1 _4 F6 R2 |0 l2 F/ @/ B u7 y) u! v$ R9 V; x
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());5 g3 y p- D2 w% z
}
, X9 f# w8 l$ `7 ~) I$ [6 [: F- V, e }& t5 i4 U7 q5 s5 l
* q4 `8 C3 ~1 v' @ i0 W
int Shrinkage::apply_cb()8 t1 d$ y r9 e. t
{% Z9 n' Z# I0 H. b4 L0 }% @ K, U) ]
int errorCode = 0;. t. r, X% I4 B4 J9 @( A/ F
try+ T" x* u8 A4 y1 f6 Z
{
. M& c; [1 _; }0 e+ s //---- Enter your callback code here -----
! n6 j1 x8 p/ y- }3 C' u, A }
4 i3 u9 I2 ^' z. a3 J, { catch(exception& ex)' l, ^9 d5 x: G$ R# `4 X- |: K
{
# H" C; E) @) Q9 `) x4 w" | //---- Enter your exception handling code here -----2 b. Q& C; t4 d1 g/ X
errorCode = 1;
$ u, d9 @8 i9 b* R Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
5 X% g" r; D. h. x; r }
/ O/ \. k( L8 F/ w return errorCode;
7 A; I# K- M7 S' C9 B }
0 k0 C' s6 P4 @" ~4 V! r0 R2 r5 o4 m q3 S. k( A4 M
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)* F8 A# Z; e/ U3 l1 O6 l+ U' z
{
5 l$ G: E S* o0 q" v3 K8 s try
3 g* g- t' I+ M1 R+ G- d {
& s/ z& F. g& ^6 p if(block == face_select0)
/ O1 K* t$ ?$ x1 B$ [. j {
& r: c. W4 {/ @# o //---------Enter your code here-----------
; x4 m( ? E# i6 ~# n" j" y4 ^' P+ c } [ H3 X4 K' [
else if(block == face_select01)4 c8 ]. a/ C$ c/ `& p
{
& Y/ v2 }. L, y6 h1 k M# Q$ x5 s% i //---------Enter your code here-----------
+ s6 ^, B [. Q! w- M# Q }
9 U+ h" g& _% K9 M Y else if(block == bodySelect0)' @2 A' a$ L. y) Z
{
" ^6 e8 W8 J% K, A+ B5 ~6 S" s& I //---------Enter your code here-----------8 c: ~+ [+ {: z$ i, Y0 D
}
1 A+ J- x# Z* H. [2 N else if(block == bodySelect01)
$ y! w& g" l0 }! X9 u* X' D7 n {
& i; j) E' W" [0 L5 b //---------Enter your code here-----------" g" l" [- N9 S1 y
}
1 j% d; J& z/ L else if(block == string0)
\; r+ ^1 v2 D7 z o) k {& b) `4 B: @! o
//---------Enter your code here-----------
1 }( l: R4 Z0 L1 d O3 v }$ k/ l) W* @0 g& V
else if(block == label0)& Z: n7 J0 _* p( D3 M1 }
{! ~" g6 ]1 k- N
//---------Enter your code here-----------
$ p! ~* `1 {8 Z9 d- I }
& w: @7 t, t6 U* G1 [! h else if(block == string01)
$ o8 @4 j; R+ i8 @2 J$ D {3 |, V! N. o4 C4 m, z" Z2 `$ \
//---------Enter your code here-----------3 Z3 t+ k2 _8 w# V; p" ?
}
! j Y$ d) L0 C' | q+ r: a else if(block == label01)/ X/ R3 a1 Y; _
{6 B! e, W/ F8 S% r y8 F; ?
//---------Enter your code here-----------$ [ E+ v5 ^9 M) G$ ?0 J6 L
}( X% R2 V0 y7 E v3 P
else if(block == label02), Z+ U! |% k( F& {: n
{& S2 b" i8 X; D: W# f- d2 p
//---------Enter your code here-----------! ~# I. Y" P- y$ c7 D3 o
}8 Y3 T) L8 B9 Q5 g% c: E1 K7 L* E
}
* V' U" X9 l6 O* ^% U T& Z% e# C5 v catch(exception& ex)! O/ z$ @, ]4 w
{" l8 h S+ T/ x' E
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
0 }' r5 k2 l* @3 G0 B5 r* m. G }
* N/ I5 S- z. j* w* X0 q9 } return 0;9 _8 q$ Z/ t4 f8 @# M/ O6 [+ y6 D
}4 V2 Y, N" V' u
$ ` Y7 s8 V# V' b, g% D7 Q) P) U2 M int Shrinkage: k_cb()
9 d1 H7 J4 H5 g( s4 x {8 S8 Y. x7 e9 b M0 \7 a' ]% l) q3 P
int errorCode = 0;) Q" V: B+ z/ e9 @; ?/ s9 Z
try2 G! k. y; u- |0 P2 b
{
) I) ]" I5 u `* B1 @ errorCode = apply_cb();
5 l9 C! O7 Q9 d' g' h& Q }+ Y4 U" U3 `- S4 X, s% n
catch(exception& ex)
* a) c. U- q; M8 L8 E$ i {8 A0 q0 D8 m# { R9 u! Y
//---- Enter your exception handling code here -----5 y- [ V! {- U% y
errorCode = 1;
0 _6 s8 U1 M4 J# o* A0 _% C Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
% H5 k; P5 V8 E, R8 c7 _+ h( c }
5 x" C+ e/ ], @# F) \+ @. z return errorCode;
+ A1 n# b+ u, j- N Q/ R) d4 n }$ j2 N% z$ Q& p, u
' q5 F& u% R; M/ z: w) ?( ?
//------------------------------------------------------------------------------" V; u. |$ {9 s# m/ r1 j
//Callback Name: filter_cb
# c/ z* x7 b( _% p. v6 I //------------------------------------------------------------------------------
- }) V' D1 _& v int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)# C4 I& N: Q! i3 w
{
0 V0 I0 n( E# a* a. v m4 N u% @# p8 }! | return(UF_UI_SEL_ACCEPT);
; g8 E |$ ~4 Y, ^( z& Y }2 Z, f8 X6 f; W1 ^7 m0 @. S
1 S9 ~* s5 l& @ //------------------------------------------------------------------------------
9 i* \ y1 p q+ C0 V0 P" ~ void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
$ |/ p2 w* ]+ W {* ~; j5 E/ c0 p1 R0 I6 J v
try
% ?1 ?* \0 z4 H {
/ V0 r6 P4 F, ~- d+ z //---- Enter your callback code here -----
) l0 M5 O) L, i8 ^: m }
; B4 p* S7 r: R) l catch(exception& ex); Q8 _* D" |+ N2 N$ ]
{! u7 f, ~9 C9 k% W* g1 U
//---- Enter your exception handling code here -----
4 ?1 \$ v$ Y/ H5 ~: i: f. d2 r f Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());: N6 q1 K& Q- P+ P) ^: Q; [9 ]
}
D7 i3 d" H* Q( m& X' ?$ U }
$ u! y5 x" l" }. ? 9 s) k9 k2 H. B% E
//------------------------------------------------------------------------------
% ~) J- Y5 E6 ?- B7 i void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
6 k8 B0 ~' o( Q9 m5 I2 D- w+ Y {
9 j- u/ |! h4 [6 C3 U9 a try2 W" K+ [6 l! Z
{
7 u1 C5 g7 u8 s1 W! q //---- Enter your callback code here -----
2 G' f/ Z( V5 Y; }0 ?3 ]2 z }* F$ e1 @+ `1 E$ l: S
catch(exception& ex)6 w( g3 b) ^3 d6 `
{
4 }% c. |3 U M. Y5 \( s8 X. m
( S' y: C; }% F9 ~, x, X Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());" D6 A! v1 l0 \1 @" z* H" H( U9 U
}
/ v9 r& c; o; ?0 p }
4 A. O" T- ~# q" X- D% _" [# I; O, X0 r8 m
# T4 f/ w/ g4 S9 S( J
|
|