NX二次开发-NXopen录制:导入IGS

// Created by:  Tag_jiang
// Language:   C++
// Version:   NX 10
// Date:      12-24-2019
// Time:       9:00

//头文件
#include <NXOpen/DexBuilder.hxx>
#include <NXOpen/DexManager.hxx>
#include <NXOpen/NXObject.hxx>
#include <NXOpen/ObjectTypeSelector.hxx>
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/Session.hxx>
#include <NXOpen/IgesImporter.hxx>
#include <NXOpen/Update.hxx>

void PrtImportIgs(NXString AllPath, bool Simplify, bool Curves, bool Surfaces, bool Solids, bool Annotations, bool Csys, bool Structures, bool SewSurfaces, bool SmoothBSurf, bool FlattenAssembly)
{
	NXOpen::Session *theSession = NXOpen::Session::GetSession();
	NXOpen::Part *workPart(theSession->Parts()->Work());
	NXOpen::Part *displayPart(theSession->Parts()->Display());
	// ----------------------------------------------
	//   Menu: 文件(F)->导入(M)->IGES...
	// ----------------------------------------------

	NXOpen::IgesImporter *igesImporter1;
	igesImporter1 = theSession->DexManager()->CreateIgesImporter();

	igesImporter1->SetCopiousData(NXOpen::IgesImporter::CopiousDataEnumLinearNURBSpline);//冗余数据类型

	igesImporter1->SetLayerDefault(1);//0默认层

	igesImporter1->SetGeomFixupTol(0.0127);//几何修正公差

	igesImporter1->SetSettingsFile("D:\\Program Files\\Siemens\\NX 10.0\\iges\\igesimport.def");//配置文件

	igesImporter1->ObjectTypes()->SetCurves(Curves);//曲线

	igesImporter1->ObjectTypes()->SetSurfaces(Surfaces);//曲面

	igesImporter1->ObjectTypes()->SetSolids(Solids);//实体

	igesImporter1->ObjectTypes()->SetAnnotations(Annotations);//注释

	igesImporter1->ObjectTypes()->SetStructures(Structures);//结构分析

	igesImporter1->SetSmoothBSurf(SmoothBSurf);//光顺B曲面

	igesImporter1->SetFlattenAssembly(FlattenAssembly);//展开装配

	igesImporter1->SetSewSurfaces(SewSurfaces);//缝合曲面

	igesImporter1->SetSimplifyGeometry(Simplify);//简化

	igesImporter1->ObjectTypes()->SetCsys(Csys);//坐标

	igesImporter1->SetInputFile(AllPath);//路径

	igesImporter1->SetOutputFile("E:\\Design\\Desi1F702094qgyl.prt");//缓存

	igesImporter1->SetFileOpenFlag(false);

	igesImporter1->SetLayerMask("0-99999");//图层标识

	std::vector<NXOpen::NXObject *> objects1(0);//更新
	int nErrs1;
	nErrs1 = theSession->UpdateManager()->AddToDeleteList(objects1);
	theSession->CleanUpFacetedFacesAndEdges();

	NXOpen::NXObject *nXObject1;
	nXObject1 = igesImporter1->Commit();
	igesImporter1->Destroy();
}

  

原文地址:https://www.cnblogs.com/NXString/p/12089552.html

时间: 2024-11-07 01:57:13

NX二次开发-NXopen录制:导入IGS的相关文章

NX二次开发-NXOPEN自动切换到工程图模块

UFUN的API里是没有切换到工程图的函数的,NXOPEN里是有方法可以用的.不过应该是不支持NX9以下的版本. NX9的不能录制出来,在UI类里有方法 1 NX9+VS2012 2 3 #include <uf.h> 4 #include <NXOpen/UI.hxx> 5 #include <NXOpen/MenuBar_MenuBarManager.hxx> 6 7 8 9 NXOpen::UI *theUI = NXOpen::UI::GetUI(); 10 1

NX二次开发-NXOPEN工程图导出CAD图纸DxfdwgCreator *dxfdwgCreator1;

没有什么可以看的,NXOPEN直接录制一下导出CAD就可以了.录制出来自己挑需要的代码拿过来改一下. 1 NX9+VS2012 2 3 4 #include <NXOpen/Part.hxx> 5 #include <NXOpen/PartCollection.hxx> 6 #include <NXOpen/Session.hxx> 7 #include <NXOpen/DxfdwgCreator.hxx> 8 #include <NXOpen/Dex

NX二次开发-NXOPEN更改工程图视图名字baseView1-&gt;SetName(&quot;LSY&quot;);

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_draw.h> 5 #include <uf_obj.h> 6 #include <uf_part.h> 7 8 UF_initialize(); 9 10 //新建工程图(A4图纸) 11 char* DrawingName = "Sheet1";//设置图纸名字 12 UF_DRAW_info_t DrawingInfo;//设置图纸大小.

NX二次开发-NXOpen获取边的端点NXOpen::Edge::GetVertices

1 NX9+VS2012 2 3 #include <NXOpen/Features_BlockFeatureBuilder.hxx> 4 #include <NXOpen/Features_FeatureCollection.hxx> 5 #include <NXOpen/NXException.hxx> 6 #include <NXOpen/Body.hxx> 7 #include <NXOpen/BodyCollection.hxx> 8

NX二次开发-NXOPEN导出STEP Step214Creator *step214Creator1;

没有什么可以看的,NXOPEN直接录制一下导出STEP就可以了.录制出来自己挑需要的代码拿过来改一下. 1 NX9+VS2012 2 3 #include <NXOpen/Part.hxx> 4 #include <NXOpen/PartCollection.hxx> 5 #include <NXOpen/Session.hxx> 6 #include <NXOpen/Step214Creator.hxx> 7 #include <NXOpen/Dex

NX二次开发-NXOpen读取工程图注释note1-&gt;GetText();

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_drf.h> 5 #include <NXOpen/Annotations_Note.hxx> 6 #include <NXOpen/NXObjectManager.hxx> 7 8 9 UF_initialize(); 10 11 //创建注释 12 char* TextString[] = {"Caesar卢尚宇"}; 13 double

NX二次开发-NXOPEN创建工程图表格Annotations::TableSectionBuilder *tableSectionBuilder1;

1 NX9+VS2012 2 3 4 #include <uf.h> 5 #include <uf_tabnot.h> 6 #include <NXOpen/Part.hxx> 7 #include <NXOpen/PartCollection.hxx> 8 #include <NXOpen/Session.hxx> 9 #include <NXOpen/Annotations_TableSectionCollection.hxx>

NX二次开发-NXOPEN将工程图转成PDF文件

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_draw.h> 5 #include <NXOpen/PrintPDFBuilder.hxx> 6 #include <NXOpen/Drawings_DrawingSheet.hxx> 7 #include <NXOpen/NXObjectManager.hxx> 8 #include <NXOpen/PlotManager.hxx> 9

NX二次开发-NXOpen中Point3d类型转换成point类型

1 NX9+VS2012 2 3 #include <NXOpen/NXObject.hxx> 4 #include <NXOpen/Part.hxx> 5 #include <NXOpen/PartCollection.hxx> 6 #include <NXOpen/Point.hxx> 7 #include <NXOpen/PointCollection.hxx> 8 9 NXOpen::Session *theSession = NXOpe