|
马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
UG实体着色疑问
这段代码是实体着色, 当我先对实体进行了面着色后,再进行体着色时,却不能改变面得颜色
#include <stdio.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_object_types.h>
#include <uf_disp.h>
#include <uf_modl.h>
#include <uf_obj.h>
static int init_proc(UF_UI_selection_p_t select,
void *user_data);
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int report( char *file, int line, char *call, int irc)
{
if (irc)
{
char messg[133];
printf("%s, line %d: %s\n", file, line, call);
(UF_get_fail_message(irc, messg)) ?
printf(" returned a %d\n", irc) :
printf(" returned error %d: %s\n", irc, messg);
}
return(irc);
}
static void do_ugopen_api(void)
{
char cue[] = "选择对象";
char title[] = "对象选择对话框";
int response=0;
tag_p_t object;
int count=0;
int i=0;
double pt[3]={0,0,0};
double z1[3]={0,0,1};
UF_OBJ_translucency_t cyt=0;
UF_UI_select_with_class_dialog(cue,title,0, init_proc, NULL,&response,&count, &object);
if (response == UF_UI_OK&&count>0){
for(i=0;i<count;i++){
UF_OBJ_set_color(object,186);
UF_DISP_set_highlight(object,0);//取消对象的高亮显示
UF_OBJ_set_translucency(object,cyt); //设置透明度
}
}
}
static int init_proc(
UF_UI_selection_p_t select,
void* user_data)
{
int num_triples = 1;
UF_UI_mask_t mask_triples[] = {UF_solid_type ,0,0,};//过滤对象选择
if((UF_CALL(UF_UI_set_sel_mask(select,
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,
num_triples, mask_triples))) == 0)
{
return (UF_UI_SEL_SUCCESS);
}
else
{
return (UF_UI_SEL_FAILURE);
}
}
void ufusr(char *param, int *reTCode, int param_len)
{
if (!UF_CALL(UF_initialize()))
{
do_ugopen_api();
UF_CALL(UF_terminate());
}
}
int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
} |
|
|