Skip to main content

ogeom_io/iges/
mod.rs

1//! IGES exchange.
2//!
3//! *Elsewhere:* the IGES half of the exchange layer. The format is ANSI
4//! Y14.26M / IGES 5.3, a fixed-column deck from the 1980s that a great deal
5//! of legacy CAD still speaks; implementing it from the published
6//! specification is interoperation, the same footing STEP was built on.
7
8mod parse;
9mod read;
10mod write;
11
12pub use read::{IgesImport, IgesReport, read_iges};
13pub use write::write_iges;
14
15/// The entity types the reader and writer translate, by number and by the
16/// name the specification gives each. The names are load-bearing twice over:
17/// refusal messages quote them, and `tools/parity.py exchange` greps them to
18/// keep the parity ledger's IGES coverage figure regenerable from this file
19/// rather than asserted.
20pub const SUPPORTED_ENTITIES: &[(i64, &str)] = &[
21    (100, "CIRCULAR_ARC"),
22    (102, "COMPOSITE_CURVE"),
23    (104, "CONIC_ARC"),
24    (108, "PLANE"),
25    (110, "LINE"),
26    (112, "SPLINE_CURVE"),
27    (114, "PARAMETRIC_SPLINE_SURFACE"),
28    (116, "POINT"),
29    (118, "RULED_SURFACE"),
30    (120, "SURFACE_OF_REVOLUTION"),
31    (122, "TABULATED_CYLINDER"),
32    (123, "DIRECTION"),
33    (124, "TRANSFORMATION_MATRIX"),
34    (126, "B_SPLINE_CURVE"),
35    (128, "B_SPLINE_SURFACE"),
36    (130, "OFFSET_CURVE"),
37    (140, "OFFSET_SURFACE"),
38    (141, "BOUNDARY"),
39    (142, "CURVE_ON_SURFACE"),
40    (143, "BOUNDED_SURFACE"),
41    (144, "TRIMMED_SURFACE"),
42    (150, "BLOCK"),
43    (152, "RIGHT_ANGULAR_WEDGE"),
44    (154, "RIGHT_CIRCULAR_CYLINDER"),
45    (156, "RIGHT_CIRCULAR_CONE_FRUSTUM"),
46    (158, "SPHERE"),
47    (160, "TORUS"),
48    (162, "SOLID_OF_REVOLUTION"),
49    (164, "SOLID_OF_LINEAR_EXTRUSION"),
50    (168, "ELLIPSOID"),
51    (180, "BOOLEAN_TREE"),
52    (184, "SOLID_ASSEMBLY"),
53    (186, "MANIFOLD_SOLID"),
54    (190, "PLANE_SURFACE"),
55    (192, "RIGHT_CIRCULAR_CYLINDRICAL_SURFACE"),
56    (194, "RIGHT_CIRCULAR_CONICAL_SURFACE"),
57    (196, "SPHERICAL_SURFACE"),
58    (198, "TOROIDAL_SURFACE"),
59    (202, "ANGULAR_DIMENSION"),
60    (206, "DIAMETER_DIMENSION"),
61    (208, "FLAG_NOTE"),
62    (210, "GENERAL_LABEL"),
63    (212, "GENERAL_NOTE"),
64    (214, "LEADER_ARROW"),
65    (216, "LINEAR_DIMENSION"),
66    (218, "ORDINATE_DIMENSION"),
67    (220, "POINT_DIMENSION"),
68    (222, "RADIUS_DIMENSION"),
69    (228, "GENERAL_SYMBOL"),
70    (308, "SUBFIGURE_DEFINITION"),
71    (314, "COLOR"),
72    (402, "GROUP"),
73    (406, "DEFINITION_LEVELS"),
74    (408, "SINGULAR_SUBFIGURE"),
75    (430, "SOLID_INSTANCE"),
76    (502, "VERTEX_LIST"),
77    (504, "EDGE_LIST"),
78    (508, "LOOP"),
79    (510, "FACE"),
80    (514, "SHELL"),
81];
82
83/// The specification's name for an entity type, where this module knows it.
84#[must_use]
85pub fn entity_name(kind: i64) -> Option<&'static str> {
86    SUPPORTED_ENTITIES
87        .iter()
88        .find(|(k, _)| *k == kind)
89        .map(|(_, n)| *n)
90}