|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 + Z3 i7 e+ o" X. w/ P0 b7 _5 T# `6 ? F
( n" C% h/ F r
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr$ W( H, Z+ M/ R' I4 D6 J
代码如下:
& d# X3 X [( A, G& i#include "Shrinkage.hpp"
* W+ F2 W4 @0 M3 Busing namespace NXOpen;3 V4 \8 V' X9 j3 ~7 Q/ r G/ X
using namespace NXOpen::BlockStyler;
# b) ]0 `* J0 H% r W
5 I6 f% P/ i$ ]/ f/ Q) H) a- z) R8 N6 |Session *(Shrinkage::theSession) = NULL;0 l6 I/ p* r! s2 j1 u+ B8 D4 `
UI *(Shrinkage::theUI) = NULL;
# z8 L' ?- }2 ]1 u0 z" h1 K T
! F1 u. m v1 d7 E; OShrinkage *theShrinkage;
5 W! S, B& |! X
, f' ~5 f! I# Z t$ JShrinkage::Shrinkage()
+ b+ V# E7 N1 m4 A# C{2 o8 n# z4 _, o' {5 p
try9 ?/ D+ W- ~* U! N0 `3 w& m0 @; T
{
- f- g% b) f% M // Initialize the NX Open C++ API environment
% }6 Y) P" f( y* |( t* N9 r' u Shrinkage::theSession = NXOpen::Session::GetSession(); o, b+ I, @; c5 x. [; h! c# o4 l
Shrinkage::theUI = UI::GetUI();
, x- N. t" g5 R: F theDialogName = "Shrinkage.dlx";1 G) O5 r$ D: K& J$ Q
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
; _: p: O/ Q2 V5 C6 N // Registration of callback functions" Q- y" k0 z3 w3 `1 F
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
& I8 V5 ~+ g" ^! [9 k theDialog->AddOkHandler(make_callback(this, &Shrinkage:k_cb));) k. V; ~8 n) j8 x
theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));* I# y9 h1 H9 ?4 V7 |5 S
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));* ~9 V& `7 X- q
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
3 o# q, U' m- B, H theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));, H% c2 D' O& O7 ~" n
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
" E8 P2 x' p+ R, S: U theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
' O7 P9 R) ?+ @) C; Y! @ }
9 @& H- ^0 X8 R! y, \' A8 p caTCh(exception& ex)
4 @# g- b3 H' k {( l: ]3 v* l, N
; U5 D6 y ]* c6 S+ y throw;
: D A0 a- I7 X* l" c z8 ?$ A2 f# w }3 t; m, P4 H g3 f7 i) k
}
( Y }% @. i& y3 h' p% T; ]
& C& [( z8 n) j9 E9 n d( |Shrinkage::~Shrinkage()8 i* ]7 w# Z! P2 l \
{
0 U! w. U/ O& ~3 I if (theDialog != NULL)
, k+ B4 R. e% \. n {
3 U; c+ x& w0 E delete theDialog;
7 m2 Y/ i& S, C* M8 ^5 t theDialog = NULL;: e) d* q( T u/ Y2 x
}
( i: z$ O/ V( t- g2 d3 ]5 {}1 l9 y, O+ ~! H3 \1 t5 e
$ a7 S7 x- V& {. n$ c! H: T' }
#if USER_EXIT_OR_MENU0 G: L+ Z. W; W/ ]3 u
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
/ P! ?! C" s5 P& w' r+ \ {5 _! O' i: g; c
try
5 M# j4 [" R: u3 m7 ~) v1 I4 f% C {
3 U0 h# F! Z( U0 ~' Z$ H# a( K theShrinkage = new Shrinkage();5 \3 w1 u- S$ g4 P
// The following method shows the dialog immediately
* T4 L8 f3 X0 I8 E- K. f theShrinkage->Show();
( t( H7 S) p k( ^ }
$ j, F* d2 Z- e2 P4 t: f1 } catch(exception& ex)- A/ \+ ~) \( J- v& ?/ Z' S! o& \
{9 L5 w O8 g8 [ g! |% S
//---- Enter your exception handling code here -----
: J2 w) F+ U. m Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());. B( n. G- O. z
}8 \- J( {) f, R+ ?& E% e$ F
delete theShrinkage;) D8 b$ S& i% P3 a
}, V5 F [' |7 V- v# A: g& N% T0 e
#endif//USER_EXIT_OR_MENU% a. Y c1 L0 P9 r, n
#if USER_EXIT
1 d# x9 E3 D- s F3 i X& ?$ p 9 ?* x" Z T' a& c- [& h- M
//------------------------------------------------------------------------------& G+ M7 _. z& e) N
( t: c+ r3 e/ p8 Q
// MUST NOT use this option since it will UNLOAD your NX Open application image! E5 t6 `4 m( e j5 p l9 ]# J
// from the menubar., D% I& L7 z8 {* e
//------------------------------------------------------------------------------
) T3 G* I, H+ j1 U extern "C" DllExport int ufusr_ask_unload()& @/ T% Z* E8 R1 l& W
{* @ x7 ?1 M2 R3 w" ]7 K5 s3 ]
//return (int)Session:ibraryUnloadOptionExplicitly;4 s$ Q4 Q* ?# m$ H x; w. B& ?
return (int)Session:ibraryUnloadOptionImmediately;
' B9 l W. i7 D8 L9 C //return (int)Session:ibraryUnloadOptionAtTermination;
4 k; @2 H( x/ S" C% d }" Z3 `" H" b: z1 B1 |% A
2 {0 S- ~! b0 M' a
//------------------------------------------------------------------------------
; K" v' {1 @2 \" j/ b' ]% u // This method is automatically called by NX.
& w0 T" |/ B A! p9 ^$ | //------------------------------------------------------------------------------
p) l; z& u2 `1 }" P9 k- L extern "C" DllExport void ufusr_cleanup(void)
2 Y5 Y9 T7 Z3 ?0 | {# O% d, n1 | `; n0 i2 c
try
" W# B; N5 h* s& i {2 r3 |1 @+ O9 _8 p) \ U
//---- Enter your callback code here -----
* V0 k. \/ }# R6 `2 e+ | }) X4 p6 P. \. M6 _% V6 @- _
catch(exception& ex)- x( W9 X& m4 }: m
{+ W9 [$ J% Q7 P- a, a
//---- Enter your exception handling code here -----
6 l4 a4 p" B# ~$ x, e+ E9 u Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());, z# O6 V3 t" t7 N
}2 v& D& i9 l! ] z9 k! a& ~
}0 ]) H7 |0 e8 {8 V' O
#endif//USER_EXIT0 }* S+ ?# _/ V! b9 ~" g% `
5 h& Z" a! y# [4 _/ Y int Shrinkage::Show()
" g) Y" P1 F) W- W; \4 R' J: m( L {
6 p5 n' i. F; D/ c try
& s8 R( U1 _% p; b0 T {
2 l) _1 s# X9 t7 u theDialog->Show();
3 w9 J, R+ m, A) r; \9 u7 y7 f; ` }7 ]3 f* V+ |# O1 V$ N3 e8 \) E v
catch(exception& ex)
: g1 d- |) s' O+ A2 W0 { {5 u6 E! a6 u* d; Z- J0 R% b
//---- Enter your exception handling code here -----
% @2 l8 \6 b. m, P Y2 u0 C& A5 ] Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());; O7 O* t- F) F# a# K7 l1 `
}
; N# m m7 R! G* F( A2 U g9 E3 e return 0;; C3 f7 f% X7 i$ z& b0 |
}
. X; I! u) o0 J | , N2 z# Q3 Z2 m
#if CALLBACK
8 R |6 `6 K* D2 B
3 J; F8 x, X; R: J. F) Z. Q# y void Shrinkage::Show_Shrinkage()
3 C* K# R+ t- o T) E/ n* Y, E" X- O {
- Y' C- W3 [- I9 O( m; c# G& { try
5 i5 |) k! m* o0 ?$ T& l {
, @5 _- w4 R8 \5 _( q( T; e1 U5 d theShrinkage = new Shrinkage(); Z0 E* X6 u: [0 \: H p% v3 N
7 n' t) q" d, C3 e6 R; E! H
theShrinkage->Show();
# Y" v7 U& L6 m5 g, g! h7 ` }5 P3 q6 M6 a) T' K7 v; @9 i- d
catch(exception& ex): `( Q4 W( I1 e# U" A
{
$ K3 {2 }% J( U' }* C) E' c1 o2 @/ n3 V
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
4 H( F; q: ?) b4 l- q' d( r }+ ?7 ], U1 T x3 y8 C) ~( Q
delete theShrinkage;) A! ~5 w3 O. p& f4 G3 U5 d
}
% ]) ^% E* {: }. s+ e#endif//CALLBACK' o; k# _7 i4 {' z
+ R; c* M, B _1 ]; m
void Shrinkage::initialize_cb()
" k2 z1 I% O4 o& X( F, V {+ d/ i( L/ a" b6 y6 x5 O' A
try! J8 x2 \# f0 ~& V
{6 @7 w) P3 M$ T1 N' @1 I* ~* ]
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
% b! e; B+ B* |# I face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));: y/ B& U9 y& w( ?/ v' n3 P& g
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));% ~4 j$ y, L& P- E( v
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
) R( U; x) N( m bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));1 r0 m9 X5 p1 }2 I- W
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
$ n4 h* H. J6 k# c* M5 [# |' \$ n group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));+ a6 x/ W0 H' Z Y# Y
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
) w3 ~' o( B0 k' u" K label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));# ]. i: ~ Y' @4 x0 j5 ^; y. M, A
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
1 h/ j2 B. [% w9 L. G0 W [ label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
6 G1 W! E: N) a4 M! A. Y) _3 ` label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));2 p' f3 f/ y& ~! e4 K% T" h
}' y+ \1 q& X5 F: f4 a! R3 X, g
catch(exception& ex)
! {$ b2 _' G5 B5 E2 J5 N7 R) J {" ~4 W0 G6 y4 i8 N5 ^
. V5 Y' w& D9 f: C! Y Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());1 o0 b/ H( W! U6 L
}
2 n1 Y4 \% |/ N; B, ]; _ }1 `& F6 N' g3 l* [/ x3 j* |2 G; I
//------------------------------------------------------------------------------
3 S N7 e- a" O' R' _5 ] void Shrinkage::dialogShown_cb()4 Z% [. a5 W' W k7 ?
{7 E* M, u, C, |: f
try
+ j, s3 h, g6 N9 t4 N! _ {# @4 i* g# v7 j
//---- Enter your callback code here -----
5 I* L2 l4 D3 S X6 \ }+ B' ~& R' e+ ^- X" a! [) K
catch(exception& ex)/ I8 h! f) b. _# R0 |+ G: I
{
) g7 Q9 O" s1 |$ m( p7 T. W6 E3 b
: s) e7 W8 `7 g0 ~ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
) [$ Z% O5 |$ E) [! H }3 f. E" O' j4 A7 L/ B4 n7 l
}+ _0 ?* U* L& |5 ^, l5 I. d
/ @2 J& {2 m! @1 S5 T& g0 C, N) l
int Shrinkage::apply_cb()
, a4 s, R" }) n4 V6 m; } { Q8 y& w8 W7 {$ r( X' T: |& t" k6 w
int errorCode = 0;* P- V& Y4 O+ i1 h
try
/ x7 e& e. K7 \- F {8 Y6 N& G& y; e0 z& n A- i
//---- Enter your callback code here -----/ s' j' @0 ~6 |9 g- }, X V' ^% P" ?
}
. Z7 e% |/ P1 `3 Q, G( E catch(exception& ex)
8 h( X% x9 k6 u) ^1 U5 ]" | {( }) L8 B4 y) ?1 u1 n: {2 `8 t
//---- Enter your exception handling code here -----
( [. k9 s0 R3 e: k0 _; d$ W errorCode = 1;" A0 S5 a/ }) n1 G1 M
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
1 J! k1 v4 j( `# H" h$ v$ {( n }
8 x- ]: h3 w( o& }) g3 ~& F3 X return errorCode;/ m7 r, Y. F2 x4 ?' M3 j
}2 w( |2 d1 D5 c/ J" A5 O0 i
- X5 B4 y- e1 Q* u3 ?
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)% [$ B9 T) P: J
{
. c2 m4 m8 x8 ~3 i' f% S try
4 K/ M' n; z, S2 S1 Q R {4 r$ ~0 r4 U) L. ^' p
if(block == face_select0)0 X# E8 \4 q% Y% Y$ y- F. @# y& T
{
0 I1 F& y- ~5 a) i0 |+ ~ //---------Enter your code here-----------. F7 |( V3 w* k, L
}" b7 G7 P3 j: X; f5 P7 L. c
else if(block == face_select01)# v* d7 m6 [1 D6 a! _; a0 R
{
2 H: }9 C. E1 I8 X //---------Enter your code here-----------
. q# M+ H2 p. \$ ~- V/ o& p }
4 k, a. v% Z- s2 Q7 G* l5 i else if(block == bodySelect0)2 Z `& p, I% v' u* `& \* G, d/ e/ @
{
: @# a8 C8 z. X; H //---------Enter your code here-----------
]; A- G' o- W5 c, Y }2 f8 b* U0 |8 D( f' p! V) g
else if(block == bodySelect01)+ [( h6 x+ Y+ o
{# P. i$ A+ b3 ~4 i
//---------Enter your code here-----------
4 _2 a' l0 n$ u3 C: d }* w* b) z" s7 C: q4 G4 J
else if(block == string0)
, E S% b$ |/ Z {
& W6 y% R+ o m8 |) @; C //---------Enter your code here-----------* n: D5 \: ?) r* g, c" `+ y2 O
}% v% [! O O5 F; E# N+ ?
else if(block == label0)1 O4 l- G# O$ k% t
{
" z8 \' V$ [4 ?1 o //---------Enter your code here-----------
, v' ^6 z" A2 Q& g& X! d T }& D! N$ K$ t/ ?8 D3 v; O: o
else if(block == string01)
4 w& {" R* {. n8 Y) b% _ {
- G% y( P) N2 C) K //---------Enter your code here-----------
9 Y% P6 ]5 W2 r! |! |* S6 u1 w( I }
/ `# i$ P$ y* N( Y else if(block == label01)
2 Q# R! o! J {3 r: c {' O* {6 @* [: k8 }
//---------Enter your code here-----------
! R) Z) V% i2 E+ I( O0 j }
8 M9 Y# w& |7 D else if(block == label02)0 i* Y* |: ?( ~
{! y% w5 t Z8 g0 `; G4 ~$ p# y# d
//---------Enter your code here-----------
# d) P1 Y/ L/ N }' \& o# U$ @0 U4 t7 O, z( z
}
, U0 N/ E' d6 U* z) c$ I: K catch(exception& ex)% d' |& \8 q- p. Y* h7 y
{
/ N7 {( d) u. B' {1 n4 `0 n Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());* o" Q4 U- P+ { }1 g
}
4 Z5 @# R; L$ n5 ^# \+ i" } return 0;7 H# i0 [9 M+ U$ i2 B) K
}/ J2 S) y( \4 M3 |/ }1 ^& M
$ D$ L" z4 i, y
int Shrinkage:k_cb()
7 _: s4 c6 ]7 g {! W$ T" v5 f( E+ O, T7 \! `2 v
int errorCode = 0;
; k4 _/ t4 _' c) J" |/ g try
8 s0 g5 Z% T) Y# J {
. i, M& [9 [4 z# g8 l5 Q9 Q/ s errorCode = apply_cb();
9 f' q1 m& _5 t7 x6 e0 `: T- z8 F4 I }
# z% }5 I q! j. J6 _ I catch(exception& ex)$ q7 p; a* F- [# v. j" Q8 f. F
{
0 ], Y; L- J2 x: g: `, x% y //---- Enter your exception handling code here -----. {* S( g3 s8 P: O% U
errorCode = 1;
2 g: W: S/ X% G- `" t Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
) k5 W) O& b8 l5 K; R" \ }) x% @& |# k' B' h/ Z- a" I
return errorCode;
5 J) d! b% K. H Q' C }
1 e$ f! N4 q5 ]7 g5 }8 C( g) B ) s5 h' ~$ C# \4 ?; E
//------------------------------------------------------------------------------- X( ^7 X- s" _* E0 ` y
//Callback Name: filter_cb
* f- D" j; G& b0 p2 T //------------------------------------------------------------------------------
i- y0 }' g; m6 U. T( s& O5 p int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)
, `6 j! Z6 K5 T' x3 v2 M {' Y4 q. E+ j- J: p
return(UF_UI_SEL_ACCEPT);
; ?( t! I: c( L5 Z) h }. l+ |/ \$ n" Y' N$ C
/ Z5 k/ ^& R2 W* R3 }/ M6 I
//------------------------------------------------------------------------------
7 I3 }3 R& }& C9 l! o) t) s { void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)8 J, K. E* A) `- B2 A
{
+ k& {* N: ]0 W( p4 T4 D, x. M try
( P. q. i v1 p$ J% M {5 u3 F9 `* k( W! I- s/ W
//---- Enter your callback code here -----
9 E6 j' y5 s. @2 c9 H& s8 H }3 C' R' U+ g( W. a9 H& ~" J! Q+ S
catch(exception& ex)5 m/ s: d" t# A& P
{
- ?5 l: [# a# |% r7 r& h( h //---- Enter your exception handling code here -----& m9 R# Z& q5 w4 b( [, h
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());' a3 s5 G$ y8 \6 v; _
}; Q' |/ F! b* q
}7 v9 P' F9 J1 ~- y! E* y
6 u" J1 d" g, Q& g9 a- E) R //------------------------------------------------------------------------------9 L ?2 i f; b9 o. P x
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
* B2 W& p" j* h* F! w2 u {
9 x& V4 X% g7 I! `% l5 X" | try! q U6 P( \2 X9 I6 U
{
7 {( Q4 V# g& G; ?! T% ^3 `7 a //---- Enter your callback code here -----+ b% u$ E# ]7 V/ B6 F4 q8 n
}
' ?0 \* q! ^( K7 A catch(exception& ex)+ _/ f% [0 ]3 q( k) j
{* k" o% ?" Q1 b/ m$ |8 ^4 Z' L9 Q
: m% Y3 r" ^4 J0 V6 D# w; x' y2 L( d Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());( H, n f; w' ~0 C
}8 q# A* q1 u: A
}
C+ @8 b# |+ Z: _- z/ M" c8 N0 h4 p0 m
* L6 b7 r* [3 [7 x0 ]
|
|