|
马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
谢谢,斑竹回答我上次的问题,讲得很详细,呵呵~!
下面是我编译的关于贴合装配的源程序:
char message[133]; //选择第一个面的程序
message[0]='\0';
strcpy(message,"请选择第1个面");
UF_UI_selection_options_t opts;
UF_UI_mask_t mask;
int response;
tag_t view;
double cursor[3];
int unhightlight=0;
UF_initialize();
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];
double box[6];
double radius;
double rad_data;
int norm_dir;
tag_t first_plan;
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&&type!=16&&type!=18&&type!=23&&type!=19&&type!=20&&type!=17)
{ uc1601("请选择一个面",1);
UF_DISP_set_highlight(first_plan,0);}
//此时的first_plan是object occurence
if(response!=5)
{ uc1601("没有选择面",1);
return( UF_UI_CB_CONTINUE_DIALOG );}
int ret;
tag_t from_part_occ;
ret=UF_ASSEM_ask_parent_component(first_plan,[$from_part_occ)]
char part_name[132+1];
char refset_name[30+1];
char instance_name[30+1];
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("请选择第2个面",1);
message[0]='\0';
strcpy(message,"请选择第2个平面");
tag_t second_plan;
int irc2=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&&type!=16&&type!=18&&type!=23&&type!=19&&type!=20&&type!=17)
{ uc1601("请选择一个面",1);
UF_DISP_set_highlight(second_plan,0);}
//此时的first_plan是object occurence
if(response!=5)
{ uc1601("没有选择面",1);
return( UF_UI_CB_CONTINUE_DIALOG );}
tag_t to_part_occ;
ret=UF_ASSEM_ask_parent_component(second_plan,[$to_part_occ)]
ret=UF_ASSEM_ask_component_data(to_part_occ,part_name,refset_name,instance_name,
origin,csys_matrix,transform);
//构造配合关系
tag_t from_part_ins=UF_ASSEM_ask_inst_of_part_occ(from_part_occ);(问题出现处)
uc1601("hahahahaha",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;
目前还没有编译完成,但是在进行测试的时候,虽然没有错误,但是我的测试语句 uc1601("hahahahaha",1);并没有出现,我认为就是因为执行 tag_t from_part_ins=UF_ASSEM_ask_inst_of_part_occ(from_part_occ);后就往后执行了,请问斑竹为什么会这样,怎么才能解决阿~!!!!我的程序是根据清华那本书上改编的啊,在问题出现处之前都能较好的执行,就是在那条语句之后就执行不了了~! |
|