Files
ViewDesignEngine/include/vde/brep/step_export.h
T
2026-07-24 11:09:45 +00:00

78 lines
2.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
/**
* @file step_export.h
* @brief STEP 文件导出(ISO 10303-214
*
* 将 B-Rep 模型序列化为 STEP AP214 格式。
*
* ## 输出格式
*
* 生成的 STEP 文件符合 ISO 10303-214 (AP214) 标准,
* 可以在大多数商用 CAD 软件(SolidWorks, CATIA, NX, FreeCAD 等)中打开。
*
* ## 支持的几何类型
*
* - **曲线**: LINE, CIRCLE, B_SPLINE_CURVE_WITH_KNOTS
* - **曲面**: PLANE, CYLINDRICAL_SURFACE, B_SPLINE_SURFACE_WITH_KNOTS
* - **拓扑**: CLOSED_SHELL, ADVANCED_FACE, EDGE_LOOP, ORIENTED_EDGE, VERTEX_POINT
* - **实体**: MANIFOLD_SOLID_BREP, PRODUCT, PRODUCT_DEFINITION
*
* @ingroup brep
*/
#include "vde/brep/brep.h"
#include <string>
#include <vector>
namespace vde::brep {
/**
* @brief 将 B-Rep 体导出为 STEP AP214 字符串
*
* 序列化所有传入的体及其几何数据为 STEP 文本格式。
*
* **输出结构:**
* ```
* ISO-10303-21;
* HEADER;
* FILE_DESCRIPTION(...)
* FILE_NAME(...)
* FILE_SCHEMA(('AUTOMOTIVE_DESIGN'))
* ENDSEC;
* DATA;
* #1 = PRODUCT(...)
* #2 = CARTESIAN_POINT(...)
* ...
* ENDSEC;
* END-ISO-10303-21;
* ```
*
* @param bodies B-Rep 体列表(每个体对应一个 PRODUCT)
* @return STEP AP214 格式字符串
*
* @note 输出包含所有必要的 ISO 10303-21 头部信息。
*
* @code{.cpp}
* auto body = make_box(10, 5, 3);
* std::string step_str = export_step({body});
* // 写入文件或通过网络发送
* @endcode
*
* @see export_step_file 直接写入文件
* @see export_iges IGES 格式导出
*/
[[nodiscard]] std::string export_step(const std::vector<BrepModel>& bodies);
/**
* @brief 将 B-Rep 体导出为 STEP 文件
*
* 便捷函数:调用 export_step() 后写入文件。
*
* @param filepath 输出文件路径(建议扩展名 .step 或 .stp
* @param bodies B-Rep 体列表
*
* @see export_step 获取字符串输出
*/
void export_step_file(const std::string& filepath, const std::vector<BrepModel>& bodies);
} // namespace vde::brep