[T3] Merge: Wendeltreppe – Spindel im Grundriss/IFC, Untersicht-Mengen, runder Handlauf
This commit is contained in:
15 files changed
+470
-48
No files matched your search
@@ -1688,7 +1688,7 @@ Reihenfolge = Abhängigkeiten. Neue Geometrie entsteht in Rust ([K]).
|
||||
`Dimension.arcCenter`: Masslinie als Bogen, radiale Hilfslinien, Masszahl = Bogenlänge; DXF als Linien/Text).
|
||||
Geprüft: Rust-Tests, CLI-SVG Grundriss/Schnitte/Ansicht angesehen, IFC validiert (Linux), nicht in der
|
||||
Tauri-App. Offen: Wände teilen/trimmen (fehlt auch für gerade); Bogenmass-Griffe verschieben Punkte frei (nicht auf dem Kreis).
|
||||
- ◐ **[T3] Wendeltreppe/Wendelfläche** + Handlauf-Sweep. · M — 30.10.: Ortbeton-Wendeltreppe mit echter Wendelfläche (Schraubenuntersicht, ebene Tritte, `stairs3d::spiral_mesh`), Handlauf als Schraubensweep samt Pfosten (links/rechts/beide nach Drehsinn), Mittelsäule `Stair.centerColumn` (Radius, Objekt-Info; als Block in 3D/Schnitt). Tests Rust (Volumen, Punkte auf der Schraube, Sweep-Radius, Säule). Plansymbol (Bögen, Schnittlinie, Pfeil) war schon da und im CLI-SVG geprüft; nicht in der Tauri-App. Offen: Säule im Grundriss, IFC/Mengen der Wendelfläche, Handlauf-Profil rund.
|
||||
- ◐ **[T3] Wendeltreppe/Wendelfläche** + Handlauf-Sweep. · M — 30.10.: Ortbeton-Wendeltreppe mit echter Wendelfläche (Schraubenuntersicht, ebene Tritte, `stairs3d::spiral_mesh`), Handlauf als Schraubensweep samt Pfosten (links/rechts/beide nach Drehsinn), Mittelsäule `Stair.centerColumn` (Radius, Objekt-Info; als Block in 3D/Schnitt). Tests Rust (Volumen, Punkte auf der Schraube, Sweep-Radius, Säule). Plansymbol (Bögen, Schnittlinie, Pfeil) war schon da und im CLI-SVG geprüft; nicht in der Tauri-App. 5.11.: Spindel im Grundriss (`plan_stair`, Kreis; von der Schnitthöhe geschnitten = gefüllt, sonst Umriss); IFC: Spindel als eigene IfcColumn mit `Qto_ColumnBaseQuantities` (vorher als Tritt-Prisma im Lauf mitgezählt bzw. bei Beton als falscher 2. Lauf), Lauflänge auf der Schraubenlinie, Ortbeton-Lauf (Netz) mit Untersicht `Dossier_Qto_StairFlight.SoffitArea`; Objekt-Info Treppe zeigt Betonvolumen und Untersicht (Ortbeton gerade/Wendel); Handlauf der Wendel als runder Rohr-Sweep (12 Ecken, rotationsminimierende Rahmen) mit runden Pfosten. Tests Rust (Plan-Säule, Rohr, IFC-Teile/Mengen, fileio COLUMN, Objekt-Info); IFC mit `validate-ifc.py` geprüft; nur Linux, nicht in der Tauri-App. Offen: Handlauf gerader Treppen weiterhin eckig; Wendelfläche der Spindel-/Wangentreppen ohne Untersicht-Menge.
|
||||
- ◐ **[T4] Import-Meshes glätten oder kantig** (30.10.) `ImportedMesh.smoothShading`/`creaseAngle` (Vorgabe 30°,
|
||||
auch STEP-Körper), Schalter + Knickwinkel im Panel „Gelände & Kontext"; `RMesh.creaseAngle` → render3d
|
||||
`MeshInput.creaseAngle`: geteilte Normalen je Ecke (über die Lage verschweisst, flächengewichtet, nur Nachbarn
|
||||
|
||||
@@ -1389,7 +1389,11 @@ fn w_stair(f: &mut Flat, structure: f64, id: &str, predefined: &str, footprint:
|
||||
f.nums(&[n, fl.risers, fl.treads, fl.riser_height, fl.tread_length]);
|
||||
let p = f.str(fl.predefined);
|
||||
f.num(p);
|
||||
w_psets(f, &qto("Qto_StairFlightBaseQuantities", fl.quantities.clone()));
|
||||
let mut psets = qto("Qto_StairFlightBaseQuantities", fl.quantities.clone());
|
||||
if let Some(a) = fl.soffit_area {
|
||||
psets.extend(qto("Dossier_Qto_StairFlight", vec![Qty { name: "SoffitArea", kind: QtyKind::Area, value: a }]));
|
||||
}
|
||||
w_psets(f, &psets);
|
||||
match &fl.body {
|
||||
FlightBody::Mesh(m) => {
|
||||
f.num(1.0);
|
||||
@@ -1427,6 +1431,18 @@ fn w_stair(f: &mut Flat, structure: f64, id: &str, predefined: &str, footprint:
|
||||
f.num(0.0);
|
||||
}
|
||||
}
|
||||
match &parts.column {
|
||||
Some(c) => {
|
||||
let n = f.str("Spindel");
|
||||
f.nums(&[1.0, n]);
|
||||
w_pts(f, &c.pts);
|
||||
f.nums(&[c.z_rel, c.depth]);
|
||||
w_psets(f, &qto("Qto_ColumnBaseQuantities", c.quantities.clone()));
|
||||
}
|
||||
None => {
|
||||
f.num(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -9,9 +9,12 @@
|
||||
//! Zuordnung der Tritt-Prismen: bei "L" ist das Podest das Prisma mit dem Umriss des Podest-Polygons
|
||||
//! der Treppengeometrie; Tritte bis zur Podest-Oberkante gehören zum ersten, die darüber zum
|
||||
//! zweiten Lauf. Gerade und Wendeltreppen haben einen Lauf (die Wendel-Mitte bleibt Teil davon).
|
||||
//! Die Mittelsäule (Spindel, `Stair.centerColumn`) einer Wendel ist kein Tritt: eigener Teil
|
||||
//! (IfcColumn) mit Stützen-Basismengen. Ortbeton-Läufe (Netz) tragen zusätzlich die Untersicht
|
||||
//! (Schalfläche, bei der Wendel die Wendelfläche) in `Dossier_Qto_StairFlight`.
|
||||
|
||||
use crate::export_flat::{js_key, mesh_volume, orient_outward};
|
||||
use crate::ifc_quantities::{flight_quantities, railing_quantities, ring_area, slab_quantities, Qty};
|
||||
use crate::ifc_quantities::{column_quantities, flight_quantities, railing_quantities, ring_area, slab_quantities, Qty};
|
||||
use crate::jsmath::hypot2;
|
||||
use crate::jsnum::round;
|
||||
use crate::model::*;
|
||||
@@ -48,6 +51,8 @@ pub struct StairFlightParts {
|
||||
/// IfcStairFlightTypeEnum.
|
||||
pub predefined: &'static str,
|
||||
pub quantities: Vec<Qty>,
|
||||
/// Untersicht (m²) eines Ortbeton-Laufs (Netz); `None` bei Tritt-Prismen.
|
||||
pub soffit_area: Option<f64>,
|
||||
pub body: FlightBody,
|
||||
}
|
||||
|
||||
@@ -70,6 +75,8 @@ pub struct StairParts {
|
||||
pub flights: Vec<StairFlightParts>,
|
||||
pub landing: Option<Landing>,
|
||||
pub rail: Option<Rail>,
|
||||
/// Mittelsäule (Spindel) einer Wendel: Prisma + Stützen-Basismengen.
|
||||
pub column: Option<Landing>,
|
||||
}
|
||||
|
||||
const EPS: f64 = 1e-6;
|
||||
@@ -112,6 +119,53 @@ fn ifc_mesh(mut positions: Vec<f64>, indices: &[u32], base: f64) -> IfcMesh {
|
||||
IfcMesh { positions, indices }
|
||||
}
|
||||
|
||||
/// Untersicht eines geschlossenen, nach aussen orientierten Netzes: Summe der Dreiecke, deren
|
||||
/// Normale nach unten zeigt (Schalfläche; bei der Wendel die Wendelfläche samt flachem Anlauf).
|
||||
pub fn soffit_area(positions: &[f64], indices: &[u32]) -> f64 {
|
||||
let p = |i: u32| {
|
||||
let k = 3 * i as usize;
|
||||
[positions[k], positions[k + 1], positions[k + 2]]
|
||||
};
|
||||
let mut sum = 0.0;
|
||||
for t in indices.chunks_exact(3) {
|
||||
if t.iter().any(|&i| 3 * i as usize + 2 >= positions.len()) {
|
||||
continue;
|
||||
}
|
||||
let (a, b, c) = (p(t[0]), p(t[1]), p(t[2]));
|
||||
let (u, v) = ([b[0] - a[0], b[1] - a[1], b[2] - a[2]], [c[0] - a[0], c[1] - a[1], c[2] - a[2]]);
|
||||
let n = [u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]];
|
||||
let len = crate::jsmath::hypot(&[n[0], n[1], n[2]]);
|
||||
if len > 0.0 && n[2] < -1e-9 * len {
|
||||
sum += len / 2.0;
|
||||
}
|
||||
}
|
||||
sum
|
||||
}
|
||||
|
||||
/// Ortbeton-Lauf (Netz) einer Treppe: (Betonvolumen m³, Untersicht m²); `None` ohne Netz (keine
|
||||
/// Beton-Gerade/-Wendel). `one` wie bei [`stair_parts`]. Ohne Mittelsäule.
|
||||
pub fn concrete_flight_amounts(one: &Project) -> Option<(f64, f64)> {
|
||||
let meshes = model3d::emit_stair_meshes(one);
|
||||
if meshes.is_empty() {
|
||||
return None;
|
||||
}
|
||||
let (positions, indices) = concat(&meshes);
|
||||
let m = ifc_mesh(positions, &indices, 0.0);
|
||||
Some((mesh_volume(&m.positions, &m.indices), soffit_area(&m.positions, &m.indices)))
|
||||
}
|
||||
|
||||
/// Lauflänge auf der Lauflinie: Wendel = Schraubenlinie im Laufradius, sonst Lauflänge; mit Steigung.
|
||||
fn walk_length(stair: &Stair, rise: f64) -> f64 {
|
||||
let run = if stair.shape == StairShape::Spiral {
|
||||
let half_w = 0.05_f64.max(stair.width / 2.0);
|
||||
let radius = (half_w + 0.1).max(stair.radius.unwrap_or(stair.width));
|
||||
stair.sweep.unwrap_or(270.0).to_radians().abs() * radius
|
||||
} else {
|
||||
stair.run_length
|
||||
};
|
||||
hypot2(run, rise)
|
||||
}
|
||||
|
||||
fn solid_of(s: &RSlab, base: f64) -> StairSolid {
|
||||
StairSolid { pts: s.outline.iter().map(|p| Vec2 { x: p[0], y: p[1] }).collect(), z_rel: s.z_bottom - base, depth: s.z_top - s.z_bottom }
|
||||
}
|
||||
@@ -125,7 +179,16 @@ pub fn stair_parts(one: &Project, stair: &Stair, base: f64) -> StairParts {
|
||||
let geo = crate::stair::decode_geometry(&crate::stair::geometry(&stair.encode(), rise));
|
||||
let (riser_height, tread_depth, n_treads) = geo.as_ref().map_or((0.0, 0.0, 0), |g| (g.riser_height, g.tread_depth, g.treads.len()));
|
||||
let geo_landing = geo.as_ref().and_then(|g| g.landing.as_ref());
|
||||
let slabs = model3d::emit_stairs(one, false);
|
||||
let mut slabs = model3d::emit_stairs(one, false);
|
||||
// Mittelsäule: `slabs_of` hängt sie bei einer Wendel mit Säule als letzte Platte an.
|
||||
let column = (stair.shape == StairShape::Spiral && stair.center.is_some() && stair.center_column.is_some_and(|r| r.is_finite() && r > 0.0))
|
||||
.then(|| slabs.pop())
|
||||
.flatten()
|
||||
.map(|c| {
|
||||
let s = solid_of(&c, base);
|
||||
let quantities = column_quantities(&s.pts, s.depth);
|
||||
Landing { pts: s.pts, z_rel: s.z_rel, depth: s.depth, quantities }
|
||||
});
|
||||
let meshes = model3d::emit_stair_meshes(one);
|
||||
let predefined = if stair.shape == StairShape::Spiral { "SPIRAL" } else { "STRAIGHT" };
|
||||
|
||||
@@ -190,7 +253,8 @@ pub fn stair_parts(one: &Project, stair: &Stair, base: f64) -> StairParts {
|
||||
riser_height,
|
||||
tread_length: tread_depth,
|
||||
predefined,
|
||||
quantities: flight_quantities(hypot2(run, lift), volume),
|
||||
quantities: flight_quantities(if stair.shape == StairShape::Spiral { walk_length(stair, rise) } else { hypot2(run, lift) }, volume),
|
||||
soffit_area: None,
|
||||
body: FlightBody::Solids(solids),
|
||||
});
|
||||
}
|
||||
@@ -199,6 +263,7 @@ pub fn stair_parts(one: &Project, stair: &Stair, base: f64) -> StairParts {
|
||||
let (positions, indices) = concat(&meshes);
|
||||
let mesh = ifc_mesh(positions, &indices, base);
|
||||
let volume = mesh_volume(&mesh.positions, &mesh.indices);
|
||||
let soffit = soffit_area(&mesh.positions, &mesh.indices);
|
||||
flights.push(StairFlightParts {
|
||||
name: if flights.is_empty() { "Lauf".to_string() } else { format!("Lauf {}", flights.len() + 1) },
|
||||
risers: n_treads as f64,
|
||||
@@ -206,7 +271,8 @@ pub fn stair_parts(one: &Project, stair: &Stair, base: f64) -> StairParts {
|
||||
riser_height,
|
||||
tread_length: tread_depth,
|
||||
predefined,
|
||||
quantities: flight_quantities(hypot2(stair.run_length, rise), volume),
|
||||
quantities: flight_quantities(walk_length(stair, rise), volume),
|
||||
soffit_area: Some(soffit),
|
||||
body: FlightBody::Mesh(mesh),
|
||||
});
|
||||
}
|
||||
@@ -221,9 +287,9 @@ pub fn stair_parts(one: &Project, stair: &Stair, base: f64) -> StairParts {
|
||||
let rail = (!rail_meshes.is_empty()).then(|| {
|
||||
let (positions, indices) = concat(&rail_meshes);
|
||||
let sides = if one.stair_type(stair).and_then(|t| t.railing) == Some(StairTypeRailing::Beide) { 2.0 } else { 1.0 };
|
||||
Rail { mesh: ifc_mesh(positions, &indices, base), quantities: railing_quantities(hypot2(stair.run_length, rise) * sides) }
|
||||
Rail { mesh: ifc_mesh(positions, &indices, base), quantities: railing_quantities(walk_length(stair, rise) * sides) }
|
||||
});
|
||||
StairParts { flights, landing, rail }
|
||||
StairParts { flights, landing, rail, column }
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -295,5 +361,80 @@ mod tests {
|
||||
let rail = parts.rail.expect("Handlauf");
|
||||
let len = rail.quantities[0].value;
|
||||
assert!((len - 2.0 * hypot2(3.0, 2.6)).abs() < 1e-9);
|
||||
// Gerade Laufplatte: Untersicht = schräge Platte + flacher Anlauf ≈ Breite × Lauflänge (geneigt)
|
||||
let soffit = parts.flights.iter().find_map(|f| f.soffit_area).unwrap();
|
||||
assert!(soffit > 3.0 && soffit < 1.0 * hypot2(3.0, 2.6) + 0.5, "Untersicht {soffit}");
|
||||
}
|
||||
|
||||
fn wendel(type_id: &str, column: Option<f64>) -> Stair {
|
||||
Stair {
|
||||
id: "W".into(),
|
||||
floor_id: "eg".into(),
|
||||
shape: StairShape::Spiral,
|
||||
start: Vec2 { x: 2.0, y: 0.0 },
|
||||
dir: Vec2 { x: 0.0, y: 1.0 },
|
||||
center: Some(Vec2 { x: 0.0, y: 0.0 }),
|
||||
radius: Some(1.5),
|
||||
sweep: Some(270.0),
|
||||
width: 1.0,
|
||||
total_rise: Some(2.8),
|
||||
step_count: 14.0,
|
||||
type_id: Some(type_id.into()),
|
||||
center_column: column,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
fn beton() -> StairType {
|
||||
StairType { id: "b".into(), structure: StairTypeStructure::Beton, railing: Some(StairTypeRailing::Rechts), default_width: 1.0, ..Default::default() }
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn beton_wendel_ein_lauf_als_netz_mit_wendelflaeche() {
|
||||
let st = wendel("b", Some(0.12));
|
||||
let p = project_with(st.clone(), Some(beton()));
|
||||
let parts = stair_parts(&p, &st, 0.0);
|
||||
// genau ein Lauf (das Netz) — die Säule ist kein Lauf
|
||||
assert_eq!(parts.flights.len(), 1, "{:?}", parts.flights.iter().map(|f| &f.name).collect::<Vec<_>>());
|
||||
let f = &parts.flights[0];
|
||||
assert_eq!(f.predefined, "SPIRAL");
|
||||
let FlightBody::Mesh(m) = &f.body else { panic!("Wendel aus Ortbeton als Netz") };
|
||||
let v = mesh_volume(&m.positions, &m.indices);
|
||||
let gv = f.quantities.iter().find(|q| q.name == "GrossVolume").unwrap().value;
|
||||
assert!(v > 1.5 && (gv - v).abs() < 1e-9, "Volumen {v} / {gv}");
|
||||
assert_eq!(concrete_flight_amounts(&p).map(|a| a.0), Some(v));
|
||||
// Wendelfläche: Ringsektor 270° r 1…2 = 7.07 m² im Grundriss, geneigt etwas grösser
|
||||
let soffit = f.soffit_area.unwrap();
|
||||
let plan = 0.75 * std::f64::consts::PI * (4.0 - 1.0);
|
||||
assert!(soffit > plan && soffit < 1.3 * plan, "Untersicht {soffit} vs. {plan}");
|
||||
// Länge auf der Lauflinie (r 1.5, 270°) mit Steigung
|
||||
let len = f.quantities.iter().find(|q| q.name == "Length").unwrap().value;
|
||||
assert!((len - hypot2(1.5 * 1.5 * std::f64::consts::PI, 2.8)).abs() < 1e-9, "{len}");
|
||||
// Säule: eigener Teil mit Stützenmengen
|
||||
let c = parts.column.expect("Spindel");
|
||||
assert!((c.depth - 2.8).abs() < 1e-9);
|
||||
let cv = c.quantities.iter().find(|q| q.name == "NetVolume").unwrap().value;
|
||||
assert!((cv - std::f64::consts::PI * 0.0144 * 2.8).abs() < 0.01, "{cv}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn spindeltreppe_saeule_nicht_im_lauf() {
|
||||
let ty = StairType { id: "sp".into(), structure: StairTypeStructure::Spindel, tread_thickness: 0.05, default_width: 1.0, ..Default::default() };
|
||||
let mit = wendel("sp", Some(0.1));
|
||||
let ohne = wendel("sp", None);
|
||||
let a = stair_parts(&project_with(mit.clone(), Some(ty.clone())), &mit, 0.0);
|
||||
let b = stair_parts(&project_with(ohne.clone(), Some(ty)), &ohne, 0.0);
|
||||
let vol = |p: &StairParts| p.flights[0].quantities.iter().find(|q| q.name == "GrossVolume").unwrap().value;
|
||||
assert!((vol(&a) - vol(&b)).abs() < 1e-9, "Säule nicht im Laufvolumen");
|
||||
assert!(a.column.is_some() && b.column.is_none());
|
||||
assert!(a.flights[0].soffit_area.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn untersicht_eines_wuerfels_ist_seine_bodenflaeche() {
|
||||
let pos = [0., 0., 0., 1., 0., 0., 1., 1., 0., 0., 1., 0., 0., 0., 1., 1., 0., 1., 1., 1., 1., 0., 1., 1.];
|
||||
let idx = [0, 2, 1, 0, 3, 2, 4, 5, 6, 4, 6, 7, 0, 1, 5, 0, 5, 4, 1, 2, 6, 1, 6, 5, 2, 3, 7, 2, 7, 6, 3, 0, 4, 3, 4, 7];
|
||||
assert!((soffit_area(&pos, &idx) - 1.0).abs() < 1e-12);
|
||||
assert_eq!(soffit_area(&pos, &[0, 1, 99]), 0.0);
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,10 @@ impl Out {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn plan_stair(params: &[f64], total_rise: f64, cut_rise: f64, lw_mm: f64, filled_arrow: bool) -> Vec<f64> {
|
||||
/// Ecken des Säulenkreises im Grundriss.
|
||||
const COLUMN_SEGMENTS: usize = 48;
|
||||
|
||||
pub fn plan_stair(params: &[f64], total_rise: f64, cut_rise: f64, lw_mm: f64, filled_arrow: bool, column_r: f64) -> Vec<f64> {
|
||||
let Some(p) = decode_params(params) else { return Vec::new() };
|
||||
if !(total_rise.is_finite() && cut_rise.is_finite() && lw_mm.is_finite()) {
|
||||
return Vec::new();
|
||||
@@ -107,6 +110,20 @@ pub fn plan_stair(params: &[f64], total_rise: f64, cut_rise: f64, lw_mm: f64, fi
|
||||
}
|
||||
}
|
||||
|
||||
// Mittelsäule (Spindel) der Wendel: reicht über die ganze Steighöhe, also geschnitten, sobald die
|
||||
// Schnittebene innerhalb der Treppe liegt.
|
||||
if let (true, Some(c)) = (p.shape == "spiral" && column_r.is_finite() && column_r > 0.0, p.center) {
|
||||
let r = column_r.min(5.0);
|
||||
let pts: Vec<Vec2> = (0..COLUMN_SEGMENTS)
|
||||
.map(|k| {
|
||||
let a = std::f64::consts::TAU * k as f64 / COLUMN_SEGMENTS as f64;
|
||||
Vec2::new(c.x + r * jsnum::cos(a), c.y + r * jsnum::sin(a))
|
||||
})
|
||||
.collect();
|
||||
let cut = cut_rise > 0.0 && cut_rise < total_rise;
|
||||
o.polygon(&pts, lw_mm, cut);
|
||||
}
|
||||
|
||||
let mut out = Vec::with_capacity(o.buf.len() + 1);
|
||||
out.push(o.n as f64);
|
||||
out.extend(o.buf);
|
||||
@@ -143,7 +160,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn gerade_treppe_hat_tritte_lauflinie_pfeil_und_aussenlinie() {
|
||||
let b = plan_stair(&straight(), 2.8, 1.0, 0.25, false);
|
||||
let b = plan_stair(&straight(), 2.8, 1.0, 0.25, false, 0.0);
|
||||
let t = tags(&b);
|
||||
// 16 Tritte × (Polygon + Kante) + 2 Bruchstriche + Lauflinie + 2 Pfeilflügel + Aussenlinie
|
||||
assert_eq!(t.iter().filter(|x| **x == 1.0).count(), 16 + 1);
|
||||
@@ -154,24 +171,62 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn gefuellter_pfeil_ist_ein_dreieck() {
|
||||
let offen = tags(&plan_stair(&straight(), 2.8, 1.0, 0.25, false));
|
||||
let voll = tags(&plan_stair(&straight(), 2.8, 1.0, 0.25, true));
|
||||
let offen = tags(&plan_stair(&straight(), 2.8, 1.0, 0.25, false, 0.0));
|
||||
let voll = tags(&plan_stair(&straight(), 2.8, 1.0, 0.25, true, 0.0));
|
||||
assert_eq!(voll.len() + 1, offen.len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wendel_liefert_boegen() {
|
||||
let p = vec![2.0, 0.0, 0.0, 1.0, 0.0, 3.0, NAN, NAN, 0.0, 0.0, 1.5, 270.0, 1.0, 14.0, NAN, 0.0];
|
||||
let t = tags(&plan_stair(&p, 2.8, 1.0, 0.25, false));
|
||||
let t = tags(&plan_stair(&p, 2.8, 1.0, 0.25, false, 0.0));
|
||||
assert_eq!(t.iter().filter(|x| **x == 3.0).count(), 2);
|
||||
}
|
||||
|
||||
/// Letztes Polygon im Puffer: (gefüllt, Punkte).
|
||||
fn last_polygon(buf: &[f64]) -> Option<(bool, Vec<[f64; 2]>)> {
|
||||
let n = buf[0] as usize;
|
||||
let mut i = 1;
|
||||
let mut last = None;
|
||||
for _ in 0..n {
|
||||
match buf[i] as i64 {
|
||||
1 => {
|
||||
let k = buf[i + 3] as usize;
|
||||
last = Some((buf[i + 2] != 0.0, (0..k).map(|j| [buf[i + 4 + 2 * j], buf[i + 5 + 2 * j]]).collect()));
|
||||
i += 4 + 2 * k;
|
||||
}
|
||||
2 => i += 8,
|
||||
_ => i += 9,
|
||||
}
|
||||
}
|
||||
last
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wendel_saeule_geschnitten_gefuellt_sonst_umriss() {
|
||||
let p = vec![2.0, 0.0, 0.0, 1.0, 0.0, 3.0, NAN, NAN, 0.0, 0.0, 1.5, 270.0, 1.0, 14.0, NAN, 0.0];
|
||||
let ohne = tags(&plan_stair(&p, 2.8, 1.0, 0.25, false, 0.0));
|
||||
let mit = plan_stair(&p, 2.8, 1.0, 0.25, false, 0.15);
|
||||
assert_eq!(tags(&mit).len(), ohne.len() + 1);
|
||||
let (filled, pts) = last_polygon(&mit).unwrap();
|
||||
assert!(filled, "Schnitthöhe in der Treppe: Säule geschnitten (Poché)");
|
||||
assert_eq!(pts.len(), COLUMN_SEGMENTS);
|
||||
assert!(pts.iter().all(|q| (q[0].hypot(q[1]) - 0.15).abs() < 1e-12), "Kreis um das Zentrum");
|
||||
// Schnittebene über der Treppe: nur Umriss.
|
||||
let (filled, _) = last_polygon(&plan_stair(&p, 2.8, 3.5, 0.25, false, 0.15)).unwrap();
|
||||
assert!(!filled);
|
||||
// Gerade Treppe: keine Säule.
|
||||
assert_eq!(tags(&plan_stair(&straight(), 2.8, 1.0, 0.25, false, 0.15)).len(), tags(&plan_stair(&straight(), 2.8, 1.0, 0.25, false, 0.0)).len());
|
||||
// Unsinn-Radius: keine Säule, kein Panic.
|
||||
assert_eq!(tags(&plan_stair(&p, 2.8, 1.0, 0.25, false, NAN)).len(), ohne.len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unsinn_ergibt_leeres_ergebnis() {
|
||||
assert!(plan_stair(&[1.0, 2.0], 2.8, 1.0, 0.25, false).is_empty());
|
||||
assert!(plan_stair(&straight(), NAN, 1.0, 0.25, false).is_empty());
|
||||
assert!(plan_stair(&[1.0, 2.0], 2.8, 1.0, 0.25, false, 0.1).is_empty());
|
||||
assert!(plan_stair(&straight(), NAN, 1.0, 0.25, false, 0.0).is_empty());
|
||||
let mut kaputt = straight();
|
||||
kaputt[1] = NAN;
|
||||
assert!(plan_stair(&kaputt, 2.8, 1.0, 0.25, false).is_empty());
|
||||
assert!(plan_stair(&kaputt, 2.8, 1.0, 0.25, false, 0.0).is_empty());
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ pub fn plan_stairs(c: &Ctx, out: &mut Vec<Primitive>, bounds: &mut Bounds) {
|
||||
bounds.acc(q.x, q.y);
|
||||
}
|
||||
}
|
||||
let f = crate::plan::stair_symbol::plan_stair(¶ms, zt - zb, cut_height, lw, s.arrow_style == Some(StairArrowStyle::Filled));
|
||||
let f = crate::plan::stair_symbol::plan_stair(¶ms, zt - zb, cut_height, lw, s.arrow_style == Some(StairArrowStyle::Filled), s.center_column.unwrap_or(0.0));
|
||||
if f.is_empty() {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -909,6 +909,21 @@ fn stair_selection(root: &Map<String, Value>, s: &Value) -> Result<J, String> {
|
||||
}
|
||||
let b = crate::stair::bbox(&geo);
|
||||
let bb = if b.len() < 4 { [0.0; 4] } else { [b[0], b[1], b[2], b[3]] };
|
||||
// Ortbeton (gerade/Wendel): Betonvolumen des Laufs und Untersicht (Schal-/Wendelfläche) aus
|
||||
// demselben Netz wie 3D und IFC — Projekt nur mit dieser Treppe und ihrem Typ.
|
||||
let amounts = {
|
||||
let ty: Option<crate::model::StairType> = typed.type_id.as_ref().and_then(|tid| {
|
||||
arr(root.get("stairTypes")).iter().find(|t| field(t, "id").and_then(Value::as_str) == Some(tid.as_str())).and_then(|t| serde_json::from_value(t.clone()).ok())
|
||||
});
|
||||
ty.and_then(|ty| {
|
||||
let one = crate::model::Project {
|
||||
stairs: Some(vec![crate::model::Stair { total_rise: Some(total_rise), floor_id: String::new(), ..typed.clone() }]),
|
||||
stair_types: Some(vec![ty]),
|
||||
..Default::default()
|
||||
};
|
||||
crate::ifc_stairs::concrete_flight_amounts(&one)
|
||||
})
|
||||
};
|
||||
let info = O::default()
|
||||
.raw("shape", s, "shape")
|
||||
.raw("width", s, "width")
|
||||
@@ -925,6 +940,8 @@ fn stair_selection(root: &Map<String, Value>, s: &Value) -> Result<J, String> {
|
||||
.o("floorName", floor_name(floor, field(s, "floorId")))
|
||||
.n("zBottom", zb)
|
||||
.n("zTop", zt)
|
||||
.o("concreteVolume", amounts.map(|a| js_num(a.0)))
|
||||
.o("soffitArea", amounts.map(|a| js_num(a.1)))
|
||||
.done();
|
||||
Ok(O::default()
|
||||
.s("kind", "stair")
|
||||
@@ -1355,6 +1372,28 @@ mod tests {
|
||||
assert_eq!(sel(&bad, json!({"wallIds": ["w"]})).unwrap_err(), "Unbekannter Wandtyp: x");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn betonwendel_mit_volumen_und_wendelflaeche() {
|
||||
let stair = |ty: &str| json!({"id": "s", "floorId": "eg", "shape": "spiral", "start": {"x": 2, "y": 0}, "dir": {"x": 0, "y": 1},
|
||||
"runLength": 0, "center": {"x": 0, "y": 0}, "radius": 1.5, "sweep": 270, "width": 1, "totalRise": 2.8, "stepCount": 14, "typeId": ty});
|
||||
let r = root(json!({
|
||||
"drawingLevels": [{"id": "eg", "name": "EG", "kind": "floor", "baseElevation": 0}],
|
||||
"stairTypes": [{"id": "b", "name": "Beton", "structure": "beton", "closedRisers": false, "treadThickness": 0.04, "defaultWidth": 1},
|
||||
{"id": "h", "name": "Holz", "structure": "wange", "closedRisers": false, "treadThickness": 0.04, "defaultWidth": 1}],
|
||||
"stairs": [stair("b")],
|
||||
}));
|
||||
let s = sel(&r, json!({"stairId": "s"})).unwrap();
|
||||
let v = s["stair"]["concreteVolume"].as_f64().unwrap();
|
||||
let a = s["stair"]["soffitArea"].as_f64().unwrap();
|
||||
assert!(v > 1.5 && v < 3.2, "{v}");
|
||||
assert!(a > 7.0 && a < 9.5, "{a}");
|
||||
// Holz-Wangentreppe: keine Betonmengen
|
||||
let mut h = r.clone();
|
||||
h["stairs"] = json!([stair("h")]);
|
||||
let s = sel(&h, json!({"stairId": "s"})).unwrap();
|
||||
assert!(s["stair"].get("concreteVolume").is_none() && s["stair"].get("soffitArea").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hoehen_von_waenden_und_decken() {
|
||||
let r = root(json!({
|
||||
|
||||
+129
-11
@@ -539,8 +539,85 @@ fn strut_box(a: V3, b: V3, half: f64) -> Option<(Vec<f64>, Vec<u32>)> {
|
||||
Some((positions, indices))
|
||||
}
|
||||
|
||||
/// Handlauf einer Wendeltreppe als Schraubensweep (Quader-Stücke auf der Schraubenlinie) samt
|
||||
/// Pfosten auf den Trittmitten, in einem Netz je Treppe.
|
||||
/// Ecken des runden Handlauf-Profils.
|
||||
const TUBE_SEGMENTS: usize = 12;
|
||||
|
||||
/// Rohr (Kreisprofil, Radius `radius`) entlang eines Polygonzugs, mit Deckeln; geschlossenes,
|
||||
/// nach aussen orientiertes Netz. Profil-Ebene je Punkt senkrecht zur gemittelten Tangente; die
|
||||
/// Profil-Lage wird mitgeführt (Doppelspiegelung, ohne Verdrillen). `None` bei < 2 Punkten oder
|
||||
/// entarteten (zu kurzen/NaN-) Segmenten.
|
||||
fn tube_along(path: &[V3], radius: f64) -> Option<(Vec<f64>, Vec<u32>)> {
|
||||
let n = path.len();
|
||||
if n < 2 || !(radius > 0.0) {
|
||||
return None;
|
||||
}
|
||||
let sub = |a: V3, b: V3| [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
|
||||
let dot = |a: V3, b: V3| a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
||||
let cross = |a: V3, b: V3| [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
|
||||
let unit = |a: V3| {
|
||||
let l = hypot(&[a[0], a[1], a[2]]);
|
||||
(l >= EPS).then(|| [a[0] / l, a[1] / l, a[2] / l])
|
||||
};
|
||||
let seg: Vec<V3> = path.windows(2).map(|w| unit(sub(w[1], w[0]))).collect::<Option<_>>()?;
|
||||
let tangents: Vec<V3> = (0..n)
|
||||
.map(|i| match (i.checked_sub(1).map(|k| seg[k]), seg.get(i).copied()) {
|
||||
(Some(a), Some(b)) => unit([a[0] + b[0], a[1] + b[1], a[2] + b[2]]).unwrap_or(b),
|
||||
(Some(a), None) => a,
|
||||
(None, Some(b)) => b,
|
||||
(None, None) => [0.0, 0.0, 1.0],
|
||||
})
|
||||
.collect();
|
||||
// Start-Normale: quer zur Tangente, möglichst waagrecht.
|
||||
let t0 = tangents[0];
|
||||
let up: V3 = if t0[2].abs() > 0.98 { [1.0, 0.0, 0.0] } else { [0.0, 0.0, 1.0] };
|
||||
let mut normal = unit(cross(cross(t0, up), t0))?;
|
||||
let mut positions = Vec::with_capacity(3 * (n * TUBE_SEGMENTS + 2));
|
||||
for i in 0..n {
|
||||
if i > 0 {
|
||||
// Doppelspiegelung (Wang et al. 2008): rotationsminimierende Rahmen.
|
||||
let v1 = sub(path[i], path[i - 1]);
|
||||
let c1 = dot(v1, v1);
|
||||
let r_l = sub(normal, v1.map(|x| x * 2.0 / c1 * dot(v1, normal)));
|
||||
let t_l = sub(tangents[i - 1], v1.map(|x| x * 2.0 / c1 * dot(v1, tangents[i - 1])));
|
||||
let v2 = sub(tangents[i], t_l);
|
||||
let c2 = dot(v2, v2);
|
||||
normal = if c2 > 1e-24 { sub(r_l, v2.map(|x| x * 2.0 / c2 * dot(v2, r_l))) } else { r_l };
|
||||
normal = unit(normal)?;
|
||||
}
|
||||
let bi = cross(tangents[i], normal);
|
||||
for k in 0..TUBE_SEGMENTS {
|
||||
let a = std::f64::consts::TAU * k as f64 / TUBE_SEGMENTS as f64;
|
||||
let (c, s) = (crate::jsnum::cos(a) * radius, crate::jsnum::sin(a) * radius);
|
||||
for d in 0..3 {
|
||||
positions.push(path[i][d] + normal[d] * c + bi[d] * s);
|
||||
}
|
||||
}
|
||||
}
|
||||
for d in 0..3 {
|
||||
positions.push(path[0][d]);
|
||||
}
|
||||
for d in 0..3 {
|
||||
positions.push(path[n - 1][d]);
|
||||
}
|
||||
let m = TUBE_SEGMENTS as u32;
|
||||
let ring = |i: usize, k: u32| i as u32 * m + k % m;
|
||||
let (c0, c1) = ((n * TUBE_SEGMENTS) as u32, (n * TUBE_SEGMENTS) as u32 + 1);
|
||||
let mut indices = Vec::with_capacity(6 * TUBE_SEGMENTS * n);
|
||||
for i in 0..n - 1 {
|
||||
for k in 0..m {
|
||||
let (a, b, c, d) = (ring(i, k), ring(i, k + 1), ring(i + 1, k + 1), ring(i + 1, k));
|
||||
indices.extend([a, b, c, a, c, d]);
|
||||
}
|
||||
}
|
||||
for k in 0..m {
|
||||
indices.extend([c0, ring(0, k + 1), ring(0, k)]);
|
||||
indices.extend([c1, ring(n - 1, k), ring(n - 1, k + 1)]);
|
||||
}
|
||||
Some((positions, indices))
|
||||
}
|
||||
|
||||
/// Handlauf einer Wendeltreppe als Schraubensweep mit rundem Profil (Rohr Ø `RAIL_THICK`) samt
|
||||
/// runden Pfosten auf den Trittmitten, in einem Netz je Treppe.
|
||||
fn spiral_railing(s: &StairIn, idx: usize, out: &mut Vec<Mesh>) {
|
||||
let Some((geo, total_rise)) = geometry_of(s) else { return };
|
||||
let Some(h) = helix_of(s) else { return };
|
||||
@@ -569,18 +646,18 @@ fn spiral_railing(s: &StairIn, idx: usize, out: &mut Vec<Mesh>) {
|
||||
for &left in sides {
|
||||
let r = if left == ccw { h.r_in } else { h.r_out };
|
||||
let total_seg = n * HELIX_SEGMENTS;
|
||||
let pt_at = |k: usize| {
|
||||
let f = k as f64 / total_seg as f64;
|
||||
let q = h.at(r, h.a0 + f * h.sweep);
|
||||
[q[0], q[1], rail_z(f)]
|
||||
};
|
||||
for k in 0..total_seg {
|
||||
push(strut_box(pt_at(k), pt_at(k + 1), half));
|
||||
}
|
||||
let path: Vec<V3> = (0..=total_seg)
|
||||
.map(|k| {
|
||||
let f = k as f64 / total_seg as f64;
|
||||
let q = h.at(r, h.a0 + f * h.sweep);
|
||||
[q[0], q[1], rail_z(f)]
|
||||
})
|
||||
.collect();
|
||||
push(tube_along(&path, half));
|
||||
for (i, tr) in geo.treads.iter().enumerate() {
|
||||
let f = (i as f64 + 0.5) / n as f64;
|
||||
let q = h.at(r, h.a0 + f * h.sweep);
|
||||
push(strut_box([q[0], q[1], s.z_bottom + tr.top_rise], [q[0], q[1], rail_z(f)], half));
|
||||
push(tube_along(&[[q[0], q[1], s.z_bottom + tr.top_rise], [q[0], q[1], rail_z(f)]], half * 0.75));
|
||||
}
|
||||
}
|
||||
if !indices.is_empty() {
|
||||
@@ -831,6 +908,47 @@ mod tests {
|
||||
assert!(big.positions.chunks(3).any(|c| c[2] > 2.0) && big.positions.chunks(3).any(|c| c[2] < 1.2));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rohr_ist_rund_geschlossen_und_aussen_orientiert() {
|
||||
// Schraubenlinie r = 1, Steigung 1 m je Umdrehung
|
||||
let path: Vec<V3> = (0..=48).map(|k| {
|
||||
let a = std::f64::consts::TAU * k as f64 / 48.0;
|
||||
[a.cos(), a.sin(), a / std::f64::consts::TAU]
|
||||
}).collect();
|
||||
let (positions, indices) = tube_along(&path, 0.02).unwrap();
|
||||
// jeder Profilpunkt liegt genau im Rohrradius um seinen Bahnpunkt
|
||||
for (i, c) in positions.chunks(3).take(path.len() * TUBE_SEGMENTS).enumerate() {
|
||||
let q = path[i / TUBE_SEGMENTS];
|
||||
assert!((hypot(&[c[0] - q[0], c[1] - q[1], c[2] - q[2]]) - 0.02).abs() < 1e-12);
|
||||
}
|
||||
let len: f64 = path.windows(2).map(|w| hypot(&[w[1][0] - w[0][0], w[1][1] - w[0][1], w[1][2] - w[0][2]])).sum();
|
||||
let v = volume(&Mesh { src: 0, positions, indices });
|
||||
// Polygon-Querschnitt (12 Ecken) ≈ 95.5 % des Kreises
|
||||
let ideal = std::f64::consts::PI * 0.02 * 0.02 * len;
|
||||
assert!(v > 0.9 * ideal && v < 1.01 * ideal, "Volumen {v} vs. {ideal}");
|
||||
assert!(tube_along(&[[0.0; 3]], 0.02).is_none());
|
||||
assert!(tube_along(&[[0.0; 3], [0.0; 3]], 0.02).is_none());
|
||||
assert!(tube_along(&[[0.0; 3], [f64::NAN, 0.0, 0.0]], 0.02).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wendel_handlauf_rund() {
|
||||
let rs = railings(&spiral(0.0, 1.0, 0.0));
|
||||
let m = &rs[0];
|
||||
// Netz geschlossen und nach aussen (Rohr + Pfosten, alle positiv)
|
||||
assert!(volume(m) > 0.0);
|
||||
// Querschnitt rund: Punkte des Handlaufs (oberhalb aller Pfosten-Fusspunkte im Mittelteil) streuen
|
||||
// im Abstand zur Schraubenachse r = 1 um ± Rohrradius, auch schräg (nicht nur Quaderecken).
|
||||
let near: Vec<f64> = m.positions.chunks(3).map(|c| c[0].hypot(c[1]) - 1.0).collect();
|
||||
let distinct = {
|
||||
let mut v: Vec<i64> = near.iter().map(|d| (d * 1e5).round() as i64).collect();
|
||||
v.sort();
|
||||
v.dedup();
|
||||
v.len()
|
||||
};
|
||||
assert!(distinct > 8, "nur {distinct} verschiedene Radien: Profil nicht rund");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wendel_mittelsaeule_als_block() {
|
||||
let none = slabs(&spiral(0.0, 0.0, 0.0), false).len();
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
// 2 = IfcPositiveRatioMeasure (value = Zahl), 6 = IfcLabel (Zeichenketten-Index),
|
||||
// 7 = IfcThermalTransmittanceMeasure (Zahl),
|
||||
// 3 = IfcQuantityLength, 4 = IfcQuantityArea, 5 = IfcQuantityVolume (value = Zahl, ≥ 0).
|
||||
// Heisst der Satz `Qto_…`, entsteht je Bauteil ein eigener IfcElementQuantity (Basismengen,
|
||||
// Heisst der Satz `Qto_…` (auch `CH_Qto_…`, `Dossier_Qto_…`), entsteht je Bauteil ein eigener IfcElementQuantity (Basismengen,
|
||||
// nie geteilt); sonst ein IfcPropertySet (gleicher Inhalt = ein Pset für alle Bauteile).
|
||||
// structure= Geschoss-Index oder −1 (Gebäude)
|
||||
//
|
||||
@@ -66,11 +66,13 @@
|
||||
// IfcOpeningElement = Profil-Extrusion entlang z_dir (Position origin/x_dir/z_dir) im Geschoss-
|
||||
// Placement, IfcRelVoidsElement zum Wirt; IfcWindow/IfcDoor mit dem Netz, IfcRelFillsElement.
|
||||
// STAIR = 5, structure, id, predefined (Text), PTS, z_rel, depth (Ersatzkörper, nur ohne Läufe/Podest),
|
||||
// PSETS, n_flights, FLIGHT × n_flights, has_landing, [LANDING], has_rail, [RAIL]
|
||||
// PSETS, n_flights, FLIGHT × n_flights, has_landing, [LANDING], has_rail, [RAIL],
|
||||
// has_column, [COLUMN]
|
||||
// FLIGHT = name, n_risers, n_treads, riser_height, tread_length, predefined (Text, IfcStairFlightTypeEnum),
|
||||
// PSETS, shape (0 = Extrusionen, 1 = Dreiecks-Mesh), 0: n, (PTS, z_rel, depth) × n | 1: MESH
|
||||
// LANDING = name, PTS, z_rel, depth, PSETS (IfcSlab, PredefinedType LANDING)
|
||||
// RAIL = name, predefined (Text, IfcRailingTypeEnum), PSETS, MESH
|
||||
// COLUMN = name, PTS, z_rel, depth, PSETS (Mittelsäule/Spindel: IfcColumn, COLUMN)
|
||||
// Mit mindestens einem Lauf/Podest/Geländer ist die IfcStair selbst ohne Darstellung und fasst Läufe,
|
||||
// Podest und Geländer per IfcRelAggregates zusammen (nur die Treppe liegt im Geschoss).
|
||||
// EXTRUSION = 6, structure, id, PTS, z_rel, depth
|
||||
@@ -909,7 +911,7 @@ impl Builder {
|
||||
if pset.props.is_empty() {
|
||||
return; // IfcPropertySet verlangt mindestens eine Eigenschaft
|
||||
}
|
||||
if pset.name.starts_with("Qto_") || pset.name.starts_with("CH_Qto_") {
|
||||
if pset.name.starts_with("Qto_") || pset.name.starts_with("CH_Qto_") || pset.name.starts_with("Dossier_Qto_") {
|
||||
let quantities: Vec<(&'static str, String, f64)> = pset
|
||||
.props
|
||||
.iter()
|
||||
@@ -1901,10 +1903,11 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
|
||||
}
|
||||
let landing = if r.flag()? { Some(r.stair_landing()?) } else { None };
|
||||
let rail = if r.flag()? { Some(r.stair_rail()?) } else { None };
|
||||
let column = if r.flag()? { Some(r.stair_landing()?) } else { None };
|
||||
let key = format!("stair/{id}");
|
||||
let parent = w.placement_of(structure);
|
||||
let g = w.gid(&key);
|
||||
let entity = if flights.is_empty() && landing.is_none() && rail.is_none() {
|
||||
let entity = if flights.is_empty() && landing.is_none() && rail.is_none() && column.is_none() {
|
||||
// Ohne Teile: ein Ersatzkörper (Fussabdruck) wie bisher.
|
||||
let (placement, shape) = w.emit_box_product(&pts, z_rel, depth, parent);
|
||||
w.emit_building_element("IFCSTAIR", g, "Treppe", placement, shape, Some(enum_(&predefined)))
|
||||
@@ -1966,6 +1969,16 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
|
||||
}
|
||||
parts.push(railing);
|
||||
}
|
||||
if let Some(c) = &column {
|
||||
let (placement, shape) = w.emit_box_product(&c.pts, c.z_rel, c.depth, stair_placement);
|
||||
let ckey = format!("{key}/column");
|
||||
let guid = w.gid(&ckey);
|
||||
let col = w.emit_building_element("IFCCOLUMN", guid, &c.name, placement, shape, Some(enum_("COLUMN")));
|
||||
for p in &c.psets {
|
||||
w.add_pset(p, col, &ckey);
|
||||
}
|
||||
parts.push(col);
|
||||
}
|
||||
let g = w.gid(&format!("aggregates/{key}"));
|
||||
w.add("IFCRELAGGREGATES", format!("{g},#{},$,$,#{stair},{}", w.owner_history, refs(&parts)));
|
||||
stair
|
||||
@@ -2633,7 +2646,7 @@ mod tests {
|
||||
b.pts(&SQUARE);
|
||||
b.n(&[0.0, 2.6]);
|
||||
b.no_psets();
|
||||
b.n(&[0.0, 0.0, 0.0]);
|
||||
b.n(&[0.0, 0.0, 0.0, 0.0]);
|
||||
b.n(&[REC_EXTRUSION, -1.0]);
|
||||
b.str("X1");
|
||||
b.pts(&SQUARE);
|
||||
@@ -3174,7 +3187,18 @@ mod tests {
|
||||
b.str(name);
|
||||
b.n(&[7.0, 7.0, 0.1857, 0.28]);
|
||||
b.str("STRAIGHT");
|
||||
b.qto("Qto_StairFlightBaseQuantities", &[("Length", 3.0, 2.0), ("GrossVolume", 5.0, 1.0)]);
|
||||
if k == 0 {
|
||||
// Zwei Mengensätze: Basismengen + eigene Dossier-Mengen (Untersicht).
|
||||
b.f.push(2.0);
|
||||
for (set, (n, kind, v)) in [("Qto_StairFlightBaseQuantities", ("Length", 3.0, 2.0)), ("Dossier_Qto_StairFlight", ("SoffitArea", 4.0, 7.5))] {
|
||||
b.str(set);
|
||||
b.f.push(1.0);
|
||||
b.str(n);
|
||||
b.n(&[kind, v]);
|
||||
}
|
||||
} else {
|
||||
b.qto("Qto_StairFlightBaseQuantities", &[("Length", 3.0, 2.0), ("GrossVolume", 5.0, 1.0)]);
|
||||
}
|
||||
b.n(&[0.0, 2.0]);
|
||||
b.pts(&SQUARE);
|
||||
b.n(&[0.0, 0.2 * (k + 1) as f64]);
|
||||
@@ -3191,6 +3215,11 @@ mod tests {
|
||||
b.str("HANDRAIL");
|
||||
b.no_psets();
|
||||
b.mesh_tetra();
|
||||
b.n(&[1.0]);
|
||||
b.str("Spindel");
|
||||
b.pts(&SQUARE);
|
||||
b.n(&[0.0, 2.6]);
|
||||
b.qto("Qto_ColumnBaseQuantities", &[("NetVolume", 5.0, 0.1)]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -3205,18 +3234,22 @@ mod tests {
|
||||
assert_eq!(count(&ifc, "IFCRAILING"), 1);
|
||||
assert_eq!(count(&ifc, "IFCSLAB"), 1);
|
||||
assert!(ifc.contains(".LANDING.);"), "Podest als IfcSlab(LANDING)");
|
||||
assert_eq!(count(&ifc, "IFCCOLUMN"), 1, "Spindel als IfcColumn");
|
||||
assert!(first_line(&ifc, "IFCCOLUMN").contains("'Spindel'"));
|
||||
let stair = first_line(&ifc, "IFCSTAIR");
|
||||
assert!(stair.contains(",$,$,.QUARTER_TURN_STAIR.);") && !stair.contains("#,#"), "{stair}");
|
||||
let flight = first_line(&ifc, "IFCSTAIRFLIGHT");
|
||||
assert!(flight.contains(",7,7,0.1857,0.28,.STRAIGHT.);"), "{flight}");
|
||||
// Beide Läufe: Menge je Lauf; Treppe, Läufe, Podest, Geländer in EINER Aggregation, nur die Treppe im Geschoss/Gebäude.
|
||||
assert_eq!(count(&ifc, "IFCELEMENTQUANTITY"), 2);
|
||||
let agg = ifc.lines().find(|l| l.contains("IFCRELAGGREGATES(") && l.matches('#').count() == 7).expect("Aggregation der Treppe");
|
||||
// Beide Läufe + Spindel: Menge je Teil; Treppe, Läufe, Podest, Geländer, Spindel in EINER Aggregation, nur die Treppe im Geschoss/Gebäude.
|
||||
assert_eq!(count(&ifc, "IFCELEMENTQUANTITY"), 4);
|
||||
assert!(ifc.contains("IFCQUANTITYAREA('SoffitArea',$,$,7.5,$)"), "Dossier_Qto_… als Menge");
|
||||
assert_eq!(count(&ifc, "IFCPROPERTYSINGLEVALUE"), 0);
|
||||
let agg = ifc.lines().find(|l| l.contains("IFCRELAGGREGATES(") && l.matches('#').count() == 8).expect("Aggregation der Treppe");
|
||||
assert!(agg.contains(",#"), "{agg}");
|
||||
let contained = first_line(&ifc, "IFCRELCONTAINEDINSPATIALSTRUCTURE");
|
||||
assert_eq!(contained.matches('#').count(), 4, "nur die Treppe (Nummer, Owner, Treppe, Gebäude): {contained}");
|
||||
// Läufe als Prismen, Geländer als Dreiecks-Netz.
|
||||
assert_eq!(count(&ifc, "IFCEXTRUDEDAREASOLID"), 5); // 2 Läufe × 2 Prismen + Podest
|
||||
assert_eq!(count(&ifc, "IFCEXTRUDEDAREASOLID"), 6); // 2 Läufe × 2 Prismen + Podest + Spindel
|
||||
assert_eq!(count(&ifc, "IFCTRIANGULATEDFACESET"), 1);
|
||||
// Ohne Teile: Ersatzkörper (Fussabdruck) wie vorher.
|
||||
let fallback = build(&b).unwrap();
|
||||
@@ -3237,7 +3270,7 @@ mod tests {
|
||||
g.no_psets();
|
||||
g.n(&[1.0]);
|
||||
g.mesh_tetra();
|
||||
g.n(&[0.0, 0.0]);
|
||||
g.n(&[0.0, 0.0, 0.0]);
|
||||
let mesh = build(&g).unwrap();
|
||||
check_structure(&mesh);
|
||||
assert_eq!(count(&mesh, "IFCSTAIRFLIGHT"), 1);
|
||||
|
||||
@@ -837,6 +837,8 @@ export const de = {
|
||||
"objinfo.stair.rise": "Steighöhe (gesamt)",
|
||||
"objinfo.stair.riser": "Steigungshöhe",
|
||||
"objinfo.stair.tread": "Auftrittstiefe",
|
||||
"objinfo.stair.concreteVolume": "Betonvolumen Lauf",
|
||||
"objinfo.stair.soffitArea": "Untersicht (Schalfläche)",
|
||||
"objinfo.stair.direction": "Laufrichtung",
|
||||
"objinfo.stair.direction.up": "Aufwärts",
|
||||
"objinfo.stair.direction.down": "Abwärts",
|
||||
|
||||
@@ -834,6 +834,8 @@ export const en: Record<TranslationKey, string> = {
|
||||
"objinfo.stair.rise": "Total rise",
|
||||
"objinfo.stair.riser": "Riser height",
|
||||
"objinfo.stair.tread": "Tread depth",
|
||||
"objinfo.stair.concreteVolume": "Concrete volume (flight)",
|
||||
"objinfo.stair.soffitArea": "Soffit area (formwork)",
|
||||
"objinfo.stair.direction": "Run direction",
|
||||
"objinfo.stair.direction.up": "Upwards",
|
||||
"objinfo.stair.direction.down": "Downwards",
|
||||
|
||||
@@ -1515,6 +1515,18 @@ export function StairSection({
|
||||
<span className="objinfo-flabel">{t("objinfo.stair.tread")}</span>
|
||||
<span className="objinfo-fval">{formatM(stair.treadDepth)}</span>
|
||||
</div>
|
||||
{stair.concreteVolume !== undefined && (
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("objinfo.stair.concreteVolume")}</span>
|
||||
<span className="objinfo-fval">{stair.concreteVolume.toFixed(2)} m³</span>
|
||||
</div>
|
||||
)}
|
||||
{stair.soffitArea !== undefined && (
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("objinfo.stair.soffitArea")}</span>
|
||||
<span className="objinfo-fval">{stair.soffitArea.toFixed(2)} m²</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Referenzgeschoss (read-only). */}
|
||||
<div className="objinfo-field">
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
viewBox -16.5 0 49 35.22
|
||||
bytes 82839
|
||||
bytes 83590
|
||||
circle 14
|
||||
line 481
|
||||
path 30
|
||||
polygon 106
|
||||
polygon 107
|
||||
rect 1
|
||||
svg 1
|
||||
text 75
|
||||
hash d6eab4be2a36a99a
|
||||
hash 51d02b12b3f8d6a0
|
||||
@@ -1,10 +1,10 @@
|
||||
viewBox -16.5 0 49 35.22
|
||||
bytes 82943
|
||||
bytes 83694
|
||||
circle 14
|
||||
line 481
|
||||
path 30
|
||||
polygon 106
|
||||
polygon 107
|
||||
rect 1
|
||||
svg 1
|
||||
text 75
|
||||
hash 5627a42e1a5a8903
|
||||
hash be6844edd22e12d2
|
||||
@@ -5,10 +5,10 @@ meshes[].indices [156642]
|
||||
meshes[].indices [348] x6
|
||||
meshes[].indices [36] x1816
|
||||
meshes[].indices [372]
|
||||
meshes[].indices [4032]
|
||||
meshes[].indices [60] x9
|
||||
meshes[].indices [72]
|
||||
meshes[].indices [84] x2
|
||||
meshes[].indices [9288]
|
||||
meshes[].indices [96] x6
|
||||
meshes[].positions [1044] x6
|
||||
meshes[].positions [108] x30
|
||||
@@ -17,9 +17,9 @@ meshes[].positions [192]
|
||||
meshes[].positions [216]
|
||||
meshes[].positions [24] x1781
|
||||
meshes[].positions [252] x2
|
||||
meshes[].positions [2688]
|
||||
meshes[].positions [288] x6
|
||||
meshes[].positions [324] x6
|
||||
meshes[].positions [4746]
|
||||
meshes[].positions [72] x5
|
||||
meshes[].positions [78837]
|
||||
roofLayers [59]
|
||||
@@ -50,4 +50,4 @@ walls[].start [2] x1508
|
||||
walls[].startCut [4] x1137
|
||||
walls[].topDrop [2] x112
|
||||
walls[].topPlane [3] x268
|
||||
hash a2e428fd2c5dbd0a
|
||||
hash daf0df7b109e5d1a
|
||||
@@ -277,6 +277,10 @@ export interface StairInfo {
|
||||
/** Aufgelöste absolute UK/OK (Meter). */
|
||||
zBottom: number;
|
||||
zTop: number;
|
||||
/** Nur Ortbeton (gerade/Wendel): Betonvolumen des Laufs (m³, ohne Säule). */
|
||||
concreteVolume?: number;
|
||||
/** Nur Ortbeton: Untersicht (m², Schalfläche; bei der Wendel die Wendelfläche). */
|
||||
soffitArea?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user