iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 24781|回复: 9
打印 上一主题 下一主题

再问曲面面积:现在有了函数,可为什么得不到我要的结果呢?

[复制链接]
跳转到指定楼层
楼主
发表于 2005-6-2 11:12:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
以前连求曲面面积的函数都不知道,现在知道了,是UF_MODL_ask_mass_props_3d,看了那个例子后可以求一个实体的面积了,但是我想求曲面得面积,可怎么也做不到,问题到底出在哪里呢?请求高手指教,下面是我在例子的基础上写的程序,只做了一点点改动,但是结果却出现巨大差异。
extern "C" DllExport void ufusr( char *parm, int *returnCode, int rlen )
{int irc = 0;
char *message = "Select Object";
UF_UI_selection_options_t opts;
UF_UI_mask_t mask;
int response;
  
tag_t *object;
  
int unhighlight=0;
char buffer[133];
char error[133];
    /* Initialize the API environment */
    int errorCode = UF_initialize();
  
    if ( 0 == errorCode )
    {
        /* TODO: Add your application code here */
opts.other_options = 0;
opts.reserved = NULL;
opts.num_mask_triples = 1;
opts.mask_triples = [$mask]
/* set up selectable type, subtype, solid type */
opts.mask_triples->object_type = UF_solid_type;
opts.mask_triples->object_subtype = UF_solid_face_subtype;
opts.mask_triples->solid_type = UF_UI_SEL_FEATURE_ANY_FACE;
/* set selection scope to be work part */
opts.scope = UF_UI_SEL_SCOPE_WORK_PART;
  
  int type = 2;
  int  unit = 3;
  int accuracy =  1;
  int  count = 0;
  
  int  i;
  double  acc_val[11] = {1,0,0,0,0,0,0,0,0,0,0};
  double  density = 1.0;
  double  massprop[47];
  double  massprop_stat[13];
  
irc = UF_UI_select_by_class(message,&opts,&response,
                                    [$count,&object)]
  
/* if no error, print information about selected object */
if (!irc)
{UF_UI_open_listing_window();
sprintf(buffer,"response= %d, object tag= %d", response, object);
  UF_UI_write_listing_window(buffer);
UF_MODL_ask_mass_props_3d(object,
                                       count,
                                       type,
                                       unit,
                                       density,
                                       accuracy,
                                       acc_val,
                                       massprop,
                                       massprop_stat);
  
for (i=0; i<47; i++)
     {
       sprintf(buffer,"[%d] = %f\n",i,massprop);
     UF_UI_write_listing_window(buffer);
}
    
for(i=0;i<count;i++)
  /* unhighlight selected object */
{UF_DISP_set_highlight(object,unhighlight);  
}
UF_free(object);
}
else  /* else get error message */
{
  UF_get_fail_message(irc,error);
  sprintf(buffer,"ERROR: %s\n",error);
UF_UI_write_listing_window(buffer);
}
  
        /* Terminate the API environment */
        errorCode = UF_terminate();
    }
但是如果把opts.mask_triples->object_type = UF_solid_type;
opts.mask_triples->object_subtype = UF_solid_face_subtype;
opts.mask_triples->solid_type = UF_UI_SEL_FEATURE_ANY_FACE;进行一下变动就可以求实体的面积了
opts.mask_triples->object_type = UF_solid_type;
opts.mask_triples->object_subtype = 0;
opts.mask_triples->solid_type = UF_UI_SEL_FEATURE_BODY;
比较罗索,但是还是邀请高手们帮忙看一下,自己实在不知道怎么去改才可以。我的目的只想求某一个曲面得面积,而非实体的。先谢谢了!
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 支持支持
沙发
发表于 2005-6-2 15:26:11 | 只看该作者

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

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

x
板凳
 楼主| 发表于 2005-6-2 17:54:24 | 只看该作者

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

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

x
地板
 楼主| 发表于 2005-6-4 08:45:11 | 只看该作者

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

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

x
5
发表于 2005-6-4 09:49:22 | 只看该作者

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

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

x
6
 楼主| 发表于 2005-6-4 20:11:16 | 只看该作者

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

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

x
7
发表于 2005-6-5 17:08:43 | 只看该作者

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

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

x
8
发表于 2005-6-22 18:40:05 | 只看该作者

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

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

x
9
 楼主| 发表于 2005-6-22 21:54:27 | 只看该作者

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

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

x
10
发表于 2005-6-23 16:45:27 | 只看该作者

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

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

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

本版积分规则

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

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

GMT+8, 2024-9-28 02:13 , Processed in 0.026136 second(s), 7 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

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