AMCAX Kernel
Geometry kernel for CAD/CAE/CAM
九韶内核 1.0.0.0
载入中...
搜索中...
未找到
文件读写/格式转换

目前我们内核支持的有 BREP 文件的导入和导出、网格文件读写(OBJ, STL)、IGES 文件的导入和导出、STEP 文件的导入和导出。

BREP 文件的导入和导出

导入

AMCAX::OCCTIO::OCCTTool::Read 提供导入文件的功能。

AMCAX::OCCTIO::OCCTTool::Read(shape1, "./data/box.brep");
static AMCAX_API bool Read(TopoShape &s, std::istream &is)
读取输入流中的形状
形状的基类,包含具有位置和方向信息的基础形状
定义 TopoShape.hpp:15

导出

AMCAX::OCCTIO::OCCTTool::Write 提供导出文件的功能。

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, 0.0), AMCAX::Point3(5.0, 5.0, 3.0));
AMCAX::OCCTIO::OCCTTool::Write(box, "./box.brep");
创建立方体的类
定义 MakeBox.hpp:18
static AMCAX_API bool Write(const TopoShape &s, std::ostream &os, int format=3)
将形状写入输出流
PointT< double, 3 > Point3
三维点
定义 PointT.hpp:459

网格文件读写(OBJ, STL)

OBJ

AMCAX::Meshing::Mesh::OBJReader 提供读取文件的功能; AMCAX::Meshing::Mesh::OBJWriter 提供写入文件的功能。

//read
std::cout << obj_reader.read("./data/cow.obj", io_options) << std::endl;
//write
std::cout << obj_writer.write("cow1.obj", io_options, 10) << std::endl;
Options about pre-described properties in mesh IO.
定义 IOOptions.hpp:19
Read triangle soup from an OBJ file.
定义 OBJReader.hpp:38
AMCAXMeshing_API bool read(const std::string &filename, IOOptions &opt)
Read triangle soup from the file. results will be stored in member variables of reader,...
Write triangle soup to an OBJ file.
定义 OBJWriter.hpp:38
AMCAXMeshing_API bool write(const std::string &filename, IOOptions &opt, std::streamsize precision)
Write triangle soup to file with given options and precison.

STL

AMCAX::Meshing::Mesh::STLReader 提供导入文件的功能; AMCAX::Meshing::Mesh::STLWriter 提供导出文件的功能。

//read
std::cout << stl_reader.read("./data/cow.stl", io_options2) << std::endl;
//write
std::cout << stl_writer.write("cow2.stl", io_options2, 10) << std::endl;
Read triangle soup from an STL file.
定义 STLReader.hpp:33
AMCAXMeshing_API bool read(const std::string &filename, IOOptions &opt)
Read triangle soup from the file.
Write mesh to an STL file.
定义 STLWriter.hpp:33
AMCAXMeshing_API bool write(const std::string &filename, IOOptions &opt, std::streamsize precision=6)
Write mesh to file with given options and precison.

IGES 文件

导入

支持导入线,面和实体。 AMCAX::IGES::IgesIO::Read 提供导入文件的功能。

//edge
std::cout << AMCAX::IGES::IgesIO::Read(ts1, "./data/edge.igs") << std::endl;
//face
std::cout << AMCAX::IGES::IgesIO::Read(ts2, "./data/face.igs") << std::endl;
//solid
std::cout << AMCAX::IGES::IgesIO::Read(ts1, "./data/solid.igs") << std::endl;
static AMCAX_API bool Read(TopoShape &s, const std::string &file)
从文件中读取形状

导出

支持将点,线,面,实体导出为离散的几何体。 AMCAX::IGES::IgesIO::Write 提供导出文件的功能。

//solid
s1 = AMCAX::MakeBox(1., 1., 1.);
AMCAX::IGES::IgesIO::Write(s1, "solid.igs");
//vertex
AMCAX::TopoExplorerTool::MapShapes(s1, AMCAX::ShapeType::Vertex, vertexset);
AMCAX::IGES::IgesIO::Write(vertex1, "vertex.igs");
//edge
AMCAX::TopoExplorerTool::MapShapes(s1, AMCAX::ShapeType::Edge, edgeset);
AMCAX::IGES::IgesIO::Write(edge1, "edge.igs");
//face
AMCAX::TopoExplorerTool::MapShapes(s1, AMCAX::ShapeType::Face, faceset);
AMCAX::IGES::IgesIO::Write(face1, "face.igs");
static AMCAX_API bool Write(const TopoShape &s, const std::string &file, int format=0)
将形状写入文件
索引集的模板类
定义 IndexSet.hpp:20
static AMCAX_API const TopoEdge & Edge(const TopoShape &s)
将形状转换为边
static AMCAX_API const TopoVertex & Vertex(const TopoShape &s)
将形状转换为顶点
static AMCAX_API const TopoFace & Face(const TopoShape &s)
将形状转换为面
边的类
定义 TopoEdge.hpp:12
static AMCAX_API void MapShapes(const TopoShape &s, ShapeType t, IndexSet< TopoShape > &shapeSet)
构造给定类型的子形状集合
面类
定义 TopoFace.hpp:12
顶点类
定义 TopoVertex.hpp:12

STEP 文件

导入

支持导入零件本体、名称、文本描述、位置、朝向,简单组装信息。
建设中。

导出

支持导出零件本体、名称、位置、朝向、颜色等信息。
建设中。