Skip to main content

ifc_geometry/solid/swept/
mod.rs

1//! Swept solids: a cross section dragged along a path.
2//!
3//! # The family
4//!
5//! `IfcSweptAreaSolid` sweeps an `IfcProfileDef`; `IfcSweptDiskSolid` sweeps a
6//! circular disk along a curve. `IfcSectionedSpine` is neither -- it
7//! interpolates between explicit cross sections along a spine and is a direct
8//! `IfcGeometricRepresentationItem`, not an `IfcSolidModel`.
9//!
10//! # Why the profile is not resolved here
11//!
12//! `SweptArea` is an `IfcProfileDef` reference and profiles are a separate
13//! resource schema owned by another module. Returning the `EntityId` keeps this
14//! module a transcription of the file; the profile layer decides what a profile
15//! means.
16//!
17//! # Units
18//!
19//! Every length and angle here is in the **file's** units, not metres or
20//! radians. Converting is [`crate::units`]'s job and must happen exactly once,
21//! at lowering time. Doing it in an accessor would double-apply the scale for
22//! any caller that also converts.
23
24pub mod area;
25pub mod directrix;
26pub mod trim;
27
28pub use area::{
29    ExtrudedAreaSolid, ExtrudedAreaSolidTapered, RevolvedAreaSolid, RevolvedAreaSolidTapered,
30    SweptAreaSolid,
31};
32pub use directrix::{
33    FixedReferenceSweptAreaSolid, SectionedSpine, SurfaceCurveSweptAreaSolid, SweptDiskSolid,
34    SweptDiskSolidPolygonal,
35};
36pub use trim::TrimMeasure;
37
38/// `IfcSweptAreaSolid` attribute slots, inherited by every subtype.
39///
40/// EXPRESS (IFC4 ADD2 TC1): `IfcSweptAreaSolid` declares `SweptArea` then
41/// `Position`; its supertype `IfcSolidModel` declares no explicit attributes,
42/// so these are absolute slots 0 and 1 for the whole family.
43pub(crate) mod swept_area_slot {
44    /// `SweptArea : IfcProfileDef`, declared on `IfcSweptAreaSolid`.
45    pub const SWEPT_AREA: usize = 0;
46    /// `Position : OPTIONAL IfcAxis2Placement3D`, on `IfcSweptAreaSolid`.
47    pub const POSITION: usize = 1;
48}
49
50/// `IfcExtrudedAreaSolid` own slots, after the two inherited ones.
51///
52/// EXPRESS: `ExtrudedDirection : IfcDirection`, `Depth :
53/// IfcPositiveLengthMeasure`; then `EndSweptArea` on the tapered subtype.
54pub(crate) mod extruded_slot {
55    /// `ExtrudedDirection`, absolute slot 2.
56    pub const EXTRUDED_DIRECTION: usize = 2;
57    /// `Depth`, absolute slot 3.
58    pub const DEPTH: usize = 3;
59    /// `EndSweptArea` on `IfcExtrudedAreaSolidTapered`, absolute slot 4.
60    pub const END_SWEPT_AREA: usize = 4;
61}
62
63/// `IfcRevolvedAreaSolid` own slots.
64///
65/// EXPRESS: `Axis : IfcAxis1Placement`, `Angle : IfcPlaneAngleMeasure`; then
66/// `EndSweptArea` on the tapered subtype.
67pub(crate) mod revolved_slot {
68    /// `Axis`, absolute slot 2.
69    pub const AXIS: usize = 2;
70    /// `Angle`, absolute slot 3.
71    pub const ANGLE: usize = 3;
72    /// `EndSweptArea` on `IfcRevolvedAreaSolidTapered`, absolute slot 4.
73    pub const END_SWEPT_AREA: usize = 4;
74}
75
76/// Directrix-driven swept area slots.
77///
78/// EXPRESS: `IfcSurfaceCurveSweptAreaSolid` and
79/// `IfcFixedReferenceSweptAreaSolid` both declare `Directrix`, `StartParam`,
80/// `EndParam` in that order after the inherited pair, then differ in slot 5.
81pub(crate) mod directrix_slot {
82    /// `Directrix : IfcCurve`, absolute slot 2.
83    pub const DIRECTRIX: usize = 2;
84    /// `StartParam`, absolute slot 3: `IfcParameterValue` (IFC2X3, IFC4) or
85    /// `IfcCurveMeasureSelect` (IFC4X3); see [`super::trim`].
86    pub const START_PARAM: usize = 3;
87    /// `EndParam`, absolute slot 4, declared as `StartParam`.
88    pub const END_PARAM: usize = 4;
89    /// `ReferenceSurface : IfcSurface` on `IfcSurfaceCurveSweptAreaSolid`.
90    pub const REFERENCE_SURFACE: usize = 5;
91    /// `FixedReference : IfcDirection` on `IfcFixedReferenceSweptAreaSolid`.
92    pub const FIXED_REFERENCE: usize = 5;
93}
94
95/// `IfcSweptDiskSolid` slots.
96///
97/// EXPRESS: it subtypes `IfcSolidModel` directly, so `Directrix` is slot 0 --
98/// there is no inherited `SweptArea` here despite the family resemblance.
99pub(crate) mod disk_slot {
100    /// `Directrix : IfcCurve`, absolute slot 0.
101    pub const DIRECTRIX: usize = 0;
102    /// `Radius : IfcPositiveLengthMeasure`, absolute slot 1.
103    pub const RADIUS: usize = 1;
104    /// `InnerRadius : OPTIONAL IfcPositiveLengthMeasure`, absolute slot 2.
105    pub const INNER_RADIUS: usize = 2;
106    /// `StartParam : OPTIONAL IfcParameterValue`, absolute slot 3.
107    pub const START_PARAM: usize = 3;
108    /// `EndParam : OPTIONAL IfcParameterValue`, absolute slot 4.
109    pub const END_PARAM: usize = 4;
110    /// `FilletRadius` on `IfcSweptDiskSolidPolygonal`, absolute slot 5.
111    pub const FILLET_RADIUS: usize = 5;
112}
113
114/// `IfcSectionedSpine` slots.
115///
116/// EXPRESS: subtypes `IfcGeometricRepresentationItem`, which declares no
117/// explicit attributes, so all three slots are its own.
118pub(crate) mod spine_slot {
119    /// `SpineCurve : IfcCompositeCurve`, absolute slot 0.
120    pub const SPINE_CURVE: usize = 0;
121    /// `CrossSections : LIST [2:?] OF IfcProfileDef`, absolute slot 1.
122    pub const CROSS_SECTIONS: usize = 1;
123    /// `CrossSectionPositions : LIST [2:?] OF IfcAxis2Placement3D`, slot 2.
124    pub const CROSS_SECTION_POSITIONS: usize = 2;
125}