NX secondary development - UFUN closes STL file function UF_STD_close_stl_file
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[256];
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)
{
//Open STL file for binary output
void * file_handle = NULL;
UF_STD_open_binary_stl_file("D:\\abc.stl",true,"",&file_handle);
//Placing entities in STL files
int num_errors;
UF_STD_stl_error_p_t error_info;
UF_STD_put_solid_in_stl_file(file_handle,NULL_TAG,ObjectTag,0,10000,0.0001,&num_errors,&error_info);
//Close STL file
UF_STD_close_stl_file(file_handle);
UF_OBJ_set_color(ObjectTag, 186);
SolidVector.push_back(ObjectTag);
}
}
UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_solid_type, &ObjectTag);
}
sprintf_s(msg, "Currently there are%d Entity", SolidVector.size());
UF_UI_open_listing_window();
UF_UI_write_listing_window(msg);
UF_terminate();
Caesar
2018 October 21, 2001

NX Secondary Development Technology Column
More NX secondary development content
Posted by neil.johnson on Mon, 18 Mar 2019 04:30:28 -0700