青华模具培训学校

 找回密码
 注册

QQ登录

只需一步,快速开始

青华模具培训学院
查看: 2182|回复: 1

[疑难] 求教,我做的参数化表达式的编程出问题.

[复制链接]
发表于 2010-11-12 16:04 | 显示全部楼层 |阅读模式
int ROLL_constructor ( int dialog_id,
6 |. r1 P( @1 K4 G. t% M1 S+ K             void * client_data,1 R0 f- R. n( E$ u
             UF_STYLER_item_value_type_p_t callback_data)6 L1 W1 m6 _4 K. G! w- @
{
$ b0 m4 y7 O) l, O, s) P* s' N- m     /* Make sure User Function is available. */  
/ D6 r9 }! o& j# H: _5 O      char dir[100];                                             ) X, }0 K; f8 |8 Q) ~3 I0 n* U
    const char env[155]="ugII_USER_DIR";# [" ^; H5 H& f' l2 |3 W
char *basedir=NULL;4 U% x+ c4 Q$ ?- Y* }
tag_t part;( a( l. e' C7 ~% g' P1 E* s1 u; C- U8 u
UF_PART_load_status_t error_status;" |' z$ Z5 U# Z/ b, `' X( A
basedir=getenv(env);1 `* {0 l" K( l( H8 A
   ! B: l! W) j" e* Q# }1 @5 o! g% O
strcpy(dir,basedir);' d8 Z: c: b, _8 f: e
strcat(dir,"\\roll\\J-J 2D.prt");
* b: ]3 \9 m. w if(UF_PART_open(dir,&part,&error_status)!=0)' S) ?# p# G& j, F
{0 t8 w0 R) K8 z0 C$ n
  UF_free_string_array(error_status.n_parts,error_status.file_names);. p8 M+ b0 _$ t& y2 I
     UF_free(error_status.statuses);
* r8 z% `; \8 K; p4 D' @& A" p% \  return(UF_UI_CB_CONTINUE_DIALOG);
) e  T: K7 a; y4 H( y }& s! E9 e7 F! F- j. t/ _2 K
    UF_free_string_array(error_status.n_parts,error_status.file_names);
5 Y& \  z7 k. A0 Z$ E4 z. ~) I8 } UF_free(error_status.statuses);0 I/ N% x: P. |0 o
double arExpValue[2];
8 @. x; W/ w8 I' E/ q9 J- H UF_MODL_eval_exp("threeJ_a",&arExpValue[0]);$ J3 V$ D: k, g6 G* w
UF_MODL_eval_exp("threeJ_b",&arExpValue[1]);  ]; F+ |* T% y% x3 }( [
" f" G+ j7 o9 k; o
UF_STYLER_item_value_type_t data_set;
! W+ p: w+ G  j" H    data_set.item_attr=UF_STYLER_VALUE;
, |7 k$ l- E1 ]/ h* ?9 ^    data_set.item_id=ROLL_A;                 (此处报错)            
. T' z& b& A  y3 ?, F data_set.value.real=arExpValue[0];
$ U( L! ^0 e& C6 Z! X' I UF_STYLER_set_value(dialog_id,&data_set);
5 f' h; P( u* t  J( C5 D* H    UF_STYLER_free_value(&data_set);
; Q6 b- K/ Y8 ~2 l  j9 j data_set.item_attr=UF_STYLER_VALUE;
: I! }4 J( K) L# ]; m5 B    data_set.item_id=ROLL_B;                 (此处报错)      
8 d( y; E8 L; T data_set.value.real=arExpValue[1];* i) W* i9 `/ k- L
UF_STYLER_set_value(dialog_id,&data_set);3 R4 q: R/ b$ ~3 a& G: m& U9 k+ T
UF_STYLER_free_value(&data_set);
8 w: o8 k7 @) i3 A$ w6 T0 A     UF_terminate ();- F3 u! s: Z, [; X6 j
    /* Callback acknowledged, do not terminate dialog */0 r* r7 Y' U9 y! q$ w; O
    return (UF_UI_CB_CONTINUE_DIALOG); 2 G& p+ c% ~5 a# _& d/ q
    /* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted    */3 u, w& E# L& t- j
    /* for this callback type.  You must continue dialog construction.*/
+ A$ {  V7 R6 n5 F( a. @' \}9 y) t2 H# C9 r' C" k0 S
; N# F$ `3 p5 D3 _' Z

+ h% B+ @# X, t1 m- W报错如下:
* g" ?; y, }  x" O) r5 D9 GE:\roll\roll\threeJ.cpp(438) : error C2065: 'ROLL_A' : undeclared identifier
: m% K1 M- h  m9 b$ tE:\roll\roll\threeJ.cpp(438) : error C2440: '=' : cannot convert from 'int' to 'const char *'7 @! z4 y3 X; v* {
        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
6 @/ O, F2 D7 d  t) PE:\roll\roll\threeJ.cpp(444) : error C2065: 'ROLL_B' : undeclared identifier
" g& i6 u. O& O: iE:\roll\roll\threeJ.cpp(444) : error C2440: '=' : cannot convert from 'int' to 'const char *'4 F  |( x! i4 q6 u* g/ B: g  k/ I! N
        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
, u8 m& U' t0 U; _- k其中 ROLL 是文件夹名称+ r8 ?! e4 c+ `; D
J-J 2D.prt  是部件名
7 V) O/ R+ `/ c( d( tthreeJ_a
9 L* k# \3 ]5 A- A, {5 D) DthreeJ_b* u- t3 f" ^, @* R, n' g% [( A
是表达式的两个名称
+ f: i+ J) f3 k! ]$ b
4 d5 x! f! g+ b! jROLL_A
5 g$ @$ J8 U1 P; q2 ^4 AROLL_B
. |7 o  i# Z2 f- LA和B是UISTYLE的标识符8 Y8 F$ o" j* A- f) r7 F
5 j8 L8 z9 H8 I% t6 e3 d5 Z
请教,我这是一个初级的二次开发表达式,我只要定义两个参数化变量,请问我这里的constructor哪里出错?
6 _2 d( U0 ~5 z% Q6 ?, g2 T, P; @, w8 `我这也是参考一个例子编的,它的是五个变量。。
& `5 g2 D: e) `0 y/ c9 w6 |- m7 f/ h( C0 U8 o, z
请各位高手能帮我解决这个问题,感激不尽!
头像被屏蔽
发表于 2010-11-18 03:11 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 1 反对 0

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|关于我们|sitemap|小黑屋|Archiver|手机版|UG网-UG技术论坛-青华数控模具培训学校 ( 粤ICP备15108561号 )

GMT+8, 2025-9-18 08:06 , Processed in 0.225927 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表