• NX二次开发遍历工作部件所有体的显示属性(图层, 颜色, 隐藏状态, 线宽, 字体, 高亮状态)


    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();

    怡宁塑胶模具设计
  • 相关阅读:
    系统环境变量
    Shell入门(三)之字符串
    Shell入门(二)之变量
    Shell入门(一)之简介
    Spring入门(三)之IoC
    Spring入门(二)之下载与安装
    Spring入门(一)之简介
    面向对象与面向过程
    Hadoop入门(二)集群安装
    Hadoop入门(一)概念与单机安装
  • 原文地址:https://www.cnblogs.com/hqsalanhuang/p/14957772.html
Copyright © 2020-2023  润新知