马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
我的程序如下:为什么不能正确执行函数:
int res,response,count,num_fcfs;
int type,subtype;
double origin[3],point[3];
char mes[133];
char datum_name[30] = "Feature1";
tag_p_t face;
tag_t feature_instance = NULL_TAG;
tag_t view,edge;
tag_t object,view_tag;
tag_t tolerance_feature;
my_motion_data_t my_data;
UF_GDT_datum_identifier_p_t pdatum_data;
UF_GDT_feature_parms_p_t feat_parms;
UF_GDT_feature_parms_t feature_parms;
UF_GDT_geometric_definition_t def;
UF_GDT_datum_assoc_type_t assoc_type;
UF_GDT_description_t descript;
UF_GDT_modifier_data_t modifier_data;
UF_GDT_surface_parms_t sets;
UF_GDT_surface_parms_p_t psets;
UF_GDT_tolerance_type_t tolerance_type = UF_GDT_DATUM_IDENTIFIER_TYPE;
UF_GDT_annotation_tags_t instance_para_tag;
UF_GDT_set_instance_display_information(1);
//初始化数据结构
res = UF_GDT_init(UF_GDT_FEAT_PARMS_TYPE,(void *)(&feature_parms));
if(res)
{
UF_get_fail_message(res,mes);
uc1601(mes,1);
}
res = UF_GDT_init(UF_GDT_MOD_DATA_TYPE,(void *)(&modifier_data));
if(res)
{
UF_get_fail_message(res,mes);
uc1601(mes,1);
}
res = UF_GDT_init(UF_GDT_DESCRIPT_TYPE,(void *)(&descript));
if(res)
{
UF_get_fail_message(res,mes);
uc1601(mes,1);
}
res = UF_GDT_init(UF_GDT_SURFACE_PARMS_TYPE,(void *)(&sets));
if(res)
{
UF_get_fail_message(res,mes);
uc1601(mes,1);
}
/////////////////////////////////////创建基准/////////////////////////////////
UF_UI_set_cursor_view(0);
//选择基准放置面
res = UF_UI_select_with_class_dialog("选择基准放置面",
"选择基准放置面",UF_UI_SEL_SCOPE_WORK_PART_AND_OCC,
init_proc,NULL,&response, &count, &face);
if(res)
{
UF_get_fail_message(res,mes);
}
if(response != UF_UI_OK)
return 0;
UF_DISP_set_highlight(face[0],0);
sets.num_faces = 1;
sets.faces = face;
psets = &sets;
descript.name = "Feature ggl";
descript.description = "";
feature_parms.num_faces = 1;
feature_parms.face_list = face;
feature_parms.descript = &descript;
feature_parms.feature = UF_GDT_PLANE_FEATURE ;
feature_parms.pattern = UF_GDT_NO_PATTERN;
modifier_data.num_modifiers = 0;
modifier_data.num_keywords = 0;
feature_parms.modifier_data= &modifier_data;
feature_parms.num_sets = 1;
feature_parms.sets = &psets;
feature_parms.num_modl_sets = 0;
def.type = UF_GDT_ALL_GEOMETRY;
feature_parms.def.type = UF_GDT_ALL_GEOMETRY;
UF_GDT_datum_identifier_t datum_data;
datum_data.datum_label = "GG";
datum_data.is_individual = FALSE;
tag_t datum_feature = NULL_TAG;
res = UF_GDT_create_datum_identifier(&feature_parms,&datum_data,&datum_feature);
if(res)
{
UF_get_fail_message(res,mes);
}
res = UF_UI_select_with_single_dialog("请选择","点",
UF_UI_SEL_SCOPE_WORK_PART_AND_OCC, init_proc_edge, NULL,
&response, &object, point, &view);
if(res)
{
UF_get_fail_message(res,mes);
}
double point_drawing[3],origin_drawing[3],temp_point[3];//存放对应成员视图中的点的工程图的坐标
double p2[3];
tag_t work_view;
char view_name[30];
UF_VIEW_ask_work_view(&work_view);
UF_OBJ_ask_name(work_view,view_name);
UF_OBJ_ask_type_and_subtype(object,&type,&subtype);
if(type == UF_solid_type && subtype == UF_solid_edge_subtype)
{
UF_MODL_ask_edge_verts(object,point,p2,&count);
}
point[1] = (point[1] + p2[1])/2;
double reference_pt[3];
res = UF_VIEW_map_model_to_drawing(view,point,point);
if(res)
{
UF_get_fail_message(res,mes);
}
UF_DRAW_ask_drawing_ref_pt(view,reference_pt);
UF_UI_specify_screen_position("Indicate the site of the tolerance feature",
NULL,NULL,origin,&view_tag,&response);
if (response != UF_UI_PICK_RESPONSE)
{
return 0;
}
if(view_tag != work_view)
{
UF_DRAW_ask_drawing_ref_pt(view_tag,reference_pt);
origin[0] += reference_pt[0];
origin[1] += reference_pt[1];
origin[2] = 0;
}
UF_UI_set_cursor_view(1);
origin[1] = point[1];
//将两个点的坐标转成work_view的坐标。
logical is_gdt_view;
UF_GDT_is_gdt_view(work_view,&is_gdt_view);
res = UF_GDT_create_instance(UF_GDT_DATUM_IDENTIFIER_TYPE,datum_feature,work_view,
object,origin,point,&feature_instance);
if(res)
{
UF_get_fail_message(res,mes);
uc1601(mes,0);
}
return 1; |