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

时间:2021-03-09 15:27:01
     NX9+VS2012

     #include <uf.h>
#include <uf_obj.h>
#include <uf_modl.h>
#include <uf_part.h>
#include <uf_std.h>
#include <NXOpen/Annotations.hxx> UF_initialize(); std::vector<tag_t> SolidVector;
tag_t ObjectTag = NULL_TAG;
int Type, SubType, Body_Type;
char msg[];
UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_solid_type, &ObjectTag);
while (ObjectTag != NULL_TAG)
{
UF_OBJ_ask_type_and_subtype(ObjectTag, &Type, &SubType);
if (SubType == UF_solid_body_subtype)
{
UF_MODL_ask_body_type(ObjectTag, &Body_Type);
if (Body_Type == UF_MODL_SOLID_BODY)
{ //打开用于二进制输出的STL文件
void * file_handle = NULL;
UF_STD_open_binary_stl_file("D:\\abc.stl",true,"",&file_handle); //将实体放入STL文件中
int num_errors;
UF_STD_stl_error_p_t error_info;
UF_STD_put_solid_in_stl_file(file_handle,NULL_TAG,ObjectTag,,,0.0001,&num_errors,&error_info); //关闭STL文件
UF_STD_close_stl_file(file_handle); UF_OBJ_set_color(ObjectTag, );
SolidVector.push_back(ObjectTag);
}
}
UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_solid_type, &ObjectTag);
} sprintf_s(msg, "当前有%d个实体", SolidVector.size());
UF_UI_open_listing_window();
UF_UI_write_listing_window(msg); UF_terminate();

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