UG/NX二次开发-获取指定图层对象的数量_UF_LAYER_cycle_by_layer
vector<tag_t> 对象sTAG ;
for (int 图层号 = 1; 图层号 <= 256; 图层号++)
{
tag_t 查询对象TAG = NULL_TAG;
对象sTAG.clear();
UF_CALL(UF_LAYER_cycle_by_layer(图层号, &查询对象TAG));
while (查询对象TAG != NULL_TAG)
{
int type;
int subtype;
UF_CALL(UF_OBJ_ask_type_and_subtype(查询对象TAG, &type, &subtype));
if (type == UF_solid_type && subtype == UF_solid_body_subtype)//||type == UF_point_type && subtype == UF_point_subtype ||type == UF_line_type && subtype == UF_line_normal_subtype
{
对象sTAG.push_back(查询对象TAG);
}
UF_CALL(UF_LAYER_cycle_by_layer(图层号, &查询对象TAG));
}
char 图层对象数量字符串[256]="";
sprintf_s(图层对象数量字符串, "\n%d层对象数量:%d",图层号,对象sTAG.size());
print(图层对象数量字符串);
}
————————————————————————————