NX二次开发 UFUN获得部件里所有模型视图 UF_OBJ_cycle_objs_in_part
//NX8.0+VS2010
#include <uf_assem.h>
#include <uf_part.h>
#include <uf_obj.h>
#include <uf_modl.h>
#include <uf_view.h>
#include <uf_draw.h>
//获得部件里所有模型视图
bool AskPartModelingViews(const tag_t part_tag, std::vector<tag_t>& tModelingViews)
{
int type = UF_view_type, subtype = UF_view_modeling_subtype;
int type1 = type, subtype1 = 0, body_type = 0;
tag_t part = part_tag, next_tag = NULL_TAG;
tModelingViews.clear();
if (part == NULL_TAG)
part = UF_ASSEM_ask_work_part();
if (part == NULL_TAG)
return false;
if (UF_OBJ_cycle_objs_in_part(part, type, &next_tag))
return false;
while (next_tag != NULL_TAG)
{
UF_OBJ_ask_type_and_subtype(next_tag, &type1, &subtype1);
if (type1 == type && subtype1 == subtype)
{
tModelingViews.push_back(next_tag);
}
if (UF_OBJ_cycle_objs_in_part(part, type, &next_tag))
break;
}
if (0 == (int)tModelingViews.size())
return false;
return true;
}