|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
5 n, k6 N+ K% V. W) A2 U
( s0 @: e, S5 k3 z( U. N请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr' s7 k1 C: w, H3 H9 t
代码如下:& `0 h W3 x$ t5 [# J' ?
#include "Shrinkage.hpp"4 }" t2 X$ x! l
using namespace NXOpen;# [4 y6 ]5 \- E9 Y. c& A1 u
using namespace NXOpen::BlockStyler;
" ^1 A |. T) v1 N) D# e
$ z) w4 p7 C4 C( r8 }: i# bSession *(Shrinkage::theSession) = NULL;
5 e9 H5 ~1 X1 V; f6 Q% B/ mUI *(Shrinkage::theUI) = NULL;' q- a7 }( ]8 L0 J) k1 i
+ Z/ A# p0 ^' ], R; H: V( z m
Shrinkage *theShrinkage;
+ I+ N/ n6 E, O9 J, T" V; y2 ?5 @' {) `, H
Shrinkage::Shrinkage()$ W/ `' Z) A6 W( J7 O u$ v5 g
{$ L+ l- P) Q* v) v& v" M. w! e
try0 @7 ~% E% x& _2 q
{
1 e0 D1 O7 J4 L4 S! {" | // Initialize the NX Open C++ API environment
/ K6 E6 V# [! @& Z9 u Shrinkage::theSession = NXOpen::Session::GetSession();
5 g) s. P) ^( l% [. @: ] Shrinkage::theUI = UI::GetUI();
. o) W# t4 B+ F5 H% ^4 Y6 G* ^ theDialogName = "Shrinkage.dlx";% [9 G9 o3 | @- V/ y
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
; f0 S6 s2 O& ^0 h) M2 D5 H5 u, d // Registration of callback functions
1 W2 T5 {0 l$ M$ F( M7 E theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
2 j3 {5 [, a6 [- U1 E theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
. Y- P& _; [. L$ S# {# X theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
0 }2 O8 d1 A, O2 Y T theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));$ ~3 z5 d4 { @- ~! y8 i' T) s9 U; a& \! C
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));2 k: B/ k+ d. V: ~: C
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));4 G9 g$ A: f3 l6 z9 A. W
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
# h& e$ l; P5 w& a0 u theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
~& I% |- O$ V }+ k( Q3 o+ N5 w# L1 i
caTCh(exception& ex)
4 I) A, y: d: }1 ^& i {4 \, M: s% L4 D. p& P- L: M, y
' h5 A# F. w7 P. @, c6 t! I throw;
! p+ Y, O3 }9 Z- y, R }
+ \1 {% [5 M9 `+ e3 a' V}
& E, x2 C. |+ x0 w& w+ E3 P' w6 Q7 Y. k9 J1 E. p
Shrinkage::~Shrinkage()- Z8 o# n9 |4 b" i& m
{
% e1 I1 p. f' M( y% i$ r! S if (theDialog != NULL)6 V9 M. R5 G6 E6 {
{
" Q' Y m ~! h delete theDialog; E! r7 F/ W% j1 v) u5 P# T* f, p1 h
theDialog = NULL;
" V$ K) X5 q! p/ A8 C; o2 M. I% M' H }
! `8 y( p) s, W" s2 G- A}; ] b, c$ H9 p/ c9 ^3 H+ g0 _; L- E
: p) X8 q, S1 ~% `9 f#if USER_EXIT_OR_MENU( B; B- N) w- F O/ A6 w; | Y' K( g8 R
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
! r6 V3 t, i! |/ @ H& q" S" V {& M8 I3 h( g& \7 N' D+ v
try) b# q$ w! g8 A' ^
{7 d: f* t- e# x" H \+ E' G
theShrinkage = new Shrinkage();
: R+ ^! L! J! f* U7 h // The following method shows the dialog immediately. P+ K' j- h$ M
theShrinkage->Show();
, T s0 G( ^% Z% m& C }' ~+ e6 Z I: {, E/ g& B' h
catch(exception& ex)
0 {. a+ y0 w1 m. U {
' R& M7 r8 p9 q- K4 Q$ A8 J% N //---- Enter your exception handling code here -----
: k* ^& f( q8 T/ k$ ] Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what()); a4 k" d. L. C( }
}/ i# v+ e1 u/ p! V* ]" ]# x
delete theShrinkage;
- P/ A2 f! B8 W }+ C2 m3 E M2 ~, v3 A
#endif//USER_EXIT_OR_MENU
# B1 V2 B; v2 m5 O#if USER_EXIT# X* h5 |; T8 p0 Y" d1 T
5 @1 Q$ y* Q, F6 K
//------------------------------------------------------------------------------2 \* G4 s6 p- x9 Y- Q
( h2 i/ f6 c( D: X% F Z
// MUST NOT use this option since it will UNLOAD your NX Open application image1 H" ]0 _: o- _6 Y' X8 v
// from the menubar.5 F1 T# u6 @2 g. E2 K
//------------------------------------------------------------------------------. a3 o, Q# R$ B* J
extern "C" DllExport int ufusr_ask_unload()7 l) u/ r# C W) p: C% \
{
/ n" u* U% |9 w* H9 }3 V o+ ^/ B //return (int)Session: ibraryUnloadOptionExplicitly;0 |1 o4 }1 t( F6 @ ?
return (int)Session: ibraryUnloadOptionImmediately;- u2 s' a" E5 `; m
//return (int)Session: ibraryUnloadOptionAtTermination;( B( @' t2 H+ }' F% B K
}
, J8 i# U; C7 T) T & f; A" r0 L$ [
//------------------------------------------------------------------------------7 e6 P+ k- e O) l
// This method is automatically called by NX.9 ]" Q6 b. ?* C4 z
//------------------------------------------------------------------------------
% u9 }" ^$ ]6 H% K9 ^6 [- O extern "C" DllExport void ufusr_cleanup(void)- \) r# Z+ ], p3 B
{ z! ~4 L& Q( \0 q$ E) [* x
try
% r4 B3 O4 N6 C' B$ U6 N5 O6 Y {" q% Z4 h, K# L0 S; F9 [; P
//---- Enter your callback code here -----( ]; T" n- u% _
}
. I( q: v. Q- i' z; ]! H) q catch(exception& ex)6 U5 L5 c. O/ `6 L8 N" C# v
{
8 A0 O' l `. X5 t8 i6 c; \0 K //---- Enter your exception handling code here -----' [1 { u8 Q7 a; D5 G9 f
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());( W: l/ u; {4 X; X/ v
}
2 Z/ q6 y/ C& c) Y; l, F; J }/ M% q1 B1 E) m
#endif//USER_EXIT5 D% D% `# C# s4 j, J
G7 j7 j1 ]+ {9 [
int Shrinkage::Show()
' B2 ]! A% w2 z8 G( ] {- x, Y! {$ y* l4 @9 j
try
* e4 ]5 K7 U( \' ?" M {
7 o! a3 E0 l# ?1 m3 r+ e: h, B! f theDialog->Show();
9 t' F" v, n; W8 E }; j6 K/ k! ]/ `( y
catch(exception& ex)
# B& h- {" X- ?& L6 s {
6 S3 u+ f) ?0 L' x) J ^/ w, V //---- Enter your exception handling code here -----3 E% P7 Q! `# s- S$ h( I
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
8 c0 [2 v4 @& Q/ m" o }: _6 Z1 H7 W2 Q& t0 q; h& y% o9 C
return 0;- N8 l- Y8 g. o, Z( d+ I
}
' _4 a G0 y% |! C2 {! K 3 t0 C1 H9 o7 v7 |* A b
#if CALLBACK3 W& C* k# B0 _ _ Q8 k
6 v% b0 m4 v+ Q0 N7 G+ ~9 h void Shrinkage::Show_Shrinkage()% j9 F/ ?5 I. u1 w
{, n% [- f; l/ ]
try
* w5 x4 d. J# @6 T {
7 d" K5 `& a9 E' b7 P theShrinkage = new Shrinkage();
$ U/ N! p( d& U8 X ]
) p7 v% ]- K5 H, d* D* y theShrinkage->Show();
- m9 Q0 b9 B& ^5 Y- `- N }: p4 Q7 s( @9 n9 z" ]
catch(exception& ex)
. a( @5 b3 R4 R9 {! s' [# Y; h {: ~# D: U2 y4 p# ]. N* J, s% e/ t
, [" U+ f1 P/ \0 J9 v Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());$ q1 L! h K. F- [
}
% G$ q) @5 n* _+ a0 ] delete theShrinkage;, {& _( A5 i5 g& Q3 r7 ]: o6 k: ^
}
, S. g3 Q* x/ K" ^#endif//CALLBACK# m% }( V/ t) {. O. p
* y4 e5 e D1 H; C: ]; e; d void Shrinkage::initialize_cb()1 s ]4 T6 t6 k' r' @
{% a9 b+ z' |& Q- t! p- }
try2 f2 q- S4 m' f3 p( J' U" g
{
9 O7 J7 o" L6 X: \+ p) M group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
' f: Z+ G2 v+ H face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));! `- \( P# K; q+ Z1 L) t
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
* I/ v s1 A9 r1 w9 O group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
/ {1 t" f8 b+ v# `* l5 L bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));' }, @2 G; O* t7 O4 P% c3 i/ d
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
6 i8 A' Y3 ?4 n, } group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));/ _1 N' W' m. S# c+ }* B% E
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
2 U5 A X1 [! n" g0 C! n label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
% z3 h9 V! N* x& v( W! i: | string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));# H, ?6 f. @* P8 C1 h
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
6 X3 ]5 v" t) t u) E( y label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
: C, }/ Z4 f4 a/ H+ F* ], r j }2 d4 X" N% X6 i. f
catch(exception& ex)' d' ^1 g4 U0 {4 X* Y; A- b5 x, t
{
/ L( k! m/ e6 L3 B & Z4 y( G$ A8 Y, a: D
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());$ k; r Q6 x4 ^4 f2 j9 e/ V" X& h
}0 ~2 z, q3 D: n, `2 n
}/ u% g3 k) e4 W8 _$ r2 O
//------------------------------------------------------------------------------: N/ i# t1 q& ]$ D# @3 ^ g% O
void Shrinkage::dialogShown_cb()4 k* R! B+ W9 S2 K& K7 I+ b
{2 \0 [( V% c5 `& P+ R
try
3 i m/ Y4 o, a' K( B2 | {, A5 E$ Y. m }4 j0 p
//---- Enter your callback code here -----3 G5 s8 V8 {( ]
}
. r1 o# M% H& b$ O: R0 N; w! @( p( F catch(exception& ex)
+ ^9 ]- z* S3 {. C6 x7 a' j {3 d, e l3 n' }0 A( M; L
; U9 ^0 }2 j$ h0 d# U$ ~7 }/ _
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
, A; m: U$ p3 H: q% e }
# ]% V% l- m8 D3 D }7 S5 ~* D) v3 I: U+ Y! N
% z/ t: w* O9 `/ r7 l) q8 Q3 `9 j0 N int Shrinkage::apply_cb()! b# X% n! Z. s! _) T
{, K% s- _' m+ p& v, G8 P
int errorCode = 0;/ R% [9 T3 [! o" g( |
try* w' R- t P- y3 K; C, E
{9 u- F! T \% A0 _5 G- A7 H# }# N
//---- Enter your callback code here -----1 O! q6 O: z/ M6 h, \' W
}0 l3 r) x0 r/ X: X, r( m
catch(exception& ex)
3 K( G S/ S; G5 G {
: M Q8 c# w/ t( X" V2 A //---- Enter your exception handling code here -----
$ x0 ]8 y7 n4 a! P: I3 v5 I. v# t errorCode = 1;
+ e/ m9 o* p3 Y" V& z; g Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
2 }" k8 y1 _, G+ g3 I& p }
/ T0 v; G) B: E$ F" r! `$ u return errorCode;
) Q) U+ y# V5 {/ ?& h, P. L! a }
" ?# _- V. H- F8 i) m) E" E# b6 _7 Q8 `: \
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)+ v, m# ^, q9 N6 ~3 `
{" A4 ^; a5 N0 |9 |! J& U# W# x* j
try8 G( o. T+ e3 m5 _8 @
{ V7 S$ ~5 _, c* z; ?# q
if(block == face_select0)2 ~6 o: Z5 w6 a2 n
{
9 k8 _$ d" i& x8 P- i# \( h //---------Enter your code here-----------9 @1 m6 s( X, R/ S' i g' f
}( D5 B8 e1 f9 t) o4 t) v
else if(block == face_select01)
) E0 U, ^" g; A {
8 A; U' k5 M+ m# \( J //---------Enter your code here-----------
9 m+ ~! @& n- a5 @5 M) g }, m2 w8 [! w0 Y. V" V
else if(block == bodySelect0)- ~4 E; Q1 U& u+ Q, R; J1 ` Y
{
; w @7 B8 d& d2 J0 v //---------Enter your code here-----------
0 }: a: d0 J% M, ?! s }9 l- Y: L! L8 c0 E8 g5 Z
else if(block == bodySelect01)* L+ J/ w* s1 `' x$ J" n9 s7 V
{
( K! l/ N+ }* Q+ s H //---------Enter your code here-----------) H; n4 Z& N4 Y
}
+ G& i+ c3 y+ h6 a5 m else if(block == string0): T( P' i0 g+ ]2 A+ q# z
{
, @% s8 N8 d; B$ `/ }# L) E //---------Enter your code here-----------
- w! _6 `& ? i! `2 m0 a }
9 b m R8 K8 H; e else if(block == label0)
- k9 H1 n7 t5 @ {
6 E, ~$ z, Q0 x: V' G5 n, e6 i6 z //---------Enter your code here-----------: S2 z o7 f1 v% Q* y
}3 t2 p \* n! \( f6 y' l: T9 h+ `( E
else if(block == string01)
% q5 B! t) D, N3 S {) L N; z8 d- B; m O2 Z& d
//---------Enter your code here-----------% F0 L8 |" w# \: l
}
0 f+ d2 F- C& T0 X6 r else if(block == label01)& Q" N% r7 V; P8 [' H* ]" M
{
9 R0 ^6 d8 w5 c6 t$ [* [) t //---------Enter your code here------------ g3 X! ^" l! e7 d! X
}
% y* M9 U0 b8 ~! K- ?3 S4 y else if(block == label02)
- K k% Y8 _9 E, x8 f {
6 i7 A: f. C* `3 K5 r2 D. ~+ j //---------Enter your code here-----------3 f2 Z$ _, `1 \3 f- T* O7 W7 ?- b4 e
}
* y L% T* G. T. y8 F( w# q+ C }0 k% [" H" M; Z. P* W: `, \+ l
catch(exception& ex)* [: b6 _ @' s0 s* S
{2 R0 U& s j Z6 m' Q6 i! j
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());9 ]. m% W* k; O( M$ o" X; ^
}
+ G: e( e/ g5 L" }2 p9 H9 w) B return 0;4 k+ R4 I5 h9 ~
}* x1 F3 Q% L: b: h q% M3 N* d
+ z/ E& O2 e& x: D3 K int Shrinkage: k_cb()
- j! t# @3 R: J+ `: n# t {1 u4 _% o1 d! A, L9 w) [! L
int errorCode = 0;( i/ g7 ?$ W% k% Q
try3 k; p; i; s' P% ?9 q
{
4 b, O6 z0 K; F& S; _, A; R errorCode = apply_cb(); h7 Z$ {5 L; m: q
}
4 J& c2 ?# q k; ? catch(exception& ex)& K6 v& z* W4 O+ V) c
{! d( o5 z+ ]& B3 V$ c+ [, Q7 v
//---- Enter your exception handling code here -----# s/ c h& H" J( W$ s
errorCode = 1;
+ S# M. w& l v( O Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
C$ H# H& [/ ^# Q }0 p( h+ P/ n; a% u2 q
return errorCode;; E- n1 {2 S2 I9 j# q0 K' [
}) s9 R* |5 @1 j# w4 p
9 t e Q J. S4 v$ V0 u
//------------------------------------------------------------------------------
; n: Q7 k; F" g# u, D" k //Callback Name: filter_cb1 i. [% E* q" u- n, E7 y
//------------------------------------------------------------------------------
$ _4 T' u* E1 F+ r2 f int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
1 _9 L$ o" T' t: \4 T: O$ a {
7 N+ j, u% [: B# v" {/ ^& J return(UF_UI_SEL_ACCEPT);
' {0 \: Q+ a8 z4 P, X }
2 }/ L0 S- N+ q3 J4 \$ A # h' x( ]5 t! c/ t
//------------------------------------------------------------------------------' B! l! m) h/ q2 \$ Y0 a" X
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
% w2 e3 {, t. _: g9 R {5 u5 D- a0 C7 p/ y4 X& c
try
: F& X7 b6 h' H. t: K {
6 _* _6 h) f1 C8 ]8 u //---- Enter your callback code here -----7 t! _1 U3 {- B$ C# e. u
}
- j( W) Q# F, Y& l% f6 z# r4 `3 J$ M catch(exception& ex)
5 q; P/ {& l g4 Z7 h {
; |% @: Y4 {7 R% m //---- Enter your exception handling code here -----, ~0 ~2 v, O _
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());) S! D M$ }) l- U4 n! v
}- I+ `) Z, C" o( B& r$ j
}
. P2 R) i9 I) C" h3 @+ c6 B
r" y9 [- ^; Q //------------------------------------------------------------------------------1 Y: ?; |: d5 C) u4 o4 G0 Y
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)6 o# b8 Q$ G4 v# N, n; J; n
{% M) t3 M7 p1 t2 ^( t- `
try: J$ e5 I: q! {2 E
{
V2 b: j/ p' D6 h3 q9 b5 N" x7 D //---- Enter your callback code here -----+ c% r0 ~2 J; u" e
}$ k7 `# j! p2 ]1 P# S, Q. N+ m- d
catch(exception& ex)) d [% T2 V- {' Q! C7 d
{
% ^, D5 S2 a4 e% v# Z$ J4 Z7 K0 X3 h
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());& [" y0 @1 b1 {; u7 R) d
}7 I3 \( {; F& f
}
0 u0 T8 r; ?* s: s3 J, A z
/ a4 `1 D- S9 ]: b# O3 m& d/ Z8 l
: g" |2 r; x1 W1 z* }, ? |
|