|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 5 s6 m- i" p5 t0 q( l
2 G2 E5 j1 M$ w* s1 f请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr. l7 q! N: \2 K2 ?8 F
代码如下:
0 [' I- `1 E3 R! N7 _3 {5 Z- t#include "Shrinkage.hpp"+ X& E* n$ j4 D( `7 M
using namespace NXOpen;2 p- i4 w6 f e/ L( J) ^1 z+ h1 J
using namespace NXOpen::BlockStyler;! n) f% C6 X9 E$ f1 s' Y
* Q; U% L- A) I5 A7 @
Session *(Shrinkage::theSession) = NULL;
: ?0 A1 y0 d1 Q1 tUI *(Shrinkage::theUI) = NULL;: g( a1 D# r( p
& y; h/ \% e2 R& L$ v
Shrinkage *theShrinkage;" M8 G. W$ l/ g' z% Y
3 P0 a8 H) y% t8 J! `7 J# a4 _Shrinkage::Shrinkage()3 j4 o2 n+ V, n- X9 m
{
+ t o- C4 X+ m6 H+ d# M. A try
7 p9 k3 N. J5 k3 x- @ {; W9 v) R8 u( D
// Initialize the NX Open C++ API environment ~+ }; p: w, e9 T1 P
Shrinkage::theSession = NXOpen::Session::GetSession();
. ^' O8 o7 e& P! u" n$ U3 \ Shrinkage::theUI = UI::GetUI();
% A* z$ \5 |4 o6 l8 H theDialogName = "Shrinkage.dlx";1 L! t* `! n' S9 H2 i
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
' e v$ A7 K3 ~+ Z% i% [ // Registration of callback functions
4 [! a E/ k8 u theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
- B A m6 O0 s; I5 v theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
- c: I6 q( c( N* V theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
" ]2 _5 q# K) p) z. n: C theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
& R# g2 O, M6 G6 F# B2 R/ P5 V4 C theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
) U1 d% T; F" M theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
1 o6 C0 V; [0 S theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));( T# J3 k) n; T1 p/ L- {2 m$ ?) I4 V
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));& T, s1 g/ {9 d
}
) ]" \3 }- D6 Q- p, T* M, k! V caTCh(exception& ex)
q# S7 b% ?4 T4 }' G( C8 z {
% r* j' j" O# U! s' |9 l6 F' Z
3 G6 s0 C! [9 J throw;; b8 \1 h& \% g2 f
}
! ]4 Z& f6 K! ]6 M. ?( @9 z}
- |( M+ w) S) M# j% @9 h! V
; ^0 u$ X; i8 UShrinkage::~Shrinkage() e% j- w% z7 I( a r
{
4 s5 ~6 ^+ m4 K2 o if (theDialog != NULL)2 b9 a' ?; Z: @' N! l
{
- B; @# [9 N0 j p2 A" j! c& S K delete theDialog;
/ T2 t4 s: `( z1 O R: }0 V1 R9 b theDialog = NULL;
. l! {8 ]$ C0 _ }
$ b$ {; k, S( s}$ K D! R g( V
' L: f( @( e; G#if USER_EXIT_OR_MENU" Y! p) ~+ E' ?% {
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
& Y$ e1 H/ \( i {& \% p& O8 R! ~9 Q
try
$ F7 l. W( G1 r k {( q3 H+ J9 D2 E
theShrinkage = new Shrinkage();
3 _' N% g. I' I9 u! I+ V& w/ ` // The following method shows the dialog immediately
# N: i: }; V& l5 M theShrinkage->Show();
_7 n: g$ K! M# O0 f }
) p2 w, N/ |1 l% n) L ?( S catch(exception& ex)
7 Q, p. K, H: }. W$ A& F {
o) t1 }( J. x4 U8 |9 Q //---- Enter your exception handling code here -----8 K4 \$ p) k) h# {$ f
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
) N4 e- n! m! P# V, G }
3 ^/ A& } M7 ^; O5 t5 K delete theShrinkage;
$ i8 z5 u0 e2 I }3 Q6 s% I4 r4 l. M
#endif//USER_EXIT_OR_MENU
' }: o2 _% [4 n#if USER_EXIT
k8 z: S2 X+ Y3 Y! C( E
4 s8 s/ p2 H, d! R //------------------------------------------------------------------------------
1 Y7 P9 J" }* o5 ?3 h 1 |; N6 E2 g& ~3 n2 a1 L
// MUST NOT use this option since it will UNLOAD your NX Open application image/ D/ X! _4 I6 \( N: q; z
// from the menubar.
4 K1 m& f) K# ]# O @- D //------------------------------------------------------------------------------9 p# K; L) Z3 L3 c, Q
extern "C" DllExport int ufusr_ask_unload()
* B" p7 Q% B( s- p, q4 Q) } {
( w$ l7 t! y' v) ] //return (int)Session: ibraryUnloadOptionExplicitly;
; f# n5 c9 H; q! N9 T3 G return (int)Session: ibraryUnloadOptionImmediately;
* {3 w: Q6 @9 G6 R% X" B5 Y3 f) E //return (int)Session: ibraryUnloadOptionAtTermination;7 y9 s# Y% B) B e) d- Y, l+ I" i
}
! b: C" g E/ I# G 5 D5 [3 L8 k" \' r6 q( B1 V3 Q }& _
//------------------------------------------------------------------------------: _# `: V: I3 H1 o1 O
// This method is automatically called by NX.
2 n6 e" g* M8 r5 L //------------------------------------------------------------------------------
" s7 a( l7 t: _. J5 o extern "C" DllExport void ufusr_cleanup(void)9 Z" d4 \* K/ Q0 s9 u
{. [: p: ^# M; v7 a" A' U
try
( k$ i0 p! H: ~ M5 _! A {
6 e0 N- z- @- N* S8 n //---- Enter your callback code here -----3 K1 w u, W8 F, g. B/ z$ X8 }' m
}9 h9 j* D Z) @' G( r0 v7 l
catch(exception& ex)( L! y% ~' M9 |$ u$ q
{4 i% v: G& R% w$ J) q' `
//---- Enter your exception handling code here -----
9 {5 i) S1 q$ E5 ~- P( C2 i7 ^4 M' S Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());- x: @ R" z# A Z' `. S4 b- h
}
0 q. p5 [4 Z# I4 X% j+ H }
- S$ y% q* J9 z& y' _! K; ^#endif//USER_EXIT$ l3 B- D! h& Z: x$ ~7 F
' X1 f9 Q g3 q/ R int Shrinkage::Show()1 R3 O+ J, A6 X) B# L' s1 x3 O( D, \
{' J& {6 ?& g& @, {9 K" V
try- z' l. r) u2 o7 W1 z. l- R& z
{
$ K& v. j |7 A7 d" D/ i theDialog->Show();1 U) ~: _8 F0 Z9 {
}
/ J% R- r+ i3 o% u) O+ a catch(exception& ex)
' q0 T6 K) {! ]; `1 n) I9 ~ {
9 m1 X% r% t8 b* u8 t9 h% j //---- Enter your exception handling code here -----
! s, b+ w- d# {7 m5 l; ]/ w Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
9 H) g5 I& \5 ` }( Z, E& Q6 E! n3 ?
return 0;
p3 }5 c4 Q Z1 x- q% ^( w }+ ~- c0 N, s* J% }' S
, ?2 e0 t' K# ^: L$ Q#if CALLBACK* N3 l4 z' m3 _6 L9 Y. p' _
' X) K0 r$ A& p0 R& l8 _
void Shrinkage::Show_Shrinkage()* m! s. t& }: k5 F( T
{
2 Q, S' E, W/ D$ l! l. I4 I try
- I3 K4 P* O) Y* \ {' N, H4 T( d& u& U
theShrinkage = new Shrinkage();
2 M* {5 F/ J' i: ~2 |7 G: h D: z9 z
theShrinkage->Show();
3 z3 K: ~2 k0 b, Z }
! X9 B7 @$ b3 s8 E# {) y catch(exception& ex)& w" x0 S- E0 b% j3 ?# x
{2 u: q) M0 A0 M; A
" |2 `. ^& Y3 l9 W3 {. a Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
0 `" F7 H+ f, B J1 |7 p }
* g) [4 d& Q* p+ J delete theShrinkage;" b+ r. t8 f! J4 R2 Y4 @) H
}( B, b: N3 M" y3 T+ U
#endif//CALLBACK' p* b! S; B, c0 W/ _, r; w: X
9 F1 @; Z, N" b; G. G* z
void Shrinkage::initialize_cb()1 Z( p7 n3 T! d- M6 ]/ F$ b
{
2 J$ X, z' O6 N4 O) c: u K7 q try
) s* u9 c; q5 t- @ {1 L% A9 }8 ]7 D5 A# K, K! @3 X
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));3 d5 d( v8 \* y5 p4 | A9 N
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));9 x3 A/ Y w' L- W
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));! p. k, h& D! Z* { @
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));: A: M/ E; }4 R& B# H
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
7 h- o* {7 u: `0 B; z3 T bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));. P- j% ?3 _5 g8 o4 y
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
/ T+ k9 E4 }, R string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));& p* B# q/ F5 u0 S- `4 v
label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));: O* E; A, H: ~3 o* ^
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));7 O8 U1 d0 C1 f! P
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));. d& ]+ A, p, q' N1 h t
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));0 f+ b* W) q5 y8 |
}* y+ B( K' M$ U4 R
catch(exception& ex)
/ j. o! ^$ B0 H( U2 t! B5 ^ {
4 r) L& m7 p8 a8 o. P
: b5 Y) `0 ~( `; x$ u! j0 { Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());+ E+ g( e3 G3 c: V
}
, t" Q; N2 X9 Y2 Y }$ Z8 x9 J% H' R% q: y
//------------------------------------------------------------------------------
$ q6 N6 `8 t# e1 r" @- [* d, i void Shrinkage::dialogShown_cb()1 M7 Y& E, Z" s* t5 x& G {* D
{4 W5 y5 I2 P6 f m
try
+ Y3 z* Q9 F1 q/ C6 y" V {, X! U* T9 O% Q
//---- Enter your callback code here -----
4 Y0 g# U9 m5 I: s/ v }
: ^. U+ s- i$ e" k* k catch(exception& ex)5 P, E7 s' u. n* F5 l, V
{
2 N9 R; g1 O9 ]3 Y: ~; Z/ n1 i3 e7 F( ?: V/ W
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
$ l: j8 A% {1 R }
7 }$ [! V: h( d* H% I }5 K$ \$ F. R P. _1 o. G5 \
, m9 l5 G) q3 {+ W, G. b int Shrinkage::apply_cb()
7 q4 f( g4 `. B. [- g% G, F {* P& m, R+ P! h; k
int errorCode = 0; [! G' f; U' o! \+ s7 o
try
2 C* A. h: w0 L {7 O6 ~0 {7 L$ s+ e: V# h4 H: X
//---- Enter your callback code here -----
) Q1 O6 c) u3 c- q$ S1 P5 C O }
& {) E! K0 m B( m catch(exception& ex)
' @' {5 Y0 ?, C; T' n1 w {2 P: p/ X7 f7 G3 n( |- e# W
//---- Enter your exception handling code here -----/ K6 P7 \& l6 ^" a0 \# ?
errorCode = 1; [( w% l( z& S
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
9 t0 k$ Y( H0 [0 ^ }4 h: P8 U& A$ Q6 f" Y2 X3 a
return errorCode;7 L' h/ I; E, Q
}
! a$ O$ L' L. t
; Z g1 u+ ^- l0 J int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
+ C. k) _3 J- l) L0 l7 N# v* C) {2 J {
9 y+ G0 g0 H. |+ M, V try
' n" o' T/ a7 ]/ M7 Q" E {
. [% v u& q0 f; n if(block == face_select0)/ R* U& _% m, t, [
{( J; N+ g9 @* K; S& L: S
//---------Enter your code here-----------0 y) v# m4 d4 ?
}4 D9 j3 n& r( ^1 c+ r. V
else if(block == face_select01)
+ n3 X, X& g; v. t4 Q {& @$ j2 i M! S- ]; z4 n( {' |
//---------Enter your code here-----------
+ l# |; B$ O: [9 ] }: T4 v* {9 t# d: Q5 X0 T) ?% u
else if(block == bodySelect0)
4 T% f% \ B8 [) z+ C& ?% b1 x {1 n6 p0 k8 h+ r$ a
//---------Enter your code here----------- F$ j, E% X F; D; t
}
; O( g7 o6 T( v: ~, F else if(block == bodySelect01)$ Z4 z0 h- g8 b
{
8 g4 Q5 X" C* w& m* G. c+ Z8 q //---------Enter your code here-----------
, x i, o5 K' i% G1 }; T. { }
, z$ X7 R9 o L/ f' h else if(block == string0)
) Q9 C* z8 K+ b% ^ {
; S9 X! t$ s) W7 t6 J' N9 A- A //---------Enter your code here-----------
; f4 i ]# M# E }
2 O8 g( I1 S% @0 ^ else if(block == label0)1 K! x8 G& ]+ b O, G7 }# b
{
4 w$ o9 j \2 n4 f) ~" P, k, s9 E //---------Enter your code here-----------
/ o7 P5 E# F7 H, D }
/ n" N1 U- l$ u* P$ t! T else if(block == string01)
) h! E8 u$ B1 s4 I4 v/ z {& x2 w& G5 ^" R% p" j2 D
//---------Enter your code here-----------
! u- d$ T2 K' ]: _* d+ l }5 a9 s4 I8 ?4 q2 h2 {
else if(block == label01)
" b/ R5 @* n6 q& a {
. c& l3 i7 u" n) z0 Q //---------Enter your code here-----------
9 P7 t$ O! \, ^$ O }
! K/ X3 x2 t' r4 o1 c7 | else if(block == label02)
2 [' a6 l! K) J# p {
1 X2 p5 `, v/ _8 Q- V D3 Q8 I //---------Enter your code here-----------+ G+ N) ~$ z- u3 L
}
0 I. B6 x; d# C }
8 x; s8 g! I9 Z) O& q% @ catch(exception& ex)/ u' A- j- }% F3 z& j8 O. j
{
7 g2 g" Z" V. E) ~, j Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());* f7 u6 I) q: f
}
8 R; D Y' |5 @& Q+ | return 0;
$ o" A" N3 N6 B }) J; h: @; m9 n
; ^2 b4 x C& F6 t( \5 u
int Shrinkage: k_cb()8 |) P- }0 A6 L) B8 T( z# u {* y. b
{
8 u* _% B. n, c8 H int errorCode = 0;% j# A0 n+ \$ D" o1 Z* ~+ H
try& \7 p1 h( K' O3 p% {4 N
{
1 t, `& H: E2 ^ errorCode = apply_cb();" s! H( n: A- `9 G. J
}: b" B+ @+ a7 _7 d
catch(exception& ex)
% x& a9 I/ R- I* F {
: k) R% W$ I5 c* I3 L7 P //---- Enter your exception handling code here -----; n! C6 W$ a4 J5 r- \
errorCode = 1;
1 n# Y3 e* o2 Y, G7 [3 I Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());2 k* ~1 p" A3 P, @3 K
}
& [/ K* b$ | [ return errorCode;
1 I' M- ~6 `3 E! } }
% C" D6 V7 P; }+ b# B
, b+ V8 ]# a9 J1 L: G+ d //------------------------------------------------------------------------------
3 ?& u6 ]' R9 y! V- w, x) s- @5 U //Callback Name: filter_cb/ G5 h7 f- P# Z0 Y
//------------------------------------------------------------------------------. }' D) [' N3 ^9 d
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject). x3 x! I7 B( O0 R& X$ s6 G2 Z/ \
{+ y0 }/ Y4 z9 `( Q3 s
return(UF_UI_SEL_ACCEPT);
1 F' A0 Z0 ]! t* K. q }: d) ?; T( q5 n0 G
& t( y* {9 u2 y z+ d* C- ~
//------------------------------------------------------------------------------' @+ |. }7 t# \, C& H
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)$ C+ W) `- C$ f( m3 v
{
) T% q; W% L- f' v5 V try
4 g' R2 ?* t- j% ^0 M {
. \+ _ F3 a+ k6 j# M" B //---- Enter your callback code here -----; W$ [5 |$ o M$ Z% T' a
}2 r5 T/ U& @1 R; T7 q5 Z
catch(exception& ex)
- t0 h$ \; L% X8 t6 e: @ {
1 e# G N$ Z8 K1 h8 n: | //---- Enter your exception handling code here -----
2 s4 w& H& m0 p4 L) q) w' K2 r Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());& C: p2 Y& g/ O: o7 B* C
}1 L. m/ E9 R/ P* s) ^; ?& H
} Y& }: E; p7 O" g
\1 P' Q6 u/ o# Y5 N //------------------------------------------------------------------------------
8 m# y6 L3 _, d8 t; p* F3 r void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)% n2 ]$ h0 Q% A! G7 Q5 P0 O, ]7 f0 L
{, w5 z0 L# h9 @$ W0 O( D- a
try
1 q/ b: h4 ]0 x6 i+ Y {. L% M9 [/ _6 j# N9 A) o
//---- Enter your callback code here -----
# B! Y" @8 i! X* o! F L! c }$ E5 s" G$ A5 }+ _
catch(exception& ex)% H9 |5 z4 {) ?- {" i
{
) x( e; K- A( G) t
. R) }6 T. M0 Q8 A/ T1 m8 ?! C Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
& T! r! A7 f3 g3 a) v3 F' J }6 M' ^4 Y4 Q F" v% q {* \* [
}
" e2 O1 v$ y: D" i8 u8 e5 C$ l3 n, @: c9 H
X9 |! ^4 H9 l1 B i6 @1 h6 j H |
|