这是UG自带的例子,和你做的基本一样
tag_t ProtoTag;
UF_OBJ_disp_props_t DispProps;
UF_BREP_topology_t *MakeBodyRoot;
UF_OBJ_cycle_objs_in_part (PartTag, UF_solid_type, &BodyTag);
if (BodyTag == NULL_TAG) break;
UF_OBJ_ask_display_properties (BodyTag, &DispProps);
UF_OBJ_ask_type_and_subtype (BodyTag, &Type, &Subtype);
if (Subtype != UF_solid_body_subtype ||
DispProps.blank_status != UF_OBJ_NOT_BLANKED) continue;
ProtoTag = BodyTag;
if (UF_ASSEM_is_occurrence (BodyTag))
ProtoTag = UF_ASSEM_ask_prototype_of_occ (BodyTag);
UF_MODL_ask_body_type (ProtoTag, &Type);
if (Type == UF_MODL_SOLID_BODY) SolidCount++;
else if (Type == UF_MODL_SHEET_BODY) SheetCount++;
else continue; |