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

This commit is contained in:
Claude committed 2026-11-16 16:25:05 +00:00
commit 0cd52acfe1
20 files changed
+281 -39

No files matched your search

+6 -6
View File
@@ -63,13 +63,13 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC.
6. ~~**Situation: Nordpfeil und Massstabsbalken auf Parzelle/Strasse**~~ **behoben 16.11. (Plakat):** die Situation des Plakats blendet die Klasse „84 Planzeichen“ aus, Nordpfeil und Massstabsbalken stehen am Rahmenrand im Band unter dem Plan (wie beim ersten Grundriss; bei schmalem Rahmen steht der Pfeil in der oberen rechten Ecke), der Platzhalter des 3D-Bilds passt seine Schrift dem Rahmen an. **Offen:** eigenständige Situations-Layouts (Vorlage „Situation WBW“ ohne Plakat) setzen die Zeichen weiter unter die Lage; Kataster-Gebäude unter dem eigenen Fussabdruck (Bestandsbau 1003) werden nicht ausgeblendet.
7. ~~**Ansichtslinien heissen „Ansicht B/C/D“**~~ **behoben 16.11.:** neue Ansichten heissen nach der Gebäudeseite („Ansicht Süd“: Linie südlich des Hauses, Blick nach Norden, Plan oben = Norden; wie die Beispielprojekte), bei gleicher Richtung „… 2“; Kern `cmd_solid.rs::elevation_side`/`elevation_name`, Namen über `t()` (`cmd.sectionline.dir.*`). Der Befehl `ansichten` in einem anderen Branch soll `elevation_side` mitbenutzen. **Offen:** Marken überlagern sich weiter (Punkt 8).
8. **Marken überlagern sich im Grundriss:** Ansichtsmarke „Süd“ auf der Schnittmarke B, Ansichtsmarke Nord auf dem anderen Ende von Schnitt B · Kern Planmarken (`plan/`) · Marken gegeneinander ausweichen lassen · S.
9. **Treppe ohne Deckenloch** läuft im Schnitt in die Decke, ohne Hinweis; das Loch muss von Hand (`deckenloch`, zwei Gegenecken) gesetzt werden · `cmds/stair.ts`, Kern `stair_guard` · beim Setzen einer Treppe unter einer Decke Aussparung anlegen oder anbieten · S–M.
10. **Neues Projekt: Geschosshöhe 2.60 m, Decke 30 cm → lichte Höhe 2.30 m** (unter den üblichen 2.40 m für Wohnräume) · Vorlage des leeren Projekts · Vorgabe 2.90–3.00 m · S.
11. **Projektname nicht änderbar** (im Browser-Build kein Feld gefunden; bleibt „Leeres Projekt“ in Dateinamen nicht anonymer Exporte und im Kennzahlen-/Kosten-PDF) · Panel Mappe (neben „Projektnummer“) · Feld „Projektname“ · S.
9. ~~**Treppe ohne Deckenloch** läuft im Schnitt in die Decke, ohne Hinweis; das Loch muss von Hand (`deckenloch`, zwei Gegenecken) gesetzt werden · `cmds/stair.ts`, Kern `stair_guard` · beim Setzen einer Treppe unter einer Decke Aussparung anlegen oder anbieten · S–M.~~ **Erledigt 16.11.:** `stair_hole_ops` (`cmd_solid.rs`) legt im selben Commit wie die Treppe (ein Undo-Schritt) eine Aussparung in der Form des Treppenumrisses in die Decke des Geschosses, wenn die Treppe aufwärts über die volle Geschosshöhe läuft, der Umriss ganz in der Decke liegt und dort noch kein Loch ist; Test `treppe_legt_deckenloch_an` (`cmd_create.rs`). Offen: Wendeltreppen (Umriss aus Linien/Bögen) behalten das Loch von Hand (`deckenloch`); Treppen nach unten und mit Teilhöhe bekommen keins.
10. ~~**Neues Projekt: Geschosshöhe 2.60 m, Decke 30 cm → lichte Höhe 2.30 m** (unter den üblichen 2.40 m für Wohnräume) · Vorlage des leeren Projekts · Vorgabe 2.90–3.00 m · S.~~ **Erledigt 16.11.:** Vorgabe 2.90 m (CH-Wohnbau 2.80–3.00 m; bei 30 cm Decke 2.60 m lichte Höhe, ≥ 2.40 m), `EMPTY_FLOOR_HEIGHT` in `sampleProject.ts` für `emptyProject` und „Geschoss hinzufügen“; Beispielprojekte bleiben 2.60 m. Test `emptyProjectHeight.test.ts`.
11. ~~**Projektname nicht änderbar** (im Browser-Build kein Feld gefunden; bleibt „Leeres Projekt“ in Dateinamen nicht anonymer Exporte und im Kennzahlen-/Kosten-PDF) · Panel Mappe (neben „Projektnummer“) · Feld „Projektname“ · S.~~ **Erledigt 16.11.:** Feld „Projektname“ im Abschnitt Publikation (Panel Mappe, über „Projektnummer“), übernommen bei Enter/Verlassen, über Ops (`onSetProjectName`, ein Undo-Schritt, leer = unverändert). Test `projectName.test.ts`, e2e `projectName266.spec.ts` (Screenshot angesehen).
12. **3D-Bild nicht prüfbar:** headless verliert SwiftShader das WebGPU-Gerät („3D-Engine nicht verfügbar“), `bild3d` liefert kein Bild; das Plakat behält „3D-Bild hier einsetzen“; die CLI hat unter Linux keinen 3D-Bildweg ausser Blender · Mac-Gegenprobe; Vorschlag: Vektor-Axonometrie (verdeckte Kanten) aus dem Kern für CLI/Plakat · M.
13. **Getippte LV95-Koordinaten** hinterlassen Gleitkomma-Reste im Modell (Deckenloch bei 53.200000000186) · Umrechnung LV95 → lokal in der Befehlszeile · auf 1e-6 m runden · S.
14. **IFC-Räume ohne Nummer:** `IfcSpace.Name` = interne Id („RM-…“), Name in `LongName`; die Objekt-Info hat kein Feld „Nummer“ für Räume aus `raum` · Kern IFC-Export, Objekt-Info Raum · Nummernfeld, `Name` = Nummer · S.
15. **Auto-Linie „Schnitt A“ liegt auf der Achse der OG-Innenwand** (y = 51) und schneidet sie der Länge nach (schwarze Fläche im Schnitt) · Kern Auto-Schnittlinie (`autoLine`) · Wandachsen meiden · S.
13. ~~**Getippte LV95-Koordinaten** hinterlassen Gleitkomma-Reste im Modell (Deckenloch bei 53.200000000186) · Umrechnung LV95 → lokal in der Befehlszeile · auf 1e-6 m runden · S.~~ **Erledigt 16.11.:** `fromWorldInput` rundet auf mm (`parseInput.ts`, Test dort).
14. ~~**IFC-Räume ohne Nummer:** `IfcSpace.Name` = interne Id („RM-…“), Name in `LongName`; die Objekt-Info hat kein Feld „Nummer“ für Räume aus `raum` · Kern IFC-Export, Objekt-Info Raum · Nummernfeld, `Name` = Nummer · S.~~ **Erledigt 16.11.:** `Name` = Raumnummer (Stempel), sonst Raumname statt interner Id; `LongName` = Raumname (`ifc_data.rs`, Test `exportIfc.test.ts`). Die Objekt-Info hat das Feld „Nummer“ schon (Raumstempel-Abschnitt).
15. ~~**Auto-Linie „Schnitt A“ liegt auf der Achse der OG-Innenwand** (y = 51) und schneidet sie der Länge nach (schwarze Fläche im Schnitt) · Kern Auto-Schnittlinie (`autoLine`) · Wandachsen meiden · S.~~ **Erledigt 16.11.:** `auto_lines::place` weicht Wandachsen aus (parallele Achsen < 0.5 m → in 0.25-m-Schritten zur Seite, nächster freier Platz); Test `schnitt_meidet_wandachsen`.
Geprüft und in Ordnung: Anonymität (Plakat-PDF Titel „FALKE 7“, Producer leer, Datum 2000, Schriften eingebettet, `pdftotext` ohne Projekt-/Büronamen; Kennzahlen-PDF nach „anonym“ ebenso; DXF/IFC ohne Projektnamen), Ansichten/Schnitt stimmig zum Grundriss (Fensterlagen nachgemessen), Kennzahlen-Tabelle Plakat = Flächenbilanz, ÜZ 127.71/900, Kosten 2’844 CHF/m² GF plausibel (mit Befund 1), IFC mit Georeferenz LV95 (IfcMapConversion). **Nicht geprüft:** Tauri-App/Mac (Metal, 3D-Bild, Schatten, Rendering), Mausbedienung (alles über Befehlszeile und Test-Naht), Druck des A1-Plakats, DXF/IFC in Fremdsoftware. · M (Reste)
- ◐ **[263]** Visuelle und UX-Prüfung des Referenz-Ablaufs (15.11., Wunsch Maintainer „prüfe auch visuell und UX“): Chromium/Linux, Screenshots 1280×800 (de hell, de dunkel, en hell, 1440×900 und 1920×1080 stichprobenweise) von Start, Neues Projekt, allen Dock-Reitern, Menüs, Einstellungen/Über/Kürzel/Ressourcen/Verlauf/BCF/3D-Bild/Rendering/DXF-/IFC-Export/Standort-Import, Musterhaus, Musterhaus komplex, Wettbewerb (Plan, Objekt-Info, Taste T, Mappe, Plakat-Blatt, Publikationssatz). Automatisch geprüft: Symbolknöpfe ohne Tooltip (0 Funde), rohe Übersetzungs-Schlüssel (0), abgeschnittene Texte, Esc/Enter an Dialogen (alle modalen Dialoge schliessen mit Esc). **Behoben 15.11.:** (1) unbekannter Befehl in der Befehlszeile tat nichts, jetzt Meldung „Unbekannter Befehl …“ (`engine.ts`, `cmd.unknown`); (2) Layout-Werkzeugleiste: Tabellen-Auswahl auf den Pfeil geschrumpft und „Einpassen“ ausserhalb, jetzt Umbruch; (3) Attribute-Panel: Quellen-Auswahl neben der Strichstärke zeigte „e ▾“ (Label-Spalte höchstens 42 %); (4) Standort-Import: Platzhalter der Bezugspunkt-Felder abgeschnitten; (5) Ansichtsleiste: Ausblendung am rechten Rand, wenn dort noch Bedienelemente liegen; (6) Schreibweise: de „Schließen/Maßstab/Außen“ gemischt mit „Schliessen/Massstab/Aussen“ → überall Schweizer „ss“ (Test `src/i18n/spelling.test.ts`), „Snap-/Endpunkt-Farbe“ → „Fang-“, en „room program“/„colour“ → „room programme“/„color“. e2e: `e2e/uxReview263.spec.ts`. **Offen (nach Wichtigkeit, Grösse):**
+23
View File
@@ -0,0 +1,23 @@
// [266] Projektname im Panel Mappe änderbar (Enter übernimmt, Kopfzeile folgt, Undo stellt zurück);
// neues Projekt hat 2.90 m Geschosshöhe.
import { expect, openTab, startNewProject, test } from "./app";
test("[266] Projektname ändern: Kopfzeile folgt, Undo stellt ihn zurück", async ({ page }) => {
await startNewProject(page);
const header = page.locator(".project-name");
const before = (await header.innerText()).trim();
await openTab(page, "Mappe");
const field = page.getByTestId("project-name");
await expect(field).toHaveValue(before);
await field.fill("Haus am See");
await field.press("Enter");
await expect(header).toHaveText("Haus am See");
// Leer übernehmen bleibt wirkungslos.
await field.fill(" ");
await field.press("Enter");
await expect(header).toHaveText("Haus am See");
await expect(field).toHaveValue("Haus am See");
await page.screenshot({ path: "test-results/projectName266.png" });
await page.locator("body").press("Control+z");
await expect(header).toHaveText(before);
});
+55 -9
View File
@@ -106,12 +106,22 @@ pub fn extent(p: &Project) -> Option<[f64; 4]> {
bbox(&pts).filter(areal).or_else(|| bbox(p.site_rules.iter().flat_map(|r| &r.parcel)).filter(areal))
}
/// [266] Mindestabstand (m) des automatischen Schnitts von einer parallelen Wandachse, Suchschritt (m) und
/// grösster Sinus des Winkels, bis zu dem eine Wand als parallel gilt (≈ 6°).
const AXIS_CLEARANCE: f64 = 0.5;
const AXIS_STEP: f64 = 0.25;
const PARALLEL_SIN: f64 = 0.1;
/// Kleinste Ausdehnung (m) des Ausmasses in beiden Richtungen, ab der die Linien nachgeführt werden.
const MIN_SIZE: f64 = 1.0;
/// Linie einer automatischen Ebene für das Ausmass `b`: Richtung und Blickrichtung wie `line`, Schnitt durch die
/// Mitte, Ansicht vor dem Ausmass (gegen die Blickrichtung), beide mit Rand über das Ausmass hinaus.
pub fn place(kind: DrawingLevelKind, line: [Vec2; 2], sign: f64, b: [f64; 4]) -> Option<[Vec2; 2]> {
///
/// [266] `axes`: Wandachsen des Projekts. Der Schnitt weicht von der Mitte soweit aus, bis er keiner zu ihm
/// (fast) parallelen Wandachse näher als [`AXIS_CLEARANCE`] liegt: sonst schneidet er die Wand der Länge nach (schwarze
/// Fläche im Schnitt). Gibt es keinen freien Platz, bleibt er in der Mitte.
pub fn place(kind: DrawingLevelKind, line: [Vec2; 2], sign: f64, b: [f64; 4], axes: &[[Vec2; 2]]) -> Option<[Vec2; 2]> {
let (dx, dy) = (line[1].x - line[0].x, line[1].y - line[0].y);
let len = dx.hypot(dy);
if !(len > 1e-9) || !b.iter().all(|v| v.is_finite()) {
@@ -126,8 +136,26 @@ pub fn place(kind: DrawingLevelKind, line: [Vec2; 2], sign: f64, b: [f64; 4]) ->
let (s0, s1) = corners.iter().map(along).fold((f64::INFINITY, f64::NEG_INFINITY), |(a, z), v| (a.min(v), z.max(v)));
let (t0, t1) = corners.iter().map(across).fold((f64::INFINITY, f64::NEG_INFINITY), |(a, z), v| (a.min(v), z.max(v)));
let margin = 2.0f64.max(0.1 * (s1 - s0).max(t1 - t0));
// Quer-Koordinaten (Richtung `n`) der zur Linie parallelen Wandachsen.
let parallel: Vec<f64> = axes
.iter()
.filter_map(|a| {
let (wx, wy) = (a[1].x - a[0].x, a[1].y - a[0].y);
let wl = wx.hypot(wy);
if !(wl > 1e-6) || (wx * d.1 - wy * d.0).abs() / wl > PARALLEL_SIN {
return None;
}
Some(a[0].x * n.0 + a[0].y * n.1)
})
.collect();
let clear = |t: f64| parallel.iter().all(|c| (c - t).abs() >= AXIS_CLEARANCE);
let mid = (t0 + t1) / 2.0;
let section_t = || {
let steps = ((t1 - t0) * 0.45 / AXIS_STEP).floor() as i32;
(0..=steps).flat_map(|k| [mid + k as f64 * AXIS_STEP, mid - k as f64 * AXIS_STEP]).find(|t| clear(*t)).unwrap_or(mid)
};
let t = match kind {
DrawingLevelKind::Section => (t0 + t1) / 2.0,
DrawingLevelKind::Section => section_t(),
DrawingLevelKind::Elevation => t0 - margin,
_ => return None,
};
@@ -142,6 +170,7 @@ pub fn place(kind: DrawingLevelKind, line: [Vec2; 2], sign: f64, b: [f64; 4]) ->
pub fn sync_ops(p: &Project, root: &Map<String, Value>, t: &Touch) -> Vec<Op> {
let levels = root.get("drawingLevels").and_then(Value::as_array).map(Vec::as_slice).unwrap_or(&[]);
let ext = if t.extent { extent(p) } else { None };
let axes: Vec<[Vec2; 2]> = p.walls.iter().map(|w| [w.start, w.end]).collect();
let mut out = Vec::new();
for l in &p.drawing_levels {
if l.auto_line != Some(true) || !matches!(l.kind, DrawingLevelKind::Section | DrawingLevelKind::Elevation) {
@@ -153,7 +182,7 @@ pub fn sync_ops(p: &Project, root: &Map<String, Value>, t: &Touch) -> Vec<Op> {
e.remove("autoLine");
} else {
let (Some(b), Some(line)) = (ext, l.line_points) else { continue };
let Some(next) = place(l.kind, line, l.direction_sign.unwrap_or(1.0), b) else { continue };
let Some(next) = place(l.kind, line, l.direction_sign.unwrap_or(1.0), b, &axes) else { continue };
let same = line.iter().zip(&next).all(|(a, c)| (a.x - c.x).abs() < 1e-6 && (a.y - c.y).abs() < 1e-6);
if same && l.bend_points.as_ref().is_none_or(Vec::is_empty) {
continue;
@@ -194,17 +223,34 @@ mod tests {
fn schnitt_durch_die_mitte_ansicht_davor() {
let b = [48.0, 46.0, 60.0, 56.0];
let line = [Vec2 { x: -1.0, y: 2.0 }, Vec2 { x: 6.0, y: 2.0 }];
let s = place(DrawingLevelKind::Section, line, 1.0, b).unwrap();
let s = place(DrawingLevelKind::Section, line, 1.0, b, &[]).unwrap();
assert_eq!(s, [Vec2 { x: 46.0, y: 51.0 }, Vec2 { x: 62.0, y: 51.0 }]);
let e = place(DrawingLevelKind::Elevation, line, 1.0, b).unwrap();
let e = place(DrawingLevelKind::Elevation, line, 1.0, b, &[]).unwrap();
// Blick nach +y (Norden): Linie südlich des Gebäudes.
assert_eq!(e, [Vec2 { x: 46.0, y: 44.0 }, Vec2 { x: 62.0, y: 44.0 }]);
// Umgekehrte Blickrichtung: Linie auf der anderen Seite.
let n = place(DrawingLevelKind::Elevation, line, -1.0, b).unwrap();
let n = place(DrawingLevelKind::Elevation, line, -1.0, b, &[]).unwrap();
assert_eq!(n[0].y, 58.0);
assert!(place(DrawingLevelKind::Floor, line, 1.0, b).is_none());
assert!(place(DrawingLevelKind::Section, [line[0], line[0]], 1.0, b).is_none());
assert!(place(DrawingLevelKind::Section, line, 1.0, [f64::NAN, 0.0, 1.0, 1.0]).is_none());
assert!(place(DrawingLevelKind::Floor, line, 1.0, b, &[]).is_none());
assert!(place(DrawingLevelKind::Section, [line[0], line[0]], 1.0, b, &[]).is_none());
assert!(place(DrawingLevelKind::Section, line, 1.0, [f64::NAN, 0.0, 1.0, 1.0], &[]).is_none());
}
/// [266] Liegt die Mitte auf der Achse einer parallelen Innenwand, rückt der Schnitt zur Seite (nicht auf die Achse).
#[test]
fn schnitt_meidet_wandachsen() {
let b = [48.0, 46.0, 60.0, 56.0];
let line = [Vec2 { x: -1.0, y: 2.0 }, Vec2 { x: 6.0, y: 2.0 }];
let ax = |y: f64| [Vec2 { x: 48.0, y }, Vec2 { x: 60.0, y }];
let y_of = |axes: &[[Vec2; 2]]| place(DrawingLevelKind::Section, line, 1.0, b, axes).unwrap()[0].y;
assert_eq!(y_of(&[]), 51.0);
let y = y_of(&[ax(51.0)]);
assert!((y - 51.0).abs() >= 0.5 && (y - 51.0).abs() <= 1.0, "{y}");
// Senkrechte Wände zählen nicht; zwei Achsen beidseits: weiter ausweichen.
assert_eq!(y_of(&[[Vec2 { x: 51.0, y: 46.0 }, Vec2 { x: 51.0, y: 56.0 }]]), 51.0);
let y = y_of(&[ax(51.0), ax(51.25), ax(50.75)]);
assert!(![51.0, 51.25, 50.75].iter().any(|c| (c - y).abs() < 0.5), "{y}");
assert!(place(DrawingLevelKind::Elevation, line, 1.0, b, &[ax(44.0)]).unwrap()[0].y == 44.0);
}
#[test]
+36 -3
View File
@@ -686,9 +686,13 @@ fn build_stair(p: &Project, v: &Value, ctx: &Ctx, id: Value) -> StairBuilt {
StairBuilt { fields: f, params, rise, steps }
}
fn stair_ops(p: &Project, v: &Value, ctx: &Ctx, ids: &mut IdGen) -> Vec<Op> {
fn stair_ops(root: &Map<String, Value>, p: &Project, v: &Value, ctx: &Ctx, ids: &mut IdGen) -> Vec<Op> {
let b = build_stair(p, v, ctx, s(&ids.next("ST")));
add_op("stairs", vec![obj(b.fields)])
// [266] Deckenloch im selben Commit (ein Undo-Schritt), wenn die Treppe die Decke des Geschosses durchstösst.
let hole = crate::cmd_solid::stair_hole_ops(root, &b.params, b.rise, b_of(v, "up"), ctx);
let mut ops = add_op("stairs", vec![obj(b.fields)]);
ops.extend(hole);
ops
}
/// Treppen-Vorschau: Tritte, Podest, Lauflinie; `info = [Stufenzahl]`.
@@ -1147,7 +1151,7 @@ pub fn ops(root: &Map<String, Value>, p: &Project, v: &Value) -> Option<Vec<Op>>
"wand" => wand_ops(p, v, &ctx, ids),
// [154] Bauteile aus Zeichnung erkennen.
"recognize" => crate::drawing_recognize::ops(p, v, &ctx, ids),
"stair" => stair_ops(p, v, &ctx, ids),
"stair" => stair_ops(root, p, v, &ctx, ids),
"opening" => opening_ops(root, p, v, &ctx, ids),
"roof" => roof_ops(p, v, &ctx, ids),
"column" => column_ops(v, &ctx, ids),
@@ -1539,6 +1543,35 @@ mod tests {
assert_eq!((p, from, set), (4.8, 4.8, 4.8));
}
/// [266] Treppe durch die Decke des Geschosses: Aussparung im selben Commit (Treppenumriss), nur wenn die
/// Treppe aufwärts über die volle Geschosshöhe läuft und der Umriss ganz in der Decke liegt.
#[test]
fn treppe_legt_deckenloch_an() {
let ceil = json!({"id": "C1", "type": "ceiling", "floorId": "F1", "outline": [{"x": 0, "y": 0}, {"x": 8, "y": 0}, {"x": 8, "y": 6}, {"x": 0, "y": 6}]});
let r = root(json!({"ceilings": [ceil]}));
let t = crate::model::lenient::typed_for_test(&r);
let stair = |start: [f64; 2], cursor: [f64; 2], up: bool, rise: Value| {
let mut v = json!({"cmd": "stair", "shape": "straight", "up": up, "width": 1.0, "referenz": "mitte", "treadMode": "without",
"auftritt": 0.28, "steps": null, "start": {"x": start[0], "y": start[1]}, "cursor": {"x": cursor[0], "y": cursor[1]}});
v["rise"] = rise;
ops(&r, &t, &req(v)).unwrap()
};
let o = stair([1.0, 2.0], [5.0, 2.0], true, Value::Null);
assert_eq!(o.len(), 2, "Treppe + Aussparung");
let j = o[1].to_json();
assert_eq!(j["entity"]["id"], "C1");
let ring = j["entity"]["openings"][0].as_array().unwrap();
assert!(ring.len() >= 4);
for q in ring {
let (x, y) = (q["x"].as_f64().unwrap(), q["y"].as_f64().unwrap());
assert!((0.9..=5.1).contains(&x) && (1.4..=2.6).contains(&y), "{x},{y}");
}
// abwärts, Teilhöhe, ausserhalb der Decke → nur die Treppe
assert_eq!(stair([1.0, 2.0], [5.0, 2.0], false, Value::Null).len(), 1);
assert_eq!(stair([1.0, 2.0], [5.0, 2.0], true, json!(1.5)).len(), 1);
assert_eq!(stair([7.0, 2.0], [11.0, 2.0], true, Value::Null).len(), 1);
}
fn pos_or(p: &Preview) -> f64 {
p.info[0]
}
+39
View File
@@ -684,6 +684,45 @@ fn ceiling_opening_ops(root: &Map<String, Value>, v: &Value, ctx: &Ctx) -> Vec<O
vec![Op::Replace { collection: "ceilings".into(), entity: with(host, "openings", Value::Array(openings)) }]
}
/// [266] Deckenloch einer neuen Treppe: steigt sie über die ganze Geschosshöhe nach oben, wird in die Decke des
/// Geschosses (die den ganzen Treppengrundriss enthält) eine Aussparung in der Form des Treppenumrisses gelegt.
/// Keine solche Decke, Treppe nach unten oder nicht über die volle Höhe, oder schon ein Loch darüber → keine Op.
/// Die Ops laufen mit der Treppe im selben Commit (ein Undo-Schritt).
pub(crate) fn stair_hole_ops(root: &Map<String, Value>, params: &[f64], rise: f64, up: bool, ctx: &Ctx) -> Vec<Op> {
let floor_h = ctx.floor_height.unwrap_or(f64::NAN);
if !up || !(floor_h.is_finite() && rise >= floor_h - 0.05) {
return Vec::new();
}
let o = crate::stair::outline(params);
let ring: Vec<V> = match o.first() {
Some(&k) if k == 0.0 && o.len() >= 2 => {
let n = o[1] as usize;
(0..n).filter_map(|i| Some((*o.get(2 + 2 * i)?, *o.get(3 + 2 * i)?))).collect()
}
// Wendeltreppen (Linien + Bögen statt Polygon): Loch weiter von Hand (`deckenloch`).
_ => return Vec::new(),
};
if ring.len() < 3 || ring.iter().any(|q| !(q.0.is_finite() && q.1.is_finite())) {
return Vec::new();
}
let host = arr(root.get("ceilings")).iter().find(|c| {
let outline = ring_of(c);
crate::cmd_create::floor_of(c) == Some(ctx.level) && outline.len() >= 3 && ring.iter().all(|q| point_in_polygon(*q, &outline))
});
let Some(host) = host else { return Vec::new() };
let mut openings = arr(field(host, "openings")).to_vec();
// Ein bestehendes Loch, das den Umriss schon enthält, genügt.
let covered = openings.iter().any(|h| {
let hr: Vec<V> = arr(Some(h)).iter().map(xy).collect();
hr.len() >= 3 && ring.iter().all(|q| point_in_polygon(*q, &hr))
});
if covered {
return Vec::new();
}
openings.push(pvs(&ring));
vec![Op::Replace { collection: "ceilings".into(), entity: with(host, "openings", Value::Array(openings)) }]
}
/// Dachfenster / Deckenöffnung mit Oberlicht ([103]): ein Klick setzt die Öffnung (Mitte im Grundriss) in das
/// Dach, dessen Umriss den Punkt enthält (Dächer des aktiven Geschosses zuerst), sonst in die Decke des
/// Geschosses. Masse in der Dachebene (Standard 78 × 118 cm), Fenstertyp wie beim Fenster-Befehl.
+2 -1
View File
@@ -1571,7 +1571,8 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result<Flat, String>
common.push(ident("Reference", n));
}
common.push(Prop::Bool("IsExternal", external));
let (id, name, long) = (f.str(&room.id), f.str(number.unwrap_or(&room.id)), f.str(&room.name));
// [266] IFC-Konvention: Name = Raumnummer, LongName = Raumname; ohne Nummer steht der Raumname im Namen (nicht die interne Id).
let (id, name, long) = (f.str(&room.id), f.str(number.unwrap_or(if room.name.is_empty() { &room.id } else { &room.name })), f.str(&room.name));
let bands = crate::room_book::height_bands(&p, room, roofs, area.net);
let arcs = crate::ring_arc::has_arcs(room.boundary_bulge.as_deref(), room.boundary.len());
f.nums(&[if arcs { REC_SPACE_ARC } else { REC_SPACE }, structure, id, name, long, if external { 1.0 } else { 0.0 }, height, z_rel, bands.mean]);
+6
View File
@@ -6,6 +6,12 @@ describe("[221] getippte Landeskoordinaten", () => {
it("absolute LV95-Eingabe wird bei Standort-Bezug auf den Projekt-Nullpunkt gerechnet", () => {
expect(fromWorldInput(parseInput("2600048,1200046"), origin)).toEqual({ kind: "absolute", point: { x: 48, y: 46 } });
});
it("[266] Ergebnis auf mm gerundet, keine Gleitkomma-Reste", () => {
const o = { e: 2_600_000.1, n: 1_200_000.3 };
const r = fromWorldInput(parseInput("2600053.3,1200010.7"), o);
expect(r).toEqual({ kind: "absolute", point: { x: 53.2, y: 10.4 } });
expect(fromWorldInput(parseInput("2600053.2,1200000.1"), origin)).toEqual({ kind: "absolute", point: { x: 53.2, y: 0.1 } });
});
it("lokale, relative Eingaben und Projekte ohne Bezug bleiben", () => {
expect(fromWorldInput(parseInput("48,46"), origin)).toEqual({ kind: "absolute", point: { x: 48, y: 46 } });
expect(fromWorldInput(parseInput("r2600048,1200046"), origin).kind).toBe("relative");
+3 -1
View File
@@ -147,7 +147,9 @@ export function isLv95(e: number, n: number): boolean {
*/
export function fromWorldInput(p: ParsedInput, origin: { e: number; n: number } | null): ParsedInput {
if (!origin || p.kind !== "absolute" || !isLv95(p.point.x, p.point.y)) return p;
return { kind: "absolute", point: { x: p.point.x - origin.e, y: p.point.y - origin.n } };
// [266] Auf mm runden: 2600053.2 − 2600000 ergäbe sonst 53.200000000186 im Modell.
const mm = (v: number) => Math.round(v * 1000) / 1000;
return { kind: "absolute", point: { x: mm(p.point.x - origin.e), y: mm(p.point.y - origin.n) } };
}
/** Punkt aus polarer Form (Distanz/Winkel) relativ zu einem Basispunkt. */
+1 -1
View File
@@ -49,7 +49,7 @@ function expectRoomHeightsAndLayers(p: Project, c: Check) {
const rows = roomBook(p).rows;
expect(rows.length).toBeGreaterThan(0);
for (const row of rows) {
const h = c.stats.spaceHeights![row.number || row.id];
const h = c.stats.spaceHeights![row.number || row.name || row.id];
expect(h, row.number).toBeDefined();
expect(Math.abs(h.Height - row.clearHeight)).toBeLessThan(0.01);
expect(Math.abs(h.FinishCeilingHeight - row.heightMean)).toBeLessThan(0.01);
+8
View File
@@ -543,6 +543,14 @@ describe("Räume als IfcSpace", () => {
const contained = spf.split("\n").filter((l) => /=IFCRELCONTAINEDINSPATIALSTRUCTURE\(/.test(l) && spaceIds.some((id) => new RegExp(`${id}[,)]`).test(l)));
expect(contained).toEqual([]);
});
it("[266] Name = Raumnummer, LongName = Raumname; ohne Nummer der Raumname statt der internen Id", () => {
const p = withRooms();
p.rooms![0] = { ...p.rooms![0], stamp: { number: "1.01" } } as NonNullable<Project["rooms"]>[number];
const spaces = exportIfcSpf(p).split("\n").filter((l) => /=IFCSPACE\(/.test(l));
expect(spaces[0]).toMatch(/,'1\.01',\$,\$,#\d+,#\d+,'K\\X2\\00FC\\X0\\che',/);
expect(spaces[1]).toMatch(/,'Gang',\$,\$,#\d+,#\d+,'Gang',/);
expect(spaces.some((l) => l.includes("'R1'") || l.includes("'R2'"))).toBe(false);
});
it("Netto-Geschossfläche und SIA-416-Kategorie", () => {
const spf = exportIfcSpf(withRooms());
expect(spf).toMatch(/IFCQUANTITYAREA\('NetFloorArea',\$,\$,12\.0,\$\)/);
+1
View File
@@ -4018,6 +4018,7 @@ export const de = {
"publish.none": "Kein Publikationssatz. Mit + Blätter zu einem Satz bündeln.",
"publish.defaultName": "Neuer Satz",
"publish.projectNumber": "Projektnummer",
"publish.projectName": "Projektname",
"publish.name": "Name",
"publish.format": "Ausgabe",
"publish.format.pdf-multi": "PDF, ein Dokument",
+1
View File
@@ -4004,6 +4004,7 @@ export const en: Record<TranslationKey, string> = {
"publish.none": "No publication set. Use + to bundle sheets into a set.",
"publish.defaultName": "New set",
"publish.projectNumber": "Project number",
"publish.projectName": "Project name",
"publish.name": "Name",
"publish.format": "Output",
"publish.format.pdf-multi": "PDF, one document",
+17 -14
View File
@@ -23,6 +23,9 @@ const symmetric = (p: Project, wallTypeId: string) => {
return l.every((x, i) => x.componentId === l[l.length - 1 - i].componentId && Math.abs(x.thickness - l[l.length - 1 - i].thickness) < 1e-9);
};
/** Leeres Projekt mit den Geschossen des Demo-Hauses (2.60 m): der Import ordnet Geschosse über die Höhe zu; die Vorgabe neuer Projekte (2.90 m, [266]) passt nicht dazu. */
const blankProject: Project = { ...emptyProject, drawingLevels: sampleProject.drawingLevels };
async function importInto(base: Project, src: Project) {
const r = await importIfcInto(base, bytesOf(exportIfcSpf(src)), { elements: true });
return { ...r, summary: r.summary as IfcElementsSummary };
@@ -30,7 +33,7 @@ async function importInto(base: Project, src: Project) {
describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
it("gleiche Wände (Achse, Typ, Höhe, Geschoss), Öffnungen, Decke, Raum; Rest als Mesh", async () => {
const { project: p, summary, report } = await importInto(emptyProject, sampleProject);
const { project: p, summary, report } = await importInto(blankProject, sampleProject);
expect(report.parseErrors).toBe(0);
expect(summary).toMatchObject({ walls: 9, openings: 3, ceilings: 1, columns: 0, rooms: 1, floors: 0, wallTypes: 0, ceilingTypes: 0, components: 0, kept: 0 });
// (6.11.) Dach und Treppe kommen als Bauteile zurück, kein Kontext-Mesh mehr.
@@ -110,7 +113,7 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
: o,
),
};
const { project: p } = await importInto(emptyProject, src);
const { project: p } = await importInto(blankProject, src);
const d = (p.openings ?? []).find((o) => o.kind === "door")!;
expect(d).toMatchObject({ fireRating: "EI30", soundClass: "Rw 32 dB", burglaryClass: "RC2", uValue: 1.3, isExternal: false });
const w = (p.openings ?? []).find((o) => o.kind === "window" && Math.abs(o.width - win.width) < 1e-6)!;
@@ -129,9 +132,9 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
expect(spf).toContain("Pset_SpaceCoveringRequirements");
expect(spf).toContain("Dossier_RoomBook");
// In ein Projekt mit demselben Material: Verweis über den Namen; sonst Freitext.
const { project: p } = await importInto({ ...emptyProject, components: [comp] }, src);
const { project: p } = await importInto({ ...blankProject, components: [comp] }, src);
expect(p.rooms![0]).toMatchObject({ usage: "bath", floorFinish: comp.id, wallFinish: "Abrieb 1 mm", ceilingFinish: "Weissputz", floorBuildUp: "UB 80, TSD 20" });
const { project: q } = await importInto({ ...emptyProject, components: [] }, src);
const { project: q } = await importInto({ ...blankProject, components: [] }, src);
expect(q.rooms![0]!.floorFinish).toBe(comp.name);
// Ohne Angaben: keine Raumbuch-Psets.
expect(exportIfcSpf(sampleProject)).not.toContain("Dossier_RoomBook");
@@ -155,7 +158,7 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
o.id === "D1" ? { ...o, hinge, swing, openingDir } : o.id === "O2" ? { ...o, wingCount: 2 } : o,
),
};
const { project: p } = await importInto(emptyProject, src);
const { project: p } = await importInto(blankProject, src);
const d1 = src.openings!.find((o) => o.id === "D1")!;
const w1 = src.walls.find((w) => w.id === d1.hostWallId)!;
const got = (p.openings ?? []).find((o) => o.kind === "door")!;
@@ -175,8 +178,8 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
it("in ein Projekt ohne Geschosse/Typen: legt Geschosse, Wand-/Deckentypen und Materialien an", async () => {
const bare: Project = {
...emptyProject,
drawingLevels: emptyProject.drawingLevels.filter((l) => l.kind !== "floor"),
...blankProject,
drawingLevels: blankProject.drawingLevels.filter((l) => l.kind !== "floor"),
wallTypes: [],
ceilingTypes: [],
components: [],
@@ -200,8 +203,8 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
});
it("über Ops angewandt und gespeichert/geladen bleibt alles gleich", async () => {
const { project: next } = await importInto(emptyProject, sampleProject);
const applied = applyOps(emptyProject, projectDiffOps(emptyProject, next));
const { project: next } = await importInto(blankProject, sampleProject);
const applied = applyOps(blankProject, projectDiffOps(blankProject, next));
expect(applied.walls).toEqual(next.walls);
expect(applied.openings).toEqual(next.openings);
const back = parseProjectFile(serializeProject(applied));
@@ -219,7 +222,7 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
{ id: "S2", type: "column", floorId: "og", categoryCode: "50", position: { x: 3, y: 2 }, profile: { kind: "round", radius: 0.15 }, rotation: 0, height: 2.5 },
];
const src: Project = { ...sampleProject, columns: cols };
const { project: p, summary } = await importInto(emptyProject, src);
const { project: p, summary } = await importInto(blankProject, src);
expect(summary.columns).toBe(2);
const s1 = p.columns!.find((c) => c.profile.kind === "rect")!;
expect(s1.floorId).toBe("eg");
@@ -246,7 +249,7 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
for (const [name, typeId, patch] of cases) {
it(`[151] Treppe ${name}: Rundreise`, async () => {
const st0: Stair = { ...base, ...patch, typeId };
const { project: p, summary } = await importInto(emptyProject, { ...sampleProject, stairs: [st0] });
const { project: p, summary } = await importInto(blankProject, { ...sampleProject, stairs: [st0] });
expect(summary.stairs).toBe(1);
const st = p.stairs![0];
expect([st.shape, st.stepCount, st.turn ?? null, st.midSteps ?? null], JSON.stringify(st)).toEqual([st0.shape, st0.stepCount, st0.turn ?? null, st0.midSteps ?? null]);
@@ -268,11 +271,11 @@ describe("Kontext-Mesh: Farbe und GlobalId", () => {
// Benennung, Farbe (#rrggbb, gemeinsame Farbe beim Zusammenlegen) und GlobalId prüft der Kern-Test
// `import_drawing_tests.rs::ifc_meshes_farbe_und_globalid`; hier die Rundreise aus einer Datei.
it("Farbe aus der Datei (IfcStyledItem) kommt am Mesh an und übersteht Speichern/Laden", async () => {
const { meshes } = await importIfcInto(emptyProject, new Uint8Array(readFileSync(new URL("./testdata/ifc-geometry-cases.ifc", import.meta.url))), { fileName: "cases.ifc" });
const { meshes } = await importIfcInto(blankProject, new Uint8Array(readFileSync(new URL("./testdata/ifc-geometry-cases.ifc", import.meta.url))), { fileName: "cases.ifc" });
expect(meshes.length).toBeGreaterThan(0);
expect(meshes.every((m) => m.ifcGlobalId && !m.name.includes("["))).toBe(true);
const withColor = { ...meshes[0], color: "#336699" };
const proj: Project = { ...emptyProject, context: [withColor] };
const proj: Project = { ...blankProject, context: [withColor] };
const back = parseProjectFile(serializeProject(proj));
expect(back.ok && back.project.context?.[0]).toEqual(withColor);
});
@@ -294,7 +297,7 @@ describe.skipIf(!samples || !existsSync(samples))("IFC-Import als Bauteile: Beis
walk(samples!);
const rows: string[] = [];
for (const f of files) {
const { project, summary } = await importIfcInto(emptyProject, new Uint8Array(readFileSync(f)), { fileName: f, elements: true });
const { project, summary } = await importIfcInto(blankProject, new Uint8Array(readFileSync(f)), { fileName: f, elements: true });
expect(validateProject(project), f).toEqual([]);
rows.push(`${f.slice(samples!.length + 1)}: ${JSON.stringify(summary)}`);
}
+16
View File
@@ -0,0 +1,16 @@
// [266] Neues Projekt: Geschosshöhe praxisgerecht (lichte Höhe ≥ 2.40 m), Beispielprojekte unverändert.
import { describe, expect, it } from "vitest";
import { emptyProject, sampleProject } from "./sampleProject";
describe("Geschosshöhe neuer Projekte [266]", () => {
it("lichte Höhe ≥ 2.40 m über der Decke des Typs, Geschosse gestapelt", () => {
const floors = emptyProject.drawingLevels.filter((l) => l.kind === "floor");
const slab = (emptyProject.ceilingTypes ?? [])[0].layers.reduce((a, l) => a + l.thickness, 0);
for (const f of floors) expect((f.floorHeight ?? 0) - slab).toBeGreaterThanOrEqual(2.4);
expect(floors[0].floorHeight).toBe(2.9);
expect(floors[1].baseElevation).toBe(2.9);
});
it("Beispielprojekt bleibt bei 2.60 m", () => {
expect(sampleProject.drawingLevels.find((l) => l.id === "eg")!.floorHeight).toBe(2.6);
});
});
+10 -1
View File
@@ -595,6 +595,9 @@ export const sampleProject: Project = {
* Leeres Projekt (nur Bibliotheken, keine Geometrie) — für manuelle Tests, die
* ohne das Demo-Haus starten wollen (z. B. Standort-Import auf leerer Fläche).
*/
/** [266] Geschosshöhe neuer Projekte (m), auch für „Geschoss hinzufügen“. */
export const EMPTY_FLOOR_HEIGHT = 2.9;
export const emptyProject: Project = {
...sampleProject,
id: "empty",
@@ -611,5 +614,11 @@ export const emptyProject: Project = {
context: [],
// [221] Schnitt A und Ansicht Süd folgen dem ersten Gebauten (bzw. der Parzelle), bis man sie bearbeitet
// (Kern `auto_lines.rs`) — sonst lägen sie bei einem Projekt in Landeskoordinaten oder abseits des Nullpunkts daneben.
drawingLevels: sampleProject.drawingLevels.map((l) => (l.kind === "section" || l.kind === "elevation" ? { ...l, autoLine: true } : l)),
// [266] Geschosshöhe 2.90 m (CH-Wohnbau 2.80–3.00 m): bei 30 cm Decke bleiben 2.60 m lichte Höhe (≥ 2.40 m für Wohnräume);
// die 2.60 m des Beispielprojekts ergaben nur 2.30 m. Die Beispielprojekte bleiben unverändert.
drawingLevels: sampleProject.drawingLevels.map((l) => {
if (l.kind === "section" || l.kind === "elevation") return { ...l, autoLine: true };
if (l.kind !== "floor") return l;
return { ...l, floorHeight: EMPTY_FLOOR_HEIGHT, baseElevation: l.id === "og" ? EMPTY_FLOOR_HEIGHT : l.baseElevation };
}),
};
+28 -1
View File
@@ -148,6 +148,29 @@ function SetEditor({ set }: { set: PublishSet }) {
);
}
/** [266] Projektname: Entwurf lokal, übernommen bei Enter/Verlassen (leer → alter Name bleibt). */
function ProjectNameInput({ name, onCommit }: { name: string; onCommit: (v: string) => void }) {
const [draft, setDraft] = useState<string | null>(null);
const commit = () => {
if (draft !== null && draft.trim() && draft !== name) onCommit(draft);
setDraft(null);
};
return (
<input
className="res-input"
style={{ flex: 1 }}
data-testid="project-name"
value={draft ?? name}
onChange={(e) => setDraft(e.target.value)}
onBlur={commit}
onKeyDown={(e) => {
if (e.key === "Enter") (e.target as HTMLInputElement).blur();
if (e.key === "Escape") setDraft(null);
}}
/>
);
}
export function PublishSection() {
const host = usePanelHost();
const project = useStore((s) => s.project);
@@ -165,7 +188,11 @@ export function PublishSection() {
</span>
</header>
<label style={{ display: "flex", gap: 6, alignItems: "center", padding: "2px 10px", fontSize: 12 }}>
<span>{t("publish.projectNumber")}</span>
<span style={{ minWidth: 82 }}>{t("publish.projectName")}</span>
<ProjectNameInput name={project.name} onCommit={host.onSetProjectName} />
</label>
<label style={{ display: "flex", gap: 6, alignItems: "center", padding: "2px 10px", fontSize: 12 }}>
<span style={{ minWidth: 82 }}>{t("publish.projectNumber")}</span>
<input
className="res-input mono"
style={{ flex: 1 }}
+2
View File
@@ -802,6 +802,8 @@ export interface PanelHostValue {
onDeletePublishSet: (id: string) => void;
/** Erzeugt und speichert alle Dateien des Satzes; zählt Indizes hoch und protokolliert. */
onPublishSet: (id: string) => void;
/** [266] Setzt den Projektnamen (leer → unverändert). */
onSetProjectName: (value: string) => void;
/** Setzt die Projektnummer (Dateinamen-Muster `{Projektnummer}`). */
onSetProjectNumber: (value: string) => void;
/** Wettbewerb ([208]): anonyme Abgabe und Kennwort setzen (Teil-Patch). */
+2
View File
@@ -182,6 +182,8 @@ export function buildLayoutsHost(c: FlatHostOpts) {
applyChange((p) => addWbwSetOps(p, id));
return id;
},
// [266] Projektname (Dateinamen der Exporte, Kopfzeilen); leer lässt den bisherigen Namen stehen.
onSetProjectName: (value) => applyChange((p) => (value.trim() ? fieldOps(p, "name", value) : []), "projectName"),
onSetProjectNumber: (value) => applyChange((p) => fieldOps(p, "projectNumber", value.trim() ? value : undefined), "projectNumber"),
onDeletePublishSet: (id) => applyChange((p) => deletePublishSetOps(p, id)),
onPublishSet: (id) => {
+23
View File
@@ -0,0 +1,23 @@
// [266] Projektname über Ops änderbar (ein Undo-Schritt), leerer Name wird ignoriert.
import { describe, expect, it } from "vitest";
import { getState } from "../appStore";
import { emptyProject } from "../../model/sampleProject";
import { buildLayoutsHost } from "./layoutsHost";
import type { FlatHostOpts } from "./types";
describe("onSetProjectName [266]", () => {
it("setzt den Namen, Undo stellt ihn zurück, leer ändert nichts", () => {
getState().loadProject(emptyProject);
const s = getState();
const host = buildLayoutsHost({ applyChange: s.applyChange, project: s.project } as unknown as FlatHostOpts);
const before = getState().project.name;
const depth = getState().undoDepth;
host.onSetProjectName("Haus am See");
expect(getState().project.name).toBe("Haus am See");
expect(getState().undoDepth).toBe(depth + 1);
host.onSetProjectName(" ");
expect(getState().project.name).toBe("Haus am See");
getState().undo();
expect(getState().project.name).toBe(before);
});
});
+2 -2
View File
@@ -25,7 +25,7 @@ import {
setFieldIfChanged,
} from "../core";
import type { PolylineVertexType } from "../core";
import { sampleProject } from "../model/sampleProject";
import { EMPTY_FLOOR_HEIGHT, sampleProject } from "../model/sampleProject";
import {
addChildByCode,
applyVisibilityByCode,
@@ -729,7 +729,7 @@ export function createProjectSlice(
kind: "floor",
visible: true,
locked: false,
floorHeight: 2.6,
floorHeight: EMPTY_FLOOR_HEIGHT,
cutHeight: 1.0,
};
return fieldOps(p, "drawingLevels", recomputeFloorElevations([...p.drawingLevels, floor]));