iCAx开思工具箱

标题: 【求助】已知Feature的Tag如何对其进行颜色设置? [打印本页]

作者: jambo436    时间: 2004-12-13 10:01
标题: 【求助】已知Feature的Tag如何对其进行颜色设置?
已知Feature的Tag如何对其进行颜色设置?
下面是我的代码,
先生成两个小球,
然后将第一小球的颜色改变.
程序实现时出现如图所示错误,颜色改变不成功,
请指教,谢谢
//////////////////////////////////////////////////////////
/////////112上午Jambo  小球 START
UF_FEATURE_SIGN sign_sphere=UF_NULLSIGN;  
tag_t sphere_tag[10];  
double number=100;  
char diam[15];  
sprintf(diam,"%f",number);  
  
double center_1[3]={-799,0,50};   
UF_MODL_create_sphere1(sign_sphere, center_1,diam, [$sphere_tag[1] )]  
  
double center_r1[3]={-799,850,50};   
UF_MODL_create_sphere1(sign_sphere, center_r1,diam, [$sphere_tag[2])]  
/////////112上午Jambo  小球 END
//////////////////////////////////////////////////////////
  
//////////////////////////////////////////////////////////
/////////112上午Jambo  改变第一个小球的颜色 START
int * n_eids;  
tag_t ** eids;  
int a=UF_MODL_ask_feat_object (sphere_tag[1],  
n_eids,  
eids );
  
int color=200;
UF_OBJ_set_color (**eids,  
color );
UF_free(eids);
  
char message[133];
UF_get_fail_message(a,message);
uc1601(message,1);
/////////112上午Jambo  获取输出信息 END
//////////////////////////////////////////////////////////
作者: 深夜摔键盘    时间: 2004-12-14 10:53
feature没有颜色属性吧。
点,线,面这些几何对象有颜色。
试试UF_MODL_ask_feat_body,从 feature tag得到body tag
作者: landgrave    时间: 2004-12-15 08:48
问题出在使用UF_MODL_ask_feat_object()得到的是Object的Tag号的数组,在UF_OBJ_set_color()里,不能直接对数组名设置颜色,应该是*eid[];
如键盘兄所说,用UF_MODL_ask_feat_body()也是很好的解决方法!
作者: jambo436    时间: 2004-12-15 16:34
是不是如下修改,
可是修改过后还是有同样的错误
//////////////////////////////////////////////////////////
/////////112上午Jambo  小球 START
UF_FEATURE_SIGN sign_sphere=UF_NULLSIGN;  
tag_t sphere_tag[10];  
double number=100;  
char diam[15];  
sprintf(diam,"%f",number);  
  
double center_1[3]={-799,0,50};   
UF_MODL_create_sphere1(sign_sphere, center_1,diam, [$sphere_tag[1] )]  
  
double center_r1[3]={-799,850,50};   
UF_MODL_create_sphere1(sign_sphere, center_r1,diam, [$sphere_tag[2])]  
/////////112上午Jambo  小球 END
//////////////////////////////////////////////////////////
  
//////////////////////////////////////////////////////////
/////////115上午Jambo  START
tag_t * body_obj_id;
int a=UF_MODL_ask_feat_body (sphere_tag[1],  
body_obj_id);
/////////115上午Jambo   END
  
int color=200;
UF_OBJ_set_color (*body_obj_id,  
color );
  
char message[133];
UF_get_fail_message(a,message);
uc1601(message,1);
/////////112上午Jambo  获取输出信息 END
//////////////////////////////////////////////////////////
作者: hmjjh    时间: 2004-12-16 20:40
extern DllExport void ufusr( char *parm, int *returnCode, int rlen )
{
UF_FEATURE_SIGN sign_sphere=UF_NULLSIGN;  
tag_t sphere_tag[2];  
char *diam = "20";  
double center_1[3]={0,0,50};  
double center_r1[3]={0,100,50};  
tag_t body_obj_id;  
int color=200;
    /* Initialize the API environment */
    int errorCode = UF_initialize();
  
    if ( 0 == errorCode )
    {
        /* TODO: Add your application code here */
    UF_MODL_create_sphere1(sign_sphere, center_1,diam, [$sphere_tag[0])]      
    UF_MODL_create_sphere1(sign_sphere, center_r1,diam, [$sphere_tag[1])]
    
    UF_MODL_ask_feat_body (sphere_tag[0], [$body_obj_id)]  
      
    UF_OBJ_set_color (body_obj_id, color );  
  
    
        /* Terminate the API environment */
        errorCode = UF_terminate();
    }
  
    /* Print out any error messages */
   &nbsprintErrorMessage( errorCode );
}




欢迎光临 iCAx开思工具箱 (https://t.icax.org/) Powered by Discuz! X3.3