|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
a- A' z% q# Q% o1 C8 \& L7 }4 }
% T9 @$ e4 w4 b; ?* U请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr
" {, O1 F* N$ u$ T. H4 a& I" ^1 {代码如下:
3 p" s; D; {6 _; g2 n6 \( y#include "Shrinkage.hpp"
/ t% C1 U) m# V" g Wusing namespace NXOpen;) Y8 K; \9 x7 |$ V, Z1 @+ I
using namespace NXOpen::BlockStyler;
j4 n# a5 O- W6 i4 N$ J/ s* V8 f
4 e6 |" N0 E) |+ f6 PSession *(Shrinkage::theSession) = NULL;
}+ s/ P* I0 P6 e; I1 sUI *(Shrinkage::theUI) = NULL;
! ^& q) K$ \! I, W8 w" c1 G- C) v
Shrinkage *theShrinkage;
3 b4 F4 R o# m- f3 b* h9 x, p# w. x n
Shrinkage::Shrinkage()# H3 T. Z ~5 g% t' R3 B! T
{
/ S( r) Z$ Q: \* e, V try; p5 H( W1 C# I0 e) d; m
{7 @/ F1 W8 N F: B$ k {& ]
// Initialize the NX Open C++ API environment: g! [, E! `! i. [; l
Shrinkage::theSession = NXOpen::Session::GetSession();/ ~& l# o6 \1 d0 O& \
Shrinkage::theUI = UI::GetUI();
" Z1 A( S5 |! ? V3 p. J theDialogName = "Shrinkage.dlx";$ v7 T3 T M1 t! L5 O2 t3 q& L2 A
theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
# s5 ^- f' y* p9 `/ r# n // Registration of callback functions, \1 J3 N( D U. f# s7 P' J' m/ [
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));. W0 h4 g# g1 Q) o6 t, e0 [ Y
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
+ W) b" t; T* i' g0 T( X5 h: @/ | theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));
' A$ A! V9 w- f7 F: [ theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));9 S: m3 _+ v7 Q4 K% z" J
theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
7 P6 S1 y$ h) @0 u" S& V theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb)); U. l$ |2 X. _# b7 j
theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));" \7 b6 {5 F0 ~ z; q
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
( r; U; C/ [% A2 D, p }6 d. S0 m2 D0 A1 t. E
caTCh(exception& ex)
! {0 F8 M2 ]7 o. ]5 g. B {: r {. Y& q& \* ^ l
" Q: l9 w: D: H2 G: ? throw;( l; I5 t1 \' N# k( H
}8 a3 i7 C, B# a2 m4 [5 g+ D
}
' T" }& g( h4 q9 r# Q5 g! w& A* V6 d: \8 H& E. N) ]
Shrinkage::~Shrinkage()# `9 E1 V1 D- B( S. Y( Y
{
! K" i+ i2 h' o' C h if (theDialog != NULL)3 T! H0 Y7 O1 @6 q6 S
{/ V- m7 W" D8 [ c
delete theDialog;
2 t: ?* l- M; p d1 o8 a2 V theDialog = NULL;
* s6 G9 L7 H, {/ \ }, w+ U! h7 s0 S; E3 I, l8 `2 f' E( j
}, v3 C9 q2 V6 L
9 E* y1 L, i! |0 ?! c1 {
#if USER_EXIT_OR_MENU
4 Z9 W$ {/ V& e5 ^& n extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
* S/ @6 d% Q9 E {
: h1 u' C& B, Y( e( r N& k try
. s( H! y0 b6 E {8 F' Q9 O, h- l7 v1 ~' o
theShrinkage = new Shrinkage();
# g; U3 T P8 z8 z/ t // The following method shows the dialog immediately9 e# P. f% k) A; w' s
theShrinkage->Show();1 V6 d8 z$ l6 ^2 ?; i& L6 y
}5 m9 O; p2 Q8 Y! `; ~' A7 i
catch(exception& ex)
; d* @- o9 b. z5 a* A5 ` {0 S! v0 a4 r8 |4 U; ]1 E/ ~
//---- Enter your exception handling code here -----" e& N# a* _" X/ v
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());( k m1 X0 w* H0 n
}
& M& a- \- x5 O4 U# q( b delete theShrinkage;% Z: B. V2 a8 _( v, F
}
* n# v$ n' j3 a8 S9 e5 N#endif//USER_EXIT_OR_MENU
3 S+ \9 ] T/ Z" L#if USER_EXIT
* E3 _/ K' D) L7 G( A: M
* m! W" N# P2 N! J //------------------------------------------------------------------------------
. Y4 }7 k0 L" B: e' v" r. N1 l
; l2 I& |& l5 s6 M# h // MUST NOT use this option since it will UNLOAD your NX Open application image) \) p* u5 C0 Y' h3 r- a0 o# m0 B) N
// from the menubar.
! f, V6 q' s5 `& \( d5 T2 \' W //------------------------------------------------------------------------------
1 B' v6 b W" U2 U B" V extern "C" DllExport int ufusr_ask_unload()3 o* w' D* I% z
{( G" z5 M: d) U5 O
//return (int)Session: ibraryUnloadOptionExplicitly;7 R! H; x" m' ^& ?, i
return (int)Session: ibraryUnloadOptionImmediately;
7 m0 ~* L) |3 m* q* F$ _3 f: k //return (int)Session: ibraryUnloadOptionAtTermination;
" h0 t" z) z( e4 P5 X }/ N: A5 r4 _. ]+ X9 g
# a% A. @. m3 J5 [3 V! N- E! {1 W
//------------------------------------------------------------------------------/ Q0 [0 \3 j. V8 h
// This method is automatically called by NX.' I% z. ?! U0 O I. y
//------------------------------------------------------------------------------2 X2 U% m" b9 q. z! ~# i
extern "C" DllExport void ufusr_cleanup(void), g* Y9 B1 T# D6 r. V. T8 m
{
% d! |0 f( O9 X5 u/ j5 g+ L try B( A* F, p3 r
{- Y5 S; I% G2 z/ R+ ]
//---- Enter your callback code here -----, [7 D5 h/ q* W: ]9 ]0 p" e; [
}
: ^/ i, P9 A. W& ?7 y/ d catch(exception& ex)- G% |4 t. j' `/ X: j8 g7 Z) m
{" Z" g: {8 F# E( [
//---- Enter your exception handling code here -----4 L( I7 t- D* I/ U4 R
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());$ z- R9 b( H1 J8 W, Y, d
}& z' B+ l1 b" \8 t) r1 a3 k" s# V
}
; i8 i! [9 O% F& k/ N F#endif//USER_EXIT: I3 X, L4 {6 ?% p+ R
1 `2 u- n4 ^' B& u! H( y* l
int Shrinkage::Show(). x) v, V v2 ?9 E3 k
{
4 ~: O4 c: g7 j try1 ]- m7 k" d: M# u, W6 C
{. f+ i3 s7 N! k! s! d
theDialog->Show();
% w/ P* h, i. l/ w2 q+ F/ c }
0 _- ]8 t5 q- {5 y$ } catch(exception& ex); Q, `( X( r& q" |- P* u
{( G2 s7 a. g, r, D1 M
//---- Enter your exception handling code here -----; U5 N! Z- v+ ]$ d
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());( n+ m( r! |/ W8 s- G9 W" A9 l
}
* j6 P+ v$ J& T$ h& } return 0;* E w+ G x7 n; t
}
" v$ B- n) s( P" u* b. e0 V( e
/ {4 n1 T3 o" A#if CALLBACK, Q0 A4 \9 X) m0 o0 u$ D* U
) A' N/ l0 Y8 R/ O$ d( z- d3 x void Shrinkage::Show_Shrinkage()
( l; {8 c' \0 Z' _ {
* `5 w0 C' {" y try
& C* s3 i/ n; B& x3 p+ W {
) b0 l, Q' p! m+ h; V) x1 Z3 T theShrinkage = new Shrinkage();
/ D, v% n% X% |3 B6 i
# i6 H* u* m( E! K4 K( Q theShrinkage->Show();
. Z. z0 H* W& ^- G, g }
$ b& c- d6 Y3 U- V1 Q9 q" j D catch(exception& ex)# s/ ]! J7 }$ e, |
{5 X$ z- Q% i2 _' j# x. s
0 w* s9 b" A" z' d# y0 O Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
8 z4 A, P5 @5 ~8 K; M2 k9 x0 ^ }
3 h( Q) x! I! ]: ^9 e2 z3 y0 i delete theShrinkage;
2 m6 \, X4 \" S% y }. q! _* P+ B5 Q5 |; F+ @3 f
#endif//CALLBACK
, N9 w/ {( \) L6 C p; `# z g
7 H; R1 |8 P% [ void Shrinkage::initialize_cb()+ B* A% G. Z2 P9 p7 q
{
- a* a3 e% k. U( ? try9 O/ E: S, K+ g+ n
{
' k6 x2 x3 k0 ^/ S9 ]3 Z( \- {( M group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));
8 F$ b9 i1 S$ D1 L) v face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));3 d6 C9 h5 P; P* A' f$ V' F
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
# h; T4 p# S6 v9 |/ s group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));5 [5 f1 }: b% d, }& L) R: S8 W& I& e5 K
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));) J! u2 W N8 @0 z8 c Y: H
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));
8 n* E8 z4 p9 v2 C group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
" w& f* O2 ^0 ^7 S1 c8 g' K string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
9 r' ?' J$ p( R: C" e label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));# K( \. [- X8 C
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
0 m5 C% V8 J* l. ^3 u label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));! n9 e" K2 r) `) f7 I9 J! t2 x
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));
7 n' I" P# k! C! m" ]# M7 U4 z1 ~ } l4 X$ [0 A7 K9 t: Z K
catch(exception& ex)
0 e4 ^" |5 m! t- A* n1 J1 j {1 q; p% I0 w# z+ V) e9 R6 l0 Q
" M. H6 \' L- t( b3 G Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());! `* u% j5 _- i/ p0 d) G7 ~' _* ?6 I
}
2 {! _' C7 n6 T; _* E O }; S# G/ b* [- L& a! q3 P
//------------------------------------------------------------------------------
( K5 R3 F+ P7 u+ k: U; X0 y void Shrinkage::dialogShown_cb()
4 Q- h }2 F+ Q- M3 c D |- \' B {* E0 K- u5 n* a! [4 I$ m! Q' N7 E2 G
try' V* u% r' c2 z0 h
{$ y* W4 r8 ~; i
//---- Enter your callback code here -----
. p1 R! I+ h' _: k F2 H A }
- `: H# y: H- x! _3 h6 i% f+ \ catch(exception& ex)8 ]* P$ A6 j2 `+ t
{% }" b5 n7 ?; |) T1 B
, f2 {+ y! i, } Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
) U5 P% O/ S. P# R; ?, l }. i2 b) D( l. { S% k K: F
}; }+ ] j' F. f8 y. T1 _* {. @
" Y7 f7 _+ ] L' ?* f; b int Shrinkage::apply_cb()- N& r( \7 p8 d& c4 p5 ~
{
, j% v x2 E) y int errorCode = 0;
0 W" Q, h, Q7 O# G0 `! w try
& ?) ?& V0 w6 U, l7 S; {/ | {
1 B: V3 i( l2 @) E8 e$ p! T; J4 W //---- Enter your callback code here -----
- D7 d5 m; X6 ^7 V" w }8 _. Z8 k3 k6 d
catch(exception& ex)+ a* g. a3 C7 d8 e# _+ T
{4 k( M2 {" c2 K% N: \7 S `1 b/ o- g
//---- Enter your exception handling code here -----' d) J1 ?, @# r+ J# l
errorCode = 1;
/ T; n: e: g- }0 c y" a& { Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
* F$ s; G& Z, K/ V3 P C7 n }
) B+ t& M L5 c: i return errorCode;6 A$ G# Q. N$ |3 V1 q
}
) P8 T7 h9 @' F) e1 V! p
- ?& e8 q4 ?- q) S9 t& ^$ L int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)8 v1 E2 D8 K9 c3 o
{
$ h& l& X" F* s; \1 s+ h( S try' l4 i/ I7 k. z' h/ g) N/ i* Z" C3 B
{
/ [% J- x& `: K if(block == face_select0)0 W R6 ~% T1 n9 h4 A% I
{
; Q, w: q5 ?) I- e" U8 C //---------Enter your code here-----------7 e$ I }0 e1 e: o$ E, I6 E% j
}
: s a$ t0 r% p else if(block == face_select01)- y* |) ?- Y( ~ c$ K. [2 K
{% k1 u! F- ^- n+ }- [
//---------Enter your code here-----------/ f) ?! K. _8 S# o/ e7 y
} y5 l, v5 M4 I$ W+ d
else if(block == bodySelect0)
: B8 ^$ ] t1 J ^/ U- t ~ {
/ K( H4 l4 _# C+ O( o. }, r //---------Enter your code here-----------
* Q5 D/ K( i0 X) {0 w: L6 ` }* g k8 N+ _% W+ ?; s" i
else if(block == bodySelect01)
) q( @& c c# Z$ L" I$ ` {
2 M: L: b/ @3 K6 p7 {8 t( U. r+ S! ] //---------Enter your code here-----------7 @3 h" `) S3 q4 w# [' ]2 e
}
1 j$ [6 Q* h* A } else if(block == string0)2 d( r$ s" c7 D/ A8 s
{
" K1 }% J, Y4 h3 o# N //---------Enter your code here-----------
+ @0 ~& ^; U4 E( `8 P }' D$ R6 I R* ^# x) L" X
else if(block == label0)( o; d4 Q1 n1 M. }0 K' p
{9 C( t. b9 Q5 |9 U- |) |
//---------Enter your code here-----------
* _0 a, A& c, ]7 O. | }& Z$ f4 w9 K+ D
else if(block == string01)
) s K* ^& M/ s, t# h, M {
v. ?, _6 n& G6 E: F+ @; B //---------Enter your code here-----------
: m' b$ R5 a3 G% |4 `6 X: C# S ? }
+ O& [& j$ Q7 h4 R9 a: o0 r$ { else if(block == label01)
Q2 G) f q( a( w3 K1 K {
) p& B; d/ _: h$ B+ b0 l, w3 V3 B //---------Enter your code here-----------
2 S0 N' k6 B1 H7 ~, p& R }& F+ E; C( X8 \4 v5 Q
else if(block == label02)9 `& G2 \7 S) w
{0 r/ }9 ~8 t+ @
//---------Enter your code here-----------
7 B `, } o! J, y0 n) y }
0 v* K' [4 ?1 z7 C+ g, z* ~9 L }$ ?# A q) a; @+ X
catch(exception& ex)
, y! L7 O4 B s. Z2 ` j {
7 i! h% d: G; B# k4 Z0 g) Q' \ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());3 }! i& M7 O- [ a
}; i0 K0 }; ^- R1 Y
return 0;, p% N0 o k% O
}
" _; B- Y# J- `- r8 V) Z: g
8 z; g- ?4 r& r7 z: z; {. W; ` int Shrinkage: k_cb()& A8 N; I/ W7 y
{
$ ?. R1 L3 g1 ^# S v1 ?5 K int errorCode = 0;" h5 x- j" m% o' r1 l
try
6 D }& S9 s5 O3 J7 \( N) ^2 u {
8 f) D! |3 I0 T, @ errorCode = apply_cb();
6 |6 p' O( S( d) L* h/ S4 d }5 S/ M' |6 I( R9 A$ z w
catch(exception& ex)
2 o/ y) m3 |9 ^6 w' m- }4 f {- x4 U0 i# w' c
//---- Enter your exception handling code here -----, Z) [2 R1 |7 W
errorCode = 1;+ x: P' W8 }- [& g7 k. }" b; q* V
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
' S# Z. r1 a4 n0 u }
$ L/ Z7 e1 `. T; u5 _ return errorCode;" b$ O9 `/ H0 W: C7 r: ], P& {
}7 v+ ~/ w4 o6 k" F$ O/ N0 M
) i+ z& f! y& J$ K$ r5 N //------------------------------------------------------------------------------' e) a4 X- W% U% b
//Callback Name: filter_cb- {5 o5 s: g3 B6 g7 e2 v/ \4 W- p6 U
//------------------------------------------------------------------------------
6 c4 Q# D" n, c2 V6 b1 t4 X l5 F int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)# E# a8 n0 M" Z7 J# g
{5 l& Z2 r- d- r2 i4 G [' _2 Y
return(UF_UI_SEL_ACCEPT);
4 {' n- j. _+ C o0 r8 | }
' w$ {" y- G' i - D% d- V" W- V. M( ?
//------------------------------------------------------------------------------/ d$ S8 U; {/ X% v
void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
7 \% ~& c q. q5 S {$ T/ g. V9 s+ Q% f2 E
try
7 _0 m4 y |0 k( v {
( ~) R5 V- L0 x5 F- i( S //---- Enter your callback code here -----; E% N! p* t0 X% l7 O. v
}; z4 p( ~& s: o1 y! P
catch(exception& ex)
# F( O) G5 h% @1 ?' b {
) g d; Z$ E$ F+ w7 Q1 q9 n0 S //---- Enter your exception handling code here -----) j7 J+ s0 Y8 ?+ y) @
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
: \2 S" b9 I/ q4 X5 S6 m2 m }
+ Y8 z1 A6 N) b/ ` }. G( Y5 i. S' d4 s7 L
- F% _, l$ t( T! f5 l
//------------------------------------------------------------------------------
8 H0 C" U5 I' y% D3 O+ l K void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)3 n! k7 w0 j6 q+ h$ @
{
: |0 c+ H0 H( y try
/ }3 g) v1 E& K+ n O" j {: g. p7 ?) q; L1 V) D3 N
//---- Enter your callback code here -----
& v4 ^: J5 t1 y }: ^. r5 F6 s0 H1 [: Y3 q
catch(exception& ex)) H+ Q: m. [! V% d( C
{2 r. x. ^0 U' G6 L0 m
; W- H2 r3 ^; W
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
% _ @0 e. e: V: s: A+ @5 W5 x }
; e. s6 Q- W; A, A8 q! ^6 F }
' b$ e* K$ \! }2 ^; X; @1 i' ]3 X! Q: E0 _1 p
+ V5 Q4 i1 v* I/ G& q9 G! R |
|