怡宁塑胶模具设计

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

VS2019 NX1946

 

#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>

#include <NXOpen/ListingWindow.hxx>

#include <uf_layer.h>
#include<uf_obj.h>

 

UF_initialize();

Part* workPart;//定义工作部件
workPart = theSession->Parts()->Work();//获取工作部件

char msg[256];

std::vector<int> BodyTagVector;//对象TAG容器
BodyTagVector.clear();

//遍历工作部件所有体的显示属性
BodyCollection* bodys = workPart->Bodies();
for (BodyCollection::iterator ite = bodys->begin(); ite != bodys->end(); ite++)
{
Body* bodys = (*ite);
BodyTagVector.push_back(bodys->Tag());

//获得对象信息
UF_OBJ_disp_props_s dispprops;
UF_OBJ_ask_display_properties(bodys->Tag(), &dispprops); //获取对象的显示属性(图层, 颜色, 隐藏状态, 线宽, 字体, 高亮状态)
sprintf(msg, "体的TAG: %d", bodys->Tag());
theSession->ListingWindow()->WriteLine(msg);
sprintf(msg, "体的图层:%d", dispprops.layer);
theSession->ListingWindow()->WriteLine(msg);
sprintf(msg, "体的颜色:%d", dispprops.color);
theSession->ListingWindow()->WriteLine(msg);
sprintf(msg, "体的隐藏状态:%d", dispprops.blank_status);
theSession->ListingWindow()->WriteLine(msg);
}

UF_terminate();

 

 

posted on 2021-07-01 10:43  怡宁塑胶模具设计  阅读(1008)  评论(0编辑  收藏  举报