|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
- {0 n( o% E! U( r
# c6 w8 R3 n* _( l% q2 ~请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr: a5 t9 M3 e j# C; j
代码如下:
+ K6 {7 M! X/ y9 t% T" R1 n Y#include "Shrinkage.hpp"4 r* o4 p& q( n, J
using namespace NXOpen;9 e& w* O/ d/ s0 {* @* j' p u
using namespace NXOpen::BlockStyler;
# h; [" V( x" J; A4 T8 N f
}* v( a( |$ D" W9 o DSession *(Shrinkage::theSession) = NULL;
( X% A; x3 i# J. q- y: g% UUI *(Shrinkage::theUI) = NULL;- Z" p3 R" i4 f7 J; ]. `
' V1 H& P/ J5 m7 c1 lShrinkage *theShrinkage;' A& B* v+ }" V) k
* M; y6 \4 O: i" LShrinkage::Shrinkage()
$ v4 i$ q% |/ x9 L{
* h. R" X; x: n, I$ I+ a try
H/ C; W: ~0 @+ \6 E; P. R { j) A; Z% A6 W- e! s; z) Q
// Initialize the NX Open C++ API environment
6 i: u5 Q" r c Shrinkage::theSession = NXOpen::Session::GetSession();
$ j6 z/ r* q( D1 i Shrinkage::theUI = UI::GetUI();
5 T1 c* B0 a+ r( e3 S theDialogName = "Shrinkage.dlx";
5 ]3 e3 c9 z7 l2 J( v theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
( h2 J7 c' t6 y8 h/ M) `% K# S$ _ ~ // Registration of callback functions
/ U5 v/ D7 z0 I ~0 t8 `! D: K$ ?" n theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
f: l$ l) x, n y0 E% F! R theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
& ]! ?' Z2 l' ~; G3 G" V5 V theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
- U# D8 R0 A# o theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
9 s/ N6 C* A& F, m theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));# v" K7 E6 ^! {; Z: d7 g
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
" H5 `# y2 O1 B: o6 A! E" t theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));& ~" V) U) Y I4 H
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));' T8 Q [2 q s! P8 n6 G" ?, ]! ?
}" q( K6 w" ~ C
caTCh(exception& ex)! }) _6 H, f: X W$ v1 C/ l
{
6 O" s# m. j5 ]% Q) a
% G+ q& E: q2 N. y) T I" L7 `0 f+ O throw;
# ?6 A' |: T& T k }
% W! C! w& A7 b3 O( U: Z$ h7 v {}: `9 f9 ~9 L9 ?; X) r; j1 B" N4 ?
0 P2 F) t! s" f( e: ]1 K' zShrinkage::~Shrinkage()2 o0 l) {2 l1 ?/ _, Z; K, D& [
{: Q/ H9 F7 E9 I M6 Q
if (theDialog != NULL)# w/ q& [, k4 v% [
{1 c3 ~" q4 G& r
delete theDialog;& d1 O$ D( @# F
theDialog = NULL;
* c9 s5 T" G% M* b8 { }
4 \0 V! a7 N L& X0 Z$ r}
; u* \# o' h8 w* E! M- }- e
) v% z# I& c b+ J9 E! N#if USER_EXIT_OR_MENU' a3 V1 g9 ~9 q2 |$ g2 Z
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
8 p/ V5 c! G8 k/ {+ k {
- o# f6 O/ U. \. ?. [ try" j5 g# P3 ~+ p
{
9 U$ G. r0 P7 I) D! ?2 {/ K theShrinkage = new Shrinkage();. v& z) }8 e, C7 @$ d
// The following method shows the dialog immediately! A1 |! d/ {7 T3 o* p5 z
theShrinkage->Show();
) W$ N L9 s1 t/ l* M" O }& R: C1 S& ], U
catch(exception& ex)
# v9 ]1 c- s! W4 N) ^( J {
& s# K! ~, M2 t% N. s9 r/ a //---- Enter your exception handling code here -----6 C) ^% F9 ?5 J
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());6 q! ]/ m# v2 |7 Q3 s( ^: h
}
- \: S; H" G9 \( Y8 k" Z delete theShrinkage;
% }- f5 I& \' a R) J$ ^ }0 m- g S3 [8 k
#endif//USER_EXIT_OR_MENU8 q4 o; v$ M* V& ^7 T$ F
#if USER_EXIT: j; \' E# ^: `9 L
0 z& V) N0 U- o/ Y ^8 k+ d //------------------------------------------------------------------------------* |# z) v/ T; Z& [& w6 k) t
4 N9 p; c5 \2 o' O# }: ?
// MUST NOT use this option since it will UNLOAD your NX Open application image
/ q- j5 U& N" k4 c // from the menubar. K4 E/ J9 O& i1 ]+ ?# [6 Q7 k) m9 d
//------------------------------------------------------------------------------
/ I/ \/ D/ W$ `5 Z- a extern "C" DllExport int ufusr_ask_unload()1 d, a5 B/ J6 Y3 H; @3 _
{
' D/ _) o \2 |& m1 l5 T4 v& n //return (int)Session: ibraryUnloadOptionExplicitly;& x& d: r* p3 a# z3 m y7 i- a5 r
return (int)Session: ibraryUnloadOptionImmediately;# E* [* Y; b$ V- n
//return (int)Session: ibraryUnloadOptionAtTermination;
4 C* Y9 B* t$ G/ _ }# V7 F' K, t2 ?. @' U$ ~; R5 B5 ^
6 A B/ L* Z& x5 Q1 @0 Q; [- @ //------------------------------------------------------------------------------' W2 f- X+ n8 k' O3 e# f9 S4 P8 _
// This method is automatically called by NX.; M8 k G3 D9 U+ q) |0 H. e
//------------------------------------------------------------------------------7 {* _( O. b* d. g
extern "C" DllExport void ufusr_cleanup(void)
0 J% v5 u1 r6 H+ ~0 d* h8 z. ` {
% M3 u" B% d9 ]' Y0 |% ] try8 i# m- D, m Q
{% W: J. B+ O: u
//---- Enter your callback code here -----' A, s4 Z, ]/ G. j& f+ `: P
}' ?; M5 {! j+ z L/ E$ Q
catch(exception& ex) g4 Q1 Q+ v2 u7 A' i5 u2 I2 I& O
{2 {2 O" c) G! y0 Q0 h v
//---- Enter your exception handling code here ------ E: d- U0 K+ C2 j
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());' ~- }! g" E z) b: u$ w9 ?: O
}
- {5 u7 w; Y% W( v* ~& L0 _6 X; N }4 N: h; c) r2 U
#endif//USER_EXIT" L, W. ?1 ~2 c( \6 e* ^, s; x
. O1 x. ~: r# L- L3 b8 C
int Shrinkage::Show()! T" D/ ]( p2 `! u/ n
{
+ ~) x9 P' m5 D* ~8 i' `5 Y try; E$ K9 D9 o! H5 }( ^
{. U" R( A- i5 T# W
theDialog->Show();9 P/ l$ v5 v3 A$ s3 H$ l
}. ~7 c8 v% B! t& ^; H$ k |; b
catch(exception& ex)
2 n. `0 U7 s& k {
6 {: K" l$ ?0 Q# J4 D0 C3 g) D0 Y' Z7 C //---- Enter your exception handling code here -----
; F" q; _0 ?+ J5 ~- g Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
6 g0 Y8 B" U% {' Y5 D5 X# V }# B/ v$ S- N& G. V
return 0;* F, p) Y C% @2 [
}- D4 s4 n# `" V
; C/ P! _/ C7 E: b. @& K#if CALLBACK% V4 C/ X! N& W* ^2 O
0 G" ~3 J( Z, _' l7 q void Shrinkage::Show_Shrinkage() O5 z% y; I/ y! N) Q7 m5 I
{
% z2 W, i+ H9 o try, ]0 d9 f4 w5 R9 ` a; T' `
{
/ w5 ]+ t4 B$ | theShrinkage = new Shrinkage();
; `, d i+ b* B i" z
6 l. K- D) i: U1 u theShrinkage->Show();
: e3 C, ?% [+ z- w. n }( v( x4 e @ R1 ?! J1 g
catch(exception& ex)
6 x- l+ | y0 r' ^4 j- s {: \4 H7 W; |5 z1 u8 ?( G
# L5 h9 @$ J* A' `' T# P' G Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());+ i' G7 F. q _) b" [+ a7 i3 d
}1 W2 Q/ J& h9 C( U
delete theShrinkage;+ Y8 V: {7 d @) e$ p+ p1 j M9 k; G
}
# E1 x3 _9 W+ {$ K# W#endif//CALLBACK( v. R; a1 x3 Q! R9 o' v: [' q
# k' n& U( u; Q v2 J0 W. S void Shrinkage::initialize_cb()3 o6 {7 V E6 O" C- s" O$ M
{2 j* D. L2 O+ ]( e$ B4 ?, K
try6 Y& Y/ h/ W% a" ]4 Q8 }6 @+ S
{% s' {3 [6 N! @+ s
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
9 `. h* p$ M. h face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));- i% D% A; P' a$ D5 F% e
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01")); |0 v$ {3 P( O( t
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
9 D j7 Z, |) Q: j# a1 r) s bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));5 M0 ^( q% _: e
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));3 B% m- G4 I8 M5 O% A
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));! G& l! _5 X( ?! O6 Q
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));/ x4 U" T& v8 c! F4 s' k" g! {. @
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
1 ]# c$ |% ^. k8 Q0 ~+ v: z string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));5 @$ u9 T4 r4 s3 o
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));" U& ?3 Z! C' S
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));" C8 v1 m; B7 @( @; w6 v
}: \) d; x' Q0 L4 z- l% K7 g
catch(exception& ex)) g) e; Q q4 M2 y* H; a, g7 m8 U
{
8 M, F4 k+ N7 _$ E/ _3 G6 _ 8 S% ^3 b; T, W# j; N
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());' u7 P. _) N, r5 }
}
# J: S# x. T: v. G) ]4 A* Z2 a4 u }
+ ~% ?( C' J7 D" T7 u2 w" [ //------------------------------------------------------------------------------- `( c9 t& e! r
void Shrinkage::dialogShown_cb()' c- V0 v# ]7 K$ N q
{2 ]2 e1 Q1 I1 q7 { ~
try
: K% n2 T2 I0 q# p [4 {: I {
. q; v7 Z: \3 O; f0 z //---- Enter your callback code here -----# ?# N/ {, E# P) B. s' m8 W8 k1 L
}
4 e( F6 h3 d; s. _1 z! x0 @# v catch(exception& ex)
! z+ c' B w2 X( O+ x6 G {- ~+ W4 W# M6 y9 w- V0 [
3 X1 d8 v* P2 g' N2 r
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
6 @# U& K/ E" k$ y9 C0 p }8 P1 {5 h5 e. p! n
}
# G- R6 f2 f! e$ g2 l0 p
: N8 X) C/ y3 x8 Y2 Z int Shrinkage::apply_cb()
# g, C& C ]4 p/ }, x {
- A5 {7 \% M& v4 Y int errorCode = 0;
( Z/ P. x) J2 b* O* n try
- z( J* S3 O3 j$ O+ H# Y0 i* ? {
+ U( X, M0 Z/ e5 B //---- Enter your callback code here -----
/ T, @6 ?5 n* m }6 x9 a: @' T6 e" |
catch(exception& ex)
+ w, I& U6 u' i9 |2 P {
& o3 L) m0 O* Z3 ^) o, R6 J //---- Enter your exception handling code here -----: z) N& H0 L4 u$ [
errorCode = 1;! z( W% S* a. `, m( L4 w
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());, t% _$ X% g3 F! H6 m& x) c
}3 w5 V2 R9 r# r; e
return errorCode;: R5 a7 |) O5 w" E. H
}8 _# }# w! b. N/ H; p% c# O8 U
8 t) j. I9 T3 T4 w* J
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
# Y0 f: ^% S# \+ k/ r9 q6 l {/ M% I' E g' ^: T7 I- U, l* b
try6 u& B& d2 {! k) a% _1 f7 c
{
3 p) H" b4 l3 d6 P3 _0 m, z7 g if(block == face_select0)* w; `) f D# p3 x" E
{3 _9 R" T# h& a9 f v7 C" n
//---------Enter your code here-----------
j: m$ F6 n) O }
5 o: k5 U4 e/ {$ e; {4 G else if(block == face_select01)
1 ?! `7 `5 o8 B. @ {$ o& R8 P4 d, u' W) j" |
//---------Enter your code here-----------
F$ F& E5 v. Q% F3 n }
* j% n1 e4 U5 r* a% t else if(block == bodySelect0)
8 \" Z3 y2 k! i5 o. \2 Y {
. `% C7 i6 X+ V) E6 r7 M //---------Enter your code here-----------
5 G) K R! d) N( l: H1 K% O }
% p9 k5 O0 p! L6 Y6 [$ k3 n else if(block == bodySelect01)1 K' _! i; Q0 y7 K5 a
{8 g3 N9 c0 \2 G R' E( I, ?
//---------Enter your code here-----------
! R0 L- E' n1 k" {, }; G3 B }
7 F* N6 y! ?( d( M else if(block == string0)
5 S' l! P% T# q4 n: v( M {
- t! n+ k, ]8 M6 J //---------Enter your code here-----------
0 z6 E6 y( }1 ^8 N( l3 g& c! `0 p5 E, f }
5 A7 s: f! T0 J" ~5 A+ o8 T else if(block == label0)5 r9 @1 s4 K: C& g) _ _" |. N
{
* @& t$ H% _' X: H; t/ V) A8 T //---------Enter your code here-----------
& c7 n( e! S/ k: R6 X' b& }$ _$ c7 j }# E9 @& w; ?, K& `/ D( I
else if(block == string01)
+ j& J" v2 Z/ Z. x+ A- r& } {: i, r' u; h; V. Q
//---------Enter your code here-----------' }, { |: r+ }% C
}0 Z! ?! u2 O1 N' `) ^
else if(block == label01), A/ \& k7 k3 Z" i7 ]' a4 P- O; q
{
6 I: {" L W5 p5 F9 y/ N //---------Enter your code here-----------6 q" L+ _& [- J" C) M+ B/ A
}
2 J0 v+ y1 C7 y+ n* s' @& w3 ~ else if(block == label02)8 `: X; t2 J! v: i* |5 m8 u* I
{
- g# x/ D; \2 d- u2 j' G. L2 C //---------Enter your code here-----------
; z( P) R; F2 j% i# J' K" o* G }2 M7 ^7 Z4 A" W+ {0 s
}8 a A! {! s! H/ i2 ]
catch(exception& ex)
5 C& |# x& v# } {7 q3 U7 x- I* v& L! r
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
. Z5 {! C: V; a& @5 R! M. _1 v! U }
7 N- W4 A4 e! d9 }5 R( i) W( { return 0;% P' Q8 G8 D! M
}
5 h( c+ s6 v8 d6 D( t
( m: V6 f" N$ [4 O$ w int Shrinkage: k_cb()
3 ]" U7 O6 G$ M2 f7 D( h. o8 E% x {
' o8 L) J( |4 w, R. b1 Z int errorCode = 0;1 Y7 U9 _% @6 u& V; y
try
" A4 @5 h# K$ Y {& X. ~$ r+ g# i6 x" ?) ^, y$ v
errorCode = apply_cb();9 ?- y% `5 x* v- P
}6 d! J) Z+ s, E9 e: r0 S. s/ N
catch(exception& ex)
0 ~/ t: r! y: `8 \5 F' ]( {- l {9 X4 o: N. x8 x" h, G7 Z* P! |
//---- Enter your exception handling code here -----
( N2 E. m! N; W$ ] errorCode = 1;
$ U/ T; t8 {' C, S! y' q/ l6 p+ i Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());* Z$ h u' ]" Z: n! C, V1 v( o3 j
}5 W0 I) }$ K9 i$ [
return errorCode;
+ f% @- m, {& a/ b" B' }- d0 y$ r }
; D3 S2 Y' C. p" \
q! A* _3 @2 z% d9 j //------------------------------------------------------------------------------
5 b1 j- a. z4 K //Callback Name: filter_cb3 J; o- V- X2 Q3 q
//------------------------------------------------------------------------------
. x4 }$ ] s# i: p int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
M) }+ R: a) x {. E% H! z8 G( a6 p8 S& s
return(UF_UI_SEL_ACCEPT);
* j4 N) V- f* j }
+ G' n/ g& t/ e5 n& l ! c1 Z( X( ^/ F8 k( j' [, D1 I9 d
//------------------------------------------------------------------------------
: k* N% H- V* j: f; e) E ` void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)4 }* e/ ^: s- c. Z
{
7 X9 g6 l$ \3 i6 o) B$ w try
9 W& F* F/ {5 ]7 J9 l# r6 | {. s, j; R/ e9 R" l* o
//---- Enter your callback code here -----
, J2 f7 r) ^( J% g) Q& e8 ]' M }5 L2 x; {9 }) A, l/ Q
catch(exception& ex): c" Z9 t. L o- x6 N, x" C
{
# q, V" `$ Z; C& y. Q/ N9 P //---- Enter your exception handling code here -----
4 O6 Y* @5 n: q! X. E3 p5 I, Z Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());" k8 r1 ]) N! n- K, z
}) x" A1 M2 z' v
}
- g9 u/ |! d3 W0 y ( S$ E- p- r& m2 H. x% m
//------------------------------------------------------------------------------9 H# s/ f) O6 v* J/ P: r6 c
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)4 C/ t! A) w0 [
{
! j" _' M' D' z) J2 J% c1 \8 |' U. l try ]4 k+ F; w, p
{
/ V, t+ G' x" |' X2 Z; K //---- Enter your callback code here -----
% Z' H8 i7 j+ l) _ }" y) f) s6 `3 s5 T p$ c' I
catch(exception& ex)+ v) ]! ~. l: v9 _; @& c! d7 z
{
& j$ f% _: J. B: G& r7 ]8 w7 Z: E: V; j) o, x1 I
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());3 t" A7 g7 z' {
}
( o' U% h, _. \* X }, l4 o) w* l! Z: Q& V7 E
3 x3 `& n( s" I3 p, S2 I) k' H1 R
|
|