|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑
$ a/ g3 U, h/ k
6 B4 q& _9 {7 Y& C, {- {7 |, e& D请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr8 W/ k0 [5 G2 W2 d* O" h* q
代码如下:
2 |- r, P# [; U) }#include "Shrinkage.hpp"+ X% y3 x4 ?- @, K- k, j
using namespace NXOpen;
- ?9 U' W/ w' e- P4 ]using namespace NXOpen::BlockStyler;
3 T1 m* r8 |5 H0 _3 g# N+ m7 I, M3 h9 ]3 U; N4 F# D2 m! e: l
Session *(Shrinkage::theSession) = NULL;- v T8 V8 Y3 o' \/ I. ?
UI *(Shrinkage::theUI) = NULL;# \ ~! T4 R# I$ \& W8 }6 Q
6 v% o, q$ f, v2 u
Shrinkage *theShrinkage;4 N; G4 v( _! }, J$ v
0 ]1 B) {. ?/ }! y- i, A7 pShrinkage::Shrinkage()
8 _' V( a8 Y' ]# H{
k, K2 L4 K0 z# r+ f try
; ~' U6 b4 T+ f! _/ ` {
/ D8 p; C. T+ Y) M7 u, s // Initialize the NX Open C++ API environment/ l3 U: Y. g: R# ]0 N+ s2 y
Shrinkage::theSession = NXOpen::Session::GetSession();
- O: e$ e- i/ q' W' D7 [& {! ], X Shrinkage::theUI = UI::GetUI();
( E% |( _" q/ D" h, Q' w5 q theDialogName = "Shrinkage.dlx";
0 w7 c6 Q. I9 c# K/ z7 z theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
7 G* ]7 W( A/ R! F% p: W // Registration of callback functions
/ }8 Y. l$ P# h" o: P; f* V theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));9 ?; Y1 z: ^% y/ a
theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
! j; J, L9 R, n; g, n( t theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));; ~6 x! Z- z m% K& B q" b U5 e0 d
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
7 [, j, o9 S8 ^ theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));
1 T- |1 ?; [0 ?/ N, J theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
( `. c! O1 v( K/ i! S7 k theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));6 I) D: ~* F) `2 V5 ]% j9 L+ ^* C
theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));
4 q, [! Z' {$ c+ S7 U( A }
7 {6 n( o) m) z8 S0 O" p; C caTCh(exception& ex)
( N" m8 P8 W2 p3 e2 a4 s; b) v {
9 d$ m1 h# X" P4 t& n( ~
: f+ G' T0 J% s& k throw; W. y; A9 {, \
}
) x0 t6 E" S+ S' Z/ ~' k}2 H; @3 K6 ^: w6 Z
/ P( L, O2 u" \% v5 ~5 O! VShrinkage::~Shrinkage()
/ @' z% ^& \+ U! `$ d3 F{
" C" [/ ~4 \7 W: ? if (theDialog != NULL)
* i; ?5 r2 q% R1 J {4 H2 u$ [5 p1 i8 ?
delete theDialog;) l5 D; L: T1 D6 @% m3 u
theDialog = NULL;
6 _; r1 U8 ]* ~% E, G: ?8 T6 I& J6 X }
0 ~) p+ R8 @; r+ T% [}/ H. S" G3 ~1 a% ~: G: R% f0 G
3 _# x: c* r, R& U9 U$ l
#if USER_EXIT_OR_MENU0 H+ t ~; ~6 w+ j' ^1 j
extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)( G0 Z, q2 q0 r4 F1 w h
{
, m: X7 N9 ~: O) _ try
) a0 a( h3 }5 H5 ?6 W+ n; R$ n {
" Q0 G0 y P8 D: J+ A9 c theShrinkage = new Shrinkage();0 u! @2 k( |$ b* @
// The following method shows the dialog immediately, j2 P7 d+ H" M! y
theShrinkage->Show();7 ^2 `0 S! h+ `$ ^1 T- X
} e1 G& `$ u f* c2 G4 t
catch(exception& ex)
' S' d; b" w) Y4 G" |. O* m {
1 y6 W/ u" F6 H- e8 a6 ~ //---- Enter your exception handling code here -----: }( D/ C( b0 f( o" c6 e
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
4 ~5 @' p6 @3 k! D0 S9 T* L6 {2 G }, J+ u0 ^: |3 M; o6 u2 X+ N5 }
delete theShrinkage;
5 j8 ^9 E- o5 F" b2 |( E }
' \" e% s( D+ l3 V, S5 p#endif//USER_EXIT_OR_MENU) T* S$ ?) D, L
#if USER_EXIT
- h3 W( H1 z/ w# _4 |) i H; y' g F* q' l
//------------------------------------------------------------------------------' ?# U X7 `; x$ z2 R
: Q% S/ k3 @- E8 m* f' y7 N# V/ q
// MUST NOT use this option since it will UNLOAD your NX Open application image2 Z& r3 d' f# W s0 J. H6 R
// from the menubar.
- n) w$ N4 p q) R1 e" X //------------------------------------------------------------------------------
- u* D7 m4 _: g6 m1 Y+ a" q extern "C" DllExport int ufusr_ask_unload()# K" `! C; Y. O2 {
{
% \# e2 V9 ]' h5 i Q //return (int)Session: ibraryUnloadOptionExplicitly;
' [ H3 A& h% _/ T return (int)Session: ibraryUnloadOptionImmediately;! |0 {1 U* c+ h4 R4 \
//return (int)Session: ibraryUnloadOptionAtTermination;
9 d; A3 u' u0 o' r5 M7 k, t }
7 g4 a4 Q! D% r7 ^5 ?6 @ ; a. P5 K/ {0 r! V( @( t9 G
//------------------------------------------------------------------------------
4 K* Y/ F/ n; K- |1 I0 Y: J6 n" h // This method is automatically called by NX.
0 |8 k. p: V8 ~- E- @ B2 Y S5 G //------------------------------------------------------------------------------
( S3 o0 m/ a9 ?8 d extern "C" DllExport void ufusr_cleanup(void)0 e r- l, n5 v) l
{
$ c. G: i) s% p; { try; L z3 K3 }9 c( P& e
{
. ^/ I3 Y) `. { i: u //---- Enter your callback code here -----
1 N( B0 t9 R2 o: I$ A! W+ A; C }! h# J% c& f+ ^5 C. c* i9 t! U# O
catch(exception& ex)% C1 R/ M9 z$ ]% r2 N
{
- }3 r9 `! p5 i1 i2 T, ? //---- Enter your exception handling code here -----2 J0 y; P/ A2 |) z
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());/ b( |4 m7 ^; v5 A7 e
}0 t; H2 w) b; G. L# a
}% j7 X) d. u% g
#endif//USER_EXIT9 Z& P! a x: V" t; N: p
1 v, g7 K( ]4 A. ~ int Shrinkage::Show()9 C8 X) a6 w$ ~; {9 o o8 \6 r! k
{
: ]# D' n" q6 x* r1 `8 c o try5 N+ J* ]! c0 M! W
{
( l i& v* g c1 u, J theDialog->Show();+ `/ P$ E+ C1 x4 c6 i" y6 j
}
+ E% ]% S6 \% v; |; V! { catch(exception& ex)% p9 B+ f3 U9 L; o& H* s! [
{
! b& O' q* H& }7 t5 B //---- Enter your exception handling code here -----
" V" K3 W( ?; z Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());$ t) k q$ _/ I5 |, }
}. \# j% a+ _: L; S. N4 T* ]: W
return 0;2 `1 w7 j4 {6 [( G5 l+ i
}
/ S U8 @0 Y4 ~8 r1 l3 L h6 [
! W D! t: u {7 L) y$ {#if CALLBACK1 @9 Y7 \/ A4 G8 o) q4 s3 F6 {
- ]4 h( W5 e5 N% K# H
void Shrinkage::Show_Shrinkage()- n1 R9 `: @. C1 [+ r5 e& {
{
4 h$ l( }1 s. n. O- g5 x try
& [5 c) @: f0 b% y2 [, ^$ q/ ^ {
' j% }2 ?8 B) C) W& N2 b9 q, m theShrinkage = new Shrinkage();
! N% }3 G% D: C7 ~" |1 D* o7 G4 s( l# X, h% a4 h
theShrinkage->Show();/ |3 k. @" e7 x( v
}2 l( r1 b# @' u, T1 b
catch(exception& ex)
1 K( D8 h" |7 g9 A { u$ Z, p. b" X% A5 A8 p0 a$ F
+ z7 E9 l- {( X4 V$ |* C Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());, T4 X, B, Y* A/ S
}7 Y0 _' q. y6 u/ y/ N
delete theShrinkage;
0 S2 s. a, v/ B- U/ Q( Y {4 z- E }
$ g! K4 _* z5 u#endif//CALLBACK
) i% r& x$ v; s% V 7 k6 f6 z+ v5 h
void Shrinkage::initialize_cb()
9 m c4 p4 P' O' l {# @' @9 D( M* K0 i8 u
try
' C6 }& J( r# T; g. A {' B+ E9 h, d- @3 A: i, Z& D2 F2 n
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));5 _0 r3 t/ a4 @5 e' D2 n( D( a
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));
$ K) n' g' a" S8 i* N& L face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));
# [, k: @7 ]9 P% [2 `2 L* D6 } group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));+ { ~. P# w+ k$ t. V
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));3 W; N3 S: m* q2 d
bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));& W+ I# d% U2 j% k2 ?" B" u! t
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));* w( C# `5 V% w" ^
string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
( F0 n% S d! S- [- B4 h$ [ label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));: ]) x$ O, Q4 B
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));# d$ \8 @1 Q$ P$ h
label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));
; t6 y3 q' N' e& y) F label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));& |4 ]6 J6 g- Z4 }# \
} R, P" S0 E9 T8 W
catch(exception& ex)
8 m) p; X3 i7 F* D6 `2 I1 S: w {
& E/ U, C. k1 a
* C9 d2 H1 V2 q. s i Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());3 @8 }$ b" k i4 A" [9 {/ y; E
}
. _$ i! n" y7 c( \! ` }6 H# Y& l: p% a% J; O" G" W
//------------------------------------------------------------------------------
3 ~ k7 H' l" Y2 Z void Shrinkage::dialogShown_cb()
3 E. x9 M) c3 ~$ f3 y5 j% L$ n {8 `; |9 k6 A4 O) V' s
try' z5 Y" F* J) G8 C" ]* H
{ i: `; J) A- J( @; a5 ]3 ^3 |0 I
//---- Enter your callback code here -----4 L5 y* h0 {0 L' @ c( P
}
9 z9 F- {6 m4 k8 w% P& n6 Y- c catch(exception& ex) u! ?# M' M3 e: s5 @% i- ^
{9 k/ a M- f# x& y* |
# }6 G# F4 z- l Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());8 |4 M" Y6 l2 }
}9 h/ n5 Y; v5 V5 m" `# f3 f2 A1 u" @
}7 S4 Q1 u0 ?7 N9 L' K
5 k- b$ t2 o3 P: O3 C int Shrinkage::apply_cb()
3 [3 a i: t5 w2 \" F' K/ R% n {+ {( b) V+ V1 X
int errorCode = 0;
7 m, p6 `" Z3 l" ~4 G try
8 {% I" Z E9 O8 V% ~ {
5 h& T. k! N [9 v6 G2 R; V //---- Enter your callback code here -----7 z6 u; Y ~" m4 K P
}$ ]' I* F C% r/ L1 Z9 n) ]
catch(exception& ex)
7 M- O$ p$ J2 g- ?8 }0 a- Q; e5 v {
! J! M# w% i6 s* R7 v2 l' \4 w //---- Enter your exception handling code here -----
7 J. D6 u6 r$ R; W5 u errorCode = 1;
8 m8 @! w$ `3 x* ^( ] Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
- H/ V& x) {# W# w7 M0 p/ Q }
1 H) b: V! }; ^4 B return errorCode; ?5 r$ X5 ~# N' y
}! A1 o9 B6 V* G- [1 b8 [0 `
5 A/ x' y- q3 r( a9 Q+ `6 ^0 F int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
1 B+ i* U5 R( G4 k {& N! y; }+ T" O% o) S
try/ L. U! H0 \ C |+ L
{7 N, H- ^$ A% @$ v. E
if(block == face_select0)0 M, H ^1 Q# N, m- H
{
$ W- J/ }7 \) |! t: a //---------Enter your code here-----------
8 z; |& h. Q4 _! C! x7 m }
( x- G. C1 J+ _ else if(block == face_select01)
( [4 a2 C; A k+ ^ {2 L& d3 w0 I6 E* I2 ]5 B
//---------Enter your code here-----------
0 m# D6 r+ S. y. j; n& ]7 ` }
8 T Q9 @7 k, n8 b* }1 K else if(block == bodySelect0)) j/ y/ b X9 C; M% U m1 ?
{* S! W/ l4 l. C! j( ^
//---------Enter your code here-----------
" J$ O, G! y, _: {1 O3 T. J3 N$ c }
`7 u/ ?9 T B& S4 J else if(block == bodySelect01)
Z$ A: z0 w, c$ d/ p {4 F. a6 R7 I9 e0 Y |; {8 }3 R
//---------Enter your code here-----------3 ~; v* Z7 i4 z0 ~1 v) U) X
}6 L" K, M2 Q) x7 p. _' a
else if(block == string0)- T7 G+ Y; K3 [' s4 T: t! _" O7 s
{3 }' @; v$ G8 L& A- H- \, n, v' _7 N
//---------Enter your code here-----------8 ]% m7 x5 A) |. e
}
% f: I& M7 M+ T2 m else if(block == label0)* S! R9 q* R9 _7 B4 b3 Z9 ^' j
{! n6 N0 j& O+ v1 ?
//---------Enter your code here-----------. F& d7 R& x- u
}
5 ^& Q; p3 V% J; K else if(block == string01)" e; y, y: o7 G6 k n+ |
{
3 O e& k' @/ d1 q" ~ //---------Enter your code here-----------
# n! v8 H2 _; j0 \1 R( ^ }
- J) v" x9 L4 R5 ? else if(block == label01)" F3 B% e9 s/ D' o0 V
{8 _4 F/ ?8 i W' Q
//---------Enter your code here-----------
) h9 {4 U& V" W ?( @; ~ }* n7 B/ ]* j# P- A; t0 t
else if(block == label02)
& \9 r. }- m+ u7 W- A5 b2 X. T {; E) j, }! V$ @6 l# s8 e7 Z3 c
//---------Enter your code here-----------
7 {# H3 m0 ]2 z2 T `( \3 W }7 i7 ^* j2 S" U4 F3 n$ ~! d2 s
}) ]# k8 F* t$ Y/ Y, n4 q8 f
catch(exception& ex)
! M0 V1 N) g2 B" H2 ~+ ~ {. E8 {' H) e G
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
1 @. e$ l0 f& X }6 v2 v. A4 c% Y0 X" T
return 0;
! @( ?$ H" L; `2 u* U7 X }% S2 ]+ P6 O& P9 E
. i& x5 a* I$ { int Shrinkage: k_cb()& I% ^9 S; Q2 u% O0 Y0 G
{9 W+ ~8 B8 q' g) ~' S" I
int errorCode = 0;
7 ~( p6 {; Q, G9 C- d! L& k# V try
' F2 m* S) [0 `# U4 c& m {3 f4 Y5 ]; |7 x/ }2 @
errorCode = apply_cb();
' N7 z, Z u* h' f }
/ }: J/ B7 V- B2 S2 v3 }% f! J catch(exception& ex)
7 k9 u, T$ i+ s# V {7 q1 M" j4 M5 A. m
//---- Enter your exception handling code here -----$ W8 e! H# l' z" {
errorCode = 1;. H. v0 b1 s4 m B1 P! _$ }
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());* E- O9 B8 `- o2 b8 A" ?
}
$ ~8 _ |. z# m return errorCode;$ s7 I- F: ~1 U$ f) N
}/ [( s: k/ {1 w( A, ~( d2 }7 X
$ Z) Y' M' y( Q7 l //------------------------------------------------------------------------------- L/ p0 D6 l2 X
//Callback Name: filter_cb% s6 l: m0 g$ F ^4 O
//------------------------------------------------------------------------------' k# b( n7 q; s9 \
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)9 n( u9 l2 m" H& J0 l
{; \/ v% k# ]1 t7 H) x* a7 B! W- P
return(UF_UI_SEL_ACCEPT);8 R9 S8 |5 _' F! {# w
}
* K Q5 @' j& g: V; O ; q+ |: b0 m" c; l) U- |" n+ J
//------------------------------------------------------------------------------
. G; ]. l' N6 y! U. v void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)2 Y9 u2 s& y: g9 g+ ~: t4 X, o
{5 H: w( H& Q) @
try0 z, ]( D/ E5 [' d) D
{
# c2 b# e9 Q' {3 o* A* b [ //---- Enter your callback code here -----
0 s1 p+ _: ~* [' X) @8 u* Z }3 i; K- K1 e+ g b9 E3 ]
catch(exception& ex), k7 I8 R$ x0 a! k
{" B% X+ H7 L0 H% P, }: r. A
//---- Enter your exception handling code here -----
% e7 [; y7 j: H# \3 F9 @ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());. q# ]7 E% t! o5 v
}
& e- O4 J1 z/ e( e }# G" O9 J% s2 u+ h
/ P' h9 y3 c- c$ K$ R( r //------------------------------------------------------------------------------0 {* W( z" V) u" `
void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus); _% a! @& C$ N0 j% R
{% k+ `, x* t) X* M
try2 x) x. C$ X& O
{2 d C7 y& z* ?1 v) N
//---- Enter your callback code here -----/ [' X7 [5 U( C2 `1 B: `2 ^3 m# ~
} R* r6 G( Z+ K+ O- M
catch(exception& ex)' M5 u' w; q! S$ R8 `8 ?
{
# s' `# x& ~4 `& m! c1 M3 s. y; |5 F; E4 J/ z1 \" t
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
7 w% A9 |; J! d3 i+ M% @2 c+ w+ F }
7 |+ G+ b2 ~5 G) O }# Q2 [# n% r; J/ L: y
! [7 X D7 N- j2 V
6 v! D! c# C2 ^8 M
|
|