iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 26028|回复: 18
打印 上一主题 下一主题

再没有人看要死人了!!!!!

[复制链接]
跳转到指定楼层
楼主
发表于 2005-4-13 21:23:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
int ZB_action_peihe_cb ( int dialog_id,
              void * client_data,
              UF_STYLER_item_value_type_p_t callback_data)
{
      /* Make sure User Function is available. */   
      if ( UF_initialize() != 0)  
           return ( UF_UI_CB_CONTINUE_DIALOG );
  
      /* ---- Enter your callback code here ----- */
  
     //选择两个平面
     int errorCode;
     char message[133];
     message[0]='\0';
     strcpy(message,"请选择第一个平面");
     UF_UI_selection_options_t opts;
     UF_UI_mask_t mask;
     int response;
     tag_t view;
     double cursor[3];
     int unhighlight=0;
  
     opts.other_options=0;
     opts.reserved=NULL;
     opts.num_mask_triples=1;
     opts.mask_triples=[$mask]
     opts.mask_triples->object_type=UF_face_type;
     opts.mask_triples->object_subtype=UF_bounded_plane_subtype;
     opts.mask_triples->solid_type=UF_UI_SEL_FEATURE_ANY_FACE;
     opts.scope=UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY;
  
     int type;
     double point[3];
     double dir[3],box[6],radius,rad_data;
     int norm_dir;
     tag_t first_plan;
     do
     {
       int irc=UF_UI_select_single(message,
         [$opts,&response,&first_plan,cursor,&view)]
        
       UF_MODL_ask_face_data(first_plan,&type,point,dir,
         box,[$radius,&rad_data,&norm_dir)]
       if(type!=22)
       {
         uc1601("请选择一个平面",1);
         UF_DISP_set_highlight(first_plan,0);
       }
     }
     while(!(type==22 [$&response==5))]
     if(response!=5)
     {
       uc1601("没有选择平面",1);
       UF_terminate();
     }
     int ret;
     tag_t from_part_occ;
     ret=UF_ASSEM_ask_parent_component(first_plan,[$from_part_occ)]
     logical is_occ=UF_ASSEM_is_occurrence(from_part_occ);
     tag_t from_part_ins=UF_ASSEM_ask_inst_of_part_occ(from_part_occ);
     char part_name[133];
     char refset_name[31];
     char instance_name[31];
     double origin[3];
     double csys_matrix[9];
     double transform[4][4];
     ret=UF_ASSEM_ask_component_data(from_part_occ,part_name,
       refset_name,instance_name,origin,csys_matrix,transform);
     uc1601(instance_name,1);
     message[0]='\0';
     strcpy(message,"请选择第二个平面");
     tag_t second_plan;
     do
     {
       int irc=UF_UI_select_single(message,[$opts,&response,&second_plan,cursor,&view)]
  
       UF_MODL_ask_face_data(second_plan,&type,point,dir,box,
         [$radius,&rad_data,&norm_dir)]
       if(type!=22)
       {
         uc1601("请选择另一个平面",1);
         UF_DISP_set_highlight(first_plan,0);
       }
     }
     while(!(type==22 [$& response==5))]
     if(response!=5)
     {
       uc1601("没有选择平面",1);
       UF_terminate();
     }
         tag_t to_part_occ;
     ret=UF_ASSEM_ask_parent_component(second_plan,[$to_part_occ)]
     tag_t to_part_ins=UF_ASSEM_ask_inst_of_part_occ(to_part_occ);
     ret=UF_ASSEM_ask_component_data(to_part_occ,part_name,refset_name,instance_name,origin,csys_matrix,transform);
     uc1601(instance_name,1);
  
     //构造配合关系
     UF_ASSEM_mating_condition_t ftf;
      
     ftf.mated_object=from_part_ins;
     ftf.name=NULL;
     ftf.user_name=FALSE;
  
     ftf.constraints[0].from_status=UF_ASSEM_ok;
     ftf.constraints[0].to_status=UF_ASSEM_ok;
     ftf.constraints[0].mate_type=UF_ASSEM_v16_mate;
     ftf.constraints[0].from_type=UF_ASSEM_planar_face;
     ftf.constraints[0].to_type=UF_ASSEM_planar_face;
  
     ftf.constraints[0].from=UF_ASSEM_ask_prototype_of_occ(first_plan);
     ftf.constraints[0].from_part_occ=from_part_occ;
     ftf.constraints[0].to=UF_ASSEM_ask_prototype_of_occ(second_plan);
     ftf.constraints[0].to_part_occ=to_part_occ;
     ftf.constraints[0].offset=NULL_TAG;
     ftf.constraints[0].name="face to face";
     ftf.constraints[0].user_name=TRUE;
     ftf.num_constraints=1;
     ftf.suppressed=FALSE;
     UF_ASSEM_mc_status_t status;
     UF_ASSEM_mc_structure_state_t struct_status;
     UF_ASSEM_dof_t dof;
     ret=UF_ASSEM_init_mc([$ftf)]
     UF_get_fail_message(ret,message);
     uc1601(message,1);
     ret=UF_ASSEM_solve_mc([$ftf,&status,&dof,transform)]
      
     UF_get_fail_message(ret,message);
     uc1601(message,1);
     if(ret==0 || status==UF_ASSEM_mc_solved)
     {
       uc1601("成功配合",1);
       ret=UF_ASSEM_apply_mc_data([$ftf,&struct_status,&status)]
       UF_DISP_refresh();
       UF_MODL_update();
     }
     else
       uc1601("失败",1);
         UF_DISP_set_highlight(first_plan,0);
     UF_DISP_set_highlight(second_plan,0);
     errorCode=UF_terminate();
  
      UF_terminate ();
  
     /* Callback acknowledged, do not terminate dialog */
     return (UF_UI_CB_CONTINUE_DIALOG);  
      
     /* or Callback acknowledged, terminate dialog.    */
     /* return ( UF_UI_CB_EXIT_DIALOG );               */
  
}
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 支持支持
沙发
 楼主| 发表于 2005-4-13 21:31:44 | 只看该作者

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

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

x
板凳
发表于 2005-4-14 09:16:41 | 只看该作者

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

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

x
地板
 楼主| 发表于 2005-4-14 10:12:26 | 只看该作者

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

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

x
5
发表于 2005-4-14 21:58:37 | 只看该作者

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

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

x
6
 楼主| 发表于 2005-4-14 22:06:12 | 只看该作者

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

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

x
7
 楼主| 发表于 2005-4-15 10:15:49 | 只看该作者

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

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

x
8
 楼主| 发表于 2005-4-17 11:31:37 | 只看该作者

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

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

x
9
发表于 2005-4-18 11:31:24 | 只看该作者

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

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

x
10
 楼主| 发表于 2005-4-18 12:55:44 | 只看该作者

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

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

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

本版积分规则

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

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

GMT+8, 2024-6-14 05:53 , Processed in 0.020262 second(s), 8 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

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