|
ViewDesignEngine
3.1.0
高性能 CAD 计算几何引擎
|
类 | |
| struct | TopoVertex |
| 拓扑顶点 更多... | |
| struct | TopoEdge |
| 拓扑边 更多... | |
| struct | TopoLoop |
| 拓扑环(Loop) 更多... | |
| struct | TopoFace |
| 拓扑面 更多... | |
| struct | TopoShell |
| 拓扑壳 更多... | |
| struct | TopoBody |
| 拓扑体 更多... | |
| class | BrepModel |
| B-Rep 模型 更多... | |
| struct | ValidationResult |
| B-Rep 模型的综合验证结果 更多... | |
枚举 | |
| enum class | CurveType { Line , Circle , Bezier , BSpline , Nurbs } |
| 边曲线类型枚举 更多... | |
| enum class | IgesError { Ok = 0 , FileNotFound , ParseError , InvalidSection , UnsupportedEntity , MissingEntity , EntityTypeError } |
| IGES 导入错误码 更多... | |
| enum class | StepError { Ok = 0 , FileNotFound , ParseError , InvalidHeader , UnsupportedSchema , MissingEntity , EntityTypeError } |
| STEP 导入错误码 更多... | |
函数 | |
| BrepModel | brep_union (const BrepModel &a, const BrepModel &b) |
| B-Rep 布尔并集: A ∪ B 更多... | |
| BrepModel | brep_intersection (const BrepModel &a, const BrepModel &b) |
| B-Rep 布尔交集: A ∩ B 更多... | |
| BrepModel | brep_difference (const BrepModel &a, const BrepModel &b) |
| B-Rep 布尔差集: A \ B 更多... | |
| ValidationResult | validate (const BrepModel &body) |
| 对 BrepModel 执行综合验证 更多... | |
| std::string | export_iges (const std::vector< BrepModel > &bodies) |
| 将 B-Rep 体导出为 IGES 格式字符串(版本 5.3) 更多... | |
| void | export_iges_file (const std::string &filepath, const std::vector< BrepModel > &bodies) |
| 将 B-Rep 体导出为 IGES 文件 更多... | |
| std::vector< BrepModel > | import_iges (const std::string &filepath) |
| 从文件导入 IGES 更多... | |
| std::vector< BrepModel > | import_iges_from_string (const std::string &data) |
| 从字符串导入 IGES(用于测试) 更多... | |
| IgesError | iges_last_error () |
| 获取最近一次 IGES 导入的错误码 更多... | |
| const std::string & | iges_last_error_message () |
| 获取最近一次 IGES 导入的可读错误描述 更多... | |
| BrepModel | extrude (const curves::NurbsCurve &profile, const Vector3D &dir) |
| 沿方向挤出平面轮廓 更多... | |
| BrepModel | revolve (const curves::NurbsCurve &profile, const Point3D &axis_origin, const Vector3D &axis_dir, double angle_rad=2.0 *M_PI) |
| 绕轴旋转平面轮廓 更多... | |
| BrepModel | sweep (const curves::NurbsCurve &profile, const curves::NurbsCurve &path) |
| 沿任意路径扫掠轮廓 更多... | |
| BrepModel | loft (const std::vector< curves::NurbsCurve > &profiles) |
| 在两个或多个轮廓曲线之间放样 更多... | |
| BrepModel | make_box (double w, double h, double d) |
| 创建立方体 更多... | |
| BrepModel | make_cylinder (double radius, double height, int segments=32) |
| 创建圆柱体 更多... | |
| BrepModel | make_sphere (double radius, int segments_u=32, int segments_v=16) |
| 创建球体 更多... | |
| BrepModel | fillet (const BrepModel &body, int edge_id, double radius) |
| 对边做圆角处理 更多... | |
| BrepModel | chamfer (const BrepModel &body, int edge_id, double distance) |
| 对边做倒角 更多... | |
| BrepModel | shell (const BrepModel &body, int face_id, double thickness) |
| 抽壳(挖空实体) 更多... | |
| std::string | export_step (const std::vector< BrepModel > &bodies) |
| 将 B-Rep 体导出为 STEP AP214 字符串 更多... | |
| void | export_step_file (const std::string &filepath, const std::vector< BrepModel > &bodies) |
| 将 B-Rep 体导出为 STEP 文件 更多... | |
| std::vector< BrepModel > | import_step (const std::string &filepath) |
| 从文件导入 STEP(AP203/AP214) 更多... | |
| std::vector< BrepModel > | import_step_from_string (const std::string &step_data) |
| 从字符串导入 STEP(用于测试和嵌入式场景) 更多... | |
| StepError | step_last_error () |
| 获取最近一次 STEP 导入的错误码 更多... | |
| const std::string & | step_last_error_message () |
| 获取最近一次 STEP 导入的可读错误描述 更多... | |
|
strong |
|
strong |
IGES 导入错误码
| 枚举值 | |
|---|---|
| Ok | 导入成功 |
| FileNotFound | 文件不存在或无法读取 |
| ParseError | IGES 语法错误(固定宽度格式异常) |
| InvalidSection | 段标记无效或缺失 |
| UnsupportedEntity | 遇到了不支持但合法的实体类型 |
| MissingEntity | 引用了未定义的实体 |
| EntityTypeError | 实体类型解析失败 |
在文件 iges_import.h 第 42 行定义.
|
strong |
STEP 导入错误码
枚举 import_step() 和 import_step_from_string() 可能返回的所有错误类型。
| 枚举值 | |
|---|---|
| Ok | 导入成功 |
| FileNotFound | 文件不存在或无法读取 |
| ParseError | STEP 语法错误(令牌/格式异常) |
| InvalidHeader | HEADER 段格式无效 |
| UnsupportedSchema | 不支持的 SCHEMA(非 AP203/AP214) |
| MissingEntity | 引用了未定义的实体 |
| EntityTypeError | 实体类型未识别或类型不匹配 |
在文件 step_import.h 第 39 行定义.
B-Rep 布尔差集: A \ B
从 A 中减去 B 所占据的区域。
| a | 被减实体 A |
| b | 减去实体 B |
B-Rep 布尔交集: A ∩ B
保留两个实体共有的区域。
| a | 第一个 B-Rep 实体 |
| b | 第二个 B-Rep 实体 |
B-Rep 布尔并集: A ∪ B
合并两个 B-Rep 实体为一个,自动处理相交曲面的分割和重新连接。
算法概要:
| a | 第一个 B-Rep 实体 |
| b | 第二个 B-Rep 实体 |
对边做倒角
将尖锐边替换为 45° 斜面。
| body | 输入实体 |
| edge_id | 要倒角的边 ID |
| distance | 倒角距离(从原边沿两个面各偏移的距离) |
| std::string vde::brep::export_iges | ( | const std::vector< BrepModel > & | bodies | ) |
将 B-Rep 体导出为 IGES 格式字符串(版本 5.3)
序列化所有传入的体及其几何/拓扑数据为 IGES 固定宽度格式。
输出结构:
| bodies | B-Rep 体列表 |
| void vde::brep::export_iges_file | ( | const std::string & | filepath, |
| const std::vector< BrepModel > & | bodies | ||
| ) |
将 B-Rep 体导出为 IGES 文件
调用 export_iges() 后写入文件。
| filepath | 输出文件路径(建议扩展名 .igs 或 .iges) |
| bodies | B-Rep 体列表 |
| std::string vde::brep::export_step | ( | const std::vector< BrepModel > & | bodies | ) |
将 B-Rep 体导出为 STEP AP214 字符串
序列化所有传入的体及其几何数据为 STEP 文本格式。
输出结构:
| bodies | B-Rep 体列表(每个体对应一个 PRODUCT) |
| void vde::brep::export_step_file | ( | const std::string & | filepath, |
| const std::vector< BrepModel > & | bodies | ||
| ) |
将 B-Rep 体导出为 STEP 文件
便捷函数:调用 export_step() 后写入文件。
| filepath | 输出文件路径(建议扩展名 .step 或 .stp) |
| bodies | B-Rep 体列表 |
| BrepModel vde::brep::extrude | ( | const curves::NurbsCurve & | profile, |
| const Vector3D & | dir | ||
| ) |
沿方向挤出平面轮廓
将平面曲线沿给定方向扫掠,生成柱状实体。
算法: 曲线的每个点沿方向向量平移,两端加盖平面形成封闭实体。
| profile | 轮廓曲线(必须位于一个平面内) |
| dir | 挤出方向向量(其长度决定挤出距离) |
对边做圆角处理
在指定的边上施加恒定半径的圆角(倒圆)。 适用于凹边和凸边。
| body | 输入实体 |
| edge_id | 要倒圆的边 ID |
| radius | 圆角半径,必须 > 0 |
| IgesError vde::brep::iges_last_error | ( | ) |
| const std::string& vde::brep::iges_last_error_message | ( | ) |
| std::vector<BrepModel> vde::brep::import_iges | ( | const std::string & | filepath | ) |
从文件导入 IGES
解析 .igs 或 .iges 文件并返回其中的 B-Rep 体。
算法概要:
| filepath | .igs 或 .iges 文件路径 |
| std::vector<BrepModel> vde::brep::import_iges_from_string | ( | const std::string & | data | ) |
| std::vector<BrepModel> vde::brep::import_step | ( | const std::string & | filepath | ) |
从文件导入 STEP(AP203/AP214)
解析 .step / .stp 文件并提取所有 PRODUCT 对应的 B-Rep 体。 每个 PRODUCT 定义对应返回向量的一个元素。
算法概要:
| filepath | .step 或 .stp 文件路径 |
| std::vector<BrepModel> vde::brep::import_step_from_string | ( | const std::string & | step_data | ) |
从字符串导入 STEP(用于测试和嵌入式场景)
与 import_step() 功能完全相同,但从内存中的 STEP 数据字符串解析。
| step_data | 完整的 STEP 文件内容(字符串形式) |
| BrepModel vde::brep::loft | ( | const std::vector< curves::NurbsCurve > & | profiles | ) |
| BrepModel vde::brep::make_box | ( | double | w, |
| double | h, | ||
| double | d | ||
| ) |
创建立方体
以原点为中心、轴对齐的立方体。
| w | 宽度(X 方向),必须 > 0 |
| h | 高度(Y 方向),必须 > 0 |
| d | 深度(Z 方向),必须 > 0 |
| BrepModel vde::brep::make_cylinder | ( | double | radius, |
| double | height, | ||
| int | segments = 32 |
||
| ) |
创建圆柱体
沿 Y 轴、以原点为中心的圆柱体。
| radius | 截面半径,必须 > 0 |
| height | 总高度,沿 Y 轴从 -h/2 到 +h/2 |
| segments | 截面分段数(边数,默认 32) |
| BrepModel vde::brep::make_sphere | ( | double | radius, |
| int | segments_u = 32, |
||
| int | segments_v = 16 |
||
| ) |
创建球体
以原点为中心的球体。
| radius | 球半径,必须 > 0 |
| segments_u | 经度方向分段数(默认 32) |
| segments_v | 纬度方向分段数(默认 16) |
| BrepModel vde::brep::revolve | ( | const curves::NurbsCurve & | profile, |
| const Point3D & | axis_origin, | ||
| const Vector3D & | axis_dir, | ||
| double | angle_rad = 2.0 *M_PI |
||
| ) |
绕轴旋转平面轮廓
将轮廓绕给定轴旋转,生成旋转体(如轮子、瓶子等)。
| profile | 轮廓曲线(通常位于轴的半平面中) |
| axis_origin | 旋转轴上的一个点 |
| axis_dir | 旋转轴方向(单位向量) |
| angle_rad | 旋转角度(弧度,默认 2π = 完整的旋转体) |
抽壳(挖空实体)
将实体变为等厚度的壳,去除指定面形成开口。
| body | 输入实心实体 |
| face_id | 要移除的面 ID(形成开口),-1 表示封闭壳(不开口) |
| thickness | 壁厚(正值 = 向外偏移,负值 = 向内偏移) |
| StepError vde::brep::step_last_error | ( | ) |
| const std::string& vde::brep::step_last_error_message | ( | ) |
获取最近一次 STEP 导入的可读错误描述
| BrepModel vde::brep::sweep | ( | const curves::NurbsCurve & | profile, |
| const curves::NurbsCurve & | path | ||
| ) |
| ValidationResult vde::brep::validate | ( | const BrepModel & | body | ) |
对 BrepModel 执行综合验证
检查以下项:
| body | 待验证的 B-Rep 模型 |