fcf25e561d
v4.1 收尾: - IncrementalUpdateEngine: dirty flag propagation, cache invalidation - LargeAssembly: InstanceCache, assembly instancing - STEP import: robust/graceful parsing with skip tracking v4.3 分析工具: - Mass properties (volume, centroid, inertia tensor) - Clearance analysis, wall thickness analysis - Enhanced drawing: hidden-line removal, offset sections, BOM - DXF import (LINE/CIRCLE/ARC/LWPOLYLINE/SPLINE → B-Rep extrusion) v4.4 地基加固: - ToleranceChain: RSS cumulative tolerance propagation (7 tests) - Euler operations: MEV/KEV/MEF/KEF/KEMR/MEKR (20 tests) - Replace hardcoded tolerances with ToleranceConfig in validate - Fix incremental_update test API mismatch (15/15 pass on Linux) Docs: - v4.1-v4.4 development plans + roadmap updated - v4.4 marked complete on Linux 30 files, +3424/-210
57 lines
1.9 KiB
C++
57 lines
1.9 KiB
C++
#pragma once
|
||
/**
|
||
* @file dxf_import.h
|
||
* @brief DXF 文件导入(AutoCAD R12+ 兼容)
|
||
*
|
||
* 解析 DXF 格式的 2D 图形,转换为 B-Rep 轮廓。
|
||
* 支持的实体类型:LINE, CIRCLE, ARC, LWPOLYLINE, SPLINE, POLYLINE
|
||
*
|
||
* @ingroup brep
|
||
*/
|
||
#include "vde/brep/brep.h"
|
||
#include "vde/core/point.h"
|
||
#include <string>
|
||
#include <vector>
|
||
|
||
namespace vde::brep {
|
||
|
||
/// 2D 轮廓点(用于拉伸生成体)
|
||
struct DxfContour {
|
||
std::string layer; ///< 图层名称
|
||
std::vector<core::Point3D> points; ///< 轮廓点序列(Z=0)
|
||
bool closed = false; ///< 是否闭合
|
||
};
|
||
|
||
/// DXF 导入结果
|
||
struct DxfImportResult {
|
||
std::vector<DxfContour> contours; ///< 提取的 2D 轮廓
|
||
std::vector<std::string> layers; ///< 所有图层名称
|
||
int entities_parsed = 0; ///< 成功解析的实体数
|
||
int entities_skipped = 0; ///< 跳过的实体数
|
||
};
|
||
|
||
/// 导入 DXF 文件,提取 2D 轮廓
|
||
/// @param filepath .dxf 文件路径
|
||
/// @return 轮廓列表 + 统计信息
|
||
[[nodiscard]] DxfImportResult import_dxf(const std::string& filepath);
|
||
|
||
/// 从内存字符串导入 DXF
|
||
/// @param dxf_data DXF 文件内容
|
||
/// @return 轮廓列表 + 统计信息
|
||
[[nodiscard]] DxfImportResult import_dxf_from_string(const std::string& dxf_data);
|
||
|
||
/// 将 DXF 轮廓拉伸为 B-Rep 实体
|
||
/// @param contour 2D 轮廓
|
||
/// @param height 拉伸高度
|
||
/// @return B-Rep 实体
|
||
[[nodiscard]] BrepModel extrude_dxf_contour(const DxfContour& contour, double height);
|
||
|
||
/// 导入 DXF 并拉伸所有轮廓为实体
|
||
/// @param filepath .dxf 文件路径
|
||
/// @param height 拉伸高度(默认 10)
|
||
/// @return B-Rep 实体列表(每个轮廓一个实体)
|
||
[[nodiscard]] std::vector<BrepModel> import_dxf_as_solids(const std::string& filepath,
|
||
double height = 10.0);
|
||
|
||
} // namespace vde::brep
|