iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 19461|回复: 1
打印 上一主题 下一主题

[技术交流] 关于UG实体着色问题,有源代码

[复制链接]
跳转到指定楼层
楼主
发表于 2014-10-23 00:20:30 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

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);
}

先面着色.jpg (40.42 KB, 下载次数: 36)

先面着色.jpg

执行这段代码后.jpg (33.3 KB, 下载次数: 36)

执行这段代码后.jpg
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 支持支持
沙发
发表于 2014-11-1 14:56:10 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

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

本版积分规则

手板模型制作,在线3D打印服务

QQ|小黑屋|手机版|开思工具箱 CAD工具箱_CAM工具箱  

GMT+8, 2024-4-25 15:07 , Processed in 0.021448 second(s), 8 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

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