Merge branch 'worktree-agent-a187eec572780c726' into claude/practical-noether-1hb2s1

This commit is contained in:
Claude committed 2026-11-11 20:25:56 +00:00
commit 186940eb81
15 files changed
+321 -87

No files matched your search

+12 -8
View File
@@ -347,7 +347,7 @@ fn split_layers_along(cp: &Cut, p: &Project, layers: &[Layer], owner: &Wall, u_w
}
/// `splitWallLayers`: stehende Teil-Rechtecke je Schicht quer zur Dicke (u).
pub(super) fn split_wall_layers(cp: &Cut, p: &Project, layers: &[Layer], owner: &Wall, u_world: (f64, f64), plane: &Plane) -> Result<Vec<Cut>, String> {
pub(super) fn split_wall_layers(cp: &Cut, p: &Project, layers: &[Layer], owner: &Wall, u_world: (f64, f64), plane: &Plane, flat: &HashSet<String>) -> Result<Vec<Cut>, String> {
let total = sum_thickness(layers);
let [u_min, u_max, v_min, v_max] = bbox(&cp.pts);
let u_span = u_max - u_min;
@@ -364,7 +364,7 @@ pub(super) fn split_wall_layers(cp: &Cut, p: &Project, layers: &[Layer], owner:
let mut out = Vec::with_capacity(layers.len());
// [106] Schichteinzug am Sturz (Stück liegt über der Öffnung) bzw. an der Brüstung (darunter),
// [94] Anschlag: die Schichten vor dem Rahmen reichen um die Anschlagtiefe in die Öffnung.
let (top, bottom) = section_reveal(p, owner, plane, v_min, v_max);
let (top, bottom) = section_reveal(p, owner, plane, v_min, v_max, flat);
let n = layers.len();
let offsets: Vec<f64> = layers.iter().scan(0.0, |acc, l| { let o = *acc; *acc += l.thickness; Some(o) }).collect();
let mut acc = 0.0;
@@ -444,13 +444,13 @@ pub(super) fn split_wall_layers(cp: &Cut, p: &Project, layers: &[Layer], owner:
}
/// Anschlag-Nasen eines einschaligen Wandbands (ganze Dicke als eine Schicht).
fn single_layer_nibs(p: &Project, owner: &Wall, cp: &Cut, u_world: (f64, f64), plane: &Plane) -> Vec<[f64; 4]> {
fn single_layer_nibs(p: &Project, owner: &Wall, cp: &Cut, u_world: (f64, f64), plane: &Plane, flat: &HashSet<String>) -> Vec<[f64; 4]> {
let total = sum_thickness(&p.wall_type_or_fallback(owner).layers);
let [u_min, u_max, v_min, v_max] = bbox(&cp.pts);
if !(total > 1e-9 && u_max - u_min > 1e-9) {
return Vec::new();
}
let (top, bottom) = section_reveal(p, owner, plane, v_min, v_max);
let (top, bottom) = section_reveal(p, owner, plane, v_min, v_max, flat);
if top.is_none() && bottom.is_none() {
return Vec::new();
}
@@ -536,7 +536,7 @@ fn rebate_nibs(top: &Option<EdgeJoin>, bottom: &Option<EdgeJoin>, (l0, l1): (f64
/// Schichteinzug und Anschlag der Öffnung, deren Sturz (unten an `v_min`) bzw. Brüstung (oben an `v_max`)
/// dieses Wandstück ist und die die Schnittebene quert.
fn section_reveal(p: &Project, wall: &Wall, plane: &Plane, v_min: f64, v_max: f64) -> (Option<EdgeJoin>, Option<EdgeJoin>) {
fn section_reveal(p: &Project, wall: &Wall, plane: &Plane, v_min: f64, v_max: f64, flat: &HashSet<String>) -> (Option<EdgeJoin>, Option<EdgeJoin>) {
let (mut top, mut bottom) = (None, None);
let u_raw = plane.u_model();
let l = hypot2(u_raw.0, u_raw.1);
@@ -547,6 +547,10 @@ fn section_reveal(p: &Project, wall: &Wall, plane: &Plane, v_min: f64, v_max: f6
// Bogenwand: `wall` ist hier die Sehnen-Teilwand (mit Bulge) — die Öffnung sitzt auf der echten Wand.
let host = p.walls.iter().find(|w| w.id == wall.id).unwrap_or(wall);
for o in p.openings_of_wall(&wall.id) {
// [184] Grob: nur ein Strich, Sturz und Brüstung des Wandschnitts bleiben flach (kein Anschlag, kein Einzug).
if flat.contains(&o.id) {
continue;
}
// Bogenwand ([T2]): Einzug auf der Sehne zwischen den Laibungen.
let chord = arc_chord_opening(host, o);
let (wall, o) = match &chord {
@@ -584,7 +588,7 @@ fn section_reveal(p: &Project, wall: &Wall, plane: &Plane, v_min: f64, v_max: f6
}
/// `attachCutStyles`: Stil, Herkunft, Schicht-Bänder, Terminierung, Dominanz.
pub(super) fn attach_cut_styles(cuts: Vec<Cut>, p: &Project, plane: &Plane, walls: &[Option<&Wall>], slabs: &[SlabOwner]) -> Result<Vec<Cut>, String> {
pub(super) fn attach_cut_styles(cuts: Vec<Cut>, p: &Project, plane: &Plane, walls: &[Option<&Wall>], slabs: &[SlabOwner], flat: &HashSet<String>) -> Result<Vec<Cut>, String> {
if cuts.is_empty() {
return Ok(cuts);
}
@@ -606,7 +610,7 @@ pub(super) fn attach_cut_styles(cuts: Vec<Cut>, p: &Project, plane: &Plane, wall
if let Some(o) = owner {
let wt = p.wall_type_or_fallback(o);
if wt.layers.len() > 1 {
bands.extend(split_wall_layers(&cp, p, &wt.layers, o, u_world, plane)?);
bands.extend(split_wall_layers(&cp, p, &wt.layers, o, u_world, plane, flat)?);
continue;
}
}
@@ -617,7 +621,7 @@ pub(super) fn attach_cut_styles(cuts: Vec<Cut>, p: &Project, plane: &Plane, wall
cp.join_priority = owner.and_then(|o| wall_representative_priority(p, o));
cp.component_id = owner.and_then(|o| wall_representative_component_id(p, o));
// [94] Anschlag-Nase der einschaligen Wand: Band und Nase als ein Umriss.
let nibs = owner.map(|o| single_layer_nibs(p, o, &cp, u_world, plane)).unwrap_or_default();
let nibs = owner.map(|o| single_layer_nibs(p, o, &cp, u_world, plane, flat)).unwrap_or_default();
if !nibs.is_empty() {
let mut polys = vec![vec![cp.pts.clone()]];
polys.extend(nibs.iter().map(|r| vec![vec![[r[0], r[3]], [r[1], r[3]], [r[1], r[2]], [r[0], r[2]]]]));
+6 -2
View File
@@ -174,6 +174,9 @@ pub struct Visibility {
pub has_display: bool,
pub norender: HashSet<String>,
pub grey: HashSet<String>,
/// [184] Öffnungen, die im Schnitt nur als Strich erscheinen (grob): im Wandschnitt an Sturz und Brüstung
/// weder Anschlag-Nase noch Schichteinzug (flache Kante). Vom Aufrufer aus dem Detailgrad gefüllt (`query.rs`).
pub flat_openings: HashSet<String>,
}
impl Visibility {
@@ -185,6 +188,7 @@ impl Visibility {
has_display: v.get("hasDisplay").and_then(|b| b.as_bool()).unwrap_or(false),
norender: set("norender"),
grey: set("grey"),
flat_openings: HashSet::new(),
}
}
/// `visibleCodes.has(code)` (ohne `visibleCodes`: wahr).
@@ -614,7 +618,7 @@ pub(super) fn compute_plane(p: &Project, level: &LevelSpec, bodies: &[BodyMesh],
let shown = |c: &str| vis.visible(c) && vis.render(c);
let skip = |k: Kind, i: usize| edge_cats.get(&(k, i)).is_some_and(|c| !shown(c));
cuts.retain(|c| !skip(c.kind, c.index));
let cuts = attach_cut_styles(cuts, p, &plane, &walls, &slabs)?;
let cuts = attach_cut_styles(cuts, p, &plane, &walls, &slabs, &vis.flat_openings)?;
let cuts = merge_monolith_cuts(cuts, &slabs_r, &stair_flight_sections(p, plane.base(), plane.u_model()));
let base = plane.base();
let u = plane.u_model();
@@ -624,7 +628,7 @@ pub(super) fn compute_plane(p: &Project, level: &LevelSpec, bodies: &[BodyMesh],
bodies.retain(|b| !skip(Kind::Body, b.index));
let cuts = subtract_body_voids_in_section(cuts, &void_bodies, base, u);
let cuts = subtract_pockets_in_section(cuts, p, base, u);
let mut cuts = parallel_reveal_cuts(cuts, p, &plane, &walls)?;
let mut cuts = parallel_reveal_cuts(cuts, p, &plane, &walls, &vis.flat_openings)?;
append_body_sections(&mut cuts, p, &bodies, base, u);
// [152] Netzkörper: geschnitten (Flächen bzw. offene Linien) und in der Projektion. Gelände ist ein eigenes
// Element (`terrainMesh`, auch IFC-Gelände seit dem Import, [181]) und wird Geländelinie (`append_terrain_profiles`).
+86 -40
View File
@@ -3,6 +3,7 @@
//! `section_plan_buf()` (`query.rs`).
use super::*;
use crate::plan::model_view::{Options, SectionLook};
const OPENING_INK: &str = "#1f242c";
const FRAME_MM: f64 = 0.25;
@@ -102,7 +103,8 @@ pub(crate) fn sashes_of_window_type(wt: &WindowType) -> Vec<crate::opening_geom:
(0..n).map(|_| crate::opening_geom::Sash { post: false, auto_width: true, width: f64::NAN, post_width: f64::NAN, operable }).collect()
}
fn window_cut(p: &Project, wall: &Wall, o: &Opening, c: &CrossSection, detail: bool) -> Result<Vec<Primitive>, String> {
fn window_cut(p: &Project, wall: &Wall, o: &Opening, c: &CrossSection, look: SectionLook, shading_box: bool) -> Result<Vec<Primitive>, String> {
let full = look == SectionLook::Full;
let wt = p.window_type(o);
let fw = max(0.02, wt.and_then(|t| t.frame_width).unwrap_or(DEFAULT_FRAME_WIDTH));
let (_, n) = axis_frame(wall);
@@ -171,9 +173,20 @@ fn window_cut(p: &Project, wall: &Wall, o: &Opening, c: &CrossSection, detail: b
let (sp, sh) = det.as_ref().map_or((0.0, 0.0), |f| (min(f.sill_profile, h / 4.0), min(f.shading_profile, h / 4.0)));
let (fwb, fwt) = det.as_ref().map_or((fwv, fwv), |f| (min(max(0.02, f.sides.bottom), h / 3.0), min(max(0.02, f.sides.top), h / 3.0)));
let mut out = vec![opening_poly(rect(c.u_at(c.face_min), c.u_at(c.face_max), c.z_bottom, c.z_top), false, &o.id)];
// [173] Ohne Detail (Modelldarstellung): Rahmen oben/unten und eine Glaslinie, kein Sturz, keine
// Fensterbank, kein Kämpfer, keine Storen.
if !detail {
// [184] Grob: Leibungen offen (Wandschnitt) und ein Strich in der Rahmenmitte, kein Profil, kein Sturz,
// keine Fensterbank, keine Storen: nur der Strich.
if look == SectionLook::Line {
let u = (u0 + u1) / 2.0;
let mut l = line(v2(u, c.z_bottom), v2(u, c.z_top), "section-window-glass", GLASS_MM, OPENING_INK);
if let Primitive::Line { opening_id, .. } = &mut l {
*opening_id = Some(o.id.clone());
}
out.push(l);
return Ok(out);
}
// [184] Mittel: einfacher Rahmen (Rechteck oben/unten) und eine Glaslinie; Fensterbank als einfache Fläche,
// kein Sturz, kein Kämpfer.
if !full {
out.push(opening_poly(rect(u0, u1, c.z_bottom, c.z_bottom + fwv), true, &o.id));
out.push(opening_poly(rect(u0, u1, c.z_top - fwv, c.z_top), true, &o.id));
let u = (u0 + u1) / 2.0;
@@ -182,6 +195,7 @@ fn window_cut(p: &Project, wall: &Wall, o: &Opening, c: &CrossSection, detail: b
*opening_id = Some(o.id.clone());
}
out.push(l);
sill_and_shading(&mut out, p, o, c, (f_min, f_max), look, shading_box);
return Ok(out);
}
let (zb0, zt0) = (c.z_bottom + sp, c.z_top - sh);
@@ -225,43 +239,62 @@ fn window_cut(p: &Project, wall: &Wall, o: &Opening, c: &CrossSection, detail: b
}
}
if let Some(t) = wt {
// Formöffnung ([G3]): kein Sturz-Querschnitt, kein Storenkasten (Bogen/Schräge statt Sturz).
let shaped = crate::opening_shape::is_shaped(o);
let shading = t.shading.as_ref().filter(|s| s.create && !shaped);
let sturz_box = shading.filter(|s| s.mount == Some(WindowShadingMount::Sturz)).map_or(0.0, |s| max(0.0, s.r#box.depth));
if !shaped {
lintel_cut(&mut out, o, c, t.lintel_height, sturz_box);
// Formöffnung ([G3]): kein Sturz-Querschnitt (Bogen/Schräge statt Sturz).
if !crate::opening_shape::is_shaped(o) {
lintel_cut(&mut out, o, c, t.lintel_height, sturz_box_depth(t, o, shading_box));
}
// Fensterbänke nur bei ausdrücklicher Wahl (bisherige Schnitte bleiben gleich).
let zb = c.z_bottom;
}
sill_and_shading(&mut out, p, o, c, (f_min, f_max), look, shading_box);
Ok(out)
}
/// Tiefe des Storenkastens im Sturz (ab der Aussenfläche in die Wand), 0 = keiner (Option "Storenkasten" aus,
/// Formöffnung oder Kasten vorgesetzt).
fn sturz_box_depth(t: &WindowType, o: &Opening, shading_box: bool) -> f64 {
let shading = t.shading.as_ref().filter(|s| s.create && shading_box && !crate::opening_shape::is_shaped(o));
shading.filter(|s| s.mount == Some(WindowShadingMount::Sturz)).map_or(0.0, |s| max(0.0, s.r#box.depth))
}
/// Fensterbaenke und Storenkasten im Schnitt. Fensterbaenke nur bei ausdruecklicher Wahl am Typ: fein mit Gefaelle,
/// sonst als einfache Flaeche. Der Storenkasten nur mit der Option "Storenkasten" der Modelldarstellung (Basis aus,
/// wie im Grundriss, [184]).
fn sill_and_shading(out: &mut Vec<Primitive>, p: &Project, o: &Opening, c: &CrossSection, frame: (f64, f64), look: SectionLook, shading_box: bool) {
let (f_min, f_max) = frame;
let Some(t) = p.window_type(o) else { return };
let zb = c.z_bottom;
// Grob: keine Fensterbank (Wandschnitt genuegt).
if look != SectionLook::Line {
if matches!(t.sill_board, Some(WindowTypeSillBoard::Aussen | WindowTypeSillBoard::Beide)) {
// Aussen: mit Gefälle, bis 4 cm vor die Aussenfläche.
// Aussen: bis 4 cm vor die Aussenfläche, fein mit Gefälle.
let out_s = min(f_min, c.face_min) - 0.04;
let pts = vec![v2(c.u_at(f_min), zb), v2(c.u_at(out_s), zb - 0.015), v2(c.u_at(out_s), zb - 0.045), v2(c.u_at(f_min), zb - 0.03)];
let pts = if look == SectionLook::Full {
vec![v2(c.u_at(f_min), zb), v2(c.u_at(out_s), zb - 0.015), v2(c.u_at(out_s), zb - 0.045), v2(c.u_at(f_min), zb - 0.03)]
} else {
rect(c.u_at(f_min), c.u_at(out_s), zb - 0.03, zb)
};
out.push(opening_poly(pts, true, &o.id));
}
if matches!(t.sill_board, Some(WindowTypeSillBoard::Innen | WindowTypeSillBoard::Beide)) {
let in_s = max(f_max, c.face_max) + 0.02;
out.push(opening_poly(rect(c.u_at(f_max), c.u_at(in_s), zb - 0.025, zb), true, &o.id));
}
if let Some(sh) = shading {
let h = max(0.0, sh.r#box.height);
let d = max(0.0, sh.r#box.depth);
if h > 1e-4 && d > 1e-4 {
// Im Sturz: ab der Aussenfläche in die Wand; vorgesetzt: vor der Rahmen-Vorderkante.
let (s0, s1) = if sturz_box > 0.0 { (c.face_min, c.face_min + d) } else { (f_min - d, f_min) };
out.push(opening_poly(rect(c.u_at(s0), c.u_at(s1), c.z_top, c.z_top + h), true, &o.id));
// Lamellen-/Rollpaket im Kasten.
let m = min(0.02, d / 4.0);
let mut pack = polygon(rect(c.u_at(s0 + m), c.u_at(s1 - m), c.z_top + m, c.z_top + h * 0.6), SHADING_PACK_FILL, OPENING_INK, crate::plan::style::SYMBOL_LINE_MM, no_hatch_base());
if let Primitive::Polygon { opening_id, .. } = &mut pack {
*opening_id = Some(o.id.clone());
}
out.push(pack);
}
}
}
Ok(out)
let Some(sh) = t.shading.as_ref().filter(|s| s.create && shading_box && !crate::opening_shape::is_shaped(o)) else { return };
let sturz = sh.mount == Some(WindowShadingMount::Sturz);
let h = max(0.0, sh.r#box.height);
let d = max(0.0, sh.r#box.depth);
if h > 1e-4 && d > 1e-4 {
// Im Sturz: ab der Aussenfläche in die Wand; vorgesetzt: vor der Rahmen-Vorderkante.
let (s0, s1) = if sturz { (c.face_min, c.face_min + d) } else { (f_min - d, f_min) };
out.push(opening_poly(rect(c.u_at(s0), c.u_at(s1), c.z_top, c.z_top + h), true, &o.id));
// Lamellen-/Rollpaket im Kasten.
let m = min(0.02, d / 4.0);
let mut pack = polygon(rect(c.u_at(s0 + m), c.u_at(s1 - m), c.z_top + m, c.z_top + h * 0.6), SHADING_PACK_FILL, OPENING_INK, crate::plan::style::SYMBOL_LINE_MM, no_hatch_base());
if let Primitive::Polygon { opening_id, .. } = &mut pack {
*opening_id = Some(o.id.clone());
}
out.push(pack);
}
}
/// Sturz im Schnitt ([94]): eigener Querschnitt über der Öffnung (Beton grau), neben einem
@@ -282,14 +315,23 @@ fn lintel_cut(out: &mut Vec<Primitive>, o: &Opening, c: &CrossSection, height: O
out.push(pr);
}
fn door_cut(p: &Project, o: &Opening, c: &CrossSection, detail: bool) -> Vec<Primitive> {
fn door_cut(p: &Project, o: &Opening, c: &CrossSection, look: SectionLook) -> Vec<Primitive> {
let mut out = vec![opening_poly(rect(c.u_at(c.face_min), c.u_at(c.face_max), c.z_bottom, c.z_top), false, &o.id)];
// [173] Ohne Detail (Modelldarstellung): nur das Blatt in der Wandmitte (Wandöffnung: nur die Lücke).
if !detail {
// [184] Ohne Detail (Modelldarstellung): grob das Blatt als Linie, mittel als Fläche, beide in der Wandmitte
// (Wandöffnung: nur die Lücke).
if look != SectionLook::Full {
let kind = p.door_type(o).map(|t| t.kind);
if o.door_type != Some(OpeningDoorType::Wandoeffnung) && kind != Some(DoorTypeKind::Wandoeffnung) {
let mid = (c.face_min + c.face_max) / 2.0;
out.push(opening_poly(rect(c.u_at(mid - DOOR_LEAF_THICKNESS / 2.0), c.u_at(mid + DOOR_LEAF_THICKNESS / 2.0), c.z_bottom + 0.01, c.z_top), true, &o.id));
if look == SectionLook::Line {
let mut l = line(v2(c.u_at(mid), c.z_bottom), v2(c.u_at(mid), c.z_top), "section-window-glass", GLASS_MM, OPENING_INK);
if let Primitive::Line { opening_id, .. } = &mut l {
*opening_id = Some(o.id.clone());
}
out.push(l);
} else {
out.push(opening_poly(rect(c.u_at(mid - DOOR_LEAF_THICKNESS / 2.0), c.u_at(mid + DOOR_LEAF_THICKNESS / 2.0), c.z_bottom + 0.01, c.z_top), true, &o.id));
}
}
return out;
}
@@ -357,13 +399,17 @@ fn door_frame_cut(out: &mut Vec<Primitive>, o: &Opening, c: &CrossSection, df: &
}
/// `sectionOpeningPrimitives`.
#[cfg(test)]
pub fn section_opening_primitives(p: &Project, level: &LevelSpec, vis: &Visibility) -> Result<Vec<Primitive>, String> {
section_opening_primitives_mv(p, level, vis, true, true)
let mut o = crate::plan::model_view::resolve(None, crate::plan::style::Detail::Fein, 50.0);
o.window.shading_box = true;
section_opening_primitives_mv(p, level, vis, &o)
}
/// [173] Wie [`section_opening_primitives`] mit dem Detail der Modelldarstellung: `doors`/`windows` = Zarge,
/// Sturz, Kämpfer, Fensterbank und Storen zeigen (sonst nur Blatt bzw. Rahmen und Glas).
pub fn section_opening_primitives_mv(p: &Project, level: &LevelSpec, vis: &Visibility, doors: bool, windows: bool) -> Result<Vec<Primitive>, String> {
/// [173]/[184] Geschnittene Öffnungen nach der Modelldarstellung `mv` (Detailgrad wie im Grundriss, Rangfolge Element >
/// Stufe > Basis, EINE Auflösung `Options::section_look`): grob Linie, mittel einfacher Rahmen, fein volles Profil;
/// Storenkasten nach `windows.shadingBox`.
pub fn section_opening_primitives_mv(p: &Project, level: &LevelSpec, vis: &Visibility, mv: &Options) -> Result<Vec<Primitive>, String> {
let Some(plane) = level.plane() else { return Ok(Vec::new()) };
if level.kind != "section" {
return Ok(Vec::new());
@@ -403,7 +449,7 @@ pub fn section_opening_primitives_mv(p: &Project, level: &LevelSpec, vis: &Visib
None => (wall, o),
};
let Some(c) = cross_section(p, wall, o, p0, u)? else { continue };
let prims = if o.kind == ElementKind::Window { window_cut(p, wall, o, &c, windows)? } else { door_cut(p, o, &c, doors) };
let prims = if o.kind == ElementKind::Window { window_cut(p, wall, o, &c, mv.section_look(false, o.detail_level), mv.window.shading_box)? } else { door_cut(p, o, &c, mv.section_look(true, o.detail_level)) };
let greyed = vis.greyed(&o.category_code);
for pr in prims {
out.push(if greyed { pr.with_greyed(true) } else { pr });
+28 -5
View File
@@ -48,7 +48,7 @@ fn cache_put(key: (f64, u64), o: std::rc::Rc<Output>) {
pub fn section_plan_buf(p: &Project, args: &[f64], text: &str) -> Result<Vec<u8>, String> {
let v: serde_json::Value = serde_json::from_str(text).map_err(|e| format!("Schnitt-Argumente: {e}"))?;
let level = LevelSpec::from_json(v.get("level").unwrap_or(&serde_json::Value::Null));
let vis = Visibility::from_json(&v);
let mut vis = Visibility::from_json(&v);
let mono = args.first().is_some_and(|&x| x != 0.0);
let openings = args.get(1).is_some_and(|&x| x != 0.0);
let key = args.get(2).copied().unwrap_or(0.0);
@@ -60,6 +60,21 @@ pub fn section_plan_buf(p: &Project, args: &[f64], text: &str) -> Result<Vec<u8>
let hidden_ids = crate::plan::overrides::hidden_elements(p, rv);
let filtered = (!hidden_ids.is_empty()).then(|| without_elements(p, &hidden_ids));
let p = filtered.as_ref().unwrap_or(p);
// [184] Öffnungen mit Detailgrad grob (Strich im Schnitt): Wandschnitt an Sturz/Brüstung flach. Das ändert die
// Schnittflächen, gehört also in den Schlüssel (unten) und in die Sichtbarkeit.
let open_mv = {
let detail = Detail::parse(v.get("detail").and_then(|d| d.as_str()).unwrap_or("mittel"));
let mv_id = v.get("modelView").and_then(|m| m.as_str()).filter(|m| !m.is_empty()).or(level.model_view.as_deref());
crate::plan::model_view::for_view_scaled(p, mv_id, detail, scale)
};
vis.flat_openings = p
.openings
.as_deref()
.unwrap_or(&[])
.iter()
.filter(|o| open_mv.section_look(o.kind == crate::model::ElementKind::Door, o.detail_level) == crate::plan::model_view::SectionLook::Line)
.map(|o| o.id.clone())
.collect();
// [180] Ausgeblendete Klassen gehören in den Schlüssel: sie nehmen an der Verdeckung nicht teil, der Schnitt
// hängt also an ihnen (graue nicht).
let hkey = {
@@ -68,8 +83,16 @@ pub fn section_plan_buf(p: &Project, args: &[f64], text: &str) -> Result<Vec<u8>
let mut codes: Vec<&String> = vis.hidden_codes().collect();
codes.sort();
codes.dedup();
let empty = ids.is_empty() && codes.is_empty();
ids.iter().flat_map(|s| s.bytes().chain([0u8])).chain([1u8]).chain(codes.iter().flat_map(|s| s.bytes().chain([0u8]))).fold(if empty { 0 } else { 0xcbf2_9ce4_8422_2325u64 }, |h, b| (h ^ b as u64).wrapping_mul(0x0000_0100_0000_01b3))
let mut flat: Vec<&String> = vis.flat_openings.iter().collect();
flat.sort();
let empty = ids.is_empty() && codes.is_empty() && flat.is_empty();
ids.iter()
.flat_map(|s| s.bytes().chain([0u8]))
.chain([1u8])
.chain(codes.iter().flat_map(|s| s.bytes().chain([0u8])))
.chain([2u8])
.chain(flat.iter().flat_map(|s| s.bytes().chain([0u8])))
.fold(if empty { 0 } else { 0xcbf2_9ce4_8422_2325u64 }, |h, b| (h ^ b as u64).wrapping_mul(0x0000_0100_0000_01b3))
};
let key = (key, hkey);
let mut w = crate::plan::buf::Writer::new(true);
@@ -110,11 +133,11 @@ pub fn section_plan_buf(p: &Project, args: &[f64], text: &str) -> Result<Vec<u8>
trees.extend(unfold::bend_lines(&level, bounds));
let prims = trees;
w.group(&prims);
let (door_detail, window_detail) = mvo.as_ref().map_or((true, true), |o| (o.door.section_detail, o.window.section_detail));
// [184] Öffnungen wie im Grundriss: Detailgrad aus Stufe bzw. Massstab (mittel ab 1:200 grob).
let mut ops = Vec::new();
if openings {
for (l, s) in &parts {
ops.extend(unfold::clip_prims(section_opening_primitives_mv(p, l, &vis, door_detail, window_detail)?, s.as_ref()));
ops.extend(unfold::clip_prims(section_opening_primitives_mv(p, l, &vis, &open_mv)?, s.as_ref()));
}
}
crate::plan::extras::scale_line_weights(p, scale, &mut ops);
+4 -1
View File
@@ -355,7 +355,7 @@ pub(super) fn is_void_solid(s: &ExtrudedSolid) -> bool {
/// [106] Schnitt parallel zur Wand durch die Leibungen: Die geschnittene Schicht springt an den
/// Öffnungen um ihren Rücksprung zurück (Loch geweitet), ihre Zusatzstücke (Leibungsdämmung, Putz,
/// Überdämmung), die die Schnittebene quert, kommen als Schnittfläche im Stil der Schicht dazu.
pub(super) fn parallel_reveal_cuts(mut cuts: Vec<Cut>, p: &Project, plane: &Plane, walls: &[Option<&Wall>]) -> Result<Vec<Cut>, String> {
pub(super) fn parallel_reveal_cuts(mut cuts: Vec<Cut>, p: &Project, plane: &Plane, walls: &[Option<&Wall>], flat: &HashSet<String>) -> Result<Vec<Cut>, String> {
use crate::opening_detail::SIDES;
let (base, u_raw) = (plane.base(), plane.u_model());
let l = hypot2(u_raw.0, u_raw.1);
@@ -403,6 +403,9 @@ pub(super) fn parallel_reveal_cuts(mut cuts: Vec<Cut>, p: &Project, plane: &Plan
vec![[ua, z0], [ub, z0], [ub, z1], [ua, z1]]
};
for o in p.openings_of_wall(&w.id) {
if flat.contains(&o.id) {
continue;
}
let Some(r) = crate::opening_detail::opening_reveal(p, w, o) else { continue };
let (zb, zt) = opening_extent(p, w, o);
// Rücksprung je Seite dieser Schicht; die seitlichen reichen in die Ecken oben/unten.
+37
View File
@@ -556,6 +556,43 @@ fn anschlag_im_schnitt_sturz_nase_und_bruestung() {
assert_eq!(k, count["insulation"], "Einzug gehört zum Band");
}
/// [184] Grob (Fenster nur als Strich): Sturz-Unterkante und Brüstungs-Oberkante des Wandschnitts sind flach —
/// kein Anschlag, keine Nase, kein Schichteinzug. Fein (ohne `flat_openings`) bleibt wie bisher.
#[test]
fn grob_wandschnitt_an_oeffnung_flach() {
let mut p = sample_flush();
let o1 = p.openings.as_deref().unwrap().iter().find(|o| o.id == "O1").unwrap().clone();
let w1 = p.walls.iter().find(|w| w.id == "W1").unwrap().clone();
let (u, n) = axis_frame(&w1);
let m = o1.position + o1.width / 2.0;
let c = (w1.start.x + u.0 * m, w1.start.y + u.1 * m);
let l = LevelSpec { kind: "section".into(), line: Some([Vec2 { x: c.0 - n.0 * 3.0, y: c.1 - n.1 * 3.0 }, Vec2 { x: c.0 + n.0 * 3.0, y: c.1 + n.1 * 3.0 }]), ..Default::default() };
let (zb, zt) = opening_extent(&p, &w1, &o1);
// Anschlag 5 cm und Überdämmung 3 cm: im Fein-Schnitt Nase bzw. Einzug.
for t in p.window_types.iter_mut().flatten() {
t.inset_face = Some(WindowTypeInsetFace::Aussen);
t.inset_from_face = Some(0.18);
t.rebate_depth = Some(0.05);
}
for o in p.openings.iter_mut().flatten().filter(|o| o.id == "O1") {
o.layer_reveals = Some(vec![crate::model::LayerReveal { layer: 1.0, mode: crate::model::RevealMode::Ueberdaemmt, amount: Some(0.03), ..Default::default() }]);
}
// Alle Wandschnitt-Kanten in der Öffnungshöhe: nur zb und zt (keine Stufe dazwischen).
let ys = |vis: &Visibility| -> Vec<f64> {
let out = compute_section_vis(&p, &l, &[], vis).unwrap().unwrap();
let mut ys: Vec<f64> = out.cuts.iter().filter(|c| c.kind == Kind::Wall && c.source_id.as_deref() == Some("W1")).flat_map(|c| c.pts.iter().map(|q| q[1])).filter(|y| *y > zb - 0.1 && *y < zt + 0.1).collect();
ys.sort_by(|a, b| a.partial_cmp(b).unwrap());
ys.dedup_by(|a, b| (*a - *b).abs() < 1e-6);
ys
};
let fine = ys(&Visibility::default());
assert!(fine.iter().any(|y| (y - (zt - 0.05)).abs() < 1e-6) && fine.iter().any(|y| (y - (zb + 0.05)).abs() < 1e-6), "fein: Anschlag {fine:?}");
let flat = Visibility { flat_openings: ["O1".to_string()].into(), ..Default::default() };
let rough = ys(&flat);
assert!(rough.iter().all(|y| (y - zb).abs() < 1e-6 || (y - zt).abs() < 1e-6), "grob: keine Stufe {rough:?}");
assert!(rough.iter().any(|y| (y - zb).abs() < 1e-6) && rough.iter().any(|y| (y - zt).abs() < 1e-6), "{rough:?}");
}
/// [G3] Rundbogen-Fenster: an der Schnittstelle reicht die Wand bis an den Bogen, Rahmen/Glas folgen.
#[test]
fn rundbogen_im_schnitt() {
+3 -3
View File
@@ -264,8 +264,8 @@ fn schichten_aussen_aussen_und_override_auf_allen_schichten() {
let w2 = p.walls.iter().find(|w| w.id == "W2").unwrap().clone();
let w4 = p.walls.iter().find(|w| w.id == "W4").unwrap().clone();
let u = (1.0, 0.0);
let b2 = split_wall_layers(&cp, &p, &layers, &w2, u, &Plane { point: [0.0; 3], normal: [1.0, 0.0, 0.0] }).unwrap();
let b4 = split_wall_layers(&cp, &p, &layers, &w4, u, &Plane { point: [0.0; 3], normal: [1.0, 0.0, 0.0] }).unwrap();
let b2 = split_wall_layers(&cp, &p, &layers, &w2, u, &Plane { point: [0.0; 3], normal: [1.0, 0.0, 0.0] }, &Default::default()).unwrap();
let b4 = split_wall_layers(&cp, &p, &layers, &w4, u, &Plane { point: [0.0; 3], normal: [1.0, 0.0, 0.0] }, &Default::default()).unwrap();
// W4 (Aussenseite −x): layers[0] an uMin; W2 gespiegelt: layers[0] an uMax.
assert_eq!(b4[0].component_id.as_deref(), Some(layers[0].component_id.as_str()));
assert!(close(bbox(&b4[0].pts)[0], 0.0));
@@ -273,6 +273,6 @@ fn schichten_aussen_aussen_und_override_auf_allen_schichten() {
// Override der Wand gilt für jede Schicht
p.walls[1].background = Some("#123456".into());
let w = p.walls[1].clone();
let bands = split_wall_layers(&cp, &p, &layers, &w, u, &Plane { point: [0.0; 3], normal: [1.0, 0.0, 0.0] }).unwrap();
let bands = split_wall_layers(&cp, &p, &layers, &w, u, &Plane { point: [0.0; 3], normal: [1.0, 0.0, 0.0] }, &Default::default()).unwrap();
assert!(bands.iter().all(|b| b.fill.as_deref() == Some("#123456")));
}