QQ登录

只需一步,快速开始

快捷登录

登录 或者 注册 请先

UG爱好者

查看: 1104|回复: 2

[求助] 中心线,代码错了,下面那个代码是对了,改不了线型,只有TAG**,找不到他的TAG不会怎么..

[复制链接]

列兵

Rank: 1

1

主题

8

帖子

40

积分
发表于 2021-10-26 19:20:03 | 显示全部楼层 |阅读模式

//错误代码从这里开始,
void TT_CREATE_CenterLine_TOOL::dosthCLASS_cb()
{
UF_initialize();
std::vector<TaggedObject *>theselectCLASSPros=selectionCLASS->GetProperties()->GetTaggedObjectVector("SelectedObjects");
tag_t classTAG=selectionCLASS->Tag();
if (enumCLASS->GetProperties()->GetEnum("Value")==0)
{  
   if (enumFACE->GetProperties()->GetEnum("Value")==0)
   {   
    tag_t classTAG=theselectCLASSPros[0]->Tag();   
    double bounding_Box[6];
    UF_MODL_ask_bounding_box( theselectCLASSPros[0]->Tag(), bounding_Box);
    double x = (bounding_Box[3] + bounding_Box[0])/2;
    double y = (bounding_Box[4] + bounding_Box[1])/2;
    double z = (bounding_Box[5] + bounding_Box[2])/2;
    double uv_min_max[4];
    UF_MODL_ask_face_uv_minmax(classTAG, uv_min_max);
    double parameter[2];         
  /*  double ref_pnt[3]={x,y,z};
    double face_pnt[3];   
    UF_MODL_ask_face_parm(classTAG,ref_pnt,parameter,face_pnt);  */
    double point1[3];
    double U1[3];   
    double V1[3];   
    double U2[3];   
    double V2[3];   
    double unit_norm[3];
    double radii[2];
    UF_MODL_ask_face_props (classTAG,parameter,point1,U1,V1,U2,V2,unit_norm,radii);   
    UF_CURVE_line_t Line_coords1[2];
    Line_coords1[0].start_point[0] =x+(U2[0]+U1[0])/2;
    Line_coords1[0].start_point[1] =y+(U2[1]+U1[1])/2;
    Line_coords1[0].start_point[2] =z+(U2[2]+U1[2])/2;
    Line_coords1[0].end_point[0] =x-(U2[0]+U1[0])/2;
    Line_coords1[0].end_point[1] =y-(U2[1]+U1[1])/2;
    Line_coords1[0].end_point[2] =z-(U2[2]+U1[2])/2;
    Line_coords1[1].start_point[0] =x+(V2[0]+V1[0])/2;
    Line_coords1[1].start_point[1] =y+(V2[1]+V1[1])/2;
    Line_coords1[1].start_point[2] =z+(V2[2]+V1[2])/2;
    Line_coords1[1].end_point[0] = x-(V2[0]+V1[0])/2;
    Line_coords1[1].end_point[1] = y-(V2[1]+V1[1])/2;
    Line_coords1[1].end_point[2] =z-(V2[2]+V1[2])/2;
    tag_t Line1[2];
    UF_CURVE_create_line(&Line_coords1[0], &Line1[0]);
    UF_CURVE_create_line(&Line_coords1[1], &Line1[1]);
这个做出来太长了,中心和线是对的,哪里出错了
另一个用等参数做的,找不到Tag,只有tag**,代码是对的,找不到TAG来改线型
tag_t classTAG=theselectCLASSPros[0]->Tag();
   int face_type = 0;
   UF_MODL_ask_face_type(classTAG,&face_type);   
   //分析曲面的u,v参数最大值和最小值
   double uv_min_max[4];
   UF_MODL_ask_face_uv_minmax(classTAG, uv_min_max);
   //在面上创建等参数曲线
   int uv_flag[2];
   uv_flag[0]=1;
   uv_flag[1]=2;
   double parameter[2];
   parameter[0] = (uv_min_max[1] + uv_min_max[0])/2;
   parameter[1] = (uv_min_max[3] + uv_min_max[2])/2;  
   double dist_tol = 0.01;   
   tag_t* isocurve_id[2];   
   int isocurve_cnt = 0;  
   if (enumFACE->GetProperties()->GetEnum("Value")==1)
   {   
    UF_MODL_create_isocurve(classTAG, uv_flag[0], parameter[0], dist_tol, &isocurve_id[0], &isocurve_cnt);
    UF_MODL_create_isocurve(classTAG, uv_flag[1], parameter[1], dist_tol, &isocurve_id[1], &isocurve_cnt);   
   }
   else if (enumFACE->GetProperties()->GetEnum("Value")==2)
   {   
    UF_MODL_create_isocurve(classTAG, uv_flag[0], parameter[0], dist_tol, &isocurve_id[0], &isocurve_cnt);
   }
   else
   {   
    UF_MODL_create_isocurve(classTAG, uv_flag[1], parameter[1], dist_tol, &isocurve_id[1], &isocurve_cnt);   
   }
   }   
_model1.png

有奖推广贴子: 

回复

使用道具 举报

少将

相互学习,共同进步!~

Rank: 8Rank: 8

22

主题

1545

帖子

1万

积分

论坛元老

发表于 2021-10-27 08:10:44 | 显示全部楼层

回帖奖励 +30

帮你顶,坐等高手解答
●~    ●~    ……
         ●~   ●~   ●~ ……
回复 支持 反对

使用道具 举报

中尉

Rank: 5Rank: 5

11

主题

505

帖子

4644

积分
发表于 2021-10-27 09:37:57 | 显示全部楼层
顶一下,虽然与我无关
回复 支持 反对

使用道具 举报

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

本版积分规则

 
 
QQ:1359218528
工作时间:
9:00-17:00
 
微信公众号
手机APP
机械社区
微信小程序

手机版|UG爱好者论坛 ( 京ICP备10217105号-2 )    论坛管理员QQ:1359218528

本站信息均由会员发表,不代表本网站立场,如侵犯了您的权利请联系管理员,邮箱:1359218528@qq.com  

Powered by UG爱好者 X3.2  © 2001-2014 Comsenz Inc. GMT+8, 2024-3-28 18:00

返回顶部