• NX二次开发-UFUN将实体放入STL文件中函数UF_STD_put_solid_in_stl_file


     1     NX9+VS2012
     2     
     3     #include <uf.h>
     4     #include <uf_obj.h>
     5     #include <uf_modl.h>
     6     #include <uf_part.h>
     7     #include <uf_std.h>
     8     #include <NXOpen/Annotations.hxx>
     9 
    10 
    11 
    12     UF_initialize();
    13 
    14     std::vector<tag_t> SolidVector;
    15     tag_t ObjectTag = NULL_TAG;
    16     int Type, SubType, Body_Type;
    17     char msg[256];
    18     UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_solid_type, &ObjectTag);
    19     while (ObjectTag != NULL_TAG)
    20     {
    21         UF_OBJ_ask_type_and_subtype(ObjectTag, &Type, &SubType);
    22         if (SubType == UF_solid_body_subtype)
    23         {
    24             UF_MODL_ask_body_type(ObjectTag, &Body_Type);
    25             if (Body_Type == UF_MODL_SOLID_BODY)
    26             {
    27 
    28                 //打开用于二进制输出的STL文件
    29                 void * file_handle = NULL;
    30                 UF_STD_open_binary_stl_file("D:\abc.stl",true,"",&file_handle);
    31 
    32                 //将实体放入STL文件中
    33                 int num_errors;
    34                 UF_STD_stl_error_p_t  error_info;
    35                 UF_STD_put_solid_in_stl_file(file_handle,NULL_TAG,ObjectTag,0,10000,0.0001,&num_errors,&error_info);
    36 
    37                 //关闭STL文件
    38                 UF_STD_close_stl_file(file_handle);
    39 
    40 
    41                 UF_OBJ_set_color(ObjectTag, 186);
    42                 SolidVector.push_back(ObjectTag);
    43             }
    44         }
    45         UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_solid_type, &ObjectTag);
    46     }
    47 
    48     sprintf_s(msg, "当前有%d个实体", SolidVector.size());
    49     UF_UI_open_listing_window();
    50     UF_UI_write_listing_window(msg);
    51 
    52 
    53     UF_terminate();

  • 相关阅读:
    markdown样式代码保存
    【python系统学习08】for循环知识点合集
    【python系统学习07】一张图看懂字典并学会操作
    【python系统学习06】一张图看懂列表并学会操作
    java后端学习记录
    支付功能设计及实现思路
    《Kafka权威指南》读书笔记
    ReentrantLock源码简析
    敏捷开发流程
    上线新功能,如何兼容旧数据?
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/10957264.html
Copyright © 2020-2023  润新知