|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
本帖最后由 lzhyi 于 2017-2-14 11:32 编辑 : R9 @3 K1 D9 J; W T3 V# v
X6 Q, {" I! `& ~请问出现如下问题,是什么原因:库缺少需要的入口点,功能名:ufusr) D0 m1 }$ q0 g6 o* @
代码如下:: I% `8 J" t6 w2 V2 ^4 j# Y7 c
#include "Shrinkage.hpp"
# F5 B$ O- K- s) O# Tusing namespace NXOpen;0 i2 _; \& ?# Q( K; L2 k
using namespace NXOpen::BlockStyler;
W; z) Q& U+ b& L' g. \% v- s) N- T' j1 y
Session *(Shrinkage::theSession) = NULL;
% J# i0 F+ p x. u: f- j/ EUI *(Shrinkage::theUI) = NULL;1 N6 K- l5 }, x6 x) k* }& K& o
" q" b( ?1 H0 D/ D7 T6 gShrinkage *theShrinkage;. \! e/ _$ L7 d( Z
+ N$ L# k( l- w$ S
Shrinkage::Shrinkage()8 r, t- m6 Y, C9 V; c; e. E; W4 U
{2 j& Q1 F! X+ ^
try
6 v4 o& i- a4 u' v a4 @ {- {* I" E8 x8 E2 y
// Initialize the NX Open C++ API environment$ t& {2 [7 k* Y0 D2 R, M+ [
Shrinkage::theSession = NXOpen::Session::GetSession();) P) x7 L; _! E
Shrinkage::theUI = UI::GetUI();6 X* B2 ]" V6 x) M( |/ I
theDialogName = "Shrinkage.dlx";
1 u& j5 a2 _1 t' f6 @) t theDialog = Shrinkage::theUI->CreateDialog(theDialogName.c_str());
" S: y9 Y0 c3 w5 v // Registration of callback functions# X/ `% j7 w7 W5 f* R
theDialog->AddApplyHandler(make_callback(this, &Shrinkage::apply_cb));
. I& `- n! ~. m5 k: R theDialog->AddOkHandler(make_callback(this, &Shrinkage: k_cb));
% z5 T, y- M- \% E theDialog->AddUpdateHandler(make_callback(this, &Shrinkage::update_cb));+ Z; A7 X5 w0 ?& q" h: r( e3 U
theDialog->AddFilterHandler(make_callback(this, &Shrinkage::filter_cb));
$ I* e, a& [5 V& F4 F' f7 M theDialog->AddInitializeHandler(make_callback(this, &Shrinkage::initialize_cb));4 l; Z: n; E2 X* b8 y( }
theDialog->AddFocusNotifyHandler(make_callback(this, &Shrinkage::focusNotify_cb));
# r7 h+ ? n0 z( g4 }( h; q theDialog->AddKeyboardFocusNotifyHandler(make_callback(this, &Shrinkage::keyboardFocusNotify_cb));
! }9 W$ t) j; m1 W0 B) O: n theDialog->AddDialogShownHandler(make_callback(this, &Shrinkage::dialogShown_cb));2 A, F; Y4 l0 R* a1 w
}. j+ |- _# y) ?. |5 @0 U3 X
caTCh(exception& ex)
. {' m0 m+ y6 x' P0 a1 ]! m {
! y- i7 u/ F5 S) l; v : d5 @. x2 h% C! f3 m& ?4 e
throw;
; v" y/ _6 \; f- s2 i& n2 | }0 y8 `0 Y+ ?% {) ^$ u. q' }
}
v7 @: y$ b0 r0 _: m' p( R
2 @$ c+ ~0 R1 W2 B ?* m+ {4 GShrinkage::~Shrinkage()
7 ^! w) M3 E7 y{
5 C9 [' O t, _7 s$ t( @ if (theDialog != NULL)+ Z8 w( P7 O! w+ X, n" S1 C8 Y
{# i: E9 I+ z. ?( O2 m# ]
delete theDialog;
$ p! p2 x/ ^% ^& N7 g; Z6 F theDialog = NULL;
4 H5 u) z9 W1 U* s6 J }" y1 P5 k$ r% w [+ U* J6 ]
}
# H' u0 Q3 `: \; T5 k) b3 O
3 i/ W1 Q. c4 H! d( U7 ?' ^#if USER_EXIT_OR_MENU
! k! P3 L5 M) L# B+ e: ?( j extern "C" DllExport void ufusr(char *param, int *retcod, int param_len)
) x7 {( R) E, k {
* L6 ]+ b* S% B8 T3 t/ c try
& d. r; ]" Z$ d6 k {
! f+ [( H5 n$ Z w theShrinkage = new Shrinkage();
. G5 `& @" X2 A- J7 w // The following method shows the dialog immediately
. ^, U; g9 F7 K& U theShrinkage->Show();
; G+ s* k, |2 @" G. @ }' s$ d% `, k2 }0 g9 h
catch(exception& ex)
1 A8 r0 Y/ |/ B1 v# N {
1 n# L; ]+ w* W X$ H; _7 A+ z //---- Enter your exception handling code here -----
1 o: H- w" }2 C+ c7 m& E6 K ~ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
+ w- l; @; E& b4 y+ y" r9 h }4 Z1 f8 I4 \) K9 r1 c
delete theShrinkage;
7 I# r# K8 C w1 [ }7 o K4 H# N9 O0 u/ h8 ?( y: P' n
#endif//USER_EXIT_OR_MENU! d: R$ x; Y( B8 _. Y
#if USER_EXIT# t" g, u4 J. \1 _/ S3 `
# D: M% ]' o! D0 _' E/ z9 I# k //------------------------------------------------------------------------------5 r" Z0 F7 `6 ~8 T+ W6 r4 Y5 L' X2 g
5 ]+ Y' j; v+ T% d- s // MUST NOT use this option since it will UNLOAD your NX Open application image% W. ]0 J! c' o: I" a, S6 \& Q
// from the menubar.
2 w2 o2 E- R/ R8 H3 p0 p$ } //------------------------------------------------------------------------------
, r' ^6 A- Y' e% c& K: e) N: I$ P extern "C" DllExport int ufusr_ask_unload()# q! j& X' j0 I" F2 d, V
{
- ]* l- K) f. u" N' U //return (int)Session: ibraryUnloadOptionExplicitly; d# ~! |- |6 `/ u I8 ~9 L( ]% R
return (int)Session: ibraryUnloadOptionImmediately;
% R2 _, U$ r' G; h. q% y* l1 _! _ //return (int)Session: ibraryUnloadOptionAtTermination;
, U. E/ K) @- L7 b }
# ~9 T- Y( \4 L2 d+ y+ c/ q4 U
, z2 D) T% r# B3 \ //------------------------------------------------------------------------------
' A- O4 N: P/ F7 k5 X9 v // This method is automatically called by NX.
- b" s2 ^0 `$ t3 s4 h( W% ^& v* S* C //------------------------------------------------------------------------------
* V3 J, V! f6 M5 E$ ?; d extern "C" DllExport void ufusr_cleanup(void)
$ M# b8 F6 T9 c9 S9 I2 L {, Y5 v# v1 l1 W, }8 Q( M/ N
try
, y9 {! {9 W! a7 V {0 C: |) C9 }5 l2 P! d! s
//---- Enter your callback code here -----
$ G. b) ^/ `% C }- i& C! `8 W! D. ^' U' y; L
catch(exception& ex)
/ c3 l& u' i' \3 } {
) B. ^. p* B7 \& `' ^ //---- Enter your exception handling code here -----
U$ y1 G- h; G9 t6 J1 t Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());2 ]" N: t$ N2 T- M" c
}7 z$ R/ t: n. ]$ N; o9 \, J k/ H
}
* n! ?& r& Z( \6 o& q#endif//USER_EXIT: I, F/ ^. `; Y( ~
' p7 S, [$ u; }( V& d int Shrinkage::Show()
0 B: g/ E" L; x6 z+ M1 z# T {
8 t. ^: g6 E7 [- J: z; L, @ try
5 F7 m/ W. f }; R V% f9 S0 ? {
/ _+ y; L6 n6 @6 ^+ S' k$ y! P theDialog->Show();1 O& c+ l. c- N( j. K
}4 H, i2 m) l0 v: I; e' |% `
catch(exception& ex)1 S: U8 ?# [4 d9 {5 ]* A1 f
{' J0 E5 s! _" f* r/ R
//---- Enter your exception handling code here -----
3 i+ Z$ N& X/ g# E! q Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
& \( ]' w3 q1 D% c/ }( Y/ f }
3 r Z1 X m( X1 v3 R return 0;
, y* {! Q, Z9 O9 W% d }% }- K% m* M# M3 @6 H- i& G
9 Y! J2 o4 F2 E5 I0 @) i#if CALLBACK: T; I0 k0 L% E- f, W0 n5 F. v
: O1 b, u3 K9 y. \% @ void Shrinkage::Show_Shrinkage()
) @' R) ^+ e* f6 X' b {; B X& S( Y$ I+ i
try* j; \: A6 u9 D7 r
{( E, [0 o1 t# ?
theShrinkage = new Shrinkage();( G' U1 q4 g w0 f: O
' x/ V# M9 [# q3 G! { theShrinkage->Show();
: h( W5 e% A0 b: w1 h: y: K6 n5 t } W- e" A9 f( X1 c% X
catch(exception& ex)7 S! s- \4 k' Y/ \. T3 | Z, x" V
{
$ O O% [" u0 v2 Z- P( l- G% L8 |! j8 i9 g5 T- N
Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());0 ~1 `3 }9 w9 e8 t3 y B) R
}
; E5 s. a& [$ O; g( {- e delete theShrinkage;, Z* ^. G3 ?* V- Z9 d. H" a$ Q
}2 p6 G( K; P* C/ s( Z2 j
#endif//CALLBACK
4 E# ?' `' U7 L5 { Q- t, e
& @" i3 J8 M4 e4 ^8 _ void Shrinkage::initialize_cb()+ H6 a9 [: P$ Y- V2 ]
{2 _; I) B2 U1 [# F) d% H& f0 o u$ [
try
1 P; i! m2 W5 }+ v2 { {# E* ]8 X% C* s9 A
group0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group0"));/ X4 r9 b8 W: P- I: t) {
face_select0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select0"));& L% r5 R2 Z7 o1 f
face_select01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("face_select01"));% N' g, }9 |( L7 W7 p* x" K
group01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group01"));* N7 A# M' w4 ]- J' W
bodySelect0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect0"));
, j% m2 I0 B9 D5 b bodySelect01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("bodySelect01"));/ p8 y- G( D8 h- d* v5 E: n+ e: `
group = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("group"));
- a+ s' W, h( |# S. v0 Z string0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string0"));
0 b; Y& o" H/ Z3 m5 \8 | label0 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label0"));+ S& q9 P" j! ~+ w h# W- I( l7 Z
string01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("string01"));
' W0 i% i( W" X6 A) P$ n; a) q label01 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label01"));0 v3 [) z; ]: r" S
label02 = dynamic_cast<NXOpen::BlockStyler::UIBlock* >(theDialog->TopBlock()->FindBlock("label02"));# e! X+ y5 C8 w. I0 m4 L* \
}
4 s7 o; l0 `/ h7 N. p catch(exception& ex)
* A' P1 X: {6 p6 o+ b {1 d/ Z( E6 ]: D* b F k
! M) w% {# f& c |! G! c Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());. x8 A4 S7 [" ?6 u
}
0 B# N6 T# L' s! e }6 e6 a0 \! m% g1 i& T
//------------------------------------------------------------------------------
$ j& o% Z- @1 R4 e: Y void Shrinkage::dialogShown_cb()
( `( x3 @; x$ A5 ?6 u8 ~8 J {
. D8 ~0 @% e' L( s) g( B try. v5 {) \: r# x4 _4 T
{) j$ y- I7 R4 n. z9 p. V/ H, z
//---- Enter your callback code here -----$ O; {" Y% Y' ~) N6 H/ m! p
}" w/ [! i1 w9 [6 a! @9 Z
catch(exception& ex)
8 v \3 O' w1 G3 b3 {" G$ m9 p { d0 w( f. z2 N
0 k) E1 X! e( A$ } n& j Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());) S8 N b1 g' O% Q, i
}
$ W: J [7 _; H5 f& z( s }9 P7 I5 Q. a& }* |; Z7 V4 k
5 o* j0 S; ?3 K3 q: v int Shrinkage::apply_cb()
* P. w: z) S3 v* v7 i {
9 n! Z0 k3 I5 P" d; Q4 U8 `9 c int errorCode = 0;/ Y- f, @* k3 u o1 I
try. h/ t; J/ ~8 X: p
{5 t5 m. ^( Z) r7 F; i: p* A7 t6 P2 W
//---- Enter your callback code here -----
4 y7 b# ^- x2 C3 f }
" @; K& G1 h k3 u) X/ `' H catch(exception& ex)
1 G" N7 d5 t. w% W/ ^! b. ^ {, u+ k1 i+ _# J, x, `
//---- Enter your exception handling code here -----
5 n7 n5 ]- b0 R, M: T* q errorCode = 1;
8 [9 G; s5 G! G( Z Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());
2 T# C ^5 u- p }
. O5 ] z' v4 `! | X7 C% O return errorCode;4 O! \$ R) V3 `+ X5 |. v" _
}
6 S( e# `2 Z4 G1 t% {2 A# f8 R! G- H1 D/ v1 ?; M6 d
int Shrinkage::update_cb(NXOpen::BlockStyler::UIBlock* block)
7 D6 v! E3 N" ^$ y( z3 g0 }9 ] {
- b2 t, m: R% S h+ ?" t try
' k) H5 E# E9 x1 h5 z2 D {% K5 M" F1 h6 u
if(block == face_select0)
?7 B; p% m3 M( r2 K) Z {
: W# Q5 D% N* o6 i8 q1 K //---------Enter your code here-----------
$ s$ _2 y3 [4 g7 c; R; f }
( {/ [! B2 ` h) j; ~ else if(block == face_select01)
$ N3 a9 ` P0 l; G {
' z% O8 s9 Y6 F6 q% n4 N( m& A1 k //---------Enter your code here-----------. w3 h1 r) z3 @' @. e
}
/ T" \# r0 k C else if(block == bodySelect0)6 ~7 {% \, R, V- d: }# v1 @
{4 g0 M( @/ b( x0 J9 F$ q) ^
//---------Enter your code here-----------
4 Q( y4 ]7 Y" u" y7 J/ @5 Q }5 k! l2 z9 C" J; m( w
else if(block == bodySelect01)
) j. H& ~1 X% m# M {
3 s5 X8 ?+ q# \1 u$ l2 j& o" j# h //---------Enter your code here-----------5 P6 N' j, `: `9 v
}0 ^' I5 v3 b( X
else if(block == string0)$ Z7 E' D# Q, @0 J2 O$ x
{
: G# O) {" t d) z- r: z; r+ l! R //---------Enter your code here-----------8 [: K# L9 e0 Y0 {
}
; D1 \% a* f( Z; ?8 l, W else if(block == label0)0 z& f# W% m* u/ P3 C! s
{
+ }; |- e4 Z$ b( R8 q v0 ` //---------Enter your code here-----------) U+ {+ I5 b0 A9 t
}6 T+ u; \+ G# A t7 L6 f
else if(block == string01)' U- j9 p" T( C6 r2 z$ T- t
{% @; t1 w. A' b# n4 s
//---------Enter your code here-----------8 @4 V% E- ~. b& ^9 P% e
}
) Q8 Z- H9 U0 k2 Y6 d else if(block == label01)
8 j6 E. e X9 B {
) w7 t# N6 K5 L: H //---------Enter your code here-----------/ A# ]+ e! ?+ P6 f9 V$ \
}
$ g; n" d* V, G. X% d else if(block == label02)1 i/ y" z& K$ x
{' q5 J3 A, x9 J3 z8 W& d G
//---------Enter your code here-----------
9 B( X/ A( U- V) e9 ?1 K+ o1 I }4 [$ J) j; `- E. z+ d3 t
}
/ e6 F: Q# k8 p2 L catch(exception& ex)2 R& n- M9 O+ t
{
. \- ^5 p: Z# |# r% T4 @ Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());9 _/ u( q% `4 {5 O4 d u3 Y1 b
}
1 C8 ?, d9 x1 V: \- y) D return 0;
3 a$ y- ]6 ? }" t6 |* x/ ] }
$ E# \8 P& f" c
2 l' d0 R" v, q, l# u2 J6 s9 m int Shrinkage: k_cb()
0 R9 ]) U3 J+ D! A: ` {
0 i- k2 L) Q: [! o. `& U. J int errorCode = 0;
3 {( J X w6 u$ [6 \, x7 J try
" X+ F/ A. q! M) H" c9 ~ {
* o1 d* ?2 p* |; ?2 w errorCode = apply_cb();. b: d( u, Y! g, C! ]( e+ J+ W
}9 `6 L4 B4 T, @: O- ~& X7 h
catch(exception& ex)) a' d. q9 O( c, U! B- U$ S) ?
{
r0 ]( j" I; m+ Z //---- Enter your exception handling code here -----
1 s1 C2 M( r4 L* f! g errorCode = 1;
( Y6 B; i% L U1 Y Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());# M% H6 H9 H8 L1 Q \2 u/ Y# m" r+ j
}
Y- `3 r& j: @& M7 v& i return errorCode;0 m% h/ i ^1 S) m, V# f% p
}
" d/ V D/ D& H/ b) P x8 d
/ ]0 N6 n, ^& I- G6 g, D5 E6 {. z //------------------------------------------------------------------------------( y: a1 p5 N/ T9 d$ g" w, S" U
//Callback Name: filter_cb% E% |8 X$ ^% k; j+ H- m
//------------------------------------------------------------------------------6 U- Q% W4 q8 T
int Shrinkage::filter_cb(NXOpen::BlockStyler::UIBlock* block, NXOpen::TaggedObject* selectObject)/ N) E' V: w8 ?# j" i( n
{
7 X; V$ f! s2 K8 ~ return(UF_UI_SEL_ACCEPT);, ?$ e& x: r$ ^! e2 ~7 M1 O8 h& U4 {
}
9 }4 w0 R7 m( Q ]; r* y" r e# w 6 h* v$ w, F7 h$ v
//------------------------------------------------------------------------------
5 M/ P: D; a8 N" J2 G: M void Shrinkage::focusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)6 N8 M+ w( W$ {# K4 g
{& p- `$ Z" b. v: V7 h. q
try
7 H, i k$ k! |4 P; D; } {
. U, e, v) p p7 E0 ?) {# a# _' y //---- Enter your callback code here -----
& P6 B" `) a: b( h! k5 J/ N, k }
| L) y2 Y* Z. R, {+ ^3 e2 f! i catch(exception& ex)( g+ _4 S3 u% k/ i% ~
{
. U6 [ w7 T1 S/ X b R, a0 q' X+ \3 z. m //---- Enter your exception handling code here -----
1 c7 [( H y, r/ @0 j7 Z Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox: ialogTypeError, ex.what());/ q6 ]/ l" O- N
}
8 r# ^5 i2 @: r }
/ s& D; c# r% X5 k0 P0 b& U
3 q# r o: `5 A1 ` //------------------------------------------------------------------------------
0 A5 ? F! V2 f void Shrinkage::keyboardFocusNotify_cb(NXOpen::BlockStyler::UIBlock* block, bool focus)
- V# B; }$ M4 a2 O {
9 r( T2 q3 U* M+ x0 S try. C5 F* p7 Z2 r+ ]) N4 d4 n
{& F# q1 y2 L. z
//---- Enter your callback code here -----
& @2 E) p7 I( N3 h9 T } v" k( ~6 p6 _2 X8 k' B! F
catch(exception& ex)
( J- C0 z. K. q6 Q. n" f {% [/ O8 L" I" J; D2 Y, ~# y4 J J
+ p8 F& l: {8 B2 Y$ r7 F4 Q& f Shrinkage::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
% O" Z, [. X2 @" D- A9 Q }& X' x E9 r6 f5 |
}
/ U# o( k" L' o6 g: Y2 A& ^; g; P3 D( k4 F
+ n# |, Z6 \# p& q. g
|
|