void my_tag_event_cb(UF_TAG_event_t re, tag_t tag,void *closure)
{
/* Note that this function needs to call UF_initialize()
This requirement was added in V16.
*/
if (UF_CALL(UF_initialize())) return;
GetNewCreateFeature();
UF_terminate();
}//该函数由一回调函数调用
void GetNewCreateFeature()
{
int index=0;
int irc=0,irc2=0;
int enttype;
tag_t feat1=0;
tag_t feat3;
char *feat_type;
enttype = UF_feature_type;
UF_MODL_edge_blend_data_p_t filletdata;
filletdata=new UF_MODL_edge_blend_data_s;
/*int num_objects=0;
tag_t* objects[255];
UF_MODL_SWEEP_TRIM_object_p_t trim_ptr;
trim_ptr=new UF_MODL_SWEEP_TRIM_object_s;
char* taper_angle[1];
char* limits[2];
char* offsets[2];
double region_point[3];
logical region_specified;
logical solid_creation;
double direction[3];*/
do
{
irc=UF_OBJ_cycle_objs_in_part(part_tag ,enttype , [$feat1)]
if(feat1 == NULL_TAG) break;
feat3=feat1;
++index;
}while(feat1);
if(count!=index)
{
irc=UF_MODL_ask_feat_type(feat3,[$feat_type)]
if (irc==0)
{
/*if (strcmp(feat_type,"SWP104")==0)
{
irc2=UF_MODL_ask_extrusion(feat3,&num_objects, objects, &trim_ptr,
taper_angle, limits, offsets, region_point, [$region_specified,&solid_creation,direction)]
if (irc2==0)
{
uc1601("irc2=0", TRUE);
UF_UI_open_listing_window();
sprintf(buffer,"\n %d %d %s\n",irc2,num_objects,feat_type );
UF_UI_write_listing_window(buffer);
count=index;
//UF_UI_close_listing_window();
uc1601("增加了新特征", TRUE);
}
uc1601(limits[0], TRUE);
uc1601(limits[1], TRUE);
delete(trim_ptr);
}*/
if (strcmp(feat_type,"BLEND")==0)
{
uc1601("irc1=0", TRUE);
irc2=UF_MODL_ask_edge_blend (feat3, filletdata );
if (irc2==0) {
uc1601("irc2=0", TRUE);
int irc;
UF_MODL_blend_edge_p_t edgetagdata;
tag_t edgetag;
char *blendrad;
double p1[3]={0.0, 0.0, 0.0};
UF_MODL_blend_edge_p_t blendedge_data;
char buffer[UF_UI_MAX_STRING_LEN+1];
blendedge_data=filletdata->edge_data;
UF_CURVE_line_p_t line_coords;
line_coords=new UF_CURVE_line_s;
edgetagdata=filletdata->edge_data;
edgetag=edgetagdata->edge;
blendrad=filletdata->blend_radius;
irc=UF_CURVE_ask_line_data (edgetag,line_coords );//要得到edge的参数需要用line函数,直接用边不行。
//特征数和计数的次数相等语句的放置位置比较重要,原因待查。
count=index;
p1[0]=(line_coords->start_point[0]+line_coords->end_point[0])/2.0;
p1[1]=(line_coords->start_point[1]+line_coords->end_point[1])/2.0;
p1[2]=(line_coords->start_point[2]+line_coords->end_point[2])/2.0;
UF_UI_open_listing_window();
sprintf(buffer, "\n %d The X value of P1 is: %f %f %f feature is of type %s %u\n",
irc,p1[0],p1[1],p1[2],filletdata->blend_radius,edgetag);//%dfilletdata->number_edges %s%d %d,edgetag,edgetagdata->number_points);
UF_UI_write_listing_window(buffer);
}
}
UF_free(feat_type);
}
}
UF_free(filletdata);//该函数的放置位置很难确定
//uc1601("irc2=0", TRUE);
}
因为试来试去,所以有点乱,代码中有两个,一个是拉伸(拉伸被去除了),另一个是倒圆。 |