feat(brep): S13-A — IGES import support
Implement IGES (Initial Graphics Exchange Specification) file reader that
converts IGES entities to B-Rep models.
Key features:
- 80-character fixed-width card image parser (S/G/D/P/T sections)
- Directory Entry parsing with all 18 DE fields per entity
- Parameter Data parsing with DE pointer tracking
- D exponent notation support (e.g., 1.5D+2 = 150)
Supported IGES entity types:
Curve entities (→ NurbsCurve):
Type 100 - Circular Arc (rational degree-2)
Type 102 - Composite Curve
Type 104 - Conic Arc (ellipse/hyperbola/parabola)
Type 106 - Copious Data (polyline)
Type 110 - Line (degree-1)
Type 126 - Rational B-Spline Curve
Surface entities (→ NurbsSurface):
Type 108 - Plane
Type 114 - Parametric Spline Surface
Type 118 - Ruled Surface
Type 120 - Surface of Revolution
Type 122 - Tabulated Cylinder (extrude)
Type 128 - Rational B-Spline Surface
Type 140 - Offset Surface
Type 192 - Right Circular Cylindrical Surface
Type 194 - Right Circular Conical Surface
Type 196 - Spherical Surface
Type 198 - Toroidal Surface
Topology entities (→ BrepModel):
Type 186 - Manifold Solid B-Rep Object
Type 502 - Vertex
Type 504 - Edge
Type 508 - Loop
Type 510 - Face
Type 514 - Shell
Tests cover: line, arc, cylinder, sphere, cone, torus, plane,
B-spline curve/surface, ruled surface, revolution surface,
tabulated cylinder, copious data polyline, manifold solid B-Rep,
D exponent notation, empty/truncated file handling, and file errors.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#include "vde/brep/brep.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace vde::brep {
|
||||
|
||||
/// IGES import error codes
|
||||
enum class IgesError {
|
||||
Ok = 0,
|
||||
FileNotFound,
|
||||
ParseError,
|
||||
InvalidSection,
|
||||
UnsupportedEntity,
|
||||
MissingEntity,
|
||||
EntityTypeError,
|
||||
};
|
||||
|
||||
/// Parse an IGES file (.igs/.iges) and return B-Rep bodies
|
||||
/// IGES format: 80-character fixed-width records (ANSI Y14.26M)
|
||||
/// Supports the most common entity types found in CAD files
|
||||
[[nodiscard]] std::vector<BrepModel> import_iges(const std::string& filepath);
|
||||
|
||||
/// Parse IGES data from a string (for testing)
|
||||
[[nodiscard]] std::vector<BrepModel> import_iges_from_string(const std::string& data);
|
||||
|
||||
/// Get the last error from import_iges / import_iges_from_string
|
||||
[[nodiscard]] IgesError iges_last_error();
|
||||
|
||||
/// Get a human-readable description of the last error
|
||||
[[nodiscard]] const std::string& iges_last_error_message();
|
||||
|
||||
} // namespace vde::brep
|
||||
Reference in New Issue
Block a user