cad图整理
UF_initialize(); tag_t ObjectTag = NULL_TAG; tag_t view_tag = NULL_TAG; UF_OBJ_disp_props_t disp_props; int Type, SubType, quantity=0; char msg[256]; //实体 UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_solid_type, &ObjectTag); //UF_solid_type移动到1层 while (ObjectTag != NULL_TAG) { quantity++; UF_OBJ_ask_type_and_subtype(ObjectTag, &Type, &SubType); if (Type == UF_solid_type) { UF_OBJ_set_layer(ObjectTag, 1); } UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_solid_type, &ObjectTag); } //直线 UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_line_type, &ObjectTag); //UF_line_type移到10层 while (ObjectTag != NULL_TAG) { quantity++; UF_OBJ_ask_display_properties(ObjectTag,&disp_props); UF_OBJ_ask_type_and_subtype(ObjectTag, &Type, &SubType); if (Type == UF_line_type &&disp_props.color==1 &&disp_props.font==UF_OBJ_FONT_SOLID )//白色直线移动到10层 { UF_OBJ_set_layer(ObjectTag, 10); } if (Type == UF_line_type &&disp_props.color!=1 &&disp_props.font==UF_OBJ_FONT_SOLID )//非白色直线移动到11层 { UF_OBJ_set_layer(ObjectTag, 11); } if (Type == UF_line_type &&disp_props.font==UF_OBJ_FONT_DASHED)//虚线移动到12层 { UF_OBJ_set_layer(ObjectTag, 12); } if (Type == UF_line_type &&disp_props.font==UF_OBJ_FONT_CENTERLINE)//4->中心线移动到255层 { UF_OBJ_set_layer(ObjectTag, 255); } UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_line_type, &ObjectTag); } //圆弧 UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_circle_type, &ObjectTag); //UF_circle_type移到10层 while (ObjectTag != NULL_TAG) { quantity++; UF_OBJ_ask_display_properties(ObjectTag,&disp_props); UF_OBJ_ask_type_and_subtype(ObjectTag, &Type, &SubType); if (Type == UF_circle_type &&disp_props.color==1 &&disp_props.font==UF_OBJ_FONT_SOLID )//白色圆弧移动到10层 { UF_OBJ_set_layer(ObjectTag, 10); } if (Type == UF_circle_type &&disp_props.color!=1 &&disp_props.font==UF_OBJ_FONT_SOLID )//白色圆弧移动到10层 { UF_OBJ_set_layer(ObjectTag, 11); } if (Type == UF_circle_type &&disp_props.font==UF_OBJ_FONT_DASHED)//虚线移动到12层 { UF_OBJ_set_layer(ObjectTag, 12); } if (Type == UF_circle_type &&disp_props.font==UF_OBJ_FONT_CENTERLINE)//4->中心线移动到255层 { UF_OBJ_set_layer(ObjectTag, 255); } UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_circle_type, &ObjectTag); } //样条曲线 UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_spline_type, &ObjectTag);//UF_spline_type移动到10层UF_spline_type while (ObjectTag != NULL_TAG) { quantity++; UF_OBJ_ask_display_properties(ObjectTag,&disp_props); UF_OBJ_ask_type_and_subtype(ObjectTag, &Type, &SubType); if (Type == UF_spline_type &&disp_props.color==1 &&disp_props.font==UF_OBJ_FONT_SOLID ) { UF_OBJ_set_layer(ObjectTag, 10); } if (Type == UF_spline_type &&disp_props.color!=1 &&disp_props.font==UF_OBJ_FONT_SOLID ) { UF_OBJ_set_layer(ObjectTag, 11); } if (Type == UF_spline_type &&disp_props.font==UF_OBJ_FONT_DASHED)//虚线移动到12层 { UF_OBJ_set_layer(ObjectTag, 12); } if (Type == UF_spline_type &&disp_props.font==UF_OBJ_FONT_CENTERLINE)//4->中心线移动到255层 { UF_OBJ_set_layer(ObjectTag, 255); } UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_spline_type, &ObjectTag); } //注释阴影等 UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_drafting_entity_type, &ObjectTag);//UF_drafting_entity_type移动到256层 while (ObjectTag != NULL_TAG) { quantity++; UF_OBJ_ask_type_and_subtype(ObjectTag, &Type, &SubType); if (Type == UF_drafting_entity_type) { UF_OBJ_set_layer(ObjectTag, 256); } UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_drafting_entity_type, &ObjectTag); } //点 UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_point_type, &ObjectTag);//UF_point_type移动到256层UF_spline_type while (ObjectTag != NULL_TAG) { quantity++; UF_OBJ_ask_type_and_subtype(ObjectTag, &Type, &SubType); if (Type == UF_point_type) { UF_OBJ_set_layer(ObjectTag, 256); } UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_point_type, &ObjectTag); } //坐标 UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_coordinate_system_type, &ObjectTag);//移动到256层 while (ObjectTag != NULL_TAG) { quantity++; UF_OBJ_ask_type_and_subtype(ObjectTag, &Type, &SubType); if (Type == UF_coordinate_system_type) { UF_OBJ_set_layer(ObjectTag, 256); } UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_coordinate_system_type, &ObjectTag); } UF_LAYER_set_all_but_work(4); UF_LAYER_set_status(1,1); UF_LAYER_set_status(10,2); sprintf(msg,"循环了%d次",quantity); uc1601(msg,1); UF_VIEW_fit_view(view_tag,0.8); UF_terminate();