|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
* l+ K2 r: _' g6 f8 r+ D+ r( Y3 g ] T6 j# ^+ _1 i! e; M1 t
请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr" k% e, N0 o2 r* @" x \/ q# D! I! Q
代码如下:1 }* Z: e2 q; i# i! s" [
#include "Shrinkage.hpp"2 H v _5 t/ P* A+ q
using namespace NXOpen;% W1 L; p9 M$ w5 {1 L
using namespace NXOpen::BlockStyler;
1 _# |& H6 a* e" j/ V7 X, }- N: a6 n4 l1 K* C& i3 D+ I- [! z0 E
Session *(Shrinkage::theSession) = NULL;: Q4 p7 J5 h! n( ^2 ?
UI *(Shrinkage::theUI) = NULL;5 a, O4 R$ J/ | W+ I Z
& D1 S: v/ V; i
Shrinkage *theShrinkage;' u4 k5 F6 D8 W0 g
3 m# x+ O; ^% N2 Q4 Z
Shrinkage::Shrinkage()/ K* Z6 A7 a f. o$ S+ T
{
! u$ v, \0 r( G$ ^* B% ]3 w try
- f: p G0 o2 r/ O) @ {( `, W% _1 Q* J% K$ |
// Initialize the NX Open C++ API environment& U( P* J, k, Q
Shrinkage::theSession = NXOpen::Session::GetSession();. C# X" `, b7 m, u- i5 ?
Shrinkage::theUI = UI::GetUI();& `/ o6 ^3 _% ^
theDialogName = "Shrinkage.dlx";7 |' J& K: f; E& r$ J
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
: B1 b, S+ X/ m- x: { // Registration of callback functions4 W+ |7 @0 u0 x1 b1 _. X, Y
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
, ^3 J$ r2 G3 f theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
" f7 I8 x! v# R theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));' b: S7 }/ l. r5 O4 a L! \2 B
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
; m' J% C5 W1 p) {4 W$ S theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
2 g/ N( s3 ^8 t) X* y3 ?7 g5 t theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
* P% r6 d/ H* R- W, M theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));9 z3 ]8 ?/ `& w0 H5 B
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));8 n# ~$ D6 i+ Q F" n! |
}; f* Q6 l c0 D" ?$ S* k
caTCh(exception& ex)
/ x0 l% k* o2 c7 |4 |$ p# i/ j. G" r {; V$ q% z7 x! t6 _
" |8 T" t$ Q3 |" v
throw;
! i; M6 Z$ q/ R' I }# Z( n. G4 O1 M. y$ V1 `
}
; s7 Y0 s! s& `# E' k2 o$ U8 [* S) f1 M# F
Shrinkage::~Shrinkage()
4 ` I5 H0 b& M6 r{
- J1 ^# L- l% I if (theDialog != NULL)
0 M+ m7 ^" p" o6 |; N! a {! e+ a5 z5 r2 h/ J: P# o" `
delete theDialog;- y5 c7 o+ y) u/ {6 J# A M
theDialog = NULL;
]8 T7 P! _: S+ E }
5 F5 A# P: e4 X' a( s# v9 G$ L}5 K+ O2 J5 J4 ?9 P& s. t3 K5 q
8 T. |6 I* d- x: ^6 ?#if USER_EXIT_OR_MENU& K' o9 d! r4 H4 }! x
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)5 x5 h+ X, g, e6 @8 R' Y
{
3 U. n. ^. ~/ I7 e( W# j }7 d6 z try; r8 i. N) z1 f8 G2 ?0 C' E' E
{
$ E# S8 ~$ b8 X( K1 i. G7 L theShrinkage = new Shrinkage();
' G6 Q& S# {- j- Z // The following method shows the dialog immediately& I# r! a, H# Y k8 H1 x+ X
theShrinkage->Show();
- t# u3 |6 t4 g6 f6 r6 f# p' L }1 }! p9 e( ^4 y6 u2 F* v' s$ }
catch(exception& ex)
4 }5 B9 W$ o& D; O. |. X {. j6 P5 _/ t( |' n+ a e
//---- Enter your exception handling code here -----3 N1 t$ x7 [) q$ O2 R g/ w1 r
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());. _# A j) i9 x0 ~- A, ~
}
; Q A. s z/ z1 R5 n( d! [ delete theShrinkage;
; U4 ?, ?* U" @$ \5 g7 E/ ~1 [$ x }% ?, @$ N5 |" K1 Q* M3 i
#endif//USER_EXIT_OR_MENU4 q) I- |% g$ G- ]
#if USER_EXIT/ R# ^0 a9 _) x/ A, s
( F, }- J! u9 {
//------------------------------------------------------------------------------
7 @" w* f' |2 d( Y
0 k3 L* M. c7 S, |# Y; i // MUST NOT use this option since it will UNLOAD your NX Open application image
) B! m. G# w: U2 X) K // from the menubar.
: N' W& S7 E) {% @3 u! F //------------------------------------------------------------------------------ w1 s/ `# S$ Z- M9 J
extern "C" DllExport int ufusr_ask_unload(). v; W9 t7 s; t$ ?, a' h- C
{2 s2 M: Y5 u7 G0 ~& O5 V* q. S
//return (int)Session: ibraryUnloadOptionExplicitly;
V: l% B: v4 i5 C% n. q) Y return (int)Session: ibraryUnloadOptionImmediately;/ b+ ^* t* T$ y* N
//return (int)Session: ibraryUnloadOptionAtTermination;
6 g/ Y8 ` E, Y b }8 D4 Z L& _5 C* b \
0 j% N- C1 l) j //------------------------------------------------------------------------------6 H- e* r4 a+ V, B$ o- G
// This method is automatically called by NX.
- q* K& P8 N4 u5 J" r4 U //------------------------------------------------------------------------------
2 O0 p& u+ U& J( G5 ^ extern "C" DllExport void ufusr_cleanup(void)* q% ]/ x5 q/ |" x$ E z' M
{& d' B) L! c, A9 r8 ?5 w: S: n
try% M- P/ a6 c" Q' m- [
{6 j8 N2 \0 y: I
//---- Enter your callback code here -----6 X/ y4 L; y$ N
}
0 N1 H: |. w& U9 l# P7 z" D" s catch(exception& ex)* n; J% L2 B* ^
{6 ^# _2 ` v: W0 B
//---- Enter your exception handling code here -----2 e. B. M9 |3 Z! v |, [. k' |
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
: q8 r+ l2 x& y% a. Z! R z, t }( I8 T7 ?1 h9 n$ P1 B7 {
}
( `6 N6 ?7 z1 p/ j, Q#endif//USER_EXIT& q/ V/ k3 ?' g N; ?
( Z, g6 g$ ?/ Y8 p4 n int Shrinkage::Show()3 p. }( J+ V0 t4 [0 B5 D
{( L0 [+ J# p% ^; Q) \2 _
try/ `- J1 ^7 C6 Q0 `0 w) u
{) U7 f3 r X6 ^' [
theDialog->Show();' k4 ]# o# W: y7 y" N0 x
}, Z0 c% S& U' s1 A
catch(exception& ex)
1 W2 D2 ~/ Y$ I- L! ` {
$ E! b- z) U* @ //---- Enter your exception handling code here -----
9 a& a/ t- @& |" r# D6 L# N Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());7 V9 ^* J8 s. ^4 B& a; ]; s0 a$ G5 L
}4 x: s6 _* Q7 y/ k
return 0;, C/ R$ ^) a7 C' D! t' Q
}
2 Q* W+ I" X' ?( w4 W
# F8 a; A# P z+ @* U7 H1 n#if CALLBACK
' i- @7 y5 o, r; n% U& @9 D
7 o* U9 f6 ?9 x5 r$ v void Shrinkage::Show_Shrinkage()
; Q5 k, {/ H" Q& [! c7 V5 M {2 x2 }9 k7 j8 V0 X
try
3 ]* Z9 Z9 m G {
2 h0 T. p; d1 y! S, { theShrinkage = new Shrinkage();% c8 g3 X* Y6 `7 M% b
/ Q$ F% s9 l9 _5 K$ i9 } theShrinkage->Show();
7 T, T# h$ y) Q' s! J0 b% s: W) ~4 x }
/ n0 `1 w4 E( }- N catch(exception& ex)
, X3 @. X9 R1 f7 c) _& G3 Y" _ {2 V% [1 e: v! Z! L
2 p( `9 b- J! Q Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
2 C" U4 y( I& [+ o$ u8 C }: D8 Q, ?' v7 h; H
delete theShrinkage;
# z0 R9 M9 _9 n; Z( G) ] }
3 A+ f8 K+ U; }#endif//CALLBACK+ p) J1 J5 ^8 k( L
/ Z* y7 ?7 H8 N$ t2 {, k: ~: H6 K" ~
void Shrinkage::initialize_cb()" g7 ]. ~3 G" F* N; J
{* y% W7 z2 ?& h5 P& L3 Q/ x
try+ N4 z3 m" ~: k; m! p# I* p! X J
{- f$ l4 | y c2 m
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));3 A: v- `& C; G7 z* [$ |
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));' j4 T0 j7 F% [) z; p0 b/ q4 k
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
. a0 ]$ W4 y* s+ [( f group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));
+ Q6 J4 W% y( h* v- T! a bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
$ x0 h, s7 W& w! f5 u- |& Z bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));4 {; N; Z% y; A* Z6 E0 L
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));* |- g% T5 C! K8 f
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
& A" z- w# U; E4 P5 O label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));
" j/ Z# @, E; t4 o: o string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));/ `' [: ~2 ] S z; j/ A1 O
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));9 I: @. S& a' n! [# N
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));9 x3 f9 E; P+ s: i4 f: a& G% V
}
4 ^: _3 _8 @3 ^$ H+ F catch(exception& ex)
& Q4 F* d/ h7 J {/ D7 \+ P; w; H6 B- S$ R
! y8 }; O# H) c5 X Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());& V7 D+ i7 `- n+ y2 W' t
}' i( \3 l/ n# r0 H4 j9 ?/ T
}
, a0 Z- m/ `) i0 ~+ ~ //------------------------------------------------------------------------------; ^$ ?. E- V3 n) `5 b9 w2 U% W/ Q p3 @
void Shrinkage::dialogShown_cb()% `, f2 N; W; }" }. b
{, U& v( f. A7 h1 K" s8 P
try1 T1 ^2 C) r$ Y$ i3 o2 a/ N- {
{
/ Y4 T6 f9 j$ S$ z //---- Enter your callback code here -----
- H, R Z7 e8 C# ~, K }
* J& y( M/ M7 M8 G; I p catch(exception& ex)5 |: m; W- r; K; U/ w% ]
{) u! @& u9 |! s$ J" O
) D+ \7 \, v0 C1 _9 l
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());* f4 U* y' W) L7 I. V' A. u
}9 s. G& X, D9 Q" }! @
}8 R$ ]+ R5 ]* K2 @+ m
, H# \0 e- i4 m& L1 T int Shrinkage::apply_cb()( u d0 R2 X/ I- O
{
* `, T! e" V; O4 l& j- F& { int errorCode = 0;
, Y- t) u- D: Y+ |& O! B/ ` try
' W } `$ |0 A# D; ^ { J" {3 M+ G) C9 {+ a: K' g
//---- Enter your callback code here -----' I) K S2 u) q! j7 s: G( X5 Q, y1 i
}& B' \: v6 @& x5 N8 C- U: E1 ?
catch(exception& ex), X# k1 \* h5 v+ R- o
{; Q( M* l7 p1 g1 o
//---- Enter your exception handling code here -----& S! H; C, d. L
errorCode = 1;
) o: o D+ u4 `0 f8 B, F Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
) M8 Q/ U+ Z3 Q+ \6 m1 N }, j& n5 ]; t9 Y4 L2 P
return errorCode;, y+ t8 ]+ J, Z3 h. M
}2 ]* |( M P0 k0 ~* `
* k! s' Q2 I6 |- S1 B$ [+ | int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
6 U% |) S7 j0 R8 M/ b {4 M; }2 @: H5 m/ E% {
try
+ z6 D2 Z" K0 @ M( V. [7 h3 J {
" R! U/ L. P& [4 h if(block == face_select0)& }0 n4 B5 _' n2 z8 Z+ V
{, q5 ~' S; m* |
//---------Enter your code here-----------" X1 f6 ^( b/ Z
}
0 U( _- Z4 ~/ v8 K else if(block == face_select01)
1 C4 H" q9 \ `1 l {
4 g: }# r5 d7 K) A- p( @1 d- h //---------Enter your code here-----------
( I* Z& H% G, ?8 Y2 J' W( |4 t }: I8 I' f+ o' e
else if(block == bodySelect0)2 _6 w- r0 l# S- X! Y B
{7 y& r) h/ S# p8 H) D( S* H8 H
//---------Enter your code here-----------
0 l3 W- e( p7 E }
I' o% Z0 }, C8 C. o: C( Q1 f, { else if(block == bodySelect01)
. Z* L7 E; z* q; O8 z {
3 A0 T/ r4 c: ~( w //---------Enter your code here-----------
. Z4 }- Z* {+ S4 H }# w% @& E* s0 E" F% C/ b. h
else if(block == string0)
6 ^8 m* n. J# h* O- j8 \0 V {3 V0 G/ @5 V" l! P1 ]/ H
//---------Enter your code here-----------
2 d3 A6 e- D; b" O8 g }
g; j0 r- X: L* r else if(block == label0)
* ?8 M, g9 P& ^* k% c- B9 H1 | {
, s7 Q# h$ U! X/ w) O) ^6 d5 \ //---------Enter your code here-----------
) ~. W& e: m" [& l! k }
1 v& V! E. F3 Q else if(block == string01)4 X8 L; g* j7 Y# l& j
{
* |1 F3 C7 o2 m) L7 @ //---------Enter your code here-----------
0 v; u* @/ T# @$ e }5 f/ P5 {% R2 S1 d( g
else if(block == label01)* ^; p7 f; D& L5 \. G
{
/ `1 h! z" [& x: S6 a7 @/ n //---------Enter your code here-----------; o" E1 }7 L/ C6 a0 H! M
}3 ^( C* I7 p. }$ Q8 [* ]
else if(block == label02)
( q% T, W$ s4 H! F8 k {: V: e1 E: j# g/ [& B. B. \# ]
//---------Enter your code here-----------5 e; f2 h, c+ |" c, L
}
* Q. U# R( o$ y2 N6 U }
# o T3 Q' _2 x5 D. I catch(exception& ex)
6 O6 Y7 D }8 V {
1 C9 h4 Z- K" G& j Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
/ B. \$ u: [; J3 }: b2 R }* ^- X, G+ m: l# N1 q
return 0;
# n9 g5 u0 Q( `5 S& S5 e' p/ t }% Q% T, V. q( L4 Q1 a
3 P T+ K) e9 m F. B5 _# a int Shrinkage: k_cb()# Z: n4 a% ^$ X8 X Q
{
# O/ B( T' d: [; v) o int errorCode = 0;
( R. r1 [! K3 C4 r5 e2 N, M try" t( V0 s: c! c) |' K8 ^0 ^1 @
{7 c8 [$ w" j2 q+ H% _$ e
errorCode = apply_cb();7 r/ o! H$ a9 _2 W7 j
}4 L4 A( q, }( ]" w) r* G7 l; Y
catch(exception& ex)
4 A, F8 l0 [) a O$ X9 l {5 i7 W# o4 @: \3 X5 e! Z
//---- Enter your exception handling code here -----
: }2 y1 g0 z. N, ?5 f errorCode = 1;) n0 {: \) H; o) c0 T
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
8 j5 n. h9 W( g) V0 k7 S5 f" } }6 a' K$ T+ b7 _2 `$ c+ a1 A
return errorCode;9 A7 q5 [/ D& @
}. A- r3 O. F0 i3 [
2 z8 ~( V( ?. B C# L# F //------------------------------------------------------------------------------
% ` Y9 A: p7 h% ?6 L //Callback Name: filter_cb; V# J. n8 S+ L& X( m
//------------------------------------------------------------------------------9 W; a1 z8 H( g6 V$ ^" o) H) p9 u* c6 i
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)0 z$ g) P3 k( Q
{
0 _8 x: \& ^! @6 E return(UF_UI_SEL_ACCEPT);
5 J& [7 q# I; N- m: a* S$ Y }) F9 G: J( V3 d5 D9 p2 H
* y f3 K: a7 N( L# C4 `
//------------------------------------------------------------------------------7 x9 ?5 k" n+ P1 X! A" W7 J; W
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus). k) `, {1 ?7 s6 _- i: y
{
# U6 c! b, ]/ @4 Z" p try) P- \& J' S, J s' m
{" k. e; n3 R9 E& p d! z
//---- Enter your callback code here -----
# B6 t& L1 x) d' @8 q( Z1 x8 [5 J, m }
q1 e: T7 R& |" o6 H$ P+ B catch(exception& ex)
; Y6 G D: |$ J6 P9 }" U {
1 e6 ?+ ~) H7 l4 k$ M //---- Enter your exception handling code here -----
& m* T. a- w0 ^6 R Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
& [: \# j8 Q3 _$ } }
. v# f1 {8 Y! u7 S% | }
, {; u* M( W+ M# @, o5 ^ ( A# N' k, P2 f3 S
//------------------------------------------------------------------------------
+ A# E* s1 D' t' V F void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
5 L% D- I7 I5 l8 f; c p {4 v, D2 Y! C/ q6 J9 F: S& J7 m6 x
try3 p' |5 B8 M* n9 U) v4 I1 {
{0 X6 _6 N* S' k: d% o7 Y: A% P. ?
//---- Enter your callback code here -----8 ~; t6 J8 m5 N. S2 p) v
}4 C" G1 @9 r. o8 U9 m( o. O
catch(exception& ex)
2 X. z1 F# ^5 V {
8 j5 _. W& z# x; G, |* c1 H: k* N# J4 A# `. t
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
& D+ k; V0 D; w- o6 @ }# X7 M I6 v, }! b
}
2 T& a1 m! C; k
: u9 j4 _$ w$ [( F; Z# t! ]( X+ Z, Q) U
|
|