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

Posted nxstring

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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();
}

  

以上是关于NX二次开发-NXopen录制:导入IGS的主要内容,如果未能解决你的问题,请参考以下文章

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

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

NX二次开发-测量投影距离

UG NX二次开发(C#)-曲线-用AssociativeLineBuilder创建智能直线

UG NX二次开发(C#)-曲线-用AssociativeLineBuilder创建智能直线

NX二次开发-UFUN结合NXOPEN开发_常用代码模板