[280] Träger/Unterzug als eigenes Bauteil: Project.beams, Plan (gestrichelt mit Achse), Schnitt, Ansicht, 3D, IFC IfcBeam, DXF, Befehl traeger, Objekt-Info, Griffe, Beispiel Musterhaus komplex
This commit is contained in:
97 files changed
+1479
-81
No files matched your search
@@ -10,7 +10,7 @@ Wer zu einer ID mehr wissen will (Entscheide, Tests, Bilder), sucht dort nach `*
|
||||
stehen im Archiv („Bewusst nicht übernommen“).
|
||||
- **Grösse** (eine Person mit Agenten): S ≤ 1 Tag · M ≤ 1 Woche · L ≤ 1 Monat · XL > 1 Monat.
|
||||
Steht keine Grösse im Archiv, ist sie hier geschätzt.
|
||||
- **IDs sind stabil.** Neue ID = nächste freie Zahl nach der höchsten im Archiv und hier (aktuell 278);
|
||||
- **IDs sind stabil.** Neue ID = nächste freie Zahl nach der höchsten im Archiv und hier (aktuell 280);
|
||||
nie eine ID wiederverwenden oder umnummerieren. Präfix-IDs (`[K]`, `[G]`, `[T]`, `[B]`, `[C]`) bleiben.
|
||||
- **Pro Punkt:** was fehlt · wo im Code · Grösse. Höchstens ein bis drei Sätze je Punkt;
|
||||
Messwerte und Befunde gehören in den Commit.
|
||||
@@ -74,6 +74,7 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC.
|
||||
|
||||
- ◐ **[270]** Blickrichtungen überall gleich, Marken weichen aus (17.11.). **Befund:** das 3D-Fenster (render3d, Browser und Metal) zeigte das Modell **gespiegelt**: Bauteile liegen in der Welt (x, Höhe, y), ein Achsentausch (Determinante −1), und `look_at` ist rechtshändig — von Süden gesehen lag der Erker im Osten links, die Draufsicht stand kopfüber (Süden oben). Gelände, Importe/Verbau und Punktwolken negierten y (Fix 24.9. „swisstopo gespiegelt“) und lagen damit an y = 0 gespiegelt unter dem Haus. Vektor-Axonometrie, Cycles, Blender, glTF/OBJ und die Ansichten Nord/Ost/Süd/West waren seitenrichtig, aber die Namen widersprachen sich: `iso` = von Nordost (3D, Axo-Alias), von Südwest (Cycles/Blender); `front` = von Norden (3D, Axo) bzw. Süden (Cycles); „Axonometrie Südost“ im Musterhaus komplex stand auf `isoFrontLeft`. **Behoben:** eine Tabelle `render3d/src/view_dir.rs` für 3D-Presets (`math::preset_camera`), Axonometrie (`plan/axo.rs::preset`), Cycles (`cycles_scene.rs::preset`, CLI `render --view` nimmt auch `southeast` …), Blender-Skript (Kopie, per vitest geprüft): vorne = Süden, rechts = Osten, `iso` = Südost, `isoFrontLeft` = Südwest, `isoBackRight` = Nordost, `isoBackLeft` = Nordwest, `top` mit Norden oben; Beschriftungen „Isometrie Südost“, „Südwest“ … Die Spiegelung gleicht die Kamera an einer Stelle aus (`math::view_matrix`: Bild-rechts = oben × Blick; Culling `FrontFace::Cw`; Pathtracer-Strahlen; TS `screenRight`/`orbitRight` für Pick-Strahl, Griffe, Pan, Zoom zum Cursor, Begehen, Orbit-Richtung); Gelände/Import/Punktwolke/Luftbild ohne y-Negation. Ausschnitt „Axonometrie Südost“ → `iso`. **Marken ([266]/8):** Ansichtsmarken werden nach den Schnitten gesetzt und weichen Schnittlinien, -pfeilen und anderen Ansichtsmarken aus (zusätzlich seitlich entlang ihrer Linie, bis 15 mm; `plan/context.rs::view_marker`); Schnittpfeile sind Hindernis für Beschriftungen. Tests: Rust render3d `kamera_zeigt_modell_seitenrichtig` (vorher rot), `aussenflaechen_erscheinen_im_uhrzeigersinn`, `view_dir::tests`; Kern `axo::testhaus_seitenrichtig_in_allen_vorgaben`, `cycles_scene::voreinstellungen_heissen_wie_im_3d`, `context::ansichtsmarken_weichen_schnittmarken_aus` (vorher rot); vitest `view270.test.ts`, `viewDirections.test.ts`. Bilder und Testhaus (Erker Ost, Garage West, Turm Nordwest; `testhaus.py`) in `doc/review-270/`. **Offen:** 3D-Bild nur numerisch (Kameramatrix, Pick-Strahl) geprüft, kein Bild aus render3d unter Linux, nicht auf dem Mac/Metal (Prüfschritt `doc/RELEASE-1.0.md` 13.36); natives Spike-Fenster `src-tauri/src/native.rs` (Orbit-Richtung) nicht angepasst; gespeicherte Ausschnitte mit `isoBackRight`/`isoFrontLeft` zeigen jetzt die Richtung ihres Namens (keine produktiven Projekte). · M
|
||||
- ◐ **[278]** Nutzungseinheiten und Wohnungsspiegel (17.11.; Lücke 6 in `doc/VERGLEICH-1.0.md`; Chromium/Linux, nicht in der Tauri-App/auf dem Mac geprüft): `Project.units` (`Unit`: Nummer, Typ, Nutzung Wohnen/Gewerbe/Büro/Andere, Farbe, Bemerkung), `Room.unitId`, `Room.roomCount`. Kern `unit_schedule.rs` (Annahmen im Modulkopf): je Einheit Geschoss(e), Typ (eingegeben oder „n-Zi-Whg“), Zimmerzahl, HNF/NNF/NF nach SIA 416, Aussenraum = Räume der Flächenart AGF, Summen je Typ und je Geschoss, Räume ohne Einheit getrennt. **Zimmerzahl (Annahme, nicht aus dem Namen geraten):** nur bei Wohnnutzung; Beitrag je Raum `roomCount`, sonst aus der Raumnutzung: Wohnen, Schlafen, Essen, Büro = 1, alles andere 0, nur bei Flächenart HNF; Wohnküche von Hand 0.5 (oder Wohnen/Essen 1.5). Maisonetten zählen in jedem Geschoss mit ihren Flächen. Abfrage `unitSchedule`, Blatt-Tabelle Quelle `unitSchedule`, Bericht/CSV/PDF (`buildAreaReport` mit `units`; der Nachweis-Export enthält ihn, eigene Knöpfe „Spiegel CSV/PDF“), CLI `kennzahlen --wohnungsspiegel` (ohne Option im JSON, sobald Einheiten da sind). Oberfläche: Panel Flächenbilanz „Nutzungseinheiten“ (`UnitsSection.tsx`: Liste, neue Einheit leer/aus Auswahl, Auswahl zuordnen, löschen), Objekt-Info Raum: Felder „Einheit“ (Auswahl, „Neue Einheit …“) und „Zimmer-Zählung“, Mehrfachauswahl = ein Undo-Schritt. Beispiel Wettbewerb: 6 Wohnungen (2-Zi und 2.5-Zi), Layout „Wohnungsspiegel“. Tests: Rust `unit_schedule::tests`, `sheet_table::wohnungsspiegel_tabelle`, `robustness`; vitest `unitSchedule.test.ts`; e2e `units278.spec.ts`. Bilder: `doc/review-278/`. **Offen:** Einheiten im Grundriss als farbige Fläche/Stempel auf eigener Klasse ([180]) fehlt (`Unit.color` ist schon da); Summen je Typ/Geschoss nicht als eigene Blatt-Tabelle; Mindestfläche für Zimmer und Wohnungs-Nettowohnfläche (NWF) nach kantonaler Definition nicht abgebildet; Einheit nicht in IFC/DXF-Export; im schmalen Dock wird der Spiegel als Karten gezeigt (wie die Flächentabelle) · M.
|
||||
- ◐ **[280]** Träger/Unterzug als eigenes Bauteil (17.11.; Lücke 9 in `doc/VERGLEICH-1.0.md`; Linux-Container: Rust-Tests, vitest, CLI-SVG mit `--hatch`, Axonometrie, Chromium-e2e; nicht in der Tauri-App/auf dem Mac geprüft): `Project.beams` (`Beam`: Achse `start`→`end`, Querschnitt `width` × `height` als Aussenmasse, `profileName` nur als Text wie „HEB 200“, `topOffset`, Bauteil/Schraffur/Stift wie Stützen, Umbau-Status [271], Variante [272], Sperre). **Höhenlage:** Oberkante = Unterkante der tiefsten Decke desselben Geschosses, die die Achsmitte überdeckt (sonst Geschoss-Oberkante) + `topOffset` (Vorgabe 0 = bündig, Unterzug); `Project::beam_vertical_extent`, `model::helpers::heights::beam` (auch auf der rohen Wurzel für die Objekt-Info). **Code geteilt:** `Beam::as_column` macht aus dem Träger eine Stütze (Rechteck Länge × Breite um die Achsmitte, gedreht, feste Anker, `type == "beam"`); Grundriss, Schnitt (`SlabSource::Beam`, Schraffur/Poché wie Stütze), Ansicht, 3D-Netz/Pick (`Owner::Beam`), Schatten, Fang, Hervorhebung, Explosion, OBJ/glTF-Gruppen laufen durch den Stützen-Code, Träger schneiden keine Wände aus. Grundriss: über der Schnitthöhe immer gestrichelt (Strichpunkt) mit Achse (`beam-axis`, SIA-Achslinie); geschnitten wie eine Stütze. IFC als `IfcBeam` (Satz `BEAM` = 27, `Pset_BeamCommon`, `Qto_BeamBaseQuantities`, GlobalId `beam/<id>`, Material wie Stützen; senkrechte Extrusion des Grundriss-Rechtecks), DXF auf der Klasse des Trägers (auch Umbau-Ebene), Bauteilliste „Träger“. **Auswahlkanal:** Träger liegen im Kanal der Stützen (`Selection.columns`/`columnIds`, Plan-Pick `columnId`, 3D-Pick `PickColumn`); der Kern schlägt die Id in `columns` und `beams` nach (Objekt-Info `kind: "beam"`, Transformieren/Kopieren/Einfügen, Löschen, Sperren, Klassen-Prüfung, Zwischenablage, BCF). Befehl `traeger` (Alias `träger`, `unterzug`, `beam`; Kern-Befehl `beam`): Anfang, Ende, Zahl = Höhe, Option Profil (25/40, 30/50, 20/30, HEB 200/300, IPE 200 als Text mit Aussenmassen), Klasse „25“ (Stützen) sonst „50“ sonst aktive; Werkzeugliste „Befehle 3D“; Objekt-Info „Träger“ (Profil, Breite, Höhe, OK-Versatz zur Decke, Länge, UK–OK; Mehrfachauswahl setzt für alle, ein Undo); Griffe Anfang/Ende/Mitte (`grips.rs` `beamGrip`). Beispiel Musterhaus komplex: Unterzug 30/45 im EG-Wohnraum (`tg-eg-1`), im Schnitt A-A quer geschnitten (Goldens: nur `komplex-*`, ein Bauteil mehr). Tests: Rust `beam_tests` (Höhenlage, Grundriss, Schnitt quer/längs, 3D, Objekt-Info, Befehl, Umbaufilter), `grips::traeger_griffe`, `heights`, fileio `traeger_als_ifc_beam`; vitest `beam.test.ts`; e2e `beam280.spec.ts`. Bilder: `doc/review-280/`. **Offen:** Gruppen: `Group` hat keine `beamIds`, Träger laufen über `columnIds` mit (Mitglieder-Prüfung kennt sie), aber wie bei Stützen bewegt/kopiert die Transformation nur EIN gewähltes Element dieses Kanals, und ein in einer betretenen Gruppe gezeichneter Träger wird nicht Mitglied (nicht geprüft); keine Stütze-Träger-Verschneidung (ein Träger endet nicht an der Stütze/Wand, er läuft bis zu den Achsenden) und keine Anschlussdetails; Profile nur als Text (kein Profilkatalog, keine Stahl-Masse/-Gewichte); Querschnitt nur rechteckig, Träger waagrecht (keine Neigung, kein Versatz der Achse zur Deckenunterkante ausser `topOffset`); Deckenspiegel mit Unterzügen als eigene Darstellung/Klasse fehlt (der Unterzug erscheint im Grundriss des Geschosses darunter gestrichelt); Träger über mehrere Geschosse (Fassadenträger) nur über `topOffset`; IFC-Import liest `IfcBeam` weiter als Körper ([B4]/[B5]); Attribute-Panel (Strich, Schraffur, Poché) für Träger wie für Stützen nicht verdrahtet · M.
|
||||
- ◐ **[276]** Schnitt-/Ansichtslinie im Plan einstellbar (Wunsch Maintainer 17.11., „wie Archicad“; 17.11.). **Archicad** (Hilfe „Section/Elevation Marker“, Marker- und Marker-Head-Bereich der Schnitt-Einstellungen, Modellansicht-Option „Show Section and Elevation Markers“, [Quellen nur über die Suche gelesen, Feldnamen nicht je Version geprüft]): Marke an Anfang, Ende oder beiden Enden bzw. eine in der Mitte, Markentyp und Symbol, Linientyp und Stift der Linie, Beschriftung. **Übernommen (schlank):** je Schnitt- und Ansichtslinie `lineMode` (full | ends | none), `endLengthMm`, `lineStyleId` (Linientyp), `linePenId` (Stift des aktiven Stiftsatzes: Farbe + Stärke), `marker` (arrow | lAngle | triangle | none; Ansicht: triangle | arrow | none), `markerAt` (both | start | end, nur Schnitt), `markerLabel`; Vorgabe getrennt für Schnitte (`sectionMarks`) und Ansichten (`elevationMarks`) in der Modelldarstellung (Ebene > Modelldarstellung des gezeigten Plans > Basis), dort ohne Linientyp/Stift (Auswahl nur feste Werte). `markerStyle`/`sectionMarks.style` gehen darin auf; Basis = heutiges Bild (Goldens unverändert): Schnitt = dünne Strichpunktlinie mit kräftigen Endstücken + Pfeile + Beschriftung, Ansicht = nur Dreieck + Beschriftung. Ansichtslinie wird jetzt auf Wunsch gezeichnet und ist dann anwählbar. Der frühere L (`lAngle`) heisst jetzt `lineMode: ends` + `marker: lAngle`. Kern: `plan/misc.rs` (`SectionLook`, `section_polyline_look`, `view_symbol`, `view_line_parts`), `plan/model_view.rs::mark_look`, `plan/context.rs` (Linientyp/Stift, Beschriftung nur an markierten Enden, Ausweichen [270] und Knicke [176] unverändert). Oberfläche: `SectionLookFields.tsx` in der Objekt-Info (Symbol-Knöpfe mit Vorschau; Mehrfachauswahl ändert alle gewählten Linien in einem Undo-Schritt), Ressourcen > Modelldarstellung (Schnitt- und Ansichtsmarken). Tests: Rust `misc::darstellung_varianten`, `ansicht_zeichen_und_linie`, `context::schnittlinie_varianten_im_grundriss`, `schnittlinie_linientyp_und_stift`, `ansichtslinie_varianten`; vitest `SectionLookFields.test.ts`; e2e `sectionLook276.spec.ts`. Bilder: `doc/review-276/`. **Offen:** nicht in der Tauri-App/auf dem Mac geprüft (nur CLI-SVG in Chromium und Browser-Build); Linientyp/Stift in der Modelldarstellung wählbar machen (dynamische Werte); Marke „Kreis mit Pfeil“ für Ansichten; Marken-Versatz wie bei Archicad (Symbol unabhängig von der Schnittlinie verschieben) · S.
|
||||
- ◐ **[271]** Umbaufilter wie Archicad (Wunsch Maintainer 17.11.). **Modell:** `renovation: {status: existing|demolish|new, phase?}` an Wand, Öffnung (ohne eigenen Status folgt sie der Wand), Decke, Dach, Treppe, Stütze, Körper und Raum (Raum nur Sichtbarkeit/Flächen, keine Farbe — kein Bauteil); `Project.renovation` (Etappen, Farben, eigene Filter); `DrawingLevel`/`ViewTemplate`/`ViewSnapshot.renovationFilter`+`renovationPhase` (der Filter gehört zur Ebene wie die Modelldarstellung [173], damit je Reiter/Ausschnitt/Vorlage). **Kern** `renovation.rs` (ein Ort, `doc/ARCHITEKTUR.md` 3.8): Vorgaben Bestand/Abbruch/Neubau/Umbauplan/Endzustand, SIA-400-Farben (Bestand grau, Abbruch gelb gestrichelt, Neu rot, anpassbar), Etappen „bis n“ (Neues früherer Etappen = Bestand, Abbruch früherer weg, spätere Neue fehlen), Öffnung neu in Bestandswand = Abbruch-Stück bzw. zugemauerte Öffnung = Ausfachung (Wand zu, wo die Öffnung ausgeblendet ist). Umbau-Farben bleiben auch in Tusche (Schwarz-Weiss, `extras::KeepColors`); gefüllt werden nur Schnittflächen (Wand, Stütze), Symbole (Fenster, Türflügel, Tritte) nur in Linienfarbe. Angebunden: Grundriss, Schnitt, Ansicht, Vektor-Axo, 3D-Fenster (Filter der aktiven Ebene) und `model3d`, Kennzahlen/Flächen (Zustand Bestand/Endzustand im Panel), DXF (Layer `<Klasse>_Abbruch`/`_Neu`), IFC (`Status` NEW/EXISTING/DEMOLISH im `Pset_*Common`, Etappe in `Dossier_Umbau`). **Bedienung:** Objekt-Info/Objekteinstellungen „Umbau“ + „Etappe“ (Mehrfachauswahl, ein Undo-Schritt), Statusleiste „Umbau: …“ (Zeichen-Status neuer Bauteile, Vorgabe Bestand, Kern `commands::stamp_renovation`; Umbaufilter und Etappe der Ansicht; mit der Pausfolie im Überlauf „⋯“), Befehl `umbau` (B/A/N; die Befehlszeile nimmt getippte Options-Kürzel jetzt auch mit Enter an, `engine.ts`), Ressourcen-Tab „Umbau“ (Etappen, Farben), Vorlage „Beispiel Umbau“ (`model/sampleProjectUmbau.ts`, CLI `:umbau`), CLI `--renovation`/`--phase` (plan, section, elevation, axo, model3d, kennzahlen). Tests: Kern `renovation_tests.rs` (19), Robustheit, vitest `model/renovation.test.ts`, `commands/cmds/renovation.test.ts`, e2e `renovation271.spec.ts` (2× grün, Port 5195; dazu `uxReview263`, `objectSettings`, `modelViews`, `release10`, `editing` grün); Bilder `doc/review-271/` (CLI-SVG `--hatch` in Chromium, App-Screenshot). **Offen:** 3D-Fenster nur im Code angebunden (Kern-Teile per Test geprüft, Bild nicht angesehen: kein render3d unter Linux); Blender-Paket ohne Umbau-Farben (nur Ausblenden); Ansichtsleiste/Werkzeugleiste ohne eigene Filter-Wahl (Statusleiste und Panel Umbau); eigene Filter nur im Modell (keine Bearbeitung in der Oberfläche); Tauri/Mac nicht geprüft (Prüfschritt `doc/RELEASE-1.0.md` 13.37). **Nachtrag 17.11. (Panel):** eigenes Dock-Panel „Umbau“ (`panels/RenovationPanel.tsx`, Reiter rechts oben neben Objekt-Info/Flächenbilanz, Layout v16): Zeichen-Status Bestand/Abbruch/Neu mit SIA-Farbmuster + Etappe, Umbaufilter der aktiven Ansicht als Liste mit Vorschau je Status (wie gezeichnet/ausgeblendet/Umbau-Farbe) + „bis Etappe“, Status der Auswahl (gemischt-Marke) mit Setzen und Etappe (ein Undo-Schritt), „Nach Status wählen“ (Geschoss), Etappenliste (anlegen, umbenennen, Reihenfolge, Löschen mit Rückfrage über `ui/ConfirmDialog`, Verweis auf die Farben in den Ressourcen). Statusleisten-Popover und Objekt-Info teilen Zustand und Aktionen mit dem Panel (`state/renovationHook.ts`, keine Doppelspur) und lesen nur schmale Teile des Projekts: behebt die 45 Renders je Wand-Änderung in `renderCount.spec.ts` (jetzt 42, Grenze unverändert; `RenovationField` ist `memo`). Filter-Vorschau der eingebauten Filter spiegelt `renovation::builtin` in `model/renovation.ts` (vitest prüft gegen den Plan des Kerns; sauberer wäre, die Anteile in `filter_list` mitzuliefern). Tests: vitest `model/renovation.test.ts` (+3), e2e `renovationPanel271.spec.ts` (Port 5193); Bild `doc/review-271/05-panel-umbau.png`. Nicht geprüft: Tauri/Mac. **Offen:** Panel-Bild nur hell/1280×800 angesehen (dunkel ebenfalls ok, schmale Leiste nicht eigens). **Nachtrag 17.11. (Exporte und Rendering folgen der Ansicht, mit [272]):** neue gemeinsame Ansicht `export/exportView.ts` (`levelExportView` = Umbaufilter, Etappe und Variantenkombination der aktiven Ebene; `exportViewText` = Text der Kern-Abfragen, `renovation::view_from_text`), die EIN Weg für IFC (`exportIfcSpf({view})`), OBJ/STL/glTF (`MeshOptions.view`), STEP (`exportProjectStep(…, view)`), Blender-Paket (`RenderOptions.view`) und Cycles-Szene ist. Ausgeblendetes fehlt dort; die Cycles-Szene malt Umbau-Farben nur auf Wunsch (Option `renovationColors`, `cycles_scene_styled`; Vorgabe Materialfarben). App: Export-Dialog (IFC, OBJ, STL, glTF, STEP) und Rendering-Dialog zeigen die Ansicht der aktiven Ebene („Umbau: …“, „Variante: …“) und lassen „Hauptvarianten/kein Filter“ wählen; Rendering mit Cycles hat das HäkchenLine truncated
|
||||
- ◐ **[274]** Umbau je Schicht: Sanierung mehrschichtiger Bauteile (Feedback Maintainer 17.11., typbasiert nach Rückfrage). **Modell:** `WallType.renovationTarget` (Sanierungstyp), `renovationSide` (Bezugsseite innen/aussen), `renovationOld`/`renovationNew` (manuelle Zuordnung je Schicht, Vorgabe „auto“); Wand `renovation.renovated` (nutzt den Sanierungstyp ihres Typs) bzw. `renovation.newTypeId` (Ausnahme); wirkt nur beim Status Bestand, Etappe = `renovation.phase`; ohne Umbaufilter gilt der Bestandstyp. **Kern** `renovation::build_up` (ein Ort, `doc/ARCHITEKTUR.md` 3.8): Zuordnung von der Bezugsseite her (gleicher Baustoff + Dicke + Lage = Bestand, nur alt = Abbruch, nur neu = Neu; manuell überschreibbar, weil z. B. ein ersetzter Baustoff gleicher Dicke sonst als Bestand gälte; das automatisch gepaarte Gegenstück folgt), gezeigter Aufbau je Filter (Abbruch sichtbar ⇒ alt, Neu sichtbar ⇒ neu, beide ⇒ überlagert in Teilschichten), Ersatzwand mit Ersatztyp und Achsversatz (Bezugsseite bleibt stehen, Achse bleibt) für Grundriss, Schnitt, Ansicht, Axo, 3D, Kennzahlen/GF, IFC-Schichten; Farben je Schicht (Grundriss über die Schicht-Aktionen [33], Kanten der Abbruch-Schichten gestrichelt, im Umbauplan Abbruch als gelbe gestrichelte Kontur über der roten Füllung; Schnitt je Schnittfläche; Ansicht/Axo/3D Farbe der äussersten Schicht); Öffnungsleibungen folgen dem gezeigten Aufbau. Abfragen `renovationPair`/`renovationPairs`. **Bedienung:** Objekt-Info/Objekteinstellungen „Neuer Aufbau (Sanierung)“ (keiner / wie Typ / anderer Wandtyp; Mehrfachauswahl ein Undo-Schritt) mit Streifen Alt/Neu/Ergebnis in SIA-Farben (`ui/RenovationStrip.tsx`); Umbau-Panel Abschnitt „Sanierung“ (`panels/RenovationSanierung.tsx`): Zähler „Sanierte Bauteile“, Typ-Paare mit „x von n Wänden saniert“, „Alle Wände vom Typ sanieren“ (ein Undo-Schritt), „Sanierungstyp anlegen …“ (Kopie des Bestandstyps), Typ-Paar-Editor (Alt/Neu nebeneinander, Zuordnung je Schicht, Bezugsseite, Ergebnis-Streifen). Status/Etappe setzen und Etappe löschen behalten die Sanierung. Beispiel Umbau: Südwand W1 Beton 20 + Dämmung 10 + Putz → Dämmung 20 + Putz (Etappe 1), neuer Schnitt C durch die Wand. Tests: Kern `renovation_layers_tests.rs` (11: Zuordnung inkl. gleicher Baustoff andere Dicke, vertauscht, Bezugsseite aussen, manuell, NaN/leer/fehlender Typ; Grundriss und Schnitt je Filter; Kennzahlen je Zustand; Öffnung; 3D/Ansicht; Umstellen idempotent; Abfragen), vitest `model/renovationLayers.test.ts`, e2e `renovation274.spec.ts` (2× grün, Port 5195; dazu `renovation271`, `renovationPanel271`, `objectSettings`, `renderCount` 2× grün, Renders je Wand-Änderung 43 bei unveränderter Grenze); Bilder `doc/review-274/` (CLI-SVG `--hatch` Grundriss 1:50/1:100 und Schnitt C in allen fünf Filtern, Chromium; App-Screenshots Feld und Panel). **Offen:** Decken und Dächer ohne Sanierung je Schicht (Modell-Felder nur am Wandtyp); Bogenwände ohne gestrichelte Abbruch-Kanten (Füllung je Schicht ja); im Schnitt Abbruch-Kontur schwarz gestrichelt statt gelb, Aussenkante der Abbruch-Schicht unter der schweren Schnittkante durchgezogen (wie [271]); 3D/Ansicht nur Farbe der äussersten Schicht (Teile je Schicht im 3D wären möglich), 3D-Bild nicht angesehen; IFC: Endzustand-Aufbau als Materialschichten über die Ersatzwand (Weg wie Kennzahlen, nicht eigens geprüft), kein Status je Schicht als Eigenschaft; DXF: Schichten nicht auf eigenen Umbau-Layern (Wand-Layer nach Wand-Status); Instanz-Schichtliste (eigene Schichten je Wand) bewusst nicht, nur anderer Typ als Ausnahme; Achse auf der bewegten Seite bei dünnerem neuem Aufbau bleibt in der Wand (Bezugsseite verschiebt sich dann); Tauri/Mac nicht geprüft (Prüfschritt `doc/RELEASE-1.0.md` 13.39). **Zusammenführung mit [271]-Rest (17.11.):** sanierte Wände zeigen auch die Projektionslinien des Schnitts in der Farbe ihrer äussersten Schicht (`CutRules::edge` über `Resolved::faces`); die Ersatzstücke der Öffnungen in Schnitt und Ansicht rechnen aus dem Projekt mit allem, aber mit dem gezeigten Aufbau (`renovation::apply` ohne Ausgeblendetes); Beispiel `:umbau` vereint Südwand W1/Schnitt C mit Möbeln, Bäumen und Ansicht West. · M
|
||||
|
||||
+2
-1
@@ -253,7 +253,7 @@ Beispiel: Die Plan-Ansicht zeigt das Erdgeschoss im Massstab 1:100.
|
||||
| Dächer | `roofs()` in `domains.rs` | `src-tauri/core/src/roof.rs`, `roof_skeleton.rs` |
|
||||
| Wände mit Öffnungen | `plan_walls()` in `plan/walls.rs` | Wandknoten `joins.rs`, Poché `plan/wall_poche.rs`, Symbole `plan/openings.rs` und `opening_geom.rs`, Wand an Stütze `plan/wall_columns.rs` |
|
||||
| Treppen | `plan_stairs()` in `plan/stairs.rs` | Symbol `plan/stair_symbol.rs`, Geometrie `stair.rs` und `kernel2d` |
|
||||
| Stützen, Bäume | `columns()`, `plan_trees()` | `plan/trees.rs`, `tree.rs` |
|
||||
| Stützen, Träger ([280]), Bäume | `columns()` (Träger = `Beam::as_column`, über der Schnitthöhe gestrichelt mit Achse `beam-axis`), `plan_trees()` | `plan/trees.rs`, `tree.rs` |
|
||||
| Körper (Extrusionen) | `solids()` in `domains.rs` | Kern-Netz (`solid_mesh.rs`) über `plan/mesh_plan.rs::plan_bodies()`: Ebenenschnitt (Poché, Bauteil-Schraffur aus `componentId`), Aufsicht, Überkopf ([G1]) |
|
||||
| 2D-Zeichnungen | `plan_drawings()` in `plan/drawings.rs` | Linien, Bögen, Bemassung, Texte, Blöcke |
|
||||
| Schnittführungen | `plan_section_lines()` in `plan/context.rs` | Symbol aus `plan/misc.rs` |
|
||||
@@ -801,6 +801,7 @@ schreibt `src-tauri/src/atomic_save.rs` die Datei absturzsicher.
|
||||
| **Plan-Puffer** | Binäre Form einer Primitiv-Liste mit Gruppen, Tabellen und Inhalts-Hashes. | `plan/buf.rs`, `src/plan/planBuf.ts` |
|
||||
| **Pick-Id** | Kennung an einem Primitiv (`wallId`, `roomId` …), über die ein Klick zum Element findet. | `plan/prim.rs`, `plan/pick.rs` |
|
||||
| **Poché** | Gefüllte Schnittfläche eines geschnittenen Bauteils (Wand, Stütze), je Schicht oder als Ganzes. | `plan/wall_poche.rs` |
|
||||
| **Träger / Unterzug** ([280]) | Linienbauteil `Project.beams` (Achse, Breite × Höhe, Profilname nur Text, Oberkante bündig an der Deckenunterkante + `topOffset`); Ableitungen laufen über `Beam::as_column` durch den Stützen-Code (Grundriss, Schnitt, Ansicht, 3D, Schatten); Umbau, Variante, Auswahl (Kanal `columns`/`columnIds`), Klasse und Sperre wie bei der Stütze; IFC als `IfcBeam` (Satz `BEAM`). | `model/helpers.rs`, `model3d/columns.rs`, `beam_tests.rs` |
|
||||
| **solid_cut** | Regel, wann Schnittflächen als volle schwarze Fläche ohne Schichten und Schraffur gezeichnet werden: bei Detail „grob" immer, sonst ab Massstabszahl 75 (also 1:100 und gröber), ausser bei Detail „fein" oder mit „Schnittflächen schraffiert" (Feld der Ebene bzw. Ansichtsvorlage). | `solid_cut()` in `plan/style.rs` |
|
||||
| **Tusche** | Darstellung schwarz-weiss wie ein Tuscheplan; Standard der App. Farbe nur auf Wunsch (CLI `--color`, Ansichtsvorlage mit `mono: false`). | TODO `[140]`, `plan/extras.rs` |
|
||||
| **Wandknoten**, **Joins** | Verschneidung von Wänden am Stoss: Gehrung, T-Stoss, Kreuzung, je Schicht nach Priorität. Ergebnis sind Schnittlinien je Wandende. | `compute_joins()` in `joins.rs`, `resolve_join_priority()` |
|
||||
|
||||
@@ -61,7 +61,7 @@ Grösse: S ≤ 1 Tag · M ≤ 1 Woche · L ≤ 1 Monat. IDs aus `TODO.md`; **neu
|
||||
| 6 | **Wohnungsspiegel / Nutzungseinheiten**: Räume lassen sich keiner Wohnung zuordnen; kein Spiegel (Zimmerzahl, NWF je Wohnung) — im Mehrfamilienhaus-WBW üblich. **erledigt 17.11. ([278], Rest: Grundriss-Darstellung der Einheiten)** | `unit_schedule.rs`, `UnitsSection` | M |
|
||||
| 7 | **Geländer als eigenes Bauteil** (Balkon/Loggia/Absturzsicherung in Plan, Schnitt, Ansicht, 3D); heute nur Wand-/2D-Behelf. **neu** | Modell `Stair.railProfile`/`stairs3d::RailSpec` als Ausgangspunkt, `cmds/` | M |
|
||||
| 8 | **Geneigte Decke / Rampe** (Tiefgarage, Terrassen mit Gefälle): `Ceiling` hat nur Ober-/Unterkante, keine Neigung; Behelf Pultdach/Körper. **neu** | `Ceiling`, `ceiling_item` (`cmd_create.rs`), `plan/section` | M |
|
||||
| 9 | **Träger/Unterzug/Fassadenträger**: kein Element (Behelf Körper/Wand), Deckenspiegel mit Unterzügen fehlt. **neu**, [100] nennt die Lücke | `columns` als Muster | M |
|
||||
| 9 | **Träger/Unterzug/Fassadenträger**: kein Element (Behelf Körper/Wand), Deckenspiegel mit Unterzügen fehlt. **teilweise erledigt 17.11. ([280]: Träger/Unterzug als Bauteil in Plan, Schnitt, Ansicht, 3D, IFC; Rest: Gruppen, Deckenspiegel, Profilkatalog)**, [100] nennt die Lücke | `columns` als Muster | M |
|
||||
| 10 | **3D-Entourage** (Möbel, Menschen, Autos 3D) für Bilder: Bibliothek nur 2D; Behelf glTF/OBJ-Import | [253] („3D nach 1.0“), `furniture_lib.rs` | L |
|
||||
| 11 | **GV: Studienkörper neben Wand-Haus, Bodenplatte unter unterstem Geschoss** | [266] Punkt 1 Rest; `building_volume.rs` | S–M |
|
||||
| 12 | **IFC: Dächer als Netz, keine 2D/Layouts/Möbel**; IFC-Import zu Bauteilen unvollständig (Dächer, Träger) | [B4], [B5], [259] | M |
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
@@ -0,0 +1,53 @@
|
||||
// [280] Träger/Unterzug: Musterhaus (komplex) öffnen, der Unterzug im EG ist über „Alles wählen“-Kanal der Stützen
|
||||
// wählbar, die Objekt-Info zeigt den Abschnitt „Träger“ (Profil, Breite, Höhe, OK-Versatz), Höhe ändern und Undo;
|
||||
// ein neuer Träger über die Befehlszeile („traeger“, zwei Punkte, Zahl = Höhe). Screenshots in `test-results/`.
|
||||
import { blurFocus, commandInput, discardIfAsked, expect, fileMenu, openTab, test, typeCommand } from "./app";
|
||||
|
||||
test("Unterzug: Objekt-Info, Höhe ändern mit Undo, Träger zeichnen ([280])", async ({ page }) => {
|
||||
test.setTimeout(90_000);
|
||||
await page.goto("/?dossierTest");
|
||||
await page.getByRole("button", { name: /Neues Projekt/ }).first().click();
|
||||
await expect(page.getByRole("group", { name: "Befehlszeile" })).toBeVisible();
|
||||
await fileMenu(page, /^Neu aus Vorlage: Musterhaus \(komplex\)$/);
|
||||
await discardIfAsked(page);
|
||||
await expect(page.locator(".project-name")).toContainText("Musterhaus");
|
||||
|
||||
await openTab(page, "Objekt-Info");
|
||||
await page.evaluate(() => window.__dossierTest!.select({ columns: ["tg-eg-1"] }));
|
||||
const info = page.locator(".objinfo-panel").first();
|
||||
await expect(info).toContainText("Träger");
|
||||
// Felder des Abschnitts „Träger“ (andere Abschnitte haben ebenfalls „Breite“/„Höhe“).
|
||||
const field = (name: string) =>
|
||||
info
|
||||
.locator(".objinfo-section-label", { hasText: /^Träger$/ })
|
||||
.locator("xpath=following-sibling::label[contains(@class,'objinfo-field')]")
|
||||
.filter({ has: page.locator(".objinfo-flabel", { hasText: new RegExp(`^${name}$`) }) })
|
||||
.locator("input");
|
||||
await expect(field("Profil")).toHaveValue("Unterzug 30/45");
|
||||
await expect(field("Breite")).toHaveValue("0.300");
|
||||
await expect(field("Höhe")).toHaveValue("0.450");
|
||||
await expect(info.locator(".objinfo-field").filter({ hasText: "Länge" })).toContainText("5.7");
|
||||
await field("Höhe").fill("0.5");
|
||||
await field("Höhe").press("Enter");
|
||||
await expect(field("Höhe")).toHaveValue("0.500");
|
||||
await page.screenshot({ path: "test-results/beam280-objektinfo.png" });
|
||||
await page.keyboard.press("ControlOrMeta+z");
|
||||
await expect(field("Höhe")).toHaveValue("0.450");
|
||||
|
||||
// Neuer Träger: Befehl „traeger“, Anfang, Ende (getippte Koordinaten), Beenden; danach wählbar über die Auswahl.
|
||||
await commandInput(page).focus();
|
||||
await typeCommand(page, "traeger");
|
||||
await expect(page.locator(".cmdline-prompt")).toContainText("Anfang des Trägers");
|
||||
await typeCommand(page, "1,7");
|
||||
await expect(page.locator(".cmdline-prompt")).toContainText("Ende des Trägers");
|
||||
await typeCommand(page, "5,7");
|
||||
// Der Träger entsteht mit dem zweiten Punkt, der Befehl endet von selbst.
|
||||
await expect(page.locator(".cmdline-prompt")).toHaveText("Befehl:");
|
||||
await blurFocus(page);
|
||||
expect((await page.evaluate(() => window.__dossierTest!.counts())).beams).toBe(2);
|
||||
await page.keyboard.press("ControlOrMeta+z");
|
||||
expect((await page.evaluate(() => window.__dossierTest!.counts())).beams).toBe(1);
|
||||
await page.keyboard.press("ControlOrMeta+Shift+z");
|
||||
expect((await page.evaluate(() => window.__dossierTest!.counts())).beams).toBe(2);
|
||||
await page.screenshot({ path: "test-results/beam280-gezeichnet.png" });
|
||||
});
|
||||
@@ -47,6 +47,7 @@ Neues Modul: `<modul>.rs` und `mod` in `lib.rs`, Bindungen in `web/<modul>.rs` u
|
||||
| `model3d/` | 3D-Ableitung aus dem Projekt: `parts()` in `mod.rs`; je eine Datei für Decken, Stützen und Bäume, Wände, Öffnungen, Treppen, Dächer, Kontext, freie Körper (`solids.rs`, [115]), Wandkörper mit Formöffnungen (`wall_body.rs`, [216]), Zeichnungs-Spuren, Pick-Geometrie, Klassen-Filter (`classes.rs`, [180]); Tests in `tests.rs` |
|
||||
| `model3d_cache.rs` | inkrementelle 3D-Ableitung (Cache je Wand und Öffnung) |
|
||||
| `wall_bands.rs`, `wall_mesh_cut.rs` | Schichtbänder einer Wand; Wandnetz mit echtem Loch für Datei-Exporte |
|
||||
| `beam_tests.rs` | [280] Träger/Unterzug (`Project.beams`): wird wie eine Stütze ausgewertet (`Beam::as_column`, `model/helpers.rs`); Tests zu Höhenlage, Grundriss, Schnitt, 3D, Objekt-Info, Befehl, Griffe |
|
||||
| `ceilings3d.rs`, `columns3d.rs`, `stairs3d.rs`, `openings3d.rs`, `drawing2d_3d.rs`, `mesh3d.rs` | Netze je Bauteilart |
|
||||
| `explode3d.rs`, `highlight3d.rs`, `surface_pattern3d.rs` | Explosionsaxonometrie, Auswahl-Umrisse, Ansichtsschraffur auf 3D-Flächen |
|
||||
| `solid_bool.rs`, `solid_specs.rs`, `solid_mesh.rs` | Körper-Booleans über Manifold; B-Rep-Spezifikationen für truck; Netze der freien Körper für Grundriss, Schnitt, Ansicht, 3D und Kennwerte ([115]) |
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
//! [280] Träger/Unterzug: Höhenlage, Grundriss (gestrichelt mit Achse), Schnitt (quer und längs), 3D, Objekt-Info,
|
||||
//! Befehl und Griffe. Wie eine Stütze ausgewertet (`Beam::as_column`), liegt aber in `Project.beams`.
|
||||
|
||||
use crate::model::*;
|
||||
use crate::plan::domains::{plan_domains, PlanArgs};
|
||||
use crate::plan::prim::Primitive;
|
||||
use crate::plan::section::{compute_section, Kind, LevelSpec};
|
||||
use serde_json::{json, Value};
|
||||
|
||||
/// Geschoss EG 0 … 2.6 m, Decke (25 cm, UK 2.35) 0..6 × 0..4, Träger 25 × 40 cm auf der Achse (1, 2) → (5, 2).
|
||||
fn project(beam_extra: Value) -> Project {
|
||||
let mut beam = json!({"id": "T1", "type": "beam", "floorId": "eg", "categoryCode": "50", "start": {"x": 1, "y": 2}, "end": {"x": 5, "y": 2}, "width": 0.25, "height": 0.4});
|
||||
beam.as_object_mut().unwrap().extend(beam_extra.as_object().unwrap().clone());
|
||||
serde_json::from_value(json!({
|
||||
"id": "p", "name": "t", "lineStyles": [], "hatches": [], "components": [], "wallTypes": [{"id": "wt", "name": "WT", "layers": []}], "layers": [], "openings": [], "walls": [], "drawings2d": [],
|
||||
"drawingLevels": [{"id": "eg", "name": "EG", "kind": "floor", "visible": true, "locked": false, "floorHeight": 2.6, "baseElevation": 0.0}],
|
||||
"ceilings": [{"id": "D1", "type": "ceiling", "floorId": "eg", "categoryCode": "30", "wallTypeId": "wt", "thickness": 0.25,
|
||||
"outline": [{"x": 0, "y": 0}, {"x": 6, "y": 0}, {"x": 6, "y": 4}, {"x": 0, "y": 4}]}],
|
||||
"beams": [beam]
|
||||
}))
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn plan(p: &Project) -> crate::plan::domains::DomainPrims {
|
||||
let t = json!({"floor": "eg", "show": ["30", "50"], "grey": [], "scale": 50, "global": true, "mono": true}).to_string();
|
||||
plan_domains(p, &PlanArgs::parse(1.0, &t).unwrap()).unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn oberkante_buendig_an_deckenunterkante() {
|
||||
let p = project(json!({}));
|
||||
let b = &p.beams.as_ref().unwrap()[0];
|
||||
let (zb, zt) = p.beam_vertical_extent(b);
|
||||
assert!((zt - 2.35).abs() < 1e-9 && (zb - 1.95).abs() < 1e-9, "{zb} {zt}");
|
||||
// Versatz nach oben in die Decke, ohne Decke darüber: Geschoss-Oberkante.
|
||||
let p2 = project(json!({"topOffset": 0.1}));
|
||||
let (_, zt) = p2.beam_vertical_extent(&p2.beams.as_ref().unwrap()[0]);
|
||||
assert!((zt - 2.45).abs() < 1e-9);
|
||||
let mut p3 = project(json!({}));
|
||||
p3.ceilings = None;
|
||||
let (zb, zt) = p3.beam_vertical_extent(&p3.beams.as_ref().unwrap()[0]);
|
||||
assert!((zt - 2.6).abs() < 1e-9 && (zb - 2.2).abs() < 1e-9);
|
||||
// Achsmitte ausserhalb der Decke: nicht darunter.
|
||||
let p4 = project(json!({"start": {"x": 8, "y": 2}, "end": {"x": 12, "y": 2}}));
|
||||
assert!((p4.beam_vertical_extent(&p4.beams.as_ref().unwrap()[0]).1 - 2.6).abs() < 1e-9);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn grundriss_gestrichelt_mit_achse() {
|
||||
let p = project(json!({}));
|
||||
let d = plan(&p);
|
||||
// Schnitthöhe 1.0 liegt unter dem Träger (1.95 … 2.35): „über Schnitt“ → Pick-Fläche ohne Füllung, Kanten gestrichelt.
|
||||
let pick = d.columns.iter().filter(|q| matches!(q, Primitive::Polygon { column_id: Some(id), .. } if id == "T1")).count();
|
||||
assert_eq!(pick, 1);
|
||||
assert!(d.columns.iter().all(|q| !matches!(q, Primitive::Polygon { column_id: Some(_), fill, .. } if fill != "none")));
|
||||
let dashed = d.columns.iter().filter(|q| matches!(q, Primitive::Line { cls, dash: Some(Some(_)), .. } if cls == "column-view")).count();
|
||||
assert_eq!(dashed, 4, "vier gestrichelte Kanten");
|
||||
let axis: Vec<_> = d.columns.iter().filter_map(|q| match q { Primitive::Line { cls, a, b, dash: Some(Some(_)), .. } if cls == "beam-axis" => Some((a, b)), _ => None }).collect();
|
||||
assert_eq!(axis.len(), 1, "eine Achse");
|
||||
let (a, b) = axis[0];
|
||||
assert!((a.x - 1.0).abs() < 1e-9 && (b.x - 5.0).abs() < 1e-9 && (a.y - 2.0).abs() < 1e-9 && (b.y - 2.0).abs() < 1e-9);
|
||||
// Klasse aus: nichts.
|
||||
let t = json!({"floor": "eg", "show": ["30"], "grey": [], "scale": 50, "global": true, "mono": true}).to_string();
|
||||
let none = plan_domains(&p, &PlanArgs::parse(1.0, &t).unwrap()).unwrap();
|
||||
assert!(none.columns.is_empty());
|
||||
}
|
||||
|
||||
fn section(p: &Project, line: [(f64, f64); 2]) -> crate::plan::section::Output {
|
||||
let lv = LevelSpec { kind: "section".into(), line: Some([Vec2 { x: line[0].0, y: line[0].1 }, Vec2 { x: line[1].0, y: line[1].1 }]), direction_sign: Some(1.0), ..Default::default() };
|
||||
compute_section(p, &lv, &[]).unwrap().unwrap()
|
||||
}
|
||||
|
||||
fn area(pts: &[[f64; 2]]) -> f64 {
|
||||
let n = pts.len();
|
||||
(0..n).map(|i| pts[i][0] * pts[(i + 1) % n][1] - pts[(i + 1) % n][0] * pts[i][1]).sum::<f64>().abs() / 2.0
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn schnitt_quer_und_laengs() {
|
||||
let p = project(json!({}));
|
||||
// Quer: Schnittlinie x = 3 (entlang y) trifft den Träger: Querschnitt 25 × 40 cm.
|
||||
let o = section(&p, [(3.0, -2.0), (3.0, 8.0)]);
|
||||
let c: Vec<_> = o.cuts.iter().filter(|c| c.source_id.as_deref() == Some("T1")).collect();
|
||||
assert_eq!(c.len(), 1, "{:?}", o.cuts.iter().map(|c| &c.source_id).collect::<Vec<_>>());
|
||||
assert!((area(&c[0].pts) - 0.25 * 0.4).abs() < 1e-6, "{}", area(&c[0].pts));
|
||||
assert_eq!(c[0].kind, Kind::Slab);
|
||||
assert_eq!(c[0].category.as_deref(), Some("50"));
|
||||
// Längs: Schnittlinie y = 2 durch die Achse: Länge 4 m × 40 cm.
|
||||
let o = section(&p, [(-1.0, 2.0), (8.0, 2.0)]);
|
||||
let c: Vec<_> = o.cuts.iter().filter(|c| c.source_id.as_deref() == Some("T1")).collect();
|
||||
assert_eq!(c.len(), 1);
|
||||
assert!((area(&c[0].pts) - 4.0 * 0.4).abs() < 1e-6, "{}", area(&c[0].pts));
|
||||
// Daneben vorbei (y = 3.5): nicht geschnitten, aber in der Projektion (Kanten dahinter).
|
||||
let o = section(&p, [(-1.0, 3.5), (8.0, 3.5)]);
|
||||
assert!(o.cuts.iter().all(|c| c.source_id.as_deref() != Some("T1")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dreid_netz_pick_und_klasse() {
|
||||
let p = project(json!({}));
|
||||
let m = crate::model3d::emit_columns(&p);
|
||||
assert_eq!(m.len(), 1);
|
||||
assert!(matches!(m[0].owner, crate::model3d::Owner::Beam(0)));
|
||||
// Quader 4 × 0.25 × 0.4: z von 1.95 bis 2.35.
|
||||
let zs: Vec<f64> = m[0].positions.chunks(3).map(|v| v[2]).collect();
|
||||
let (lo, hi) = (zs.iter().cloned().fold(f64::INFINITY, f64::min), zs.iter().cloned().fold(f64::NEG_INFINITY, f64::max));
|
||||
assert!((lo - 1.95).abs() < 1e-9 && (hi - 2.35).abs() < 1e-9, "{lo} {hi}");
|
||||
assert_eq!(crate::model3d::Owner::Beam(0).id(&p), Some("T1"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn objekt_info_traeger() {
|
||||
let p = project(json!({"profileName": "HEB 200", "topOffset": 0.05}));
|
||||
let root = serde_json::to_value(&p).unwrap();
|
||||
let root = root.as_object().unwrap();
|
||||
let a: crate::selection_info::SelArgs = serde_json::from_value(json!({"columnId": "T1"})).unwrap();
|
||||
let s = crate::selection_info::derive(&crate::document::Lookup::plain(root), &a).unwrap().into_string();
|
||||
let v: Value = serde_json::from_str(&s).unwrap();
|
||||
assert_eq!(v["kind"], "beam");
|
||||
assert_eq!(v["beam"]["profileName"], "HEB 200");
|
||||
assert!((v["beam"]["zTop"].as_f64().unwrap() - 2.40).abs() < 1e-9, "{v}");
|
||||
assert!((v["beam"]["length"].as_f64().unwrap() - 4.0).abs() < 1e-9);
|
||||
assert!((v["bbox"]["minX"].as_f64().unwrap() - 1.0).abs() < 1e-9, "{v}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn befehl_traeger_legt_beam_an() {
|
||||
let root = serde_json::Map::new();
|
||||
let p = Project::default();
|
||||
let v = json!({"cmd": "beam", "pts": [[0.0, 0.0], [4.0, 0.0]], "width": 0.2, "height": 0.2, "profileName": "HEB 200", "stamp": "s", "ctx": {"level": "eg", "floorHeight": 2.6, "cat": "10", "wallType": "x"}});
|
||||
let ops = crate::cmd_create::ops(&root, &p, &v).unwrap();
|
||||
let Some(crate::ops::Op::Add { collection, items, .. }) = ops.first() else { panic!("add erwartet") };
|
||||
assert_eq!(collection, "beams");
|
||||
let b = &items[0];
|
||||
assert_eq!((b["type"].as_str(), b["floorId"].as_str(), b["categoryCode"].as_str()), (Some("beam"), Some("eg"), Some("10")), "ohne Klasse 25/50: die aktive");
|
||||
assert_eq!(b["profileName"], "HEB 200");
|
||||
assert_eq!(b["end"]["x"], 4.0);
|
||||
// Nulllänge: nichts.
|
||||
let v0 = json!({"cmd": "beam", "pts": [[1.0, 1.0], [1.0, 1.0]], "stamp": "s", "ctx": {"level": "eg"}});
|
||||
assert!(crate::cmd_create::ops(&root, &p, &v0).unwrap().is_empty());
|
||||
// Das neue Element liest das Modell.
|
||||
let _: Beam = serde_json::from_value(b.clone()).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn umbaufilter_wie_stuetze() {
|
||||
// Träger Neu: im Filter „Bestand“ weg, im „Neubau“ da (Pick-Fläche + Kanten), in „Abbruch“ weg.
|
||||
let p = project(json!({"renovation": {"status": "new"}}));
|
||||
let with = |f: &str| {
|
||||
let t = json!({"floor": "eg", "show": ["30", "50"], "grey": [], "scale": 50, "global": true, "mono": true, "renovation": f}).to_string();
|
||||
plan_domains(&p, &PlanArgs::parse(1.0, &t).unwrap()).unwrap().columns.len()
|
||||
};
|
||||
assert_eq!(with("bestand"), 0);
|
||||
assert_eq!(with("abbruch"), 0);
|
||||
assert!(with("neubau") > 0);
|
||||
}
|
||||
@@ -969,6 +969,36 @@ fn column_ops(v: &Value, ctx: &Ctx, ids: &mut IdGen) -> Vec<Op> {
|
||||
)
|
||||
}
|
||||
|
||||
/// [280] Träger: Achse `pts[0]` → `pts[1]` auf dem aktiven Geschoss, Klasse „25“ (Stützen) bzw. „50“, Querschnitt `width` × `height`
|
||||
/// (Vorgabe 25 × 40 cm), Profilname nur als Text, Oberkante bündig an der Deckenunterkante (`topOffset` 0).
|
||||
fn beam_ops(p: &Project, v: &Value, ctx: &Ctx, ids: &mut IdGen) -> Vec<Op> {
|
||||
let pts = pts_of(v, "pts");
|
||||
let [a, b] = pts[..] else { return Vec::new() };
|
||||
if seg_len(a, b) < EPS {
|
||||
return Vec::new();
|
||||
}
|
||||
let num = |k: &str, d: f64| opt_n(v, k).filter(|x| *x > 0.0 && x.is_finite()).unwrap_or(d);
|
||||
let mut f = vec![
|
||||
("id", s(&ids.next("beam"))),
|
||||
("type", s("beam")),
|
||||
("floorId", s(ctx.level)),
|
||||
// Klasse „25“ (Stützen), sonst „50“ (Tragwerk), sonst die aktive (wie beim Erkennen von Stützen).
|
||||
("categoryCode", if has_category(p, "25") { s("25") } else { category_or(p, "50", ctx) }),
|
||||
("start", pv(a)),
|
||||
("end", pv(b)),
|
||||
("width", js_num(num("width", 0.25))),
|
||||
("height", js_num(num("height", 0.4))),
|
||||
];
|
||||
let name = s_of(v, "profileName").trim();
|
||||
if !name.is_empty() {
|
||||
f.push(("profileName", s(name)));
|
||||
}
|
||||
if let Some(o) = opt_n(v, "topOffset").filter(|x| x.is_finite() && x.abs() > 1e-9) {
|
||||
f.push(("topOffset", js_num(o)));
|
||||
}
|
||||
add_op("beams", vec![obj(f)])
|
||||
}
|
||||
|
||||
/// [149] Baum am Punkt `at`: Ebene „13" (Bäume), falls vorhanden, sonst die aktive; Abmessungen, Form,
|
||||
/// Bestand und Laub/Nadel aus den Werkzeug-Vorgaben (fehlende/unsinnige Werte: Vorgaben aus `tree.rs`).
|
||||
fn tree_ops(p: &Project, v: &Value, ctx: &Ctx, ids: &mut IdGen) -> Vec<Op> {
|
||||
@@ -1155,6 +1185,7 @@ pub fn ops(root: &Map<String, Value>, p: &Project, v: &Value) -> Option<Vec<Op>>
|
||||
"opening" => opening_ops(root, p, v, &ctx, ids),
|
||||
"roof" => roof_ops(p, v, &ctx, ids),
|
||||
"column" => column_ops(v, &ctx, ids),
|
||||
"beam" => beam_ops(p, v, &ctx, ids),
|
||||
"tree" => tree_ops(p, v, &ctx, ids),
|
||||
"circlesToTrees" => circles_to_trees_ops(root, p, v, &ctx, ids),
|
||||
"extrude" => extrude_ops(root, v, &ctx, ids),
|
||||
@@ -1239,6 +1270,18 @@ pub fn preview_req(root: &Map<String, Value>, project: &Project, req: &Req, pts:
|
||||
out.poly(&column_footprint(*at, v));
|
||||
}
|
||||
}
|
||||
"beam" => {
|
||||
// [280] Rechteck um die Achse vom ersten Punkt zum Cursor.
|
||||
if let [a, b] = pts[..] {
|
||||
let w = opt_n(v, "width").filter(|x| *x > 0.0 && x.is_finite()).unwrap_or(0.25);
|
||||
let beam = crate::model::Beam { start: crate::model::Vec2 { x: a.0, y: a.1 }, end: crate::model::Vec2 { x: b.0, y: b.1 }, width: w, ..Default::default() };
|
||||
let fp = beam.footprint();
|
||||
if fp.len() == 4 {
|
||||
out.poly(&fp.iter().map(|q| (q.x, q.y)).collect::<Vec<_>>());
|
||||
out.line(a, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
"tree" => {
|
||||
// [149] Kronenkreis und Stamm am Cursor.
|
||||
if let Some(at) = pts.first() {
|
||||
|
||||
@@ -20,7 +20,7 @@ use std::collections::HashMap;
|
||||
|
||||
/// Listen der Zwischenablage: (Schlüssel in `clip`, Projekt-Liste, id-Präfix, Geschoss-Feld).
|
||||
/// Reihenfolge = Reihenfolge der ids und der Ops (Wände vor Öffnungen).
|
||||
const LISTS: [(&str, &str, &str, &str); 11] = [
|
||||
const LISTS: [(&str, &str, &str, &str); 12] = [
|
||||
("walls", "walls", "W", "floorId"),
|
||||
("drawings", "drawings2d", "dr2d", "levelId"),
|
||||
("ceilings", "ceilings", "C", "floorId"),
|
||||
@@ -30,6 +30,7 @@ const LISTS: [(&str, &str, &str, &str); 11] = [
|
||||
("rooms", "rooms", "RM", "floorId"),
|
||||
("extrudedSolids", "extrudedSolids", "extrude", "levelId"),
|
||||
("columns", "columns", "column", "floorId"),
|
||||
("beams", "beams", "beam", "floorId"),
|
||||
("trees", "trees", "tree", "floorId"),
|
||||
("cameras", "cameras", "camera", "floorId"),
|
||||
];
|
||||
|
||||
@@ -292,6 +292,14 @@ fn mv_wall(w: &Value, xf: &Xf) -> Value {
|
||||
}
|
||||
|
||||
/// Stütze: Einfügepunkt und Profil-Drehung (über einen mit abgebildeten Richtungspunkt).
|
||||
/// [280] Träger: Anfangs- und Endpunkt der Achse werden abgebildet (Querschnitt bleibt).
|
||||
fn mv_beam(b: &Value, xf: &Xf) -> Value {
|
||||
let (sx, sy) = xy(field(b, "start").unwrap_or(&Value::Null));
|
||||
let (ex, ey) = xy(field(b, "end").unwrap_or(&Value::Null));
|
||||
let (s, e) = (xf.apply(sx, sy), xf.apply(ex, ey));
|
||||
with_all(b, vec![("start", pt(s.0, s.1)), ("end", pt(e.0, e.1))])
|
||||
}
|
||||
|
||||
fn mv_column(c: &Value, xf: &Xf) -> Value {
|
||||
let (bx, by) = xy(field(c, "position").unwrap_or(&Value::Null));
|
||||
let rot = num_or(field(c, "rotation"), 0.0);
|
||||
@@ -776,6 +784,8 @@ enum Kind {
|
||||
Drawing,
|
||||
Solid,
|
||||
Column,
|
||||
/// [280] Träger (Auswahlkanal der Stützen).
|
||||
Beam,
|
||||
Ceiling,
|
||||
Roof,
|
||||
Stair,
|
||||
@@ -809,6 +819,9 @@ fn gather<'a>(root: &'a Map<String, Value>, sel: &Sel, op: &str, ignore_lock: bo
|
||||
if let Some(c) = list(root, "columns").iter().find(|c| id_of(c) == Some(id)).filter(|c| free(c)) {
|
||||
out.push((Kind::Column, c));
|
||||
}
|
||||
if let Some(b) = list(root, "beams").iter().find(|c| id_of(c) == Some(id)).filter(|c| free(c)) {
|
||||
out.push((Kind::Beam, b));
|
||||
}
|
||||
}
|
||||
let mut each = |key: &str, set: Ids, kind: Kind| out.extend(list(root, key).iter().filter(|e| set.has(e) && free(e)).map(|e| (kind, e)));
|
||||
each("ceilings", Ids::opt(&sel.ceiling_ids), Kind::Ceiling);
|
||||
@@ -981,6 +994,7 @@ pub fn transform_result(root: &Map<String, Value>, p: &Project, req: &TransformR
|
||||
}
|
||||
if let Some(id) = nonempty(&sel.column_id) {
|
||||
patch("columns", &|c| id_of(c) == Some(id) && !locked(c), &|c| mv_column(c, &xf));
|
||||
patch("beams", &|c| id_of(c) == Some(id) && !locked(c), &|c| mv_beam(c, &xf));
|
||||
}
|
||||
let (ceil, roofs, stairs, rooms) = (Ids::opt(&sel.ceiling_ids), Ids::opt(&sel.roof_ids), Ids::opt(&sel.stair_ids), Ids::opt(&sel.room_ids));
|
||||
if !ceil.is_empty() {
|
||||
@@ -1029,7 +1043,7 @@ pub fn transform_result(root: &Map<String, Value>, p: &Project, req: &TransformR
|
||||
|
||||
// Kopien (Kopie/Reihe/Verteilen bzw. gespiegelte Kopie).
|
||||
let mut ids = IdGen::new(&req.stamp);
|
||||
let mut new: [Vec<Value>; 11] = Default::default();
|
||||
let mut new: [Vec<Value>; 12] = Default::default();
|
||||
let mut new_openings = Vec::new();
|
||||
// [213] Namen der vorhandenen Kameras (Kopien heissen „… Kopie“, nummeriert bei Kollision).
|
||||
let mut cam_names: std::collections::HashSet<String> = list(root, "cameras").iter().filter_map(|c| field(c, "name").and_then(Value::as_str).map(String::from)).collect();
|
||||
@@ -1042,6 +1056,7 @@ pub fn transform_result(root: &Map<String, Value>, p: &Project, req: &TransformR
|
||||
Kind::Drawing => "dr2d",
|
||||
Kind::Solid => "extrude",
|
||||
Kind::Column => "column",
|
||||
Kind::Beam => "beam",
|
||||
Kind::Ceiling => "C",
|
||||
Kind::Roof => "RF",
|
||||
Kind::Stair => "ST",
|
||||
@@ -1069,6 +1084,7 @@ pub fn transform_result(root: &Map<String, Value>, p: &Project, req: &TransformR
|
||||
Kind::Drawing => (1, fix_refs(with_geom(e, geom_at(field(e, "geom").unwrap_or(&Value::Null), &xf, t)), &to_copy)),
|
||||
Kind::Solid => (2, mv_solid(e, &xf, k_at(t))),
|
||||
Kind::Column => (3, mv_column(e, &xf)),
|
||||
Kind::Beam => (11, mv_beam(e, &xf)),
|
||||
Kind::Ceiling => (4, mv_ceiling(e, &xf)),
|
||||
Kind::Roof => (5, mv_roof(e, &xf)),
|
||||
Kind::Stair => (6, mv_stair(e, &xf, k_at(t))),
|
||||
@@ -1102,7 +1118,7 @@ pub fn transform_result(root: &Map<String, Value>, p: &Project, req: &TransformR
|
||||
}
|
||||
}
|
||||
}
|
||||
let keys = ["walls", "drawings2d", "extrudedSolids", "columns", "ceilings", "roofs", "stairs", "rooms", "trees", "context", "cameras"];
|
||||
let keys = ["walls", "drawings2d", "extrudedSolids", "columns", "ceilings", "roofs", "stairs", "rooms", "trees", "context", "cameras", "beams"];
|
||||
for (key, items) in keys.iter().zip(new) {
|
||||
ops.extend(add(key, items));
|
||||
}
|
||||
@@ -1407,6 +1423,12 @@ fn item_preview(p: &Project, kind: Kind, e: &Value, xf: &Xf, out: &mut Pending)
|
||||
s.poly(&mapped(&fp, xf));
|
||||
}
|
||||
}
|
||||
Kind::Beam => {
|
||||
if let Ok(b) = serde_json::from_value::<crate::model::Beam>(mv_beam(e, xf)) {
|
||||
let fp: Vec<(f64, f64)> = b.footprint().iter().map(|q| (q.x, q.y)).collect();
|
||||
s.poly(&fp);
|
||||
}
|
||||
}
|
||||
Kind::Ceiling | Kind::Roof => s.poly(&mapped(&pts_of(field(e, "outline")), xf)),
|
||||
Kind::Room => s.poly(&mapped(&pts_of(field(e, "boundary")), xf)),
|
||||
Kind::Stair => stair_preview(e, xf, s),
|
||||
|
||||
@@ -53,7 +53,7 @@ pub fn ops(root: &Map<String, Value>, p: &Project, text: &str) -> Result<Vec<Op>
|
||||
}
|
||||
|
||||
/// Listen, deren neue Elemente den Zeichen-Status bekommen ([271]).
|
||||
const RENOVATION_COLLECTIONS: [&str; 8] = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "extrudedSolids", "rooms"];
|
||||
const RENOVATION_COLLECTIONS: [&str; 9] = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "beams", "extrudedSolids", "rooms"];
|
||||
|
||||
/// [271] Neue Bauteile der Ops (`add` in [`RENOVATION_COLLECTIONS`]) erhalten `renovation` (ein Objekt mit gültigem
|
||||
/// `status`), sofern sie keines tragen; sonst unverändert.
|
||||
|
||||
@@ -13,7 +13,7 @@ use serde_json::{json, Map, Value};
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
|
||||
/// Listen, deren Elemente eine Variante tragen können (Wurzel-Schlüssel).
|
||||
pub const COLLECTIONS: [&str; 9] = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "extrudedSolids", "rooms", "drawings2d"];
|
||||
pub const COLLECTIONS: [&str; 10] = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "beams", "extrudedSolids", "rooms", "drawings2d"];
|
||||
|
||||
/// Höchstens so viele Kombinationen im Vergleich (Kreuzprodukt der Sätze).
|
||||
pub const MAX_COMPARE: usize = 24;
|
||||
@@ -54,6 +54,7 @@ pub fn active(p: &Project) -> bool {
|
||||
|| p.roofs.iter().flatten().any(|x| known(x.design_option.as_ref()))
|
||||
|| p.stairs.iter().flatten().any(|x| known(x.design_option.as_ref()))
|
||||
|| p.columns.iter().flatten().any(|x| known(x.design_option.as_ref()))
|
||||
|| p.beams.iter().flatten().any(|x| known(x.design_option.as_ref()))
|
||||
|| p.extruded_solids.iter().flatten().any(|x| known(x.design_option.as_ref()))
|
||||
|| p.rooms.iter().flatten().any(|x| known(x.design_option.as_ref()))
|
||||
|| p.drawings2d.iter().any(|x| known(x.design_option.as_ref()))
|
||||
@@ -766,6 +767,7 @@ pub fn info(p: &Project) -> Value {
|
||||
p.roofs.iter().flatten().for_each(|x| add(x.design_option.as_ref()));
|
||||
p.stairs.iter().flatten().for_each(|x| add(x.design_option.as_ref()));
|
||||
p.columns.iter().flatten().for_each(|x| add(x.design_option.as_ref()));
|
||||
p.beams.iter().flatten().for_each(|x| add(x.design_option.as_ref()));
|
||||
p.extruded_solids.iter().flatten().for_each(|x| add(x.design_option.as_ref()));
|
||||
p.rooms.iter().flatten().for_each(|x| add(x.design_option.as_ref()));
|
||||
p.drawings2d.iter().for_each(|x| add(x.design_option.as_ref()));
|
||||
|
||||
@@ -48,6 +48,9 @@ impl<'a> Explode<'a> {
|
||||
for c in p.columns.as_deref().unwrap_or(&[]) {
|
||||
floor_of.insert(&c.id, &c.floor_id);
|
||||
}
|
||||
for b in p.beams.as_deref().unwrap_or(&[]) {
|
||||
floor_of.insert(&b.id, &b.floor_id);
|
||||
}
|
||||
for t in p.trees.as_deref().unwrap_or(&[]) {
|
||||
floor_of.insert(&t.id, &t.floor_id);
|
||||
}
|
||||
@@ -166,6 +169,7 @@ pub fn parts_filtered(p: &Project, layered: bool, detail: f64, for_section: bool
|
||||
for (g, dz) in groups {
|
||||
let pick = |fid: &str| ex.in_group(fid, g);
|
||||
q.columns = p.columns.as_ref().map(|v| v.iter().filter(|c| pick(&c.floor_id)).cloned().collect());
|
||||
q.beams = p.beams.as_ref().map(|v| v.iter().filter(|c| pick(&c.floor_id)).cloned().collect());
|
||||
q.trees = p.trees.as_ref().map(|v| v.iter().filter(|t| pick(&t.floor_id)).cloned().collect());
|
||||
q.stairs = p.stairs.as_ref().map(|v| v.iter().filter(|s| pick(&s.floor_id)).cloned().collect());
|
||||
q.roofs = p.roofs.as_ref().map(|v| v.iter().filter(|r| pick(&r.floor_id)).cloned().collect());
|
||||
|
||||
@@ -167,6 +167,20 @@ pub fn schedule_rows(p: &Project) -> Vec<ScheduleRow> {
|
||||
area: None,
|
||||
});
|
||||
}
|
||||
// [280] Träger: Typ = Profilname (sonst Rechteck), Länge der Achse, Querschnitt Breite, Höhe.
|
||||
for b in p.beams.as_deref().unwrap_or(&[]) {
|
||||
rows.push(ScheduleRow {
|
||||
kind: "Träger",
|
||||
id: b.id.clone(),
|
||||
type_name: b.profile_name.clone().filter(|n| !n.trim().is_empty()).unwrap_or_else(|| "Rechteck".into()),
|
||||
floor: floor_name(p, &b.floor_id),
|
||||
floor_id: Some(b.floor_id.clone()),
|
||||
length: Some((b.end.x - b.start.x).hypot(b.end.y - b.start.y)),
|
||||
height_m: Some(b.height),
|
||||
thickness: Some(b.width),
|
||||
area: None,
|
||||
});
|
||||
}
|
||||
rows
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
use serde_json::{json, Map, Value};
|
||||
|
||||
/// Projekt-Listen, die verschoben werden (jedes Element hat eine `id`), in Op-Reihenfolge.
|
||||
pub const TRANSLATED_LISTS: [&str; 12] = ["walls", "ceilings", "roofs", "stairs", "rooms", "columns", "extrudedSolids", "drawings2d", "context", "drawingLevels", "trees", "cameras"];
|
||||
pub const TRANSLATED_LISTS: [&str; 13] = ["walls", "ceilings", "roofs", "stairs", "rooms", "columns", "beams", "extrudedSolids", "drawings2d", "context", "drawingLevels", "trees", "cameras"];
|
||||
|
||||
fn shift(p: &Value, dx: f64, dy: f64) -> Value {
|
||||
let c = |k: &str| p.get(k).and_then(Value::as_f64).unwrap_or(f64::NAN);
|
||||
@@ -163,6 +163,7 @@ fn shift_element(key: &str, e: &Value, dx: f64, dy: f64) -> (Value, bool) {
|
||||
set(&mut m, "stampAnchor", c);
|
||||
}
|
||||
"columns" => shift_pts_fields(&mut m, &["position"], dx, dy, &[]),
|
||||
"beams" => shift_pts_fields(&mut m, &["start", "end"], dx, dy, &[]),
|
||||
"trees" => shift_pts_fields(&mut m, &["position"], dx, dy, &[]),
|
||||
"cameras" => shift_pts_fields(&mut m, &["position", "target"], dx, dy, &[]),
|
||||
"extrudedSolids" => {
|
||||
|
||||
@@ -295,6 +295,27 @@ pub fn run(lk: &Lookup, req: &Request) -> Result<GripResult, String> {
|
||||
})
|
||||
.into()
|
||||
}
|
||||
// [280] Träger: Griff 0 = Anfang, 1 = Ende der Achse, 2 = Mitte (verschiebt den ganzen Träger).
|
||||
"beamGrip" => {
|
||||
let (index, (x, y)) = (r.n("index"), r.p("pt"));
|
||||
patch("beams", r.s("id"), &|e| {
|
||||
if truthy(field(e, "locked")) {
|
||||
return None;
|
||||
}
|
||||
let (s, t) = (xy(field(e, "start")?), xy(field(e, "end")?));
|
||||
if index == 0.0 {
|
||||
Some(with(e, "start", pt(x, y)))
|
||||
} else if index == 1.0 {
|
||||
Some(with(e, "end", pt(x, y)))
|
||||
} else if index == 2.0 {
|
||||
let (dx, dy) = (x - (s.0 + t.0) / 2.0, y - (s.1 + t.1) / 2.0);
|
||||
Some(with_all(e, vec![("start", pt(s.0 + dx, s.1 + dy)), ("end", pt(t.0 + dx, t.1 + dy))]))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.into()
|
||||
}
|
||||
"ceilingGrip" | "roomGrip" => {
|
||||
let (coll, field) = if op == "ceilingGrip" { ("ceilings", "outline") } else { ("rooms", "boundary") };
|
||||
let (index, (x, y)) = (r.n("index"), r.p("pt"));
|
||||
@@ -2031,6 +2052,24 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// [280] Träger: Griff 0 Anfang, 1 Ende, 2 Mitte verschiebt; gesperrt/unbekannt/Index daneben ändern nichts.
|
||||
#[test]
|
||||
fn traeger_griffe() {
|
||||
let r = root(json!({"beams": [{"id": "b", "start": {"x": 0, "y": 0}, "end": {"x": 4, "y": 0}, "width": 0.2, "height": 0.4}]}));
|
||||
let ent = |req: Value| run(&Lookup::plain(&r), &rq(req)).unwrap();
|
||||
let p = |v: &Value| (v["x"].as_f64().unwrap(), v["y"].as_f64().unwrap());
|
||||
let e = ent(json!({"op": "beamGrip", "id": "b", "index": 0, "pt": [1, 1]}));
|
||||
assert_eq!((p(&entity(&e)["start"]), p(&entity(&e)["end"])), ((1.0, 1.0), (4.0, 0.0)));
|
||||
let e = ent(json!({"op": "beamGrip", "id": "b", "index": 1, "pt": [5, 2]}));
|
||||
assert_eq!(p(&entity(&e)["end"]), (5.0, 2.0));
|
||||
let e = ent(json!({"op": "beamGrip", "id": "b", "index": 2, "pt": [3, 1]}));
|
||||
assert_eq!((p(&entity(&e)["start"]), p(&entity(&e)["end"])), ((1.0, 1.0), (5.0, 1.0)));
|
||||
assert!(ent(json!({"op": "beamGrip", "id": "b", "index": 3, "pt": [3, 1]})).ops.is_empty());
|
||||
assert!(ent(json!({"op": "beamGrip", "id": "x", "index": 0, "pt": [3, 1]})).ops.is_empty());
|
||||
let locked = root(json!({"beams": [{"id": "b", "locked": true, "start": {"x": 0, "y": 0}, "end": {"x": 4, "y": 0}}]}));
|
||||
assert!(run(&Lookup::plain(&locked), &rq(json!({"op": "beamGrip", "id": "b", "index": 0, "pt": [1, 1]}))).unwrap().ops.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn js_zahlen() {
|
||||
assert_eq!(js_num(5.0).to_string(), "5");
|
||||
|
||||
@@ -263,6 +263,17 @@ pub fn selection_highlight_lines(p: &Project, a: &Args) -> Result<Vec<f32>, Stri
|
||||
lift(&mut out, n, &col.id);
|
||||
}
|
||||
}
|
||||
// [280] Träger liegen im Auswahlkanal der Stützen.
|
||||
for b in p.beams.as_deref().unwrap_or(&[]) {
|
||||
if columns.contains(b.id.as_str()) {
|
||||
let col = b.as_column(p);
|
||||
let (z0, z1) = p.column_vertical_extent(&col);
|
||||
let foot: Vec<[f64; 2]> = crate::model3d::column_footprint(&col).iter().map(|q| [q.x, q.y]).collect();
|
||||
let n = out.v.len();
|
||||
out.prism_edges(&foot, z0, z1);
|
||||
lift(&mut out, n, &b.id);
|
||||
}
|
||||
}
|
||||
let trees = set(&a.trees);
|
||||
if !trees.is_empty() {
|
||||
let list = p.trees.as_deref().unwrap_or(&[]);
|
||||
|
||||
@@ -44,6 +44,7 @@ const REC_END_SPACES: f64 = 8.0;
|
||||
const REC_ROOF: f64 = 9.0;
|
||||
const REC_COLUMN: f64 = 10.0;
|
||||
const REC_END_COLUMNS: f64 = 11.0;
|
||||
const REC_BEAM: f64 = 27.0;
|
||||
const REC_CLASSIFICATION: f64 = 12.0;
|
||||
const REC_ZONE: f64 = 13.0;
|
||||
const REC_ATTACH: f64 = 14.0;
|
||||
@@ -1085,6 +1086,7 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result<Flat, String>
|
||||
p.ceilings.iter().flatten().for_each(|x| push(format!("slab/{}", x.id), &x.ifc_global_id));
|
||||
p.roofs.iter().flatten().for_each(|x| push(format!("roof/{}", x.id), &x.ifc_global_id));
|
||||
p.columns.iter().flatten().for_each(|x| push(format!("column/{}", x.id), &x.ifc_global_id));
|
||||
p.beams.iter().flatten().for_each(|x| push(format!("beam/{}", x.id), &x.ifc_global_id));
|
||||
p.stairs.iter().flatten().for_each(|x| push(format!("stair/{}", x.id), &x.ifc_global_id));
|
||||
p.rooms.iter().flatten().for_each(|x| push(format!("space/{}", x.id), &x.ifc_global_id));
|
||||
p.extruded_solids.iter().flatten().for_each(|x| push(format!("extrusion/{}", x.id), &x.ifc_global_id));
|
||||
@@ -1832,6 +1834,38 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result<Flat, String>
|
||||
f.nums(&[cid, cname]);
|
||||
w_psets(&mut f, &psets);
|
||||
}
|
||||
// ── [280] Träger → IfcBeam (Profil-Extrusion des Grundriss-Rechtecks über die Querschnittshöhe, Material = Bauteil;
|
||||
// Datensatz wie COLUMN, in derselben Materialzuordnung) ──────────────────────────────────────────────────
|
||||
for b in p.beams.as_deref().unwrap_or(&[]) {
|
||||
let footprint = b.footprint();
|
||||
let (zb, zt) = p.beam_vertical_extent(b);
|
||||
if footprint.len() < 4 || !(zt > zb) {
|
||||
continue;
|
||||
}
|
||||
let structure = structure_of(&b.floor_id);
|
||||
classified.push((format!("beam/{}", b.id), Kind::Column, b.category_code.clone()));
|
||||
let label = crate::plan::domains::column_label(&b.as_column(&p));
|
||||
let label = match b.profile_name.as_deref().map(str::trim).filter(|n| !n.is_empty()) {
|
||||
Some(n) => format!("{label} ({n})"),
|
||||
None => label,
|
||||
};
|
||||
let length = (b.end.x - b.start.x).hypot(b.end.y - b.start.y);
|
||||
let mut psets = vec![Pset { name: "Pset_BeamCommon", props: vec![ident("Reference", &label), ident("Span", &format!("{length:.3}"))] }];
|
||||
renovation_props(&p, &mut psets, "Pset_BeamCommon", b.renovation.as_ref());
|
||||
psets.extend(qto("Qto_BeamBaseQuantities", qty::beam_quantities(&footprint, length, zt - zb)));
|
||||
let (id, lab) = (f.str(&b.id), f.str(&label));
|
||||
f.nums(&[REC_BEAM, structure, id, lab]);
|
||||
w_pts(&mut f, &footprint);
|
||||
f.nums(&[zb - base_of(structure), zt - zb]);
|
||||
let comp = b.component_id.as_deref().filter(|s| !s.is_empty());
|
||||
let cid = comp.map_or(-1.0, |c| f.str(c));
|
||||
let cname = comp.map_or(-1.0, |c| {
|
||||
let n = component_name(&p, c);
|
||||
f.str(&n)
|
||||
});
|
||||
f.nums(&[cid, cname]);
|
||||
w_psets(&mut f, &psets);
|
||||
}
|
||||
f.num(REC_END_COLUMNS);
|
||||
|
||||
// ── Bäume ([149]) → IfcGeographicElement (IFC2x3: IfcBuildingElementProxy), Netz Stamm + Krone ──
|
||||
|
||||
@@ -302,6 +302,23 @@ pub fn column_quantities(footprint: &[Vec2], length: f64) -> Vec<Qty> {
|
||||
]
|
||||
}
|
||||
|
||||
/// [280] Träger-Basismengen (`Qto_BeamBaseQuantities`): Länge der Achse, Querschnitt, Mantel, Oberfläche, Volumen;
|
||||
/// `footprint` = Grundriss-Rechteck, `height` = Querschnittshöhe.
|
||||
pub fn beam_quantities(footprint: &[Vec2], length: f64, height: f64) -> Vec<Qty> {
|
||||
let plan = ring_area(footprint);
|
||||
let cross = if length > 1e-9 { plan / length * height } else { 0.0 };
|
||||
let width = if length > 1e-9 { plan / length } else { 0.0 };
|
||||
let outer = 2.0 * (width + height) * length;
|
||||
vec![
|
||||
len("Length", length),
|
||||
area("CrossSectionArea", cross),
|
||||
area("OuterSurfaceArea", outer),
|
||||
area("NetSurfaceArea", outer + 2.0 * cross),
|
||||
vol("GrossVolume", cross * length),
|
||||
vol("NetVolume", cross * length),
|
||||
]
|
||||
}
|
||||
|
||||
/// [141] Basismengen einer in Höhenabschnitte geteilten Stütze (`model3d::column_pieces`): Länge = Gesamthöhe,
|
||||
/// Volumen und Mantel = Summe der Abschnitte, Querschnitt = grösster Abschnitt, Deckel nur an der Unter- und
|
||||
/// Oberkante der Stütze (die Fugen zwischen den Abschnitten sind innen).
|
||||
|
||||
@@ -383,6 +383,7 @@ pub fn selection_category_codes(p: &Project, sel: &SelectionMembers) -> Vec<Stri
|
||||
scan(&sel.room_ids, &mut p.rooms.iter().flatten().map(|o| (o.id.as_str(), o.category_code.as_str())));
|
||||
scan(&sel.stair_ids, &mut p.stairs.iter().flatten().map(|o| (o.id.as_str(), o.category_code.as_str())));
|
||||
scan(&sel.column_ids, &mut p.columns.iter().flatten().map(|o| (o.id.as_str(), o.category_code.as_str())));
|
||||
scan(&sel.column_ids, &mut p.beams.iter().flatten().map(|o| (o.id.as_str(), o.category_code.as_str())));
|
||||
scan(&sel.roof_ids, &mut p.roofs.iter().flatten().map(|o| (o.id.as_str(), o.category_code.as_str())));
|
||||
scan(&sel.opening_ids, &mut p.openings.iter().flatten().map(|o| (o.id.as_str(), o.category_code.as_str())));
|
||||
out
|
||||
|
||||
@@ -131,6 +131,8 @@ pub mod cmd_massing;
|
||||
pub mod cmd_draw;
|
||||
#[cfg(test)]
|
||||
mod cmd_autodim_tests;
|
||||
#[cfg(test)]
|
||||
mod beam_tests;
|
||||
pub mod cmd_solid;
|
||||
pub mod polyline_vertex;
|
||||
pub mod import_drawing;
|
||||
|
||||
@@ -470,7 +470,9 @@ pub(crate) fn collect_scene(src: &Project, opt: &MeshOptions) -> Result<SceneDat
|
||||
groups.push(g);
|
||||
}
|
||||
p.roofs = roofs;
|
||||
// [280] `emit_columns` liefert auch die Träger: je Gruppe nur das eine Element in `p` lassen.
|
||||
let columns = p.columns.take();
|
||||
let beams = p.beams.take();
|
||||
for col in columns.as_deref().unwrap_or(&[]) {
|
||||
let mut g = Group::new(format!("Stuetze_{}", sanitize_name(&col.id)), "column", &col.id, level_of(Some(&col.floor_id)));
|
||||
p.columns = Some(vec![col.clone()]);
|
||||
@@ -478,7 +480,16 @@ pub(crate) fn collect_scene(src: &Project, opt: &MeshOptions) -> Result<SceneDat
|
||||
add_meshes(&mut g, &mut mats, &model3d::emit_columns(&p), &name);
|
||||
groups.push(g);
|
||||
}
|
||||
p.columns = None;
|
||||
for b in beams.as_deref().unwrap_or(&[]) {
|
||||
let mut g = Group::new(format!("Traeger_{}", sanitize_name(&b.id)), "beam", &b.id, level_of(Some(&b.floor_id)));
|
||||
p.beams = Some(vec![b.clone()]);
|
||||
let name = component_name(&p, b.component_id.as_deref(), "Traeger");
|
||||
add_meshes(&mut g, &mut mats, &model3d::emit_columns(&p), &name);
|
||||
groups.push(g);
|
||||
}
|
||||
p.columns = columns;
|
||||
p.beams = beams;
|
||||
// [149] Bäume: je Baum eine Gruppe (Stamm + Krone).
|
||||
let trees = p.trees.take();
|
||||
for t in trees.as_deref().unwrap_or(&[]) {
|
||||
|
||||
@@ -5444,6 +5444,121 @@ pub struct Column {
|
||||
pub extra: Extra,
|
||||
}
|
||||
|
||||
/// [280] Ein Träger/Unterzug (Beam) — geschossgebundenes Tragwerk-Bauteil (Kategorie „50"): Achse
|
||||
/// `start` → `end` im Grundriss, rechteckiger Querschnitt `width` × `height` (Aussenmasse; `profileName`
|
||||
/// ist nur ein Text wie „HEB 200", gezeichnet wird das Rechteck). Oberkante = Unterkante der Decke darüber
|
||||
/// (höchstens die Geschoss-Oberkante) plus `topOffset`; bündig (0) ⇒ Unterzug. Wird wie eine Stütze
|
||||
/// ausgewertet (`Beam::as_column`), liegt aber in `Project.beams`; im Auswahlkanal der Stützen.
|
||||
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize, TS)]
|
||||
#[serde(default)]
|
||||
pub struct Beam {
|
||||
pub id: String,
|
||||
#[ts(type = "\"beam\"")]
|
||||
pub r#type: String,
|
||||
/// Zugehörige Zeichnungsebene (Geschoss).
|
||||
#[serde(rename = "floorId")]
|
||||
pub floor_id: String,
|
||||
/// Grafik-Kategorie (Ebene), z. B. "50" für Tragwerk.
|
||||
#[serde(rename = "categoryCode")]
|
||||
pub category_code: String,
|
||||
/// [201] IFC-GlobalId des Quell-Bauteils (IFC-Import); der IFC-Export schreibt sie zurück, damit
|
||||
/// die Rundreise dieselben GUIDs behält. Kopien (Einfügen, Kopieren, Reihe, Wand teilen) tragen sie NICHT.
|
||||
#[serde(rename = "ifcGlobalId", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub ifc_global_id: Option<String>,
|
||||
/// Objekt-Sperre, analog `Wall.locked`.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub locked: Option<bool>,
|
||||
/// Achse: Anfangspunkt im Grundriss (Meter).
|
||||
pub start: Vec2,
|
||||
/// Achse: Endpunkt im Grundriss (Meter).
|
||||
pub end: Vec2,
|
||||
/// Querschnittsbreite (quer zur Achse, Meter, > 0).
|
||||
pub width: f64,
|
||||
/// Querschnittshöhe (Meter, > 0), nach unten ab der Oberkante.
|
||||
pub height: f64,
|
||||
/// Profilname als Text (z. B. „HEB 200", „BSH 20/40"); ohne Wirkung auf die Geometrie, geht in Liste und IFC.
|
||||
#[serde(rename = "profileName", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub profile_name: Option<String>,
|
||||
/// Versatz der Oberkante gegenüber der Unterkante der Decke darüber (Meter, + nach oben in die Decke).
|
||||
/// Fehlt ⇒ 0: bündig, Unterzug.
|
||||
#[serde(rename = "topOffset", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub top_offset: Option<f64>,
|
||||
/// Optionales tragendes Bauteil (Component) für Poché/3D-Farbe/Schraffur.
|
||||
#[serde(rename = "componentId", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub component_id: Option<String>,
|
||||
/// Optionale Übersteuerung der Strich-/Umrandungsfarbe; sonst gilt die
|
||||
/// Kategorie-Farbe.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub color: Option<String>,
|
||||
/// Stift-Kopplung von `color` (s. `Component.colorPenId`-Doku).
|
||||
#[serde(rename = "colorPenId", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub color_pen_id: Option<String>,
|
||||
/// Attribut-Override der Muster-/Schraffurfarbe (Vordergrund) DIESER Stütze.
|
||||
/// `undefined` = „Nach System" (erben → Component.foreground), analog `Wall.
|
||||
/// foreground`.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub foreground: Option<String>,
|
||||
/// Attribut-Override der Füllfarbe (Hintergrund/Poché) DIESER Stütze.
|
||||
/// `undefined` = „Nach System" (neutrale SIA-Poché HATCH_INK/HATCH_PAPER je
|
||||
/// nach Schraffur-Muster), analog `Wall.background`.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub background: Option<String>,
|
||||
/// Stift-Kopplung von `foreground` (s. `Component.foregroundPenId`-Doku).
|
||||
#[serde(rename = "foregroundPenId", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub foreground_pen_id: Option<String>,
|
||||
/// Stift-Kopplung von `background`, analog {@link Wall.foregroundPenId}.
|
||||
#[serde(rename = "backgroundPenId", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub background_pen_id: Option<String>,
|
||||
/// Attribut-Override der Strichstärke (mm Papier) DIESER Stütze. `undefined`
|
||||
/// = „Nach System" (erben → `strokeWeightSource`), analog `Wall.strokeWeight`.
|
||||
#[serde(rename = "strokeWeight", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub stroke_weight: Option<f64>,
|
||||
/// Attribut-Override der Schnitt-Schraffur (Hatch Manager) DIESER Stütze.
|
||||
/// `undefined` = „Nach System" (erben → `hatchSource`), analog `Wall.hatchId`.
|
||||
#[serde(rename = "hatchId", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub hatch_id: Option<String>,
|
||||
/// Quelle des Vordergrunds, wenn kein explizites `foreground` gesetzt ist — analog `Wall.foregroundSource`.
|
||||
#[serde(rename = "foregroundSource", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub foreground_source: Option<AttributeSource>,
|
||||
/// Quelle des Hintergrunds, analog {@link Beam.foregroundSource}.
|
||||
#[serde(rename = "backgroundSource", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub background_source: Option<AttributeSource>,
|
||||
/// Quelle der Strichstärke, analog {@link Beam.foregroundSource}.
|
||||
#[serde(rename = "strokeWeightSource", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub stroke_weight_source: Option<AttributeSource>,
|
||||
/// Quelle der Schraffur, analog {@link Beam.foregroundSource}.
|
||||
#[serde(rename = "hatchSource", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub hatch_source: Option<AttributeSource>,
|
||||
/// [271] Umbau: Status (Bestand, Abbruch, Neu) und Etappe. Fehlt ⇒ Bestand.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub renovation: Option<Renovation>,
|
||||
/// [272] Variante, zu der das Element gehört (`Project.designOptionSets`). Fehlt ⇒ Hauptmodell (immer sichtbar).
|
||||
#[serde(rename = "designOption", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub design_option: Option<DesignOptionRef>,
|
||||
#[serde(flatten)]
|
||||
#[ts(skip)]
|
||||
pub extra: Extra,
|
||||
}
|
||||
|
||||
/// Kronenform eines Baums ([149]): Grundform der Silhouette (Schnitt/Ansicht), des 3D-Körpers und
|
||||
/// des Schattenwerfers.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize, TS)]
|
||||
@@ -6997,6 +7112,10 @@ pub struct Project {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub columns: Option<Vec<Column>>,
|
||||
/// [280] Träger/Unterzüge, siehe {@link Beam}. Optional wie `columns`.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub beams: Option<Vec<Beam>>,
|
||||
/// Bäume ([149]) — eigene Objekte mit Stamm, Krone und Höhe, siehe {@link Tree}. Optional, damit
|
||||
/// bestehende Projekte ohne `trees` gültig bleiben (Default: leer behandeln).
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
@@ -7896,6 +8015,12 @@ impl Project {
|
||||
None => Default::default(),
|
||||
};
|
||||
}
|
||||
"beams" => {
|
||||
self.beams = match v {
|
||||
Some(v) => <Option<Vec<Beam>>>::deserialize(v).map_err(|e| e.to_string())?,
|
||||
None => Default::default(),
|
||||
};
|
||||
}
|
||||
"trees" => {
|
||||
self.trees = match v {
|
||||
Some(v) => <Option<Vec<Tree>>>::deserialize(v).map_err(|e| e.to_string())?,
|
||||
|
||||
@@ -231,6 +231,21 @@ impl Project {
|
||||
heights::element(floor_base, self.resolve_anchor(c.bottom.as_ref()), self.resolve_anchor(c.top.as_ref()), c.height)
|
||||
}
|
||||
|
||||
/// [280] (UK, OK) eines Trägers (absolutes Z): Referenz ist die Unterkante der tiefsten Decke desselben
|
||||
/// Geschosses, die die Achsmitte überdeckt (nicht in einer Aussparung), sonst die Geschoss-Oberkante;
|
||||
/// dazu `topOffset` (Vorgabe 0 = bündig, Unterzug). UK = OK − Querschnittshöhe.
|
||||
pub fn beam_vertical_extent(&self, b: &Beam) -> (f64, f64) {
|
||||
let floor_top = self.floor(&b.floor_id).map_or(0.0, |f| f.base_elevation.unwrap_or(0.0) + f.floor_height.unwrap_or(0.0));
|
||||
let mid = kernel2d::Vec2::new((b.start.x + b.end.x) / 2.0, (b.start.y + b.end.y) / 2.0);
|
||||
let ring = |r: &[Vec2]| -> Vec<kernel2d::Vec2> { r.iter().map(|q| kernel2d::Vec2::new(q.x, q.y)).collect() };
|
||||
let under = self.ceilings.iter().flatten().filter(|c| c.floor_id == b.floor_id && c.outline.len() >= 3).filter_map(|c| {
|
||||
let (cb, ct) = self.ceiling_vertical_extent(c);
|
||||
let covers = (ct > cb) && kernel2d::point_in_outline(mid, &ring(&c.outline)) && !c.openings.iter().flatten().any(|h| h.len() >= 3 && kernel2d::point_in_outline(mid, &ring(h)));
|
||||
covers.then_some(cb)
|
||||
});
|
||||
heights::beam(floor_top, under, b.top_offset.unwrap_or(0.0), b.height)
|
||||
}
|
||||
|
||||
/// Traufhöhe (absolutes Z): `baseElevation`, sonst Oberkante des Geschosses (`roofBaseElevation`).
|
||||
pub fn roof_base_elevation(&self, r: &Roof) -> f64 {
|
||||
if let Some(b) = r.base_elevation {
|
||||
@@ -340,6 +355,14 @@ pub mod heights {
|
||||
(zb, top.unwrap_or(zb + height))
|
||||
}
|
||||
|
||||
/// [280] Träger: Referenz = tiefste Deckenunterkante `under` (der Decken, die die Achsmitte überdecken) unterhalb
|
||||
/// der Geschoss-Oberkante, sonst diese; OK = Referenz + Versatz, UK = OK − Querschnittshöhe.
|
||||
pub fn beam(floor_top: f64, under: impl IntoIterator<Item = f64>, top_offset: f64, height: f64) -> (f64, f64) {
|
||||
let reference = under.into_iter().filter(|z| z.is_finite()).fold(floor_top, f64::min);
|
||||
let top = reference + if top_offset.is_finite() { top_offset } else { 0.0 };
|
||||
(top - height, top)
|
||||
}
|
||||
|
||||
/// Decke: OK aus `top`, sonst Geschoss-Oberkante; UK aus `bottom`, sonst OK − Dicke (die Decke wächst
|
||||
/// nach unten; die Dicke wird nur dann bestimmt).
|
||||
pub fn ceiling(floor_top: f64, bottom: Option<f64>, top: Option<f64>, thickness: impl FnOnce() -> f64) -> (f64, f64) {
|
||||
@@ -362,6 +385,66 @@ pub mod heights {
|
||||
assert_eq!(ceiling(2.6, Some(2.2), None, || panic!("Dicke nicht gebraucht")), (2.2, 2.6));
|
||||
assert_eq!(ceiling(2.6, None, Some(3.0), || 0.2), (2.8, 3.0));
|
||||
assert_eq!(floor_anchor(2.8, 0.1), 2.8 + 0.1);
|
||||
// Träger: bündig an der tiefsten Deckenunterkante, Versatz nach oben.
|
||||
let near = |a: (f64, f64), b: (f64, f64)| (a.0 - b.0).abs() < 1e-9 && (a.1 - b.1).abs() < 1e-9;
|
||||
assert!(near(beam(2.6, [2.35, 2.5], 0.0, 0.4), (1.95, 2.35)));
|
||||
assert!(near(beam(2.6, [], 0.0, 0.4), (2.2, 2.6)));
|
||||
assert!(near(beam(2.6, [2.35], 0.1, 0.4), (2.05, 2.45)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Beam {
|
||||
/// [280] Grundriss-Rechteck des Trägers: Achse ± halbe Breite (leer bei Länge 0).
|
||||
pub fn footprint(&self) -> Vec<Vec2> {
|
||||
let (dx, dy) = (self.end.x - self.start.x, self.end.y - self.start.y);
|
||||
let l = dx.hypot(dy);
|
||||
if !(l > 1e-9) || !l.is_finite() {
|
||||
return Vec::new();
|
||||
}
|
||||
let (nx, ny) = (-dy / l * self.width / 2.0, dx / l * self.width / 2.0);
|
||||
vec![
|
||||
Vec2 { x: self.start.x + nx, y: self.start.y + ny },
|
||||
Vec2 { x: self.end.x + nx, y: self.end.y + ny },
|
||||
Vec2 { x: self.end.x - nx, y: self.end.y - ny },
|
||||
Vec2 { x: self.start.x - nx, y: self.start.y - ny },
|
||||
]
|
||||
}
|
||||
|
||||
/// [280] Der Träger als gleichwertige Stütze: Rechteck-Profil Länge × Breite um die Achsmitte, gedreht auf die
|
||||
/// Achsrichtung, Höhenlage als feste Anker. Alle Ableitungen (Grundriss, Schnitt, Ansicht, 3D, Griffe …)
|
||||
/// laufen so über den Stützen-Code; die Kennung bleibt die des Trägers.
|
||||
pub fn as_column(&self, p: &Project) -> Column {
|
||||
let (zb, zt) = p.beam_vertical_extent(self);
|
||||
let (dx, dy) = (self.end.x - self.start.x, self.end.y - self.start.y);
|
||||
Column {
|
||||
id: self.id.clone(),
|
||||
r#type: "beam".into(),
|
||||
floor_id: self.floor_id.clone(),
|
||||
category_code: self.category_code.clone(),
|
||||
locked: self.locked,
|
||||
position: Vec2 { x: (self.start.x + self.end.x) / 2.0, y: (self.start.y + self.end.y) / 2.0 },
|
||||
profile: ColumnProfile::Rect { width: dx.hypot(dy), depth: self.width },
|
||||
rotation: crate::jsnum::atan2(dy, dx),
|
||||
height: zt - zb,
|
||||
component_id: self.component_id.clone(),
|
||||
bottom: Some(VerticalAnchor::Custom { z: zb }),
|
||||
top: Some(VerticalAnchor::Custom { z: zt }),
|
||||
color: self.color.clone(),
|
||||
color_pen_id: self.color_pen_id.clone(),
|
||||
foreground: self.foreground.clone(),
|
||||
background: self.background.clone(),
|
||||
foreground_pen_id: self.foreground_pen_id.clone(),
|
||||
background_pen_id: self.background_pen_id.clone(),
|
||||
stroke_weight: self.stroke_weight,
|
||||
hatch_id: self.hatch_id.clone(),
|
||||
foreground_source: self.foreground_source.clone(),
|
||||
background_source: self.background_source.clone(),
|
||||
stroke_weight_source: self.stroke_weight_source.clone(),
|
||||
hatch_source: self.hatch_source.clone(),
|
||||
renovation: self.renovation.clone(),
|
||||
design_option: self.design_option.clone(),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ impl Project {
|
||||
"context" => put_opt(&mut self.context, i, v),
|
||||
"extrudedSolids" => put_opt(&mut self.extruded_solids, i, v),
|
||||
"columns" => put_opt(&mut self.columns, i, v),
|
||||
"beams" => put_opt(&mut self.beams, i, v),
|
||||
"trees" => put_opt(&mut self.trees, i, v),
|
||||
"cameras" => put_opt(&mut self.cameras, i, v),
|
||||
"groups" => put_opt(&mut self.groups, i, v),
|
||||
|
||||
@@ -31,6 +31,8 @@ pub enum Owner {
|
||||
None,
|
||||
Roof(usize),
|
||||
Column(usize),
|
||||
/// [280] Index in `Project::beams`.
|
||||
Beam(usize),
|
||||
Tree(usize),
|
||||
Stair(usize),
|
||||
Context(usize),
|
||||
@@ -48,6 +50,7 @@ impl Owner {
|
||||
Owner::None => None,
|
||||
Owner::Roof(i) => at(&p.roofs, i).map(|e| e.id.as_str()),
|
||||
Owner::Column(i) => at(&p.columns, i).map(|e| e.id.as_str()),
|
||||
Owner::Beam(i) => at(&p.beams, i).map(|e| e.id.as_str()),
|
||||
Owner::Tree(i) => at(&p.trees, i).map(|e| e.id.as_str()),
|
||||
Owner::Stair(i) => at(&p.stairs, i).map(|e| e.id.as_str()),
|
||||
Owner::Context(i) => at(&p.context, i).map(|e| e.id()),
|
||||
@@ -158,6 +161,9 @@ impl ClassFilter {
|
||||
for c in p.columns.as_deref().unwrap_or(&[]) {
|
||||
add(&c.category_code, &c.id, &c.floor_id);
|
||||
}
|
||||
for b in p.beams.as_deref().unwrap_or(&[]) {
|
||||
add(&b.category_code, &b.id, &b.floor_id);
|
||||
}
|
||||
for t in p.trees.as_deref().unwrap_or(&[]) {
|
||||
add(&t.category_code, &t.id, &t.floor_id);
|
||||
}
|
||||
@@ -190,6 +196,7 @@ impl ClassFilter {
|
||||
.chain(p.roofs.iter().flatten().map(|r| &r.id))
|
||||
.chain(p.stairs.iter().flatten().map(|s| &s.id))
|
||||
.chain(p.columns.iter().flatten().map(|c| &c.id))
|
||||
.chain(p.beams.iter().flatten().map(|c| &c.id))
|
||||
.chain(p.trees.iter().flatten().map(|t| &t.id))
|
||||
.chain(p.extruded_solids.iter().flatten().map(|s| &s.id))
|
||||
.chain(p.drawings2d.iter().map(|d| &d.id))
|
||||
|
||||
@@ -54,7 +54,8 @@ pub fn column_pieces(p: &Project, col: &Column) -> Vec<(Vec<Vec2>, f64, f64)> {
|
||||
let fp = column_footprint(col);
|
||||
let (zb, zt) = p.column_vertical_extent(col);
|
||||
let full = vec![(fp.clone(), zb, zt)];
|
||||
if fp.len() < 3 || !(zt > zb) {
|
||||
// [280] Träger (als Stütze, `type == "beam"`) lassen die Wände ganz.
|
||||
if fp.len() < 3 || !(zt > zb) || col.r#type == "beam" {
|
||||
return full;
|
||||
}
|
||||
let mut clips: Vec<(Vec<Vec2>, f64, f64)> = Vec::new();
|
||||
@@ -121,19 +122,26 @@ pub(super) fn column_mesh(p: &Project, col: &Column) -> Option<(Vec<f64>, Vec<u3
|
||||
(!m.is_empty()).then_some((m.positions, m.indices))
|
||||
}
|
||||
|
||||
/// [141] Stützen als lotrechte Prismen-Platten (Schnitt, Ansicht): je Höhenabschnitt der Querschnitt aus
|
||||
/// [`column_pieces`], Herkunft `SlabSource::Column`.
|
||||
/// [280] Träger als Stützen (Rechteck-Prisma über der Achse), mit Index in `Project::beams`.
|
||||
fn beam_columns(p: &Project) -> impl Iterator<Item = (usize, Column)> + '_ {
|
||||
p.beams.as_deref().unwrap_or(&[]).iter().enumerate().map(|(i, b)| (i, b.as_column(p)))
|
||||
}
|
||||
|
||||
/// [141] Stützen und [280] Träger als lotrechte Prismen-Platten (Schnitt, Ansicht): je Höhenabschnitt der
|
||||
/// Querschnitt aus [`column_pieces`], Herkunft `SlabSource::Column` bzw. `SlabSource::Beam`.
|
||||
pub fn column_slabs(p: &Project) -> Vec<RSlab> {
|
||||
let mut out = Vec::new();
|
||||
for (index, c) in p.columns.as_deref().unwrap_or(&[]).iter().enumerate() {
|
||||
let columns = p.columns.as_deref().unwrap_or(&[]).iter().enumerate().map(|(i, c)| (SlabSource::Column { index: i }, std::borrow::Cow::Borrowed(c)));
|
||||
let beams = beam_columns(p).map(|(i, c)| (SlabSource::Beam { index: i }, std::borrow::Cow::Owned(c)));
|
||||
for (source, c) in columns.chain(beams) {
|
||||
if !(c.height > 0.0) {
|
||||
continue;
|
||||
}
|
||||
let color = c.component_id.as_deref().and_then(|id| p.component(id)).map_or(COLUMN_RGB, |k| hex_to_rgb(&k.color, COLUMN_RGB));
|
||||
for (foot, z_bottom, z_top) in column_pieces(p, c) {
|
||||
for (foot, z_bottom, z_top) in column_pieces(p, &c) {
|
||||
let outline: Vec<RVec2> = foot.iter().map(|q| [q.x, q.y]).collect();
|
||||
if z_top - z_bottom > 1e-6 && outline.iter().flatten().all(|v| v.is_finite()) {
|
||||
out.push(RSlab { outline, z_bottom, z_top, color, ceiling_id: c.id.clone(), hatch: None, cut: None, monolith: None, source: SlabSource::Column { index } });
|
||||
out.push(RSlab { outline, z_bottom, z_top, color, ceiling_id: c.id.clone(), hatch: None, cut: None, monolith: None, source });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -157,6 +165,15 @@ pub fn emit_columns(p: &Project) -> Vec<RMesh> {
|
||||
let crease_angle = matches!(col.profile, ColumnProfile::Round { .. }).then_some(COLUMN_CREASE_DEG);
|
||||
out.push(RMesh { crease_angle, positions, indices, kind: "extrusion", color, vertex_colors: None, material_index: None, owner: Owner::Column(ci) });
|
||||
}
|
||||
// [280] Träger: Prisma über der Achse, Farbe des Bauteils.
|
||||
for (bi, col) in beam_columns(p) {
|
||||
if col.height <= 0.0 {
|
||||
continue;
|
||||
}
|
||||
let Some((positions, indices)) = column_mesh(p, &col) else { continue };
|
||||
let color = col.component_id.as_deref().and_then(|id| p.component(id)).map_or(COLUMN_RGB, |c| hex_to_rgb(&c.color, COLUMN_RGB));
|
||||
out.push(RMesh { crease_angle: None, positions, indices, kind: "extrusion", color, vertex_colors: None, material_index: None, owner: Owner::Beam(bi) });
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
|
||||
@@ -100,6 +100,8 @@ pub enum SlabSource {
|
||||
Stair { index: usize },
|
||||
/// [141] Index in `Project::columns` (Stützen-Prisma, je Höhenabschnitt von [`column_pieces`]).
|
||||
Column { index: usize },
|
||||
/// [280] Index in `Project::beams` (Träger-Prisma wie eine Stütze).
|
||||
Beam { index: usize },
|
||||
}
|
||||
|
||||
/// Ein rohes Dreiecks-Mesh (`RMesh`).
|
||||
|
||||
@@ -450,5 +450,16 @@ fn pick_columns(p: &Project) -> Vec<PickColumn> {
|
||||
out.push(PickColumn { tris, column_id: col.id.clone() });
|
||||
}
|
||||
}
|
||||
// [280] Träger
|
||||
for col in p.beams.iter().flatten().map(|b| b.as_column(p)) {
|
||||
if !(col.height > 0.0) {
|
||||
continue;
|
||||
}
|
||||
let Some((pos, idx)) = column_mesh(p, &col) else { continue };
|
||||
let tris = extrusion_tris(&pos, &idx);
|
||||
if !tris.is_empty() {
|
||||
out.push(PickColumn { tris, column_id: col.id.clone() });
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
@@ -233,6 +233,7 @@ pub fn rebake_ops(root: &Map<String, Value>) -> Vec<Value> {
|
||||
patch_items(root, "drawings2d", &|d| bake_color_weight(&a, d, "weightMm"), &mut ops);
|
||||
patch_items(root, "ceilings", &|c| bake_color_weight(&a, c, "strokeWeight"), &mut ops);
|
||||
patch_items(root, "columns", &|c| bake_color_weight(&a, c, "strokeWeight"), &mut ops);
|
||||
patch_items(root, "beams", &|c| bake_color_weight(&a, c, "strokeWeight"), &mut ops);
|
||||
for coll in ["roofs", "openings", "stairs", "rooms"] {
|
||||
patch_items(root, coll, &|x| bake_color(&a, x), &mut ops);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ pub const NOT_FOR_DRAWINGS: &[&str] = &[
|
||||
"rooms",
|
||||
"units",
|
||||
"columns",
|
||||
"beams",
|
||||
"trees",
|
||||
"cameras",
|
||||
"extrudedSolids",
|
||||
|
||||
@@ -1705,6 +1705,12 @@ pub fn room_stamp_spots(p: &Project, floor: &str, show: &HashSet<String>, scale:
|
||||
|
||||
/// `columnLabel` (für `object_name`).
|
||||
pub fn column_label(col: &Column) -> String {
|
||||
// [280] Träger (als Stütze ausgewertet): Breite × Höhe des Querschnitts.
|
||||
if col.r#type == "beam" {
|
||||
if let ColumnProfile::Rect { depth, .. } = &col.profile {
|
||||
return format!("Träger {}×{}", to_fixed(depth * 100.0, 0), to_fixed(col.height * 100.0, 0));
|
||||
}
|
||||
}
|
||||
match &col.profile {
|
||||
ColumnProfile::Round { radius } => format!("Stütze Ø{}", to_fixed(radius * 200.0, 0)),
|
||||
ColumnProfile::Rect { width, depth } => format!("Stütze {}×{}", to_fixed(width * 100.0, 0), to_fixed(depth * 100.0, 0)),
|
||||
@@ -1714,7 +1720,12 @@ pub fn column_label(col: &Column) -> String {
|
||||
pub(super) fn columns(c: &Ctx, out: &mut Vec<Primitive>) {
|
||||
let p = c.p;
|
||||
let range = super::view_range::ViewRange::of(p, &c.a.floor);
|
||||
for col in p.columns.as_deref().unwrap_or(&[]).iter().filter(|k| k.floor_id == c.a.floor && c.vis(&k.category_code, &k.id)) {
|
||||
// [280] Träger laufen als Stützen mit `type == "beam"` durch denselben Code (Rechteck um die Achsmitte).
|
||||
let beams = p.beams.as_deref().unwrap_or(&[]).iter().filter(|k| k.floor_id == c.a.floor && c.vis(&k.category_code, &k.id)).map(|b| std::borrow::Cow::Owned(b.as_column(p)));
|
||||
let cols = p.columns.as_deref().unwrap_or(&[]).iter().filter(|k| k.floor_id == c.a.floor && c.vis(&k.category_code, &k.id)).map(std::borrow::Cow::Borrowed);
|
||||
for col in cols.chain(beams) {
|
||||
let col: &Column = &col;
|
||||
let is_beam = col.r#type == "beam";
|
||||
let (zb, zt) = p.column_vertical_extent(col);
|
||||
let zone = range.classify(zb, zt);
|
||||
if zone == super::view_range::Zone::Hidden {
|
||||
@@ -1723,7 +1734,7 @@ pub(super) fn columns(c: &Ctx, out: &mut Vec<Primitive>) {
|
||||
let out_start = out.len();
|
||||
let greyed = Some(c.greyed(&col.category_code));
|
||||
let category = c.cat(&col.category_code);
|
||||
let ov = c.overrides(Some("column"), &col.category_code, Some(&column_label(col)));
|
||||
let ov = c.overrides(Some(if is_beam { "beam" } else { "column" }), &col.category_code, Some(&column_label(col)));
|
||||
let lw = ov.lineweight.unwrap_or_else(|| resolve_stroke_weight(col.stroke_weight, col.stroke_weight_source, category, category.map_or(WALL_FALLBACK_MM, |k| k.lw)));
|
||||
let color = ov.color.as_deref().or(col.color.as_deref());
|
||||
let cat_color = category.map(|k| k.color.as_str());
|
||||
@@ -1767,15 +1778,37 @@ pub(super) fn columns(c: &Ctx, out: &mut Vec<Primitive>) {
|
||||
for i in 0..n {
|
||||
out.push(line(fp[i], fp[(i + 1) % n], "column-view", LAYER_JOINT_MM * c.a.detail.layer_factor(), None, stroke, greyed));
|
||||
}
|
||||
if let Some(d) = range.restyle_dash(zone) {
|
||||
// [280] Träger über der Schnitthöhe (Unterzug) immer gestrichelt, dazu die Achse als Strichpunktlinie.
|
||||
let dash = if is_beam && zone == super::view_range::Zone::Above { Some(&super::view_range::ABOVE_DASH[..]) } else { range.restyle_dash(zone) };
|
||||
if let Some(d) = dash {
|
||||
super::view_range::restyle(out, out_start, d);
|
||||
}
|
||||
if is_beam {
|
||||
if let ColumnProfile::Rect { width: len, .. } = &col.profile {
|
||||
let (ux, uy) = (crate::jsnum::cos(col.rotation), crate::jsnum::sin(col.rotation));
|
||||
out.push(Primitive::Line {
|
||||
a: Vec2 { x: col.position.x - ux * len / 2.0, y: col.position.y - uy * len / 2.0 },
|
||||
b: Vec2 { x: col.position.x + ux * len / 2.0, y: col.position.y + uy * len / 2.0 },
|
||||
cls: "beam-axis".into(),
|
||||
weight_mm: lw * 0.5,
|
||||
dash: Some(Some(super::line_pattern::AXIS.to_vec())),
|
||||
zigzag: None,
|
||||
motif: None,
|
||||
color: Some(stroke.to_string().into()),
|
||||
drawing_id: None,
|
||||
opening_id: None,
|
||||
stair_id: None,
|
||||
greyed,
|
||||
opacity: None,
|
||||
});
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// [141] Geschnittene Wände, die in der (geschnittenen) Stütze enden: prioritärere Wand beschneidet
|
||||
// die Stütze, gleiches Bauteil verschmilzt (Kontur über diesen Schichten fehlt).
|
||||
let (mut clip, mut merge): (Vec<Vec<Vec2>>, Vec<crate::plan::wall_poche::WallFootprint>) = (Vec::new(), Vec::new());
|
||||
if zone == super::view_range::Zone::Cut {
|
||||
if zone == super::view_range::Zone::Cut && !is_beam {
|
||||
use super::wall_columns::{band_polys, relation, wall_meets_column, Rel};
|
||||
for w in p.walls.iter().filter(|w| w.floor_id == c.a.floor && c.vis(&w.category_code, &w.id)) {
|
||||
let (zb, zt) = p.wall_vertical_extent(w);
|
||||
|
||||
@@ -1508,6 +1508,9 @@ fn renovation_layers(cx: &mut Ctx, cats: &[&LayerCategory]) -> HashMap<String, S
|
||||
for c in p.columns.iter().flatten() {
|
||||
items.push((&c.id, &c.category_code, crate::renovation::status_of(c.renovation.as_ref())));
|
||||
}
|
||||
for c in p.beams.iter().flatten() {
|
||||
items.push((&c.id, &c.category_code, crate::renovation::status_of(c.renovation.as_ref())));
|
||||
}
|
||||
for o in p.openings.iter().flatten() {
|
||||
items.push((&o.id, &o.category_code, crate::renovation::status_of(crate::renovation::opening_renovation(p, o))));
|
||||
}
|
||||
@@ -1531,7 +1534,8 @@ fn emit_entries(cx: &mut Ctx, main: &mut Buf, entries: &[Entry], layer_by_code:
|
||||
// 2) Rückverweise Primitiv → Kategorie.
|
||||
let code_by_wall: HashMap<&str, &str> = project.walls.iter().map(|w| (w.id.as_str(), w.category_code.as_str())).collect();
|
||||
let code_by_drawing: HashMap<&str, &str> = project.drawings2d.iter().map(|d| (d.id.as_str(), d.category_code.as_str())).collect();
|
||||
let code_by_column: HashMap<&str, &str> = project.columns.iter().flatten().map(|c| (c.id.as_str(), c.category_code.as_str())).collect();
|
||||
// [280] Träger tragen im Plan ihre Kennung als `column_id`.
|
||||
let code_by_column: HashMap<&str, &str> = project.columns.iter().flatten().map(|c| (c.id.as_str(), c.category_code.as_str())).chain(project.beams.iter().flatten().map(|c| (c.id.as_str(), c.category_code.as_str()))).collect();
|
||||
let code_by_room: HashMap<&str, &str> = project.rooms.iter().flatten().map(|r| (r.id.as_str(), r.category_code.as_str())).collect();
|
||||
let layer_of_code = |m: &HashMap<&str, &str>, id: &str| -> Option<String> { layer_by_code.get(m.get(id).copied().unwrap_or("")).cloned() };
|
||||
let drawing_layer = |id: Option<&String>, fallback: &str| -> String {
|
||||
|
||||
@@ -155,7 +155,11 @@ pub(super) fn face_overrides(p: &Project, faces: &mut [Face], v: RuleView) {
|
||||
let layers = p.roof_layers(r);
|
||||
surf_ov(p, v, "roof", &r.category_code, None, &layers, Some(0))
|
||||
}),
|
||||
Role::Column => p.columns.as_deref().unwrap_or(&[]).iter().find(|c| c.id == id).and_then(|c| surf_ov(p, v, "column", &c.category_code, Some(&super::super::domains::column_label(c)), &[], None)),
|
||||
Role::Column => match p.columns.as_deref().unwrap_or(&[]).iter().find(|c| c.id == id) {
|
||||
Some(c) => surf_ov(p, v, "column", &c.category_code, Some(&super::super::domains::column_label(c)), &[], None),
|
||||
// [280] Träger
|
||||
None => p.beams.as_deref().unwrap_or(&[]).iter().find(|b| b.id == id).and_then(|b| surf_ov(p, v, "beam", &b.category_code, Some(&super::super::domains::column_label(&b.as_column(p))), &[], None)),
|
||||
},
|
||||
Role::Mesh => p.context.as_deref().unwrap_or(&[]).iter().find_map(|c| match c {
|
||||
ContextObject::ImportedMesh(m) if m.id == id => Some(m),
|
||||
_ => None,
|
||||
|
||||
@@ -265,6 +265,9 @@ pub fn elevation_primitives_ren(p: &Project, level: &LevelSpec, shadows: bool, m
|
||||
for c in p.columns.as_deref().unwrap_or(&[]) {
|
||||
col_cat.entry(c.id.as_str()).or_insert(c.category_code.as_str());
|
||||
}
|
||||
for b in p.beams.as_deref().unwrap_or(&[]) {
|
||||
col_cat.entry(b.id.as_str()).or_insert(b.category_code.as_str());
|
||||
}
|
||||
let mut mesh_cat: HashMap<&str, &str> = HashMap::new();
|
||||
for c in p.context.as_deref().unwrap_or(&[]) {
|
||||
match c {
|
||||
|
||||
@@ -422,7 +422,9 @@ pub fn subtract_voids(prims: Vec<Primitive>, p: &Project, cut_z: f64) -> Vec<Pri
|
||||
}
|
||||
// Maps wie in TS: bei doppelter id gewinnt der letzte Eintrag.
|
||||
let ceilings: HashMap<&str, &Ceiling> = p.ceilings.as_deref().unwrap_or(&[]).iter().map(|c| (c.id.as_str(), c)).collect();
|
||||
let columns: HashMap<&str, &Column> = p.columns.as_deref().unwrap_or(&[]).iter().map(|c| (c.id.as_str(), c)).collect();
|
||||
// [280] Träger als Stützen (virtuell).
|
||||
let beam_cols: Vec<Column> = p.beams.as_deref().unwrap_or(&[]).iter().map(|b| b.as_column(p)).collect();
|
||||
let columns: HashMap<&str, &Column> = p.columns.as_deref().unwrap_or(&[]).iter().chain(beam_cols.iter()).map(|c| (c.id.as_str(), c)).collect();
|
||||
let ring_of = |pts: &[Vec2]| -> Vec<[f64; 2]> { pts.iter().map(|q| [q.x, q.y]).collect() };
|
||||
// [G1] Abzugskörper beliebiger Form: Grundriss des Körpers im Höhenbereich des Bauteils.
|
||||
let cutters_for = |z0: f64, z1: f64| -> Vec<CutPoly> {
|
||||
|
||||
@@ -159,6 +159,15 @@ fn component_occluders(c: &Ctx, range: &ViewRange, out: &mut Vec<crate::hlr::Fac
|
||||
out.extend(occluder(&ring, d));
|
||||
}
|
||||
}
|
||||
// [280] Träger verdecken die Aufsicht importierter Netze wie Stützen.
|
||||
for b in p.beams.as_deref().unwrap_or(&[]).iter().filter(|k| k.floor_id == c.a.floor && c.vis(&k.category_code, &k.id)) {
|
||||
let col = b.as_column(p);
|
||||
let (zb, zt) = p.column_vertical_extent(&col);
|
||||
if let Some(d) = depth(zb, zt) {
|
||||
let ring: Vec<[f64; 2]> = crate::model3d::column_footprint(&col).iter().map(|q| [q.x, q.y]).collect();
|
||||
out.extend(occluder(&ring, d));
|
||||
}
|
||||
}
|
||||
for ce in p.ceilings.as_deref().unwrap_or(&[]).iter().filter(|x| c.vis(&x.category_code, &x.id)) {
|
||||
let (zb, zt) = p.ceiling_vertical_extent(ce);
|
||||
let zone = range.classify(zb, zt);
|
||||
|
||||
@@ -350,6 +350,11 @@ pub fn hidden_elements(p: &Project, v: RuleView) -> HashSet<String> {
|
||||
out.insert(c.id.clone());
|
||||
}
|
||||
}
|
||||
for b in p.beams.iter().flatten() {
|
||||
if test("beam", &b.category_code, Some(&super::domains::column_label(&b.as_column(p)))) {
|
||||
out.insert(b.id.clone());
|
||||
}
|
||||
}
|
||||
for r in p.rooms.iter().flatten() {
|
||||
if test("room", &r.category_code, Some(&r.name)) {
|
||||
out.insert(r.id.clone());
|
||||
|
||||
@@ -126,6 +126,8 @@ pub enum SlabOwner<'a> {
|
||||
Ceiling(&'a Ceiling, Option<usize>),
|
||||
Stair(&'a Stair),
|
||||
Column(&'a Column),
|
||||
/// [280] Träger.
|
||||
Beam(&'a Beam),
|
||||
}
|
||||
|
||||
/// Je emittierter Platte (Deckenschicht, Treppentritt, Podest) ihre Herkunft (`RSlab::source`).
|
||||
@@ -138,6 +140,7 @@ pub fn slab_owners<'a>(p: &'a Project, slabs: &[RSlab]) -> Vec<SlabOwner<'a>> {
|
||||
SlabSource::Ceiling { index, layer } => ceilings.get(index).map_or(SlabOwner::None, |c| SlabOwner::Ceiling(c, layer)),
|
||||
SlabSource::Stair { index } => stairs.get(index).map_or(SlabOwner::None, SlabOwner::Stair),
|
||||
SlabSource::Column { index } => p.columns.as_deref().and_then(|c| c.get(index)).map_or(SlabOwner::None, SlabOwner::Column),
|
||||
SlabSource::Beam { index } => p.beams.as_deref().and_then(|c| c.get(index)).map_or(SlabOwner::None, SlabOwner::Beam),
|
||||
SlabSource::None => SlabOwner::None,
|
||||
})
|
||||
.collect()
|
||||
@@ -685,14 +688,20 @@ pub(super) fn attach_cut_styles(cuts: Vec<Cut>, p: &Project, plane: &Plane, wall
|
||||
cp.category = Some(st.category_code.clone());
|
||||
}
|
||||
// [141] Stütze: Stil und Rang ihres Bauteils (wie im Grundriss); ohne Bauteil dominiert sie.
|
||||
SlabOwner::Column(c) => {
|
||||
cp.source_id = Some(c.id.clone());
|
||||
cp.category = Some(c.category_code.clone());
|
||||
let comp = c.component_id.as_deref().filter(|s| !s.is_empty()).and_then(|id| p.component(id));
|
||||
// [280] Träger genauso (eigene Felder, gleiche Auflösung).
|
||||
o @ (SlabOwner::Column(_) | SlabOwner::Beam(_)) => {
|
||||
let (id, code, component_id, hatch_id, hatch_source, foreground, foreground_source) = match o {
|
||||
SlabOwner::Column(c) => (&c.id, &c.category_code, &c.component_id, &c.hatch_id, c.hatch_source, &c.foreground, c.foreground_source),
|
||||
SlabOwner::Beam(c) => (&c.id, &c.category_code, &c.component_id, &c.hatch_id, c.hatch_source, &c.foreground, c.foreground_source),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
cp.source_id = Some(id.clone());
|
||||
cp.category = Some(code.clone());
|
||||
let comp = component_id.as_deref().filter(|s| !s.is_empty()).and_then(|id| p.component(id));
|
||||
if let Some(k) = comp {
|
||||
let category = p.layer_category(&c.category_code);
|
||||
let hid = resolve_hatch_id(c.hatch_id.as_deref(), c.hatch_source, category, Some(&k.hatch_id)).unwrap_or(&k.hatch_id);
|
||||
if let Some(h) = resolve_hatch(p, hid, None, resolve_foreground(k, c.foreground.as_deref(), category, c.foreground_source), None) {
|
||||
let category = p.layer_category(code);
|
||||
let hid = resolve_hatch_id(hatch_id.as_deref(), hatch_source, category, Some(&k.hatch_id)).unwrap_or(&k.hatch_id);
|
||||
if let Some(h) = resolve_hatch(p, hid, None, resolve_foreground(k, foreground.as_deref(), category, foreground_source), None) {
|
||||
cp.fill = Some(poche_fill(h.pattern).to_string());
|
||||
cp.hatch = Some(h);
|
||||
}
|
||||
|
||||
@@ -602,6 +602,7 @@ pub(crate) fn edge_categories(p: &Project, walls: &[Option<&Wall>], slabs: &[ban
|
||||
bands::SlabOwner::Ceiling(c, _) => &c.category_code,
|
||||
bands::SlabOwner::Stair(st) => &st.category_code,
|
||||
bands::SlabOwner::Column(c) => &c.category_code,
|
||||
bands::SlabOwner::Beam(c) => &c.category_code,
|
||||
bands::SlabOwner::None => continue,
|
||||
};
|
||||
m.insert((Kind::Slab, i), code.clone());
|
||||
@@ -628,6 +629,7 @@ pub(crate) fn edge_ids(p: &Project, walls: &[Option<&Wall>], slabs: &[bands::Sla
|
||||
bands::SlabOwner::Ceiling(c, _) => &c.id,
|
||||
bands::SlabOwner::Stair(st) => &st.id,
|
||||
bands::SlabOwner::Column(c) => &c.id,
|
||||
bands::SlabOwner::Beam(c) => &c.id,
|
||||
bands::SlabOwner::None => continue,
|
||||
};
|
||||
m.insert((Kind::Slab, i), id.clone());
|
||||
|
||||
@@ -329,7 +329,7 @@ impl<'a> SectionMv<'a> {
|
||||
pos.get(li).copied()
|
||||
})
|
||||
.collect();
|
||||
let columns = p.columns.as_deref().unwrap_or(&[]).iter().map(|c| c.id.clone()).collect();
|
||||
let columns = p.columns.as_deref().unwrap_or(&[]).iter().map(|c| c.id.clone()).chain(p.beams.iter().flatten().map(|b| b.id.clone())).collect();
|
||||
SectionMv { o, layer_pos, columns }
|
||||
}
|
||||
|
||||
|
||||
@@ -348,6 +348,7 @@ pub(crate) fn model_view_faces(p: &Project, vis: &Visibility, view: &dyn Fn([f64
|
||||
Some(SlabOwner::Ceiling(c, _)) => (Some(c.id.clone()), false, false),
|
||||
Some(SlabOwner::Stair(s)) => (Some(s.id.clone()), true, false),
|
||||
Some(SlabOwner::Column(c)) => (Some(c.id.clone()), false, true),
|
||||
Some(SlabOwner::Beam(c)) => (Some(c.id.clone()), false, true),
|
||||
_ => (None, false, false),
|
||||
},
|
||||
Kind::Roof => (roofs.get(i).map(|r| r.id.clone()), false, false),
|
||||
|
||||
@@ -15,12 +15,12 @@ const REQUIRED_ARRAYS: [&str; 3] = ["walls", "layers", "drawingLevels"];
|
||||
const DEFAULT_ARRAYS: [&str; 5] = ["lineStyles", "hatches", "components", "wallTypes", "drawings2d"];
|
||||
|
||||
/// Bekannte Felder von `Project` (für die Meldung unbekannter Felder).
|
||||
const KNOWN_KEYS: [&str; 63] = [
|
||||
const KNOWN_KEYS: [&str; 64] = [
|
||||
"formatVersion", "id", "name", "lineStyles", "textStyles", "hatches", "components", "wallTypes",
|
||||
"ceilingTypes", "roofTypes", "blockDefs", "doorTypes", "windowTypes", "stairTypes", "pens",
|
||||
"penSets", "activePenSetId", "customPalettes", "builtinPaletteBanks", "drawingLevels", "layers",
|
||||
"walls", "ceilings", "roofs", "openings", "stairs", "rooms", "drawings2d", "context",
|
||||
"extrudedSolids", "columns", "groups", "parametricWalls", "overrideRules", "viewSnapshots",
|
||||
"extrudedSolids", "columns", "beams", "groups", "parametricWalls", "overrideRules", "viewSnapshots",
|
||||
"viewSnapshotFolders", "viewTemplates", "layouts", "masterLayouts", "layoutFolders", "publishSets", "publishLog", "projectNumber", "competition", "referenceElevationMasl",
|
||||
"geoAnchor", "roomProgram", "roomProgramTolerance", "parcelArea", "sunStudy", "siteRules", "scaleLineWeights",
|
||||
"lineCap", "lineJoin", "trees", "uiState",
|
||||
|
||||
@@ -96,6 +96,11 @@ pub fn dangling_refs(p: &Project) -> Vec<String> {
|
||||
miss(&mut out, "Stütze", &c.id, "Bauteil", c.component_id.as_deref().unwrap_or(""), &components);
|
||||
miss(&mut out, "Stütze", &c.id, "Schraffur", c.hatch_id.as_deref().unwrap_or(""), &hatches);
|
||||
}
|
||||
for c in p.beams.as_deref().unwrap_or(&[]) {
|
||||
miss(&mut out, "Träger", &c.id, "Geschoss", &c.floor_id, &levels);
|
||||
miss(&mut out, "Träger", &c.id, "Bauteil", c.component_id.as_deref().unwrap_or(""), &components);
|
||||
miss(&mut out, "Träger", &c.id, "Schraffur", c.hatch_id.as_deref().unwrap_or(""), &hatches);
|
||||
}
|
||||
for r in p.rooms.as_deref().unwrap_or(&[]) {
|
||||
miss(&mut out, "Raum", &r.id, "Geschoss", &r.floor_id, &levels);
|
||||
}
|
||||
@@ -172,7 +177,7 @@ pub fn dangling_refs(p: &Project) -> Vec<String> {
|
||||
("Decke", ids(p.ceilings.as_deref().unwrap_or(&[]), |x| x.id.as_str())),
|
||||
("Raum", ids(p.rooms.as_deref().unwrap_or(&[]), |x| x.id.as_str())),
|
||||
("Treppe", ids(p.stairs.as_deref().unwrap_or(&[]), |x| x.id.as_str())),
|
||||
("Stütze", ids(p.columns.as_deref().unwrap_or(&[]), |x| x.id.as_str())),
|
||||
("Stütze", ids(p.columns.as_deref().unwrap_or(&[]), |x| x.id.as_str()).into_iter().chain(ids(p.beams.as_deref().unwrap_or(&[]), |x| x.id.as_str())).collect()),
|
||||
("Dach", ids(p.roofs.as_deref().unwrap_or(&[]), |x| x.id.as_str())),
|
||||
("Öffnung", ids(p.openings.as_deref().unwrap_or(&[]), |x| x.id.as_str())),
|
||||
("Baum", ids(p.trees.as_deref().unwrap_or(&[]), |x| x.id.as_str())),
|
||||
|
||||
@@ -472,6 +472,9 @@ impl View {
|
||||
for x in p.columns.iter().flatten() {
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), out);
|
||||
}
|
||||
for x in p.beams.iter().flatten() {
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), out);
|
||||
}
|
||||
for x in p.extruded_solids.iter().flatten() {
|
||||
put(&x.id, self.treat(x.renovation.as_ref()), out);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! Export-Scope „nur Auswahl" ([K4] S3, vorher `filterProjectToSelection` in `src/state/exportScope.ts`):
|
||||
//! die Listen der acht Elementarten auf die ausgewählten ids kürzen (jede Art ohne Eintrag wird leer);
|
||||
//! die Listen der Elementarten auf die ausgewählten ids kürzen (jede Art ohne Eintrag wird leer);
|
||||
//! Bibliotheken, Ebenen und Geschosse bleiben, damit id-Verweise weiter auflösen. Liefert die gekürzten
|
||||
//! Listen als Patch für `{...project, ...patch}`.
|
||||
|
||||
@@ -8,13 +8,15 @@ use serde_json::{Map, Value};
|
||||
use std::collections::HashSet;
|
||||
|
||||
/// Projekt-Liste → (Mitglieds-ids der Art).
|
||||
const KINDS: [(&str, &str); 8] = [
|
||||
const KINDS: [(&str, &str); 9] = [
|
||||
("walls", "wallIds"),
|
||||
("drawings2d", "drawingIds"),
|
||||
("ceilings", "ceilingIds"),
|
||||
("rooms", "roomIds"),
|
||||
("stairs", "stairIds"),
|
||||
("columns", "columnIds"),
|
||||
// [280] Träger liegen im Auswahlkanal der Stützen.
|
||||
("beams", "columnIds"),
|
||||
("roofs", "roofIds"),
|
||||
("openings", "openingIds"),
|
||||
];
|
||||
@@ -53,7 +55,7 @@ mod tests {
|
||||
assert_eq!(p["rooms"], json!([]));
|
||||
assert_eq!(p["drawings2d"], json!([]));
|
||||
assert_eq!(p["roofs"], json!([]));
|
||||
assert_eq!(p.len(), 8);
|
||||
assert_eq!(p.len(), 9);
|
||||
assert!(p.get("layers").is_none());
|
||||
}
|
||||
}
|
||||
@@ -430,7 +430,11 @@ pub fn derive(lk: &Lookup, a: &SelArgs) -> Result<J, String> {
|
||||
return Ok(lk.find("extrudedSolids", i).map_or(J::null(), |s| solid_selection(root, s)));
|
||||
}
|
||||
if let Some(i) = id(&a.column_id) {
|
||||
return lk.find("columns", i).map_or(Ok(J::null()), |c| column_selection(root, c));
|
||||
if let Some(c) = lk.find("columns", i) {
|
||||
return column_selection(root, c);
|
||||
}
|
||||
// [280] Träger liegen im Auswahlkanal der Stützen.
|
||||
return lk.find("beams", i).map_or(Ok(J::null()), |b| beam_selection(root, b));
|
||||
}
|
||||
if let Some(i) = id(&a.opening_id) {
|
||||
if let Some(o) = lk.find("openings", i) {
|
||||
@@ -1121,6 +1125,72 @@ fn column_selection(root: &Map<String, Value>, c: &Value) -> Result<J, String> {
|
||||
.done())
|
||||
}
|
||||
|
||||
/// [280] (UK, OK) eines Trägers aus der rohen Wurzel (wie `Project::beam_vertical_extent`).
|
||||
fn beam_extent(root: &Map<String, Value>, b: &Value) -> (f64, f64) {
|
||||
let floor_top = level(root, field(b, "floorId")).map_or(0.0, |f| num_or(field(f, "baseElevation"), 0.0) + num_or(field(f, "floorHeight"), 0.0));
|
||||
let (s, e) = (xy(field(b, "start").unwrap_or(&Value::Null)), xy(field(b, "end").unwrap_or(&Value::Null)));
|
||||
let mid = kernel2d::Vec2::new((s.0 + e.0) / 2.0, (s.1 + e.1) / 2.0);
|
||||
let ring = |v: Option<&Value>| -> Vec<kernel2d::Vec2> { pts_of(v).into_iter().map(|(x, y)| kernel2d::Vec2::new(x, y)).collect() };
|
||||
let under = arr(root.get("ceilings")).iter().filter(|c| field(c, "floorId") == field(b, "floorId")).filter_map(|c| {
|
||||
let outline = ring(field(c, "outline"));
|
||||
let (cb, ct) = ceiling_extent(root, c, ceiling_thickness(root, c));
|
||||
let in_hole = arr(field(c, "openings")).iter().any(|h| h.as_array().is_some_and(|a| a.len() >= 3) && kernel2d::point_in_outline(mid, &ring(Some(h))));
|
||||
(outline.len() >= 3 && ct > cb && kernel2d::point_in_outline(mid, &outline) && !in_hole).then_some(cb)
|
||||
});
|
||||
heights::beam(floor_top, under, num_or(field(b, "topOffset"), 0.0), num_of(field(b, "height")))
|
||||
}
|
||||
|
||||
fn beam_selection(root: &Map<String, Value>, b: &Value) -> Result<J, String> {
|
||||
let floor = level(root, field(b, "floorId"));
|
||||
let cat = category(root, field(b, "categoryCode"));
|
||||
let typed: crate::model::Beam = serde_json::from_value(b.clone()).map_err(|e| format!("Träger passt nicht zum Kern-Modell: {e}"))?;
|
||||
let bb = bbox_of(typed.footprint().into_iter().map(|p| (p.x, p.y)));
|
||||
let (zb, zt) = beam_extent(root, b);
|
||||
let (dx, dy) = (typed.end.x - typed.start.x, typed.end.y - typed.start.y);
|
||||
let info = O::default()
|
||||
.raw("width", b, "width")
|
||||
.raw("height", b, "height")
|
||||
.v("profileName", nn(field(b, "profileName")).cloned().unwrap_or(Value::Null))
|
||||
.n("topOffset", num_or(field(b, "topOffset"), 0.0))
|
||||
.n("length", dx.hypot(dy))
|
||||
.raw("floorId", b, "floorId")
|
||||
.o("floorName", floor_name(floor, field(b, "floorId")))
|
||||
.n("zBottom", zb)
|
||||
.n("zTop", zt)
|
||||
.done();
|
||||
let comp = if truthy(field(b, "componentId")) { find_by(arr(root.get("components")), "id", field(b, "componentId")) } else { None };
|
||||
let (fg, bg, hatch) = effective(b, comp, cat);
|
||||
let weight = match nn(field(b, "strokeWeight")) {
|
||||
Some(w) => w.clone(),
|
||||
None if is_layer(field(b, "strokeWeightSource")) => cat.and_then(|k| nn(field(k, "lw"))).cloned().unwrap_or_else(|| js_num(WALL_FALLBACK_MM)),
|
||||
None => js_num(WALL_FALLBACK_MM),
|
||||
};
|
||||
Ok(O::default()
|
||||
.s("kind", "beam")
|
||||
.raw("id", b, "id")
|
||||
.raw("categoryCode", b, "categoryCode")
|
||||
.raw("floorId", b, "floorId")
|
||||
.v("color", color_of(b, cat, COLUMN_COLOR))
|
||||
.raw("colorPenId", b, "colorPenId")
|
||||
.v("weightMm", weight)
|
||||
.raw("fillHatchId", b, "hatchId")
|
||||
.raw("foreground", b, "foreground")
|
||||
.raw("foregroundPenId", b, "foregroundPenId")
|
||||
.raw("background", b, "background")
|
||||
.raw("backgroundPenId", b, "backgroundPenId")
|
||||
.raw("foregroundSource", b, "foregroundSource")
|
||||
.raw("backgroundSource", b, "backgroundSource")
|
||||
.o("effectiveForeground", fg)
|
||||
.o("effectiveBackground", bg)
|
||||
.o("effectiveHatchId", hatch)
|
||||
.raw("strokeWeightOverride", b, "strokeWeight")
|
||||
.raw("strokeWeightSource", b, "strokeWeightSource")
|
||||
.raw("hatchSource", b, "hatchSource")
|
||||
.v("bbox", bbox_value(bb))
|
||||
.v("beam", info)
|
||||
.done())
|
||||
}
|
||||
|
||||
fn context_selection(root: &Map<String, Value>, o: &Value) -> J {
|
||||
let kind = str_of(field(o, "type"));
|
||||
let mut pts: Vec<(f64, f64)> = Vec::new();
|
||||
|
||||
@@ -298,6 +298,7 @@ fn candidate_codes(p: &Project) -> HashSet<String> {
|
||||
// [115] Freie Körper und Stützen ebenso.
|
||||
codes.extend(p.extruded_solids.iter().flatten().map(|e| e.category_code.clone()));
|
||||
codes.extend(p.columns.iter().flatten().map(|e| e.category_code.clone()));
|
||||
codes.extend(p.beams.iter().flatten().map(|e| e.category_code.clone()));
|
||||
codes
|
||||
}
|
||||
|
||||
|
||||
@@ -206,6 +206,12 @@ pub fn collect_model_at(p: &Project, level: &str, codes: &HashSet<String>, skip:
|
||||
ColumnProfile::Round { radius } => circles.push(Circle { cx: col.position.x, cy: col.position.y, r: radius, arc: None }),
|
||||
}
|
||||
}
|
||||
// [280] Träger: Rechteck um die Achse (Fang an Ecken und Kanten).
|
||||
for b in p.beams.as_deref().unwrap_or(&[]) {
|
||||
if vis_el(&b.id, &b.floor_id, &b.category_code) {
|
||||
closed_poly(&crate::model3d::column_footprint(&b.as_column(p)), &mut segs);
|
||||
}
|
||||
}
|
||||
circles.extend(stair_arcs);
|
||||
for r in p.rooms.as_deref().unwrap_or(&[]) {
|
||||
if vis_el(&r.id, &r.floor_id, &r.category_code) && r.boundary.len() >= 3 {
|
||||
|
||||
@@ -1065,6 +1065,13 @@ fn collect(p: &Project, k: [f64; 2], cut: Option<f64>, ground: Option<&Ground>)
|
||||
let footprint = crate::model3d::column_footprint(c).iter().map(|v| [v.x, v.y]).collect();
|
||||
prisms.push((Prism { footprint, z_bottom, z_top }, vec![]));
|
||||
}
|
||||
// [280] Träger werfen Schatten wie Stützen.
|
||||
for b in p.beams.as_deref().unwrap_or(&[]) {
|
||||
let c = b.as_column(p);
|
||||
let (z_bottom, z_top) = p.column_vertical_extent(&c);
|
||||
let footprint = crate::model3d::column_footprint(&c).iter().map(|v| [v.x, v.y]).collect();
|
||||
prisms.push((Prism { footprint, z_bottom, z_top }, vec![]));
|
||||
}
|
||||
// [142] Decken (auch Balkone, Auskragungen) werfen Schatten, decken Tieferes ab und empfangen ihn.
|
||||
for ce in p.ceilings.as_deref().unwrap_or(&[]) {
|
||||
let (zb, zt) = p.ceiling_vertical_extent(ce);
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"formatVersion":5,"id":"musterhaus-komplex","name":"Musterhaus komplex","projectNumber":"2611","lineStyles":[{"id":"std-ls-voll","name":"Volllinie","color":"#1a1a1a","dash":null},{"id":"std-ls-strich-fein","name":"Strichlinie","color":"#1a1a1a","dash":[3,2]},{"id":"std-ls-strich-grob","name":"Strichlinie lang","color":"#1a1a1a","dash":[6,4]},{"id":"std-ls-punkt","name":"Punktierte Linie","color":"#1a1a1a","dash":[0,1]},{"id":"std-ls-strichpunkt","name":"Strichpunktlinie (Achse)","color":"#1a1a1a","dash":[12,1.5,0,1.5]},{"id":"std-ls-strichzweipunkt","name":"Strich-Zweipunktlinie","color":"#1a1a1a","dash":[12,1.5,0,1.5,0,1.5]},{"id":"std-ls-grundstueck","name":"Grundstücksgrenze","color":"#1a1a1a","dash":[8,1.5,0,1.5,0,1.5]},{"id":"std-ls-bauteilgrenze","name":"Baulinie / Bauteilgrenze","color":"#1a1a1a","dash":[8,1.5,0,1.5]},{"id":"std-ls-bruch","name":"Bruchlinie (Zickzack)","color":"#1a1a1a","dash":null,"kind":"zigzag","zigzag":{"amplitude":1.5,"wavelength":4}},{"id":"std-ls-schraffur-strich","name":"Strichlinie kurz","color":"#1a1a1a","dash":[1,0.7]},{"id":"std-ls-schraffur-punkt","name":"Punktlinie kurz","color":"#1a1a1a","dash":[0.5,1.6]},{"id":"std-ls-sperrschicht","name":"Sperrschicht (Wind, Dampf, Wasser)","color":"#1a1a1a","dash":[3,3]}],"hatches":[{"id":"std-h-ohne","name":"SIA Ohne Schraffur","pattern":"none","scale":1,"angle":0,"color":"#1a1a1a"},{"id":"std-h-stahlbeton","name":"SIA Stahlbeton","pattern":"crosshatch","scale":0.8438,"angle":45,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-beton","name":"SIA Beton unbewehrt","pattern":"crosshatch","scale":0.8438,"angle":45,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-backstein","name":"SIA Backstein","pattern":"diagonal","scale":0.8438,"angle":45,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-kalksandstein","name":"SIA Kalksandstein","pattern":"diagonal","scale":0.8438,"angle":135,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-porenbeton","name":"SIA Porenbeton","pattern":"diagonal","scale":1.0125,"angle":45,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true,"lineStyleId":"std-ls-strich-fein"},{"id":"std-h-holz","name":"SIA Holz (Querschnitt)","pattern":"timber","scale":1,"angle":0,"relativeToWall":true,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-holz-massiv","name":"SIA Holz massiv","pattern":"wood","scale":0.4219,"angle":45,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-bsp","name":"SIA Brettsperrholz","pattern":"diagonal","scale":0.45,"angle":90,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-holzwerkstoff","name":"SIA Holzwerkstoff","pattern":"woodBased","scale":1.4063,"angle":45,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-daemmung-weich","name":"SIA Dämmung weich","pattern":"insulation","scale":1,"angle":0,"relativeToWall":true,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-daemmung-holzfaser","name":"SIA Dämmung Holzfaser","pattern":"insulation","scale":1.4,"angle":0,"relativeToWall":true,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-daemmstoffe-sia","name":"Dämmstoffe (SIA-Linien)","pattern":"diagonal","scale":0.3938,"angle":0,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-gips","name":"SIA Gips","pattern":"none","scale":1,"angle":0,"color":"#1a1a1a"},{"id":"std-h-putz","name":"SIA Putz","pattern":"none","scale":1,"angle":0,"color":"#1a1a1a"},{"id":"std-h-estrich","name":"SIA Estrich","pattern":"none","scale":1,"angle":0,"color":"#1a1a1a"},{"id":"std-h-keramik","name":"SIA Keramik","pattern":"crosshatch","scale":0.1687,"angle":45,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-faserzement","name":"SIA Faserzement","pattern":"diagonal","scale":0.225,"angle":135,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-stahl","name":"SIA Stahl","pattern":"solid","scale":1,"angle":0,"color":"#1a1a1a"},{"id":"std-h-stahl-detail","name":"SIA Stahl M 1:1","pattern":"diagonal","scale":0.8438,"angle":45,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-alu","name":"SIA Aluminium","pattern":"none","scale":1,"angle":0,"color":"#1a1a1a"},{"id":"std-h-naturstein","name":"SIA Naturstein","pattern":"stone","scale":1.2656,"angle":45,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-glas","name":"SIA Glas","pattern":"diagonal","scale":0.09,"angle":90,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-sperrschicht","name":"SIA Sperrschicht","pattern":"barrier","scale":1,"angle":0,"relativeToWall":true,"color":"#1a1a1a","lineWeight":0.5},{"id":"std-h-erdreich","name":"SIA Erdreich","pattern":"earth","scale":1.0001,"angle":45,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-kies","name":"SIA Kies / Sauberkeitsschicht","pattern":"gravel","scale":1.0001,"angle":0,"color":"#1a1a1a","lineWeight":0.1}],"components":[{"id":"std-c-beton","name":"Beton","abbrev":"BE","color":"#ffffff","background":"#ffffff","hatchId":"std-h-beton","joinPriority":95,"fireClass":"RFLine truncated
|
||||
{"formatVersion":5,"id":"musterhaus-komplex","name":"Musterhaus komplex","projectNumber":"2611","lineStyles":[{"id":"std-ls-voll","name":"Volllinie","color":"#1a1a1a","dash":null},{"id":"std-ls-strich-fein","name":"Strichlinie","color":"#1a1a1a","dash":[3,2]},{"id":"std-ls-strich-grob","name":"Strichlinie lang","color":"#1a1a1a","dash":[6,4]},{"id":"std-ls-punkt","name":"Punktierte Linie","color":"#1a1a1a","dash":[0,1]},{"id":"std-ls-strichpunkt","name":"Strichpunktlinie (Achse)","color":"#1a1a1a","dash":[12,1.5,0,1.5]},{"id":"std-ls-strichzweipunkt","name":"Strich-Zweipunktlinie","color":"#1a1a1a","dash":[12,1.5,0,1.5,0,1.5]},{"id":"std-ls-grundstueck","name":"Grundstücksgrenze","color":"#1a1a1a","dash":[8,1.5,0,1.5,0,1.5]},{"id":"std-ls-bauteilgrenze","name":"Baulinie / Bauteilgrenze","color":"#1a1a1a","dash":[8,1.5,0,1.5]},{"id":"std-ls-bruch","name":"Bruchlinie (Zickzack)","color":"#1a1a1a","dash":null,"kind":"zigzag","zigzag":{"amplitude":1.5,"wavelength":4}},{"id":"std-ls-schraffur-strich","name":"Strichlinie kurz","color":"#1a1a1a","dash":[1,0.7]},{"id":"std-ls-schraffur-punkt","name":"Punktlinie kurz","color":"#1a1a1a","dash":[0.5,1.6]},{"id":"std-ls-sperrschicht","name":"Sperrschicht (Wind, Dampf, Wasser)","color":"#1a1a1a","dash":[3,3]}],"hatches":[{"id":"std-h-ohne","name":"SIA Ohne Schraffur","pattern":"none","scale":1,"angle":0,"color":"#1a1a1a"},{"id":"std-h-stahlbeton","name":"SIA Stahlbeton","pattern":"crosshatch","scale":0.8438,"angle":45,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-beton","name":"SIA Beton unbewehrt","pattern":"crosshatch","scale":0.8438,"angle":45,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-backstein","name":"SIA Backstein","pattern":"diagonal","scale":0.8438,"angle":45,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-kalksandstein","name":"SIA Kalksandstein","pattern":"diagonal","scale":0.8438,"angle":135,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-porenbeton","name":"SIA Porenbeton","pattern":"diagonal","scale":1.0125,"angle":45,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true,"lineStyleId":"std-ls-strich-fein"},{"id":"std-h-holz","name":"SIA Holz (Querschnitt)","pattern":"timber","scale":1,"angle":0,"relativeToWall":true,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-holz-massiv","name":"SIA Holz massiv","pattern":"wood","scale":0.4219,"angle":45,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-bsp","name":"SIA Brettsperrholz","pattern":"diagonal","scale":0.45,"angle":90,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-holzwerkstoff","name":"SIA Holzwerkstoff","pattern":"woodBased","scale":1.4063,"angle":45,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-daemmung-weich","name":"SIA Dämmung weich","pattern":"insulation","scale":1,"angle":0,"relativeToWall":true,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-daemmung-holzfaser","name":"SIA Dämmung Holzfaser","pattern":"insulation","scale":1.4,"angle":0,"relativeToWall":true,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-daemmstoffe-sia","name":"Dämmstoffe (SIA-Linien)","pattern":"diagonal","scale":0.3938,"angle":0,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-gips","name":"SIA Gips","pattern":"none","scale":1,"angle":0,"color":"#1a1a1a"},{"id":"std-h-putz","name":"SIA Putz","pattern":"none","scale":1,"angle":0,"color":"#1a1a1a"},{"id":"std-h-estrich","name":"SIA Estrich","pattern":"none","scale":1,"angle":0,"color":"#1a1a1a"},{"id":"std-h-keramik","name":"SIA Keramik","pattern":"crosshatch","scale":0.1687,"angle":45,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-faserzement","name":"SIA Faserzement","pattern":"diagonal","scale":0.225,"angle":135,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-stahl","name":"SIA Stahl","pattern":"solid","scale":1,"angle":0,"color":"#1a1a1a"},{"id":"std-h-stahl-detail","name":"SIA Stahl M 1:1","pattern":"diagonal","scale":0.8438,"angle":45,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-alu","name":"SIA Aluminium","pattern":"none","scale":1,"angle":0,"color":"#1a1a1a"},{"id":"std-h-naturstein","name":"SIA Naturstein","pattern":"stone","scale":1.2656,"angle":45,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-glas","name":"SIA Glas","pattern":"diagonal","scale":0.09,"angle":90,"color":"#1a1a1a","lineWeight":0.1,"relativeToWall":true},{"id":"std-h-sperrschicht","name":"SIA Sperrschicht","pattern":"barrier","scale":1,"angle":0,"relativeToWall":true,"color":"#1a1a1a","lineWeight":0.5},{"id":"std-h-erdreich","name":"SIA Erdreich","pattern":"earth","scale":1.0001,"angle":45,"color":"#1a1a1a","lineWeight":0.1},{"id":"std-h-kies","name":"SIA Kies / Sauberkeitsschicht","pattern":"gravel","scale":1.0001,"angle":0,"color":"#1a1a1a","lineWeight":0.1}],"components":[{"id":"std-c-beton","name":"Beton","abbrev":"BE","color":"#ffffff","background":"#ffffff","hatchId":"std-h-beton","joinPriority":95,"fireClass":"RFLine truncated
|
||||
@@ -514,10 +514,10 @@ impl Builder {
|
||||
}
|
||||
|
||||
/// IfcBuildingElement-Subtyp mit dem üblichen 9-Attribut-Flatten. Das letzte Attribut ist in IFC4 die
|
||||
/// PredefinedType, in IFC2x3 je Klasse ShapeType/PredefinedType/CompositionType; IfcWall und IfcColumn
|
||||
/// haben es dort nicht.
|
||||
/// PredefinedType, in IFC2x3 je Klasse ShapeType/PredefinedType/CompositionType; IfcWall, IfcColumn
|
||||
/// und IfcBeam haben es dort nicht.
|
||||
pub(super) fn emit_building_element(&mut self, ty: &str, guid: String, name: &str, placement: usize, shape: usize, predefined: Option<String>) -> usize {
|
||||
let last = if self.v2() && matches!(ty, "IFCWALL" | "IFCWALLSTANDARDCASE" | "IFCCOLUMN") {
|
||||
let last = if self.v2() && matches!(ty, "IFCWALL" | "IFCWALLSTANDARDCASE" | "IFCCOLUMN" | "IFCBEAM") {
|
||||
String::new()
|
||||
} else {
|
||||
format!(",{}", predefined.as_deref().unwrap_or("$"))
|
||||
|
||||
@@ -91,7 +91,11 @@
|
||||
// component_name, PSETS ([141] Stütze mit Höhenabschnitten, je Abschnitt ein eigenes beschnittenes
|
||||
// Profil; EIN IfcColumn mit n Extrusionen in einer SweptSolid-Darstellung, Placement auf dem tiefsten
|
||||
// Abschnitt; Material und Materialzuordnung wie COLUMN; die Mengen stehen fertig in PSETS)
|
||||
// END_COLUMNS = 11 (Materialzuordnung der Stützen)
|
||||
// BEAM = 27 ([280] Träger), Felder wie COLUMN: structure, id, label, PTS (Grundriss-Rechteck), z_rel, depth (Querschnitts-
|
||||
// höhe), component_id (−1 = keine), component_name, PSETS; IfcBeam (BEAM, in IFC2x3 ohne PredefinedType),
|
||||
// Profil-Extrusion senkrecht über dem Rechteck; Schlüssel `beam/<id>`; Material wie bei den Stützen
|
||||
// (steht VOR END_COLUMNS).
|
||||
// END_COLUMNS = 11 (Materialzuordnung der Stützen und Träger)
|
||||
// LAYERS = 25, n_refs, (key, layer_name) x n_refs ([259]) IfcPresentationLayerAssignment je Ebene (Name =
|
||||
// "Code_Bezeichnung" wie im DXF); alle Darstellungen des Bauteils `key` (wie bei CLASSIFICATION, samt
|
||||
// aggregierter Teile) liegen auf genau einer Ebene. (IFC4 erlaubt bei IfcPresentationLayerWithStyle nur
|
||||
@@ -176,6 +180,7 @@ pub const REC_LAYERS: f64 = 25.0;
|
||||
pub const REC_COLUMN_PIECES: f64 = 20.0;
|
||||
pub const REC_CEILING_ARC: f64 = 21.0;
|
||||
pub const REC_SPACE_ARC: f64 = 22.0;
|
||||
pub const REC_BEAM: f64 = 27.0;
|
||||
|
||||
mod format;
|
||||
mod reader;
|
||||
@@ -1105,11 +1110,13 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
|
||||
let (placement, shape) = w.emit_triangulated_product(&mesh, w.placement_of(structure));
|
||||
w.finish_typed("IFCROOF", format!("roof/{id}"), &name, &ty, &psets, structure, placement, shape, Some(enum_(&predefined)), false);
|
||||
}
|
||||
c if c == REC_COLUMN || c == REC_COLUMN_PIECES => {
|
||||
c if c == REC_COLUMN || c == REC_COLUMN_PIECES || c == REC_BEAM => {
|
||||
let structure = r.structure(n_storeys)?;
|
||||
let id = r.string()?;
|
||||
let label = r.string()?;
|
||||
let pieces: Vec<(Vec<(f64, f64)>, f64, f64)> = if c == REC_COLUMN {
|
||||
// [280] Träger: gleiche Daten, andere Klasse und anderer Schlüssel.
|
||||
let (class, kind, predefined) = if c == REC_BEAM { ("IFCBEAM", "beam", "BEAM") } else { ("IFCCOLUMN", "column", "COLUMN") };
|
||||
let pieces: Vec<(Vec<(f64, f64)>, f64, f64)> = if c == REC_COLUMN || c == REC_BEAM {
|
||||
let pts = r.pts()?;
|
||||
vec![(pts, r.f()?, r.f()?)]
|
||||
} else {
|
||||
@@ -1132,12 +1139,12 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
|
||||
} else {
|
||||
w.emit_pieces_product(&pieces, w.placement_of(structure))
|
||||
};
|
||||
let g = w.gid(&format!("column/{id}"));
|
||||
let entity = w.emit_building_element("IFCCOLUMN", g, &label, placement, shape, Some(enum_("COLUMN")));
|
||||
let g = w.gid(&format!("{kind}/{id}"));
|
||||
let entity = w.emit_building_element(class, g, &label, placement, shape, Some(enum_(predefined)));
|
||||
w.add_to_containment(structure, entity);
|
||||
w.elements.insert(format!("column/{id}"), entity);
|
||||
w.elements.insert(format!("{kind}/{id}"), entity);
|
||||
for p in &psets {
|
||||
w.add_pset(p, entity, &format!("column/{id}"));
|
||||
w.add_pset(p, entity, &format!("{kind}/{id}"));
|
||||
}
|
||||
if let Some(cid) = component {
|
||||
if let Some((_, _, v)) = w.column_materials.iter_mut().find(|(c, _, _)| *c == cid) {
|
||||
|
||||
@@ -1342,6 +1342,42 @@ fn stuetze_mit_hoehenabschnitten() {
|
||||
assert!(ifc.contains("IFCCARTESIANPOINT((0.0,0.0,1.5))"), "Versatz des oberen Abschnitts");
|
||||
}
|
||||
|
||||
/// [280] Träger: IfcBeam mit einer Extrusion über dem Grundriss-Rechteck, Material wie bei Stützen, GlobalId aus `beam/<id>`;
|
||||
/// IFC2x3 ohne PredefinedType (wie IfcColumn).
|
||||
#[test]
|
||||
fn traeger_als_ifc_beam() {
|
||||
let mut b = mini();
|
||||
b.n(&[REC_BEAM, -1.0]);
|
||||
b.str("T1");
|
||||
b.str("Träger 25×40 (HEB 200)");
|
||||
b.pts(&[(0.0, 0.0), (4.0, 0.0), (4.0, 0.25), (0.0, 0.25)]);
|
||||
b.n(&[1.95, 0.4]);
|
||||
b.str("c1");
|
||||
b.str("Beton");
|
||||
b.ref_pset("Pset_BeamCommon", "Träger 25×40 (HEB 200)");
|
||||
b.n(&[REC_END_COLUMNS]);
|
||||
let ifc = build(&b).unwrap();
|
||||
check_structure(&ifc);
|
||||
assert_eq!(count(&ifc, "IFCBEAM"), 1);
|
||||
assert!(first_line(&ifc, "IFCBEAM").contains(".BEAM."), "{}", first_line(&ifc, "IFCBEAM"));
|
||||
assert_eq!(count(&ifc, "IFCEXTRUDEDAREASOLID"), 1);
|
||||
assert!(ifc.contains("IFCCARTESIANPOINT((0.0,0.0,1.95))"), "Unterkante des Trägers");
|
||||
assert_eq!(count(&ifc, "IFCRELASSOCIATESMATERIAL"), 1);
|
||||
// IFC2x3: IfcBeam ohne PredefinedType am Ende (wie IfcColumn).
|
||||
let mut c = mini_in(B::v2());
|
||||
c.n(&[REC_BEAM, -1.0]);
|
||||
c.str("T1");
|
||||
c.str("Träger");
|
||||
c.pts(&[(0.0, 0.0), (4.0, 0.0), (4.0, 0.25), (0.0, 0.25)]);
|
||||
c.n(&[1.95, 0.4]);
|
||||
c.n(&[-1.0, -1.0]);
|
||||
c.no_psets();
|
||||
c.n(&[REC_END_COLUMNS]);
|
||||
let ifc = build(&c).unwrap();
|
||||
assert_eq!(count(&ifc, "IFCBEAM"), 1);
|
||||
assert!(first_line(&ifc, "IFCBEAM").ends_with(",$);"), "{}", first_line(&ifc, "IFCBEAM"));
|
||||
}
|
||||
|
||||
/// [259] Dreieckssuppe → verbundenes Netz: gleiche Ecken (auf 6 Stellen) einmal, Dreieck mit doppelter Ecke fällt weg.
|
||||
#[test]
|
||||
fn netz_wird_verschweisst() {
|
||||
|
||||
@@ -58,7 +58,7 @@ function keysOfSnapshot(project: Project, snap: ViewSnapshot, out: Set<string>):
|
||||
if (r.floorId !== level || !cat(r.categoryCode)) continue;
|
||||
comps((project.roofTypes ?? []).find((t) => t.id === r.roofTypeId)?.layers);
|
||||
}
|
||||
for (const c of project.columns ?? []) {
|
||||
for (const c of [...(project.columns ?? []), ...(project.beams ?? [])]) {
|
||||
if (c.floorId !== level || !cat(c.categoryCode)) continue;
|
||||
if (c.hatchId) out.add(`hatch:${c.hatchId}`);
|
||||
if (c.componentId) out.add(`component:${c.componentId}`);
|
||||
|
||||
@@ -28,7 +28,7 @@ Ribbon-Befehle sie erreichen: `src/state/useToolInput.ts`.
|
||||
|
||||
| Gruppe | Module |
|
||||
|---|---|
|
||||
| Bauteile | `wall.ts`, `opening.ts`, `ceiling.ts`, `ceilingOpening.ts`, `roof.ts`, `roofHole.ts`, `roofWindow.ts`, `dormer.ts`, `stair.ts`, `column.ts`, `room.ts`, `grid.ts`, `tree.ts`, `terrain.ts`, `excavation.ts` |
|
||||
| Bauteile | `wall.ts`, `opening.ts`, `ceiling.ts`, `ceilingOpening.ts`, `roof.ts`, `roofHole.ts`, `roofWindow.ts`, `dormer.ts`, `stair.ts`, `column.ts`, `traeger.ts` ([280]), `room.ts`, `grid.ts`, `tree.ts`, `terrain.ts`, `excavation.ts` |
|
||||
| Körper | `solid.ts`, `solidbool.ts`, `solidToParts.ts` (Körper → Bauteile, [222]), `voidbox.ts`, `extrude.ts`, `revolve.ts`, `loft.ts` |
|
||||
| 2D zeichnen | `line.ts`, `xline.ts`, `ray.ts`, `polyline.ts`, `polygon.ts`, `rect.ts`, `circle.ts`, `arc.ts`, `ellipse.ts`, `bezier.ts`, `spline.ts`, `multiline.ts`, `revcloud.ts`, `wipeout.ts`, `block.ts`, `defblock.ts`, `libobj.ts` (Objekt aus der Bibliothek setzen, [253]) |
|
||||
| Beschriften | `text.ts`, `textbox.ts`, `textpath.ts`, `leader.ts`, `dimension.ts`, `dimround.ts`, `dimdetach.ts`, `autodim.ts`, `kote.ts`, `detailref.ts`, `pointmarker.ts`, `scalebar.ts`, `sectionline.ts` |
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
// [280] Träger/Unterzug als Engine-Befehl. Ablauf:
|
||||
// 1) „Anfang des Trägers:" → Punkt
|
||||
// 2) „Ende des Trägers:" → Punkt → commit (ein Träger, Befehl endet)
|
||||
//
|
||||
// Der Träger sitzt auf dem aktiven Geschoss, Klasse „25“ (Stützen), sonst „50“ (Tragwerk), die Oberkante bündig an der Deckenunterkante
|
||||
// (Unterzug); der Kern (`cmd_create.rs`, Befehl `beam`) legt ihn an. Optionen (IMMER sichtbar): Profil = Vorgabe aus
|
||||
// einer kurzen Liste (Rechteck-Unterzug 25/40 … oder Stahlprofil als Text mit Aussenmassen). Eine getippte Zahl setzt
|
||||
// die Querschnittshöhe (Meter) PERSISTENT über Aufrufe, die Breite bleibt die des Profils.
|
||||
//
|
||||
// Bezeichner englisch, sichtbarer Text via t().
|
||||
|
||||
import { segmentHud } from "../../tools/types";
|
||||
import type { Command, CommandContext, CommandResult, CommandState, CmdOption, ToolDraft, Vec2 } from "../types";
|
||||
import { createMutation, createPreview } from "../createCore";
|
||||
|
||||
const EPS = 1e-6;
|
||||
|
||||
/** Profil-Vorgaben: Breite × Höhe (Meter, Aussenmasse), Name nur als Text. */
|
||||
const PRESETS: { id: string; width: number; height: number; name: string }[] = [
|
||||
{ id: "rect2540", width: 0.25, height: 0.4, name: "" },
|
||||
{ id: "rect3050", width: 0.3, height: 0.5, name: "" },
|
||||
{ id: "rect2030", width: 0.2, height: 0.3, name: "" },
|
||||
{ id: "heb200", width: 0.2, height: 0.2, name: "HEB 200" },
|
||||
{ id: "heb300", width: 0.3, height: 0.3, name: "HEB 300" },
|
||||
{ id: "ipe200", width: 0.1, height: 0.2, name: "IPE 200" },
|
||||
];
|
||||
|
||||
// ── Persistente Vorgaben (modulweit, leben über Befehls-Instanzen hinweg) ─────
|
||||
const defaults: { preset: number; height: number | null } = { preset: 0, height: null };
|
||||
|
||||
const current = () => {
|
||||
const p = PRESETS[defaults.preset] ?? PRESETS[0];
|
||||
return { width: p.width, height: defaults.height ?? p.height, profileName: p.name };
|
||||
};
|
||||
|
||||
const label = () => {
|
||||
const c = current();
|
||||
const size = `${(c.width * 100).toFixed(0)}/${(c.height * 100).toFixed(0)}`;
|
||||
return c.profileName ? `${c.profileName} (${size})` : size;
|
||||
};
|
||||
|
||||
interface BeamState extends CommandState {
|
||||
phase: "start" | "end" | "done";
|
||||
a?: Vec2;
|
||||
}
|
||||
|
||||
const finish = (): [CommandState, CommandResult] => [{ phase: "done", lastPoint: null } as BeamState, { draft: null, done: true }];
|
||||
|
||||
/** Anfrage an den Kern: Achse a→b, Querschnitt und Profilname der Vorgabe. */
|
||||
const request = (a: Vec2, b: Vec2) => ({ cmd: "beam", pts: [[a.x, a.y], [b.x, b.y]], ...current() });
|
||||
|
||||
function draftTo(a: Vec2, b: Vec2, ctx: CommandContext): ToolDraft {
|
||||
const far = Math.hypot(b.x - a.x, b.y - a.y) >= EPS;
|
||||
return {
|
||||
preview: far ? createPreview(ctx, { cmd: "beam", ...current() }, [a, b]).shapes : [],
|
||||
vertices: [a],
|
||||
hud: far ? { at: b, text: `${segmentHud(a, b).length.toFixed(2)} m · ${label()}` } : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export const traegerCommand: Command = {
|
||||
name: "traeger",
|
||||
labelKey: "cmd.traeger.label",
|
||||
prompt: (s) => ((s as BeamState).phase === "end" ? "cmd.traeger.end" : "cmd.traeger.start"),
|
||||
accepts: () => ["point", "number", "option"],
|
||||
options: (): CmdOption[] => [{ id: "profile", labelKey: "cmd.traeger.profile", value: label() }],
|
||||
floorOnly: true,
|
||||
|
||||
init: (): BeamState => ({ phase: "start", lastPoint: null }),
|
||||
|
||||
onInput: (state, input, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as BeamState;
|
||||
if (s.phase === "done") return finish();
|
||||
if (input.kind === "number") {
|
||||
const v = Math.abs(input.value);
|
||||
if (v > 1e-4) defaults.height = v;
|
||||
return [s, { draft: s.a ? draftTo(s.a, s.a, ctx) : null }];
|
||||
}
|
||||
if (input.kind === "option" && input.id === "profile") {
|
||||
defaults.preset = (defaults.preset + 1) % PRESETS.length;
|
||||
defaults.height = null;
|
||||
return [s, { draft: null }];
|
||||
}
|
||||
if (input.kind !== "point") return [s, { draft: null }];
|
||||
if (s.phase === "start") {
|
||||
return [{ phase: "end", a: input.point, lastPoint: input.point } as BeamState, { draft: draftTo(input.point, input.point, ctx) }];
|
||||
}
|
||||
const a = s.a as Vec2;
|
||||
if (Math.hypot(input.point.x - a.x, input.point.y - a.y) < EPS) return [s, { draft: draftTo(a, a, ctx) }];
|
||||
return [{ phase: "done", lastPoint: null } as BeamState, { draft: null, done: true, commit: createMutation(ctx, request(a, input.point)) }];
|
||||
},
|
||||
|
||||
onMove: (state, point, _snap, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as BeamState;
|
||||
if (s.phase !== "end" || !s.a) return [s, { draft: null }];
|
||||
return [s, { draft: draftTo(s.a, point, ctx) }];
|
||||
},
|
||||
|
||||
onConfirm: (): [CommandState, CommandResult] => finish(),
|
||||
onCancel: (): [CommandState, CommandResult] => finish(),
|
||||
};
|
||||
@@ -13,6 +13,7 @@ import { ceilingCommand } from "./cmds/ceiling";
|
||||
import { openingCommand, fensterCommand, tuerCommand } from "./cmds/opening";
|
||||
import { stairCommand } from "./cmds/stair";
|
||||
import { columnCommand } from "./cmds/column";
|
||||
import { traegerCommand } from "./cmds/traeger";
|
||||
import { circlesToTreesCommand, treeCommand } from "./cmds/tree";
|
||||
import { roofCommand } from "./cmds/roof";
|
||||
import { solidCommand } from "./cmds/solid";
|
||||
@@ -93,6 +94,7 @@ export const COMMANDS: Record<string, Command> = {
|
||||
tuer: tuerCommand,
|
||||
stair: stairCommand,
|
||||
column: columnCommand,
|
||||
traeger: traegerCommand,
|
||||
tree: treeCommand,
|
||||
circlestotrees: circlesToTreesCommand,
|
||||
roof: roofCommand,
|
||||
@@ -194,6 +196,9 @@ export const ALIASES: Record<string, string> = {
|
||||
treppe: "stair",
|
||||
tp: "stair",
|
||||
stuetze: "column",
|
||||
träger: "traeger",
|
||||
unterzug: "traeger",
|
||||
beam: "traeger",
|
||||
stütze: "column",
|
||||
baum: "tree",
|
||||
kreiseinbaeume: "circlestotrees",
|
||||
|
||||
@@ -45,7 +45,7 @@ export const AI_TOOLS: AiToolDef[] = [
|
||||
name: "run_command",
|
||||
description:
|
||||
"Führt einen Kern-Befehl mit JSON-Parametern aus (dieselben wie die Befehle der Oberfläche): z. B. " +
|
||||
'{cmd:"wall", pts:[[0,0],[5,0]]}, {cmd:"room"|"ceiling"|"roof", pts:[…]}, {cmd:"column", at:[x,y]}, ' +
|
||||
'{cmd:"wall", pts:[[0,0],[5,0]]}, {cmd:"room"|"ceiling"|"roof", pts:[…]}, {cmd:"column", at:[x,y]}, {cmd:"beam", pts:[[x0,y0],[x1,y1]], width?, height?, profileName?}, ' +
|
||||
'{cmd:"opening", wall:<id>, start, end (Wandachse), pos, width, height, sill, kind:"door"|"window"}, {cmd:"rect"|"polyline"|"circle", …}, {cmd:"transform", ids, …}, ' +
|
||||
'{cmd:"align"|"distribute", ids, mode|axis}, {cmd:"split", ids}. `level` = Geschoss-id (Standard: aktives bzw. erstes).',
|
||||
inputSchema: obj({ cmd: { type: "string" }, params: { type: "object" }, level: { type: "string" } }, ["cmd"]),
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ export { EMPTY_MEMBERSHIP, containingGroupId, expandToGroups, isInsideActiveGrou
|
||||
export type { GroupMembership, MemberKind } from "../model/groups";
|
||||
export { arcApex, drawingVertices, gripPt, openEdges, polylineEdgeGrips, ringEdges } from "../geometry/grips";
|
||||
export { verticalExtents } from "../geometry/grips";
|
||||
export { cameraGripPoints } from "../geometry/grips";
|
||||
export { cameraGripPoints, beamGripPoints } from "../geometry/grips";
|
||||
export type { VerticalExtent } from "../geometry/grips";
|
||||
export type { GripRequest, RingKind } from "../geometry/grips";
|
||||
export { edgeArcToggle, type ArcRingKind } from "../geometry/grips";
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
import type {
|
||||
Camera,
|
||||
Ceiling,
|
||||
Beam,
|
||||
Column,
|
||||
Drawing2D,
|
||||
ExtrudedSolid,
|
||||
@@ -64,6 +65,8 @@ export interface ElementClipboard {
|
||||
rooms: Room[];
|
||||
extrudedSolids: ExtrudedSolid[];
|
||||
columns: Column[];
|
||||
/** [280] Träger (liegen im Auswahlkanal der Stützen; optional wie Bäume). */
|
||||
beams?: Beam[];
|
||||
/** [149] Bäume (optional: Zwischenablagen älterer Fenster haben sie nicht). */
|
||||
trees?: Tree[];
|
||||
/** [213] Kameras (optional: ältere Zwischenablagen haben sie nicht). */
|
||||
@@ -94,6 +97,7 @@ export function isClipboardEmpty(c: ElementClipboard): boolean {
|
||||
c.rooms.length === 0 &&
|
||||
c.extrudedSolids.length === 0 &&
|
||||
c.columns.length === 0 &&
|
||||
(c.beams?.length ?? 0) === 0 &&
|
||||
(c.trees?.length ?? 0) === 0 &&
|
||||
(c.cameras?.length ?? 0) === 0
|
||||
);
|
||||
@@ -134,6 +138,7 @@ export function collectElementClipboard(
|
||||
const extrudedSolids = (project.extrudedSolids ?? []).filter((s) => extrudedSolidIds.has(s.id));
|
||||
const columnIds = new Set(sel.columnIds);
|
||||
const columns = (project.columns ?? []).filter((c) => columnIds.has(c.id));
|
||||
const beams = (project.beams ?? []).filter((b) => columnIds.has(b.id));
|
||||
const treeIds = new Set(sel.treeIds ?? []);
|
||||
const trees = (project.trees ?? []).filter((t) => treeIds.has(t.id));
|
||||
const cameraIds = new Set(sel.cameraIds ?? []);
|
||||
@@ -149,6 +154,7 @@ export function collectElementClipboard(
|
||||
rooms: rooms.map((r) => structuredClone(r)),
|
||||
extrudedSolids: extrudedSolids.map((s) => structuredClone(s)),
|
||||
columns: columns.map((c) => structuredClone(c)),
|
||||
beams: beams.map((b) => structuredClone(b)),
|
||||
trees: trees.map((t) => structuredClone(t)),
|
||||
cameras: cameras.map((c) => structuredClone(c)),
|
||||
};
|
||||
@@ -181,6 +187,7 @@ const PASTED_KEY: Record<string, keyof PastedIds> = {
|
||||
rooms: "roomIds",
|
||||
extrudedSolids: "extrudedSolidIds",
|
||||
columns: "columnIds",
|
||||
beams: "columnIds",
|
||||
trees: "treeIds",
|
||||
cameras: "cameraIds",
|
||||
};
|
||||
|
||||
@@ -18,7 +18,8 @@ export type ScheduleKind =
|
||||
| "Treppe"
|
||||
| "Extrusion"
|
||||
| "Dach"
|
||||
| "Stütze";
|
||||
| "Stütze"
|
||||
| "Träger";
|
||||
|
||||
/** Eine ausgewertete Zeile der Bauteilliste (je Bauteil-Vorkommen ein Datensatz). */
|
||||
export interface ScheduleRow {
|
||||
|
||||
@@ -48,6 +48,7 @@ export type GripRequest =
|
||||
| { op: "sectionBendInsert"; id: string; seg: number; pt: P }
|
||||
// [213] Kamera: 0 = Standpunkt, 1 = Ziel, 2 = Bildwinkel bzw. Sichtbreite (Kern `camera::grip_edit`); `cameraBy` verschiebt Standpunkt und Ziel.
|
||||
| { op: "cameraGrip"; id: string; index: number; pt: P }
|
||||
| { op: "beamGrip"; id: string; index: number; pt: P }
|
||||
| { op: "cameraBy"; id: string; delta: P }
|
||||
| { op: "sectionBendDelete"; id: string; index: number }
|
||||
| { op: "sectionLineTidy"; id: string; tol?: number }
|
||||
@@ -111,6 +112,11 @@ export function cameraGripPoints(c: Camera, scaleDenominator: number = DEFAULT_S
|
||||
return out;
|
||||
}
|
||||
|
||||
/** [280] Griffe eines Trägers im Grundriss: Anfang, Ende, Mitte (verschiebt den ganzen Träger). */
|
||||
export function beamGripPoints(b: { start: Vec2; end: Vec2 }): Vec2[] {
|
||||
return [b.start, b.end, { x: (b.start.x + b.end.x) / 2, y: (b.start.y + b.end.y) / 2 }];
|
||||
}
|
||||
|
||||
type Owner = { drawingId?: string; wallId?: string };
|
||||
|
||||
function flat(verts: readonly Vec2[]): Float64Array {
|
||||
|
||||
@@ -617,6 +617,15 @@ export const de = {
|
||||
"objinfo.column.height": "Höhe",
|
||||
"objinfo.column.rotation": "Drehung (°)",
|
||||
"objinfo.column.floor": "Geschoss",
|
||||
"objinfo.beam.section": "Träger",
|
||||
"objinfo.beam.profileName": "Profil",
|
||||
"objinfo.beam.profileName.placeholder": "z. B. HEB 200",
|
||||
"objinfo.beam.width": "Breite",
|
||||
"objinfo.beam.height": "Höhe",
|
||||
"objinfo.beam.topOffset": "OK-Versatz zur Decke",
|
||||
"objinfo.beam.length": "Länge",
|
||||
"objinfo.beam.level": "UK – OK",
|
||||
"objinfo.beam.floor": "Geschoss",
|
||||
// ── Wand-Attribute (Object-Info-Panel) ──────────────────────────────────
|
||||
"objinfo.wall.section": "Wand",
|
||||
"objinfo.wall.refLine": "Referenzlinie",
|
||||
@@ -2278,6 +2287,10 @@ export const de = {
|
||||
"cmd.column.label": "Stütze",
|
||||
"cmd.column.place": "Stütze setzen:",
|
||||
"cmd.column.profile": "Profil",
|
||||
"cmd.traeger.label": "Träger",
|
||||
"cmd.traeger.start": "Anfang des Trägers:",
|
||||
"cmd.traeger.end": "Ende des Trägers (Zahl = Höhe):",
|
||||
"cmd.traeger.profile": "Profil",
|
||||
"cmd.stair.label": "Treppe",
|
||||
"cmd.stair.start": "Startpunkt der Treppe:",
|
||||
"cmd.stair.run": "Laufrichtung / Ende ( Grundform · Auf/Ab ):",
|
||||
@@ -3598,6 +3611,7 @@ export const de = {
|
||||
"elements.kind.extrusion": "Extrusion",
|
||||
"elements.kind.roof": "Dach",
|
||||
"elements.kind.column": "Stütze",
|
||||
"elements.kind.beam": "Träger",
|
||||
|
||||
// Ausschnitte / View-Snapshots (DOSSIER A2).
|
||||
"viewsnap.title": "Ausschnitte",
|
||||
@@ -3929,6 +3943,7 @@ export const de = {
|
||||
"history.cmd.chamfer": "Fase",
|
||||
"history.cmd.circle": "Kreis zeichnen",
|
||||
"history.cmd.column": "Stütze zeichnen",
|
||||
"history.cmd.traeger": "Träger zeichnen",
|
||||
"history.cmd.defblock": "Block definieren",
|
||||
"history.cmd.detailref": "Detailverweis",
|
||||
"history.cmd.dimension": "Bemassung",
|
||||
@@ -3986,6 +4001,7 @@ export const de = {
|
||||
"history.coll.rooms": "Raum",
|
||||
"history.coll.drawings2d": "2D-Element",
|
||||
"history.coll.columns": "Stütze",
|
||||
"history.coll.beams": "Träger",
|
||||
"history.coll.extrudedSolids": "Körper",
|
||||
"history.coll.groups": "Gruppe",
|
||||
"history.coll.layers": "Ebene",
|
||||
|
||||
@@ -615,6 +615,15 @@ export const en: Record<TranslationKey, string> = {
|
||||
"objinfo.column.height": "Height",
|
||||
"objinfo.column.rotation": "Rotation (°)",
|
||||
"objinfo.column.floor": "Floor",
|
||||
"objinfo.beam.section": "Beam",
|
||||
"objinfo.beam.profileName": "Profile",
|
||||
"objinfo.beam.profileName.placeholder": "e.g. HEB 200",
|
||||
"objinfo.beam.width": "Width",
|
||||
"objinfo.beam.height": "Height",
|
||||
"objinfo.beam.topOffset": "Top offset to slab",
|
||||
"objinfo.beam.length": "Length",
|
||||
"objinfo.beam.level": "Bottom – top",
|
||||
"objinfo.beam.floor": "Storey",
|
||||
// ── Wall attributes (object info panel) ──────────────────────────────────
|
||||
"objinfo.wall.section": "Wall",
|
||||
"objinfo.wall.refLine": "Reference line",
|
||||
@@ -2267,6 +2276,10 @@ export const en: Record<TranslationKey, string> = {
|
||||
"cmd.column.label": "Column",
|
||||
"cmd.column.place": "Place column:",
|
||||
"cmd.column.profile": "Profile",
|
||||
"cmd.traeger.label": "Beam",
|
||||
"cmd.traeger.start": "Start of beam:",
|
||||
"cmd.traeger.end": "End of beam (number = height):",
|
||||
"cmd.traeger.profile": "Profile",
|
||||
"cmd.stair.label": "Stair",
|
||||
"cmd.stair.start": "Start point of the stair:",
|
||||
"cmd.stair.run": "Run direction / end ( Shape · Up/Down ):",
|
||||
@@ -3585,6 +3598,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"elements.kind.extrusion": "Extrusion",
|
||||
"elements.kind.roof": "Roof",
|
||||
"elements.kind.column": "Column",
|
||||
"elements.kind.beam": "Beam",
|
||||
|
||||
// Views / view snapshots (DOSSIER A2).
|
||||
"viewsnap.title": "Views",
|
||||
@@ -3915,6 +3929,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"history.cmd.chamfer": "Chamfer",
|
||||
"history.cmd.circle": "Draw circle",
|
||||
"history.cmd.column": "Draw column",
|
||||
"history.cmd.traeger": "Draw beam",
|
||||
"history.cmd.defblock": "Define block",
|
||||
"history.cmd.detailref": "Detail reference",
|
||||
"history.cmd.dimension": "Dimension",
|
||||
@@ -3972,6 +3987,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"history.coll.rooms": "room",
|
||||
"history.coll.drawings2d": "2D element",
|
||||
"history.coll.columns": "column",
|
||||
"history.coll.beams": "beam",
|
||||
"history.coll.extrudedSolids": "solid",
|
||||
"history.coll.groups": "group",
|
||||
"history.coll.layers": "layer",
|
||||
|
||||
+4
-1
@@ -59,6 +59,7 @@ export function buildGuidIndex(project: Project): Map<string, Target> {
|
||||
for (const c of project.ceilings ?? []) add("slab", "ceilingIds", c.id, c.ifcGlobalId);
|
||||
for (const r of project.roofs ?? []) add("roof", "roofIds", r.id, r.ifcGlobalId);
|
||||
for (const c of project.columns ?? []) add("column", "columnIds", c.id, c.ifcGlobalId);
|
||||
for (const b of project.beams ?? []) add("beam", "columnIds", b.id, b.ifcGlobalId);
|
||||
for (const s of project.stairs ?? []) add("stair", "stairIds", s.id, s.ifcGlobalId);
|
||||
for (const e of project.extrudedSolids ?? []) add("extrusion", "extrudedSolidIds", e.id, e.ifcGlobalId);
|
||||
for (const r of project.rooms ?? []) add("space", "roomIds", r.id, r.ifcGlobalId);
|
||||
@@ -106,7 +107,9 @@ export function selectionToGuids(project: Project, sel: BcfSelection): string[]
|
||||
g("wall", sel.wallIds, project.walls);
|
||||
g("slab", sel.ceilingIds, project.ceilings);
|
||||
g("roof", sel.roofIds, project.roofs);
|
||||
g("column", sel.columnIds, project.columns);
|
||||
const isBeam = (id: string) => (project.beams ?? []).some((b) => b.id === id);
|
||||
g("column", sel.columnIds.filter((id) => !isBeam(id)), project.columns);
|
||||
g("beam", sel.columnIds.filter(isBeam), project.beams); // [280]
|
||||
g("stair", sel.stairIds, project.stairs);
|
||||
g("extrusion", sel.extrudedSolidIds, project.extrudedSolids);
|
||||
g("space", sel.roomIds, project.rooms);
|
||||
|
||||
@@ -8,7 +8,7 @@ import { patchItem, setField } from "../core/opsBuild";
|
||||
import type { DesignOption, DesignOptionCombination, DesignOptionRef, DesignOptionSet, DrawingLevel, Project } from "./types";
|
||||
|
||||
/** Listen, deren Elemente einer Variante angehören können (gleich wie `design_options::COLLECTIONS`). */
|
||||
export const DESIGN_OPTION_COLLECTIONS = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "extrudedSolids", "rooms", "drawings2d"] as const;
|
||||
export const DESIGN_OPTION_COLLECTIONS = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "beams", "extrudedSolids", "rooms", "drawings2d"] as const;
|
||||
export type DesignOptionCollection = (typeof DESIGN_OPTION_COLLECTIONS)[number];
|
||||
|
||||
/** Kombination: Satz-Id → Varianten-Id. */
|
||||
@@ -523,7 +523,10 @@ export function designOptionLocked(project: Project, edit: DesignOptionTarget |
|
||||
if (OUTSIDE_KINDS.has(kind)) return true;
|
||||
const coll = KIND_COLLECTION[kind];
|
||||
if (!coll) return false;
|
||||
const e = ((project[coll] ?? []) as { id: string; designOption?: DesignOptionRef; hostWallId?: string }[]).find((x) => x.id === id);
|
||||
type El = { id: string; designOption?: DesignOptionRef; hostWallId?: string };
|
||||
// [280] Träger liegen im Auswahlkanal der Stützen.
|
||||
const pool = ((project[coll] ?? []) as El[]).concat(coll === "columns" ? ((project.beams ?? []) as El[]) : []);
|
||||
const e = pool.find((x) => x.id === id);
|
||||
if (!e) return false;
|
||||
const r = e.designOption ?? (coll === "openings" ? project.walls.find((w) => w.id === e.hostWallId)?.designOption : undefined);
|
||||
return !(r && r.set === edit.set && r.option === edit.option);
|
||||
|
||||
@@ -16,7 +16,7 @@ export const RENOVATION_STATUSES: readonly RenovationStatus[] = ["existing", "de
|
||||
* Listen mit Umbau-Status (Räume nur Sichtbarkeit/Flächen, keine Farbe). `drawings2d`: Möbel und Symbole der Bibliothek
|
||||
* (ohne Angabe = Bestand) sowie 2D-Elemente mit ausdrücklichem Status (Linienwerk, Masse …; Kern `drawing_takes_part`).
|
||||
*/
|
||||
export const RENOVATION_COLLECTIONS = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "extrudedSolids", "rooms", "drawings2d"] as const;
|
||||
export const RENOVATION_COLLECTIONS = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "beams", "extrudedSolids", "rooms", "drawings2d"] as const;
|
||||
export type RenovationCollection = (typeof RENOVATION_COLLECTIONS)[number];
|
||||
|
||||
/**
|
||||
@@ -270,6 +270,7 @@ const SELECTION_KEY: Record<RenovationCollection, string> = {
|
||||
roofs: "roofs",
|
||||
stairs: "stairs",
|
||||
columns: "columns",
|
||||
beams: "columns", // [280] Träger liegen im Auswahlkanal der Stützen
|
||||
extrudedSolids: "solids",
|
||||
rooms: "rooms",
|
||||
drawings2d: "drawings",
|
||||
@@ -299,7 +300,7 @@ export function idsByRenovationStatus(
|
||||
if (opts.phase !== undefined && (r?.phase ?? "") !== opts.phase) continue;
|
||||
ids.push(e.id);
|
||||
}
|
||||
if (ids.length) out[SELECTION_KEY[c]] = ids;
|
||||
if (ids.length) out[SELECTION_KEY[c]] = [...(out[SELECTION_KEY[c]] ?? []), ...ids];
|
||||
}
|
||||
const trees = (project.trees ?? []).filter((t) => treeRenovationStatus(t) === status && (!opts.floorId || t.floorId === opts.floorId) && (opts.phase === undefined || opts.phase === "")).map((t) => t.id);
|
||||
if (trees.length) out.trees = trees;
|
||||
|
||||
@@ -504,6 +504,12 @@ const columns: NonNullable<Project["columns"]> = [
|
||||
{ id: "st-ug-1", type: "column", floorId: "ug", categoryCode: "25", position: P(10.0, 2.6), profile: { kind: "round", radius: 0.15 }, rotation: 0, height: H.ug, componentId: "std-c-stahlbeton" },
|
||||
];
|
||||
|
||||
// [280] Unterzug im EG-Wohnraum (Spannweite 6 m, Wand x = 0 bis Wand x = 6): 30 × 45 cm, Oberkante bündig an der
|
||||
// Deckenunterkante des EG, Stahlbeton; im Schnitt A-A quer geschnitten, im Grundriss über der Schnitthöhe gestrichelt.
|
||||
const beams: NonNullable<Project["beams"]> = [
|
||||
{ id: "tg-eg-1", type: "beam", floorId: "eg", categoryCode: "25", start: P(HA, 2.5), end: P(6 - 0.075, 2.5), width: 0.3, height: 0.45, profileName: "Unterzug 30/45", componentId: "std-c-stahlbeton" },
|
||||
];
|
||||
|
||||
/** [269] Klasse der Umgebungs-Körper (Brunnen, Pflanzgefäss, Sitzrolle): Objektbibliothek-Klasse „Fahrzeuge & Freiflächen". */
|
||||
const GARDEN_CLASS = "24";
|
||||
|
||||
@@ -870,6 +876,7 @@ export function buildComplexSampleProject(): Project {
|
||||
stairs,
|
||||
rooms: [],
|
||||
columns,
|
||||
beams,
|
||||
extrudedSolids,
|
||||
drawings2d: [...cadastre(), ...annotations()],
|
||||
context: [
|
||||
|
||||
@@ -27,6 +27,97 @@ export type Align = "left" | "center" | "right" | "justify";
|
||||
*/
|
||||
export type AttributeSource = "layer" | "object";
|
||||
|
||||
/**
|
||||
* [280] Ein Träger/Unterzug (Beam) — geschossgebundenes Tragwerk-Bauteil (Kategorie „50"): Achse
|
||||
* `start` → `end` im Grundriss, rechteckiger Querschnitt `width` × `height` (Aussenmasse; `profileName`
|
||||
* ist nur ein Text wie „HEB 200", gezeichnet wird das Rechteck). Oberkante = Unterkante der Decke darüber
|
||||
* (höchstens die Geschoss-Oberkante) plus `topOffset`; bündig (0) ⇒ Unterzug. Wird wie eine Stütze
|
||||
* ausgewertet (`Beam::as_column`), liegt aber in `Project.beams`; im Auswahlkanal der Stützen.
|
||||
*/
|
||||
export type Beam = {
|
||||
id: string;
|
||||
type: "beam";
|
||||
/** Zugehörige Zeichnungsebene (Geschoss). */
|
||||
floorId: string;
|
||||
/** Grafik-Kategorie (Ebene), z. B. "50" für Tragwerk. */
|
||||
categoryCode: string;
|
||||
/**
|
||||
* [201] IFC-GlobalId des Quell-Bauteils (IFC-Import); der IFC-Export schreibt sie zurück, damit
|
||||
* die Rundreise dieselben GUIDs behält. Kopien (Einfügen, Kopieren, Reihe, Wand teilen) tragen sie NICHT.
|
||||
*/
|
||||
ifcGlobalId?: string;
|
||||
/** Objekt-Sperre, analog `Wall.locked`. */
|
||||
locked?: boolean;
|
||||
/** Achse: Anfangspunkt im Grundriss (Meter). */
|
||||
start: Vec2;
|
||||
/** Achse: Endpunkt im Grundriss (Meter). */
|
||||
end: Vec2;
|
||||
/** Querschnittsbreite (quer zur Achse, Meter, > 0). */
|
||||
width: number;
|
||||
/** Querschnittshöhe (Meter, > 0), nach unten ab der Oberkante. */
|
||||
height: number;
|
||||
/**
|
||||
* Profilname als Text (z. B. „HEB 200", „BSH 20/40"); ohne Wirkung auf die Geometrie, geht in Liste und IFC.
|
||||
*/
|
||||
profileName?: string;
|
||||
/**
|
||||
* Versatz der Oberkante gegenüber der Unterkante der Decke darüber (Meter, + nach oben in die Decke).
|
||||
* Fehlt ⇒ 0: bündig, Unterzug.
|
||||
*/
|
||||
topOffset?: number;
|
||||
/** Optionales tragendes Bauteil (Component) für Poché/3D-Farbe/Schraffur. */
|
||||
componentId?: string;
|
||||
/**
|
||||
* Optionale Übersteuerung der Strich-/Umrandungsfarbe; sonst gilt die
|
||||
* Kategorie-Farbe.
|
||||
*/
|
||||
color?: string;
|
||||
/** Stift-Kopplung von `color` (s. `Component.colorPenId`-Doku). */
|
||||
colorPenId?: string;
|
||||
/**
|
||||
* Attribut-Override der Muster-/Schraffurfarbe (Vordergrund) DIESER Stütze.
|
||||
* `undefined` = „Nach System" (erben → Component.foreground), analog `Wall.
|
||||
* foreground`.
|
||||
*/
|
||||
foreground?: string;
|
||||
/**
|
||||
* Attribut-Override der Füllfarbe (Hintergrund/Poché) DIESER Stütze.
|
||||
* `undefined` = „Nach System" (neutrale SIA-Poché HATCH_INK/HATCH_PAPER je
|
||||
* nach Schraffur-Muster), analog `Wall.background`.
|
||||
*/
|
||||
background?: string;
|
||||
/** Stift-Kopplung von `foreground` (s. `Component.foregroundPenId`-Doku). */
|
||||
foregroundPenId?: string;
|
||||
/** Stift-Kopplung von `background`, analog {@link Wall.foregroundPenId}. */
|
||||
backgroundPenId?: string;
|
||||
/**
|
||||
* Attribut-Override der Strichstärke (mm Papier) DIESER Stütze. `undefined`
|
||||
* = „Nach System" (erben → `strokeWeightSource`), analog `Wall.strokeWeight`.
|
||||
*/
|
||||
strokeWeight?: number;
|
||||
/**
|
||||
* Attribut-Override der Schnitt-Schraffur (Hatch Manager) DIESER Stütze.
|
||||
* `undefined` = „Nach System" (erben → `hatchSource`), analog `Wall.hatchId`.
|
||||
*/
|
||||
hatchId?: string;
|
||||
/**
|
||||
* Quelle des Vordergrunds, wenn kein explizites `foreground` gesetzt ist — analog `Wall.foregroundSource`.
|
||||
*/
|
||||
foregroundSource?: AttributeSource;
|
||||
/** Quelle des Hintergrunds, analog {@link Beam.foregroundSource}. */
|
||||
backgroundSource?: AttributeSource;
|
||||
/** Quelle der Strichstärke, analog {@link Beam.foregroundSource}. */
|
||||
strokeWeightSource?: AttributeSource;
|
||||
/** Quelle der Schraffur, analog {@link Beam.foregroundSource}. */
|
||||
hatchSource?: AttributeSource;
|
||||
/** [271] Umbau: Status (Bestand, Abbruch, Neu) und Etappe. Fehlt ⇒ Bestand. */
|
||||
renovation?: Renovation;
|
||||
/**
|
||||
* [272] Variante, zu der das Element gehört (`Project.designOptionSets`). Fehlt ⇒ Hauptmodell (immer sichtbar).
|
||||
*/
|
||||
designOption?: DesignOptionRef;
|
||||
};
|
||||
|
||||
/**
|
||||
* Wiederverwendbares 2D-Symbol (Möbelblock, Sanitär-/Normsymbol, Nordpfeil
|
||||
* u. Ä.) — s. `Project.blockDefs` + `Drawing2DGeom["block"]`. `geom2d` ist
|
||||
@@ -3247,6 +3338,8 @@ export type Project = {
|
||||
* Projekte/Tests ohne `columns` gültig bleiben (Default: leer behandeln).
|
||||
*/
|
||||
columns?: Array<Column>;
|
||||
/** [280] Träger/Unterzüge, siehe {@link Beam}. Optional wie `columns`. */
|
||||
beams?: Array<Beam>;
|
||||
/**
|
||||
* Bäume ([149]) — eigene Objekte mit Stamm, Krone und Höhe, siehe {@link Tree}. Optional, damit
|
||||
* bestehende Projekte ohne `trees` gültig bleiben (Default: leer behandeln).
|
||||
|
||||
@@ -34,6 +34,7 @@ const CLASS_ORDER: Exclude<ScheduleKind, "Tür">[] = [
|
||||
"Decke",
|
||||
"Dach",
|
||||
"Stütze",
|
||||
"Träger",
|
||||
"Fenster",
|
||||
"Öffnung",
|
||||
"Treppe",
|
||||
@@ -46,6 +47,7 @@ const CLASS_LABEL_KEY: Record<Exclude<ScheduleKind, "Tür">, string> = {
|
||||
Decke: "elements.kind.ceiling",
|
||||
Dach: "elements.kind.roof",
|
||||
Stütze: "elements.kind.column",
|
||||
Träger: "elements.kind.beam",
|
||||
Fenster: "elements.kind.window",
|
||||
Öffnung: "elements.kind.opening",
|
||||
Treppe: "elements.kind.stair",
|
||||
|
||||
@@ -41,7 +41,7 @@ function parseNum(text: string): number | null {
|
||||
|
||||
/** [271] Trägt ein Bauteil oder Raum einen Umbau-Status (sonst bleibt die Wahl „Zustand“ verborgen)? */
|
||||
function hasRenovation(p: Project): boolean {
|
||||
const lists = [p.walls, p.openings, p.ceilings, p.roofs, p.stairs, p.columns, p.extrudedSolids, p.rooms] as Array<readonly { renovation?: unknown }[] | undefined>;
|
||||
const lists = [p.walls, p.openings, p.ceilings, p.roofs, p.stairs, p.columns, p.beams, p.extrudedSolids, p.rooms] as Array<readonly { renovation?: unknown }[] | undefined>;
|
||||
return lists.some((l) => (l ?? []).some((e) => e.renovation !== undefined));
|
||||
}
|
||||
|
||||
|
||||
@@ -379,7 +379,7 @@ const TOOLS_2D: ToolId[] = [
|
||||
"image",
|
||||
];
|
||||
const TOOLS_3D: ToolId[] = ["wall", "ceiling", "window", "door", "stair", "room"];
|
||||
const COMMANDS_3D = ["column", "tree", "circlestotrees", "ceilingopening", "roof", "roofhole", "roofwindow", "dormer", "extrude", "revolve", "loft", "solid", "solidbool", "solidtoparts", "sectionline", "viewline", "ansichten", "autodim", "excavation"];
|
||||
const COMMANDS_3D = ["column", "traeger", "tree", "circlestotrees", "ceilingopening", "roof", "roofhole", "roofwindow", "dormer", "extrude", "revolve", "loft", "solid", "solidbool", "solidtoparts", "sectionline", "viewline", "ansichten", "autodim", "excavation"];
|
||||
const COMMANDS_EDIT = ["move", "copy", "array", "rotate", "mirror", "offset", "multiline", "trim", "break", "split", "extend", "fillet", "chamfer", "join", "defblock", "measure", "erkennen"];
|
||||
|
||||
type ToolsView = "list" | "icons";
|
||||
|
||||
@@ -607,6 +607,11 @@ export interface PanelHostValue {
|
||||
onSetColumnRadius: (radius: number) => void;
|
||||
/** Setzt die Höhe der Stütze (Meter, > 0). */
|
||||
onSetColumnHeight: (height: number) => void;
|
||||
/** [280] Träger: Querschnitt, Profilname und Oberkanten-Versatz (nur bei selektiertem Träger). */
|
||||
onSetBeamWidth: (width: number) => void;
|
||||
onSetBeamHeight: (height: number) => void;
|
||||
onSetBeamTopOffset: (offset: number) => void;
|
||||
onSetBeamProfileName: (name: string) => void;
|
||||
/** Setzt die Drehung der Stütze (Grad; intern in Radiant gespeichert). */
|
||||
onSetColumnRotation: (deg: number) => void;
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// [280] Träger-Abschnitt der Objekt-Info: Querschnitt (Breite × Höhe), Profilname (nur Text), Versatz der Oberkante
|
||||
// gegenüber der Deckenunterkante (0 = bündig, Unterzug); Länge, Geschoss und aufgelöste UK/OK nur zur Auskunft.
|
||||
|
||||
import { t } from "../../i18n";
|
||||
import type { BeamInfo } from "../../state/selectionInfo";
|
||||
import { usePanelHost } from "../host";
|
||||
import { DimensionField } from "./fields";
|
||||
|
||||
export function BeamSection({ beam, host }: { beam: BeamInfo; host: ReturnType<typeof usePanelHost> }) {
|
||||
return (
|
||||
<>
|
||||
<div className="objinfo-sep" />
|
||||
<div className="objinfo-section-label">{t("objinfo.beam.section")}</div>
|
||||
|
||||
<label className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("objinfo.beam.profileName")}</span>
|
||||
<input
|
||||
key={beam.profileName ?? ""}
|
||||
type="text"
|
||||
className="objinfo-text"
|
||||
defaultValue={beam.profileName ?? ""}
|
||||
placeholder={t("objinfo.beam.profileName.placeholder")}
|
||||
onBlur={(e) => {
|
||||
if (e.target.value.trim() !== (beam.profileName ?? "")) host.onSetBeamProfileName(e.target.value);
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") (e.target as HTMLInputElement).blur();
|
||||
}}
|
||||
title={t("objinfo.beam.profileName")}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<DimensionField label={t("objinfo.beam.width")} value={beam.width} onCommit={(v) => host.onSetBeamWidth(v)} />
|
||||
<DimensionField label={t("objinfo.beam.height")} value={beam.height} onCommit={(v) => host.onSetBeamHeight(v)} />
|
||||
<DimensionField label={t("objinfo.beam.topOffset")} value={beam.topOffset} onCommit={(v) => host.onSetBeamTopOffset(v)} />
|
||||
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("objinfo.beam.length")}</span>
|
||||
<span className="objinfo-fval">{beam.length.toFixed(2)} m</span>
|
||||
</div>
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("objinfo.beam.level")}</span>
|
||||
<span className="objinfo-fval">
|
||||
{beam.zBottom.toFixed(2)} – {beam.zTop.toFixed(2)} m
|
||||
</span>
|
||||
</div>
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("objinfo.beam.floor")}</span>
|
||||
<span className="objinfo-fval">{beam.floorName}</span>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import { RoomSection } from "./RoomSection";
|
||||
import { RoomStampSection } from "./RoomStampSection";
|
||||
import { SectionLineSection } from "./SectionLineSection";
|
||||
import { ColumnSection, ExtrudedSolidSection } from "./SolidSections";
|
||||
import { BeamSection } from "./BeamSection";
|
||||
import { StairSection } from "./StairSection";
|
||||
import { WallSection } from "./WallSection";
|
||||
import { infoGroups, type InfoGroupId } from "./groups";
|
||||
@@ -54,6 +55,7 @@ export function InfoGroups({ sel, drawing, host }: { sel: SelectionInfo | null;
|
||||
case "roomStamp": return sel?.room ? <RoomStampSection roomId={sel.id} /> : null;
|
||||
case "extrudedSolid": return sel?.extrudedSolid ? <ExtrudedSolidSection solid={sel.extrudedSolid} host={host} /> : null;
|
||||
case "column": return sel?.column ? <ColumnSection column={sel.column} host={host} /> : null;
|
||||
case "beam": return sel?.beam ? <BeamSection beam={sel.beam} host={host} /> : null;
|
||||
case "detailRef": return sel?.detailRef ? <DetailRefSection detailRef={sel.detailRef} drawingId={sel.id} host={host} /> : null;
|
||||
case "dimRefs": return sel?.dimRefs ? <DimRefsSection refs={sel.dimRefs} drawingId={sel.id} host={host} /> : null;
|
||||
case "dimText": return sel ? <DimTextSection drawingId={sel.id} host={host} /> : null;
|
||||
|
||||
@@ -21,6 +21,7 @@ export type InfoGroupId =
|
||||
| "roomStamp"
|
||||
| "extrudedSolid"
|
||||
| "column"
|
||||
| "beam"
|
||||
| "detailRef"
|
||||
| "dimRefs"
|
||||
| "dimText"
|
||||
@@ -45,6 +46,7 @@ export const INFO_GROUP_TITLE: Record<InfoGroupId, TranslationKey> = {
|
||||
roomStamp: "roomStamp.title",
|
||||
extrudedSolid: "objinfo.extrudedSolid.section",
|
||||
column: "objinfo.column.section",
|
||||
beam: "objinfo.beam.section",
|
||||
detailRef: "objinfo.detailRef.section",
|
||||
dimRefs: "objinfo.dimRefs.section",
|
||||
dimText: "objinfo.dimText.section",
|
||||
@@ -89,6 +91,7 @@ export function infoGroups(c: InfoGroupContext): InfoGroupId[] {
|
||||
if (sel.room) out.push("room", "roomStamp");
|
||||
if (sel.extrudedSolid) out.push("extrudedSolid");
|
||||
if (sel.column) out.push("column");
|
||||
if (sel.beam) out.push("beam");
|
||||
if (sel.detailRef) out.push("detailRef");
|
||||
if (sel.dimRefs) out.push("dimRefs");
|
||||
if (sel.dimTextMoved) out.push("dimText");
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
viewBox -31.5 0 93 18.478
|
||||
bytes 179206
|
||||
bytes 179502
|
||||
circle 4
|
||||
g 1
|
||||
line 259
|
||||
line 261
|
||||
path 4
|
||||
polygon 982
|
||||
polygon 983
|
||||
polyline 123
|
||||
rect 1
|
||||
svg 1
|
||||
text 4
|
||||
hash 336574edc432bcfb
|
||||
hash 61214d28614f8dcb
|
||||
@@ -1,5 +1,5 @@
|
||||
meshes [1175]
|
||||
meshes[].color [3] x1175
|
||||
meshes [1176]
|
||||
meshes[].color [3] x1176
|
||||
meshes[].indices [1056]
|
||||
meshes[].indices [108] x6
|
||||
meshes[].indices [1140]
|
||||
@@ -35,7 +35,7 @@ meshes[].indices [300] x3
|
||||
meshes[].indices [31104]
|
||||
meshes[].indices [312]
|
||||
meshes[].indices [348] x6
|
||||
meshes[].indices [36] x1012
|
||||
meshes[].indices [36] x1013
|
||||
meshes[].indices [396]
|
||||
meshes[].indices [4092]
|
||||
meshes[].indices [4812] x2
|
||||
@@ -83,7 +83,7 @@ meshes[].positions [234]
|
||||
meshes[].positions [2412] x2
|
||||
meshes[].positions [2430] x3
|
||||
meshes[].positions [2436]
|
||||
meshes[].positions [24] x980
|
||||
meshes[].positions [24] x981
|
||||
meshes[].positions [252] x2
|
||||
meshes[].positions [2580]
|
||||
meshes[].positions [2583]
|
||||
@@ -150,4 +150,4 @@ walls[].start [2] x439
|
||||
walls[].startCut [4] x270
|
||||
walls[].topDrop [2] x22
|
||||
walls[].topPlane [3] x22
|
||||
hash 91dcb660a771029a
|
||||
hash 51132759a706b1b1
|
||||
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* [280] Träger/Unterzug: Befehl `traeger` (zwei Punkte → ein Träger), Grundriss (gestrichelt, Achse), 3D (Prisma),
|
||||
* Objekt-Info, Griff, Löschen über den Auswahlkanal der Stützen, Beispielprojekt „Musterhaus komplex“.
|
||||
* (Höhenlage, Schnitt längs/quer: Rust-Tests `beam_tests.rs`.)
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { generatePlan } from "./generatePlan";
|
||||
import { projectToModel3d } from "./toWalls3d";
|
||||
import { traegerCommand } from "../commands/cmds/traeger";
|
||||
import type { CommandContext } from "../commands/types";
|
||||
import { deriveSelection } from "../state/selectionInfo";
|
||||
import { buildComplexSampleProject } from "../model/sampleProjectComplex";
|
||||
import { applyOps } from "../core";
|
||||
import { lockOps } from "../state/objectLock";
|
||||
import { beamGripPoints } from "../core";
|
||||
import type { Beam, Project } from "../model/types";
|
||||
|
||||
const beam: Beam = { id: "B1", type: "beam", floorId: "eg", categoryCode: "50", start: { x: 1, y: 2 }, end: { x: 5, y: 2 }, width: 0.25, height: 0.4 };
|
||||
|
||||
function project(beams: Beam[]): Project {
|
||||
return {
|
||||
id: "t",
|
||||
name: "T",
|
||||
lineStyles: [{ id: "thin", name: "d", weight: 0.13, color: "#111", dash: null }],
|
||||
hatches: [{ id: "none", name: "Ohne", pattern: "none", scale: 1, angle: 0, color: "#111" }],
|
||||
components: [{ id: "a", name: "A", color: "#c8c8cc", hatchId: "none", joinPriority: 10 }],
|
||||
wallTypes: [{ id: "aw", name: "AW", layers: [{ componentId: "a", thickness: 0.3 }] }],
|
||||
drawingLevels: [{ id: "eg", name: "EG", kind: "floor", visible: true, locked: false, floorHeight: 2.6, cutHeight: 1.0, baseElevation: 0 }],
|
||||
layers: [{ code: "50", name: "Tragwerk", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }],
|
||||
walls: [],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
stairs: [],
|
||||
rooms: [],
|
||||
beams,
|
||||
drawings2d: [],
|
||||
context: [],
|
||||
};
|
||||
}
|
||||
|
||||
describe("Träger — Grundriss, 3D, Objekt-Info", () => {
|
||||
it("Grundriss: über der Schnitthöhe, Kanten gestrichelt und Achse als Linie", () => {
|
||||
const plan = generatePlan(project([beam]), "eg", new Set(["50"]));
|
||||
const prims = plan.primitives;
|
||||
expect(prims.some((p) => p.kind === "polygon" && p.columnId === "B1")).toBe(true);
|
||||
const dashed = prims.filter((p) => p.kind === "line" && p.dash && p.cls !== "beam-axis");
|
||||
expect(dashed.length).toBe(4);
|
||||
expect(prims.filter((p) => p.kind === "line" && p.cls === "beam-axis").length).toBe(1);
|
||||
// Klasse aus: nichts.
|
||||
expect(generatePlan(project([beam]), "eg", new Set()).primitives.filter((p) => p.kind === "polygon" && p.columnId === "B1").length).toBe(0);
|
||||
});
|
||||
|
||||
it("3D: ein Prisma 4 m × 25 cm, Oberkante an der Geschoss-Oberkante (keine Decke darüber)", () => {
|
||||
const m = projectToModel3d(project([beam]));
|
||||
const meshes = m.meshes.filter((x) => x.kind === "extrusion");
|
||||
expect(meshes.length).toBe(1);
|
||||
const pos = Array.from(meshes[0].positions);
|
||||
const z = pos.filter((_, i) => i % 3 === 2);
|
||||
expect(Math.max(...z)).toBeCloseTo(2.6, 6);
|
||||
expect(Math.min(...z)).toBeCloseTo(2.2, 6);
|
||||
const x = pos.filter((_, i) => i % 3 === 0);
|
||||
expect(Math.max(...x) - Math.min(...x)).toBeCloseTo(4, 6);
|
||||
});
|
||||
|
||||
it("Objekt-Info: kind beam mit Querschnitt, Länge und UK/OK; Griffe Anfang, Ende, Mitte", () => {
|
||||
const p = project([{ ...beam, profileName: "HEB 200", topOffset: 0.1 }]);
|
||||
const info = deriveSelection(p, { columns: ["B1"] });
|
||||
expect(info?.kind).toBe("beam");
|
||||
expect(info?.beam).toMatchObject({ width: 0.25, height: 0.4, profileName: "HEB 200", topOffset: 0.1, length: 4 });
|
||||
expect(info?.beam?.zTop).toBeCloseTo(2.7, 6);
|
||||
expect(beamGripPoints(beam)).toEqual([{ x: 1, y: 2 }, { x: 5, y: 2 }, { x: 3, y: 2 }]);
|
||||
});
|
||||
|
||||
it("Sperre über den Auswahlkanal der Stützen", () => {
|
||||
const p = project([beam]);
|
||||
const ops = lockOps(p, "columnIds", "B1", true);
|
||||
expect(ops.length).toBe(1);
|
||||
const q = applyOps(p, ops);
|
||||
expect(q.beams?.[0].locked).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Befehl traeger", () => {
|
||||
const ctxOf = (p: Project): CommandContext => ({ project: p, level: p.drawingLevels[0], defaultCategoryCode: "50", activeLineStyleId: "thin", activeWallTypeId: "aw", lastPoint: null, selection: { wallIds: [], drawingId: null } });
|
||||
|
||||
it("zwei Punkte legen einen Träger an und beenden den Befehl", () => {
|
||||
const p = project([]);
|
||||
const ctx = ctxOf(p);
|
||||
const [s1, r1] = traegerCommand.onInput(traegerCommand.init(), { kind: "point", point: { x: 0, y: 0 } }, ctx);
|
||||
expect(r1.done).toBeFalsy();
|
||||
const [, mv] = traegerCommand.onMove!(s1, { x: 3, y: 0 }, null, ctx);
|
||||
expect(mv.draft?.preview.length).toBeGreaterThan(0);
|
||||
const [, r2] = traegerCommand.onInput(s1, { kind: "point", point: { x: 3, y: 0 } }, ctx);
|
||||
expect(r2.done).toBe(true);
|
||||
const next = r2.commit!(p);
|
||||
expect(next.beams?.length).toBe(1);
|
||||
const item = next.beams![0];
|
||||
expect(item).toMatchObject({ type: "beam", floorId: "eg", categoryCode: "50", width: 0.25, height: 0.4, end: { x: 3, y: 0 } });
|
||||
});
|
||||
|
||||
it("Nulllänge wird ignoriert", () => {
|
||||
const p = project([]);
|
||||
const ctx = ctxOf(p);
|
||||
const [s1] = traegerCommand.onInput(traegerCommand.init(), { kind: "point", point: { x: 1, y: 1 } }, ctx);
|
||||
const [s2, r] = traegerCommand.onInput(s1, { kind: "point", point: { x: 1, y: 1 } }, ctx);
|
||||
expect(r.done).toBeFalsy();
|
||||
expect(s2).toBe(s1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Beispielprojekt Musterhaus komplex", () => {
|
||||
it("enthält den Unterzug im EG; Schnitt A-A schneidet ihn quer", () => {
|
||||
const p = buildComplexSampleProject();
|
||||
const b = p.beams?.find((x) => x.id === "tg-eg-1");
|
||||
expect(b).toBeTruthy();
|
||||
const plan = generatePlan(p, "eg", new Set(["25", "30", "20"]));
|
||||
expect(plan.primitives.some((q) => q.kind === "polygon" && q.columnId === "tg-eg-1")).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -22,7 +22,7 @@ function collection(project: Project, kind: PickKind): readonly WithCategory[] {
|
||||
case "stair": return p.stairs ?? [];
|
||||
case "room": return p.rooms ?? [];
|
||||
case "roof": return p.roofs ?? [];
|
||||
case "column": return p.columns ?? [];
|
||||
case "column": return [...(p.columns ?? []), ...(p.beams ?? [])];
|
||||
case "context": return p.context ?? [];
|
||||
case "solid": return p.extrudedSolids ?? [];
|
||||
case "tree": return p.trees ?? [];
|
||||
|
||||
@@ -46,7 +46,7 @@ function candidateCodes(project: Project): Set<string> {
|
||||
const codes = new Set<string>();
|
||||
for (const c of flattenCategories(project.layers)) codes.add(c.code);
|
||||
// [115] Freie Körper und Stützen tragen ihre Klasse wie jedes Bauteil.
|
||||
for (const list of [project.walls, project.ceilings, project.roofs, project.stairs, project.openings, project.extrudedSolids, project.columns]) {
|
||||
for (const list of [project.walls, project.ceilings, project.roofs, project.stairs, project.openings, project.extrudedSolids, project.columns, project.beams]) {
|
||||
for (const e of list ?? []) codes.add(e.categoryCode);
|
||||
}
|
||||
for (const c of project.context ?? []) if (c.type === "terrainMesh" && c.categoryCode !== undefined) codes.add(c.categoryCode);
|
||||
|
||||
@@ -115,6 +115,7 @@ const CHANNELS: [keyof Project, SelectionKind][] = [
|
||||
["rooms", "rooms"],
|
||||
["extrudedSolids", "solids"],
|
||||
["columns", "columns"],
|
||||
["beams", "columns"], // [280] Träger liegen im Auswahlkanal der Stützen
|
||||
["roofs", "roofs"],
|
||||
["context", "contextObjects"],
|
||||
];
|
||||
|
||||
@@ -125,6 +125,7 @@ export function hasContent(p: Project): boolean {
|
||||
(p.stairs?.length ?? 0) > 0 ||
|
||||
(p.rooms?.length ?? 0) > 0 ||
|
||||
(p.columns?.length ?? 0) > 0 ||
|
||||
(p.beams?.length ?? 0) > 0 ||
|
||||
(p.extrudedSolids?.length ?? 0) > 0 ||
|
||||
(p.context?.length ?? 0) > 0
|
||||
);
|
||||
|
||||
@@ -29,7 +29,7 @@ export function isLocked(project: Project, kind: MemberKind, id: string): boolea
|
||||
case "stairIds":
|
||||
return !!(project.stairs ?? []).find((s) => s.id === id)?.locked;
|
||||
case "columnIds":
|
||||
return !!(project.columns ?? []).find((c) => c.id === id)?.locked;
|
||||
return !!((project.columns ?? []).find((c) => c.id === id)?.locked || (project.beams ?? []).find((c) => c.id === id)?.locked);
|
||||
case "roofIds":
|
||||
return !!(project.roofs ?? []).find((r) => r.id === id)?.locked;
|
||||
case "openingIds":
|
||||
@@ -55,7 +55,7 @@ export function lockOps(project: Project, kind: MemberKind, id: string, locked:
|
||||
case "stairIds":
|
||||
return patchItem(project, "stairs", id, { locked });
|
||||
case "columnIds":
|
||||
return patchItem(project, "columns", id, { locked });
|
||||
return [...patchItem(project, "columns", id, { locked }), ...patchItem(project, "beams", id, { locked })];
|
||||
case "roofIds":
|
||||
return patchItem(project, "roofs", id, { locked });
|
||||
case "openingIds":
|
||||
|
||||
@@ -63,6 +63,12 @@ export function buildElementAttributesHost(c: FlatHostOpts) {
|
||||
else if (collection === "rooms") updateRoom(id, patch);
|
||||
else mapAll(collection, id, (e) => ({ ...(e as object), ...patch }) as typeof e, coalesceKey);
|
||||
}
|
||||
/** [280] Patch auf alle gewählten Träger (Träger liegen im Auswahlkanal `columns`); ein Undo-Schritt. */
|
||||
function patchBeams(id: string, patch: Record<string, unknown>): void {
|
||||
const sel = getState().selection.columns;
|
||||
const ids = sel.length > 1 && sel.includes(id) ? sel : [id];
|
||||
applyChange((p) => patchItems(p, "beams", ids, (e) => ({ ...e, ...patch }) as typeof e));
|
||||
}
|
||||
return {
|
||||
// ── Wand-Attribute (nur bei selektierter Wand) ─────────────────────────
|
||||
onSetWallReferenceLine: (ref) => {
|
||||
@@ -400,6 +406,23 @@ export function buildElementAttributesHost(c: FlatHostOpts) {
|
||||
if (selection?.kind !== "column" || !(height > 0)) return;
|
||||
patchAll("columns", selection.id, { height });
|
||||
},
|
||||
// ── [280] Träger-Attribute (nur bei selektiertem Träger; Auswahlkanal der Stützen) ──────────────
|
||||
onSetBeamWidth: (width) => {
|
||||
if (selection?.kind !== "beam" || !(width > 0)) return;
|
||||
patchBeams(selection.id, { width });
|
||||
},
|
||||
onSetBeamHeight: (height) => {
|
||||
if (selection?.kind !== "beam" || !(height > 0)) return;
|
||||
patchBeams(selection.id, { height });
|
||||
},
|
||||
onSetBeamTopOffset: (offset) => {
|
||||
if (selection?.kind !== "beam" || !Number.isFinite(offset)) return;
|
||||
patchBeams(selection.id, { topOffset: Math.abs(offset) > 1e-9 ? offset : undefined });
|
||||
},
|
||||
onSetBeamProfileName: (name) => {
|
||||
if (selection?.kind !== "beam") return;
|
||||
patchBeams(selection.id, { profileName: name.trim() || undefined });
|
||||
},
|
||||
onSetColumnRotation: (deg) => {
|
||||
if (selection?.kind !== "column" || !Number.isFinite(deg)) return;
|
||||
patchAll("columns", selection.id, { rotation: (deg * Math.PI) / 180 });
|
||||
|
||||
@@ -23,7 +23,7 @@ function singleTransformSel(kind: string, id: string): TransformSelection | null
|
||||
if (kind === "wall") return { wallIds: [id], drawingId: null };
|
||||
if (kind === "drawing2d") return { wallIds: [], drawingId: id };
|
||||
if (kind === "extrudedSolid") return { wallIds: [], drawingId: null, extrudedSolidId: id };
|
||||
if (kind === "column") return { wallIds: [], drawingId: null, columnId: id };
|
||||
if (kind === "column" || kind === "beam") return { wallIds: [], drawingId: null, columnId: id };
|
||||
if (kind === "ceiling") return { wallIds: [], drawingId: null, ceilingIds: [id] };
|
||||
// Dach: Move geht (Umriss verschiebt sich), Rotate no-opt bewusst (s.
|
||||
// TransformSelection.roofIds) — der Host-Aufruf degradiert dafür von
|
||||
@@ -367,6 +367,9 @@ export function buildSelectionStyleHost(c: FlatHostOpts) {
|
||||
case "column":
|
||||
applyChange((p) => patchItem(p, "columns", id, { categoryCode: code }));
|
||||
break;
|
||||
case "beam": // [280]
|
||||
applyChange((p) => patchItem(p, "beams", id, { categoryCode: code }));
|
||||
break;
|
||||
// [181] Gelände-/Umgebungs-Elemente (Netzkörper, Gelände, Höhenlinien, Luftbild, Baugrube) wie jedes Element.
|
||||
case "contextObject":
|
||||
applyChange((p) => patchItem(p, "context", id, { categoryCode: code }));
|
||||
@@ -394,6 +397,9 @@ export function buildSelectionStyleHost(c: FlatHostOpts) {
|
||||
case "column":
|
||||
applyChange((p) => patchItem(p, "columns", id, { floorId: levelId }));
|
||||
break;
|
||||
case "beam": // [280]
|
||||
applyChange((p) => patchItem(p, "beams", id, { floorId: levelId }));
|
||||
break;
|
||||
default: break; // opening: Ebene kommt aus der Wirts-Wand
|
||||
}
|
||||
},
|
||||
|
||||
@@ -41,6 +41,7 @@ export function buildSiteHost(c: FlatHostOpts) {
|
||||
Extrusion: "solids",
|
||||
Dach: "roofs",
|
||||
Stütze: "columns",
|
||||
Träger: "columns", // [280] Träger liegen im Auswahlkanal der Stützen
|
||||
};
|
||||
const k = kindOf[kind];
|
||||
setSelection({ ...clearKinds(), ...(k ? { [k]: [id] } : {}) });
|
||||
|
||||
@@ -392,6 +392,8 @@ export interface ProjectSlice {
|
||||
moveSectionLineGrip: (id: string, index: number, pt: Vec2, coalesceKey?: string) => void;
|
||||
/** [213] Griff einer Kamera: 0 = Standpunkt, 1 = Ziel, 2 = Bildwinkel/Sichtbreite. */
|
||||
moveCameraGrip: (id: string, index: number, pt: Vec2) => void;
|
||||
/** [280] Träger: Griff 0 Anfang, 1 Ende, 2 Mitte (verschiebt den Träger), Kern `grips.rs`. */
|
||||
moveBeamGrip: (id: string, index: number, pt: Vec2) => void;
|
||||
/** [176] Knick in Segment `seg` (Mittel-Griff) einfügen; `coalesceKey` fasst den anschliessenden Zug zusammen. */
|
||||
insertSectionBend: (id: string, seg: number, pt: Vec2, coalesceKey?: string) => void;
|
||||
/** [176] Knick löschen (`index` wie bei {@link moveSectionLineGrip}; Anfang/Ende lassen sich nicht löschen). */
|
||||
@@ -1307,6 +1309,7 @@ export function createProjectSlice(
|
||||
moveSectionLineGrip: (id, index, pt, coalesceKey) =>
|
||||
applyGrip({ op: "sectionLineGrip", id, index, pt: gripPt(pt) }, coalesceKey ?? `moveSectionLineGrip:${id}:${index}`),
|
||||
moveCameraGrip: (id, index, pt) => applyGrip({ op: "cameraGrip", id, index, pt: gripPt(pt) }, `moveCameraGrip:${id}:${index}`),
|
||||
moveBeamGrip: (id, index, pt) => applyGrip({ op: "beamGrip", id, index, pt: gripPt(pt) }, `moveBeamGrip:${id}:${index}`),
|
||||
insertSectionBend: (id, seg, pt, coalesceKey) => applyGrip({ op: "sectionBendInsert", id, seg, pt: gripPt(pt) }, coalesceKey),
|
||||
deleteSectionBend: (id, index) => applyGrip({ op: "sectionBendDelete", id, index }),
|
||||
moveRingVertex: (kind, id, index, pt, coalesceKey) => {
|
||||
|
||||
@@ -23,7 +23,8 @@ export function selectAllIds(project: Project, levelId: string): Partial<Selecti
|
||||
const stairIds = (project.stairs ?? []).filter((s) => s.floorId === levelId).map((s) => s.id);
|
||||
const roomIds = (project.rooms ?? []).filter((r) => r.floorId === levelId).map((r) => r.id);
|
||||
const solids = (project.extrudedSolids ?? []).filter((s) => s.levelId === levelId).map((s) => s.id);
|
||||
const columnIds = (project.columns ?? []).filter((c) => c.floorId === levelId).map((c) => c.id);
|
||||
// [280] Träger liegen im Auswahlkanal der Stützen.
|
||||
const columnIds = [...(project.columns ?? []), ...(project.beams ?? [])].filter((c) => c.floorId === levelId).map((c) => c.id);
|
||||
// [213] Kameras des Geschosses (Symbol im Grundriss), gesperrte bleiben.
|
||||
const cameras = (project.cameras ?? []).filter((c) => c.floorId === levelId && !c.locked).map((c) => c.id);
|
||||
// Schnittführungs-Symbole sind projektweit (kein floorId; plan/context.rs, plan_section_lines).
|
||||
|
||||
@@ -402,6 +402,28 @@ export interface ColumnInfo {
|
||||
zTop: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* [280] Träger-Attribute für die Objekt-Info (nur bei Auswahl genau eines Trägers): Querschnitt, Profilname, Versatz der
|
||||
* Oberkante gegenüber der Deckenunterkante, Länge der Achse und aufgelöste UK/OK.
|
||||
*/
|
||||
export interface BeamInfo {
|
||||
/** Querschnittsbreite (Meter, editierbar). */
|
||||
width: number;
|
||||
/** Querschnittshöhe (Meter, editierbar). */
|
||||
height: number;
|
||||
/** Profilname als Text (z. B. „HEB 200"), `null` = keiner. */
|
||||
profileName: string | null;
|
||||
/** Versatz der Oberkante gegenüber der Deckenunterkante (Meter, + nach oben, editierbar). */
|
||||
topOffset: number;
|
||||
/** Länge der Achse (Meter). */
|
||||
length: number;
|
||||
floorId: string;
|
||||
floorName: string;
|
||||
/** Aufgelöste absolute UK/OK (Meter). */
|
||||
zBottom: number;
|
||||
zTop: number;
|
||||
}
|
||||
|
||||
/** Achsparallele Bounding-Box eines Elements in Modell-Metern. */
|
||||
export interface SelectionBBox {
|
||||
minX: number;
|
||||
@@ -426,6 +448,7 @@ export interface SelectionInfo {
|
||||
| "door"
|
||||
| "extrudedSolid"
|
||||
| "column"
|
||||
| "beam"
|
||||
| "roof"
|
||||
| "contextObject";
|
||||
id: string;
|
||||
@@ -549,6 +572,8 @@ export interface SelectionInfo {
|
||||
extrudedSolid?: ExtrudedSolidInfo;
|
||||
/** Stützen-Attribute (nur bei `kind === "column"`). */
|
||||
column?: ColumnInfo;
|
||||
/** [280] Träger-Attribute (nur bei `kind === "beam"`). */
|
||||
beam?: BeamInfo;
|
||||
/** Kontext-Objekt-Attribute (nur bei `kind === "contextObject"`). */
|
||||
contextObject?: ContextObjectInfo;
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,7 @@ declare global {
|
||||
coreReady: () => Promise<void>;
|
||||
coreEpoch: () => number;
|
||||
/** Zahl der Elemente je Liste des Projekts (Wände, Öffnungen, Zeichnungsebenen) und das Projekt im Kern als JSON-Länge. */
|
||||
counts: () => { walls: number; openings: number; drawingLevels: number; coreJson: number };
|
||||
counts: () => { walls: number; openings: number; drawingLevels: number; coreJson: number; /** [280] Träger. */ beams: number };
|
||||
/** Endpunkte aller 2D-Linien des Projekts ([123] Transformations-Test). */
|
||||
lines: () => { a: { x: number; y: number }; b: { x: number; y: number } }[];
|
||||
/** [137] Polylinien-Punkte der 2D-Elemente mit Id-Präfix (Präsentations-Massstabsbalken). */
|
||||
@@ -123,7 +123,7 @@ export function installTestHooks(): void {
|
||||
coreEpoch,
|
||||
counts: () => {
|
||||
const p = getState().project;
|
||||
return { walls: p.walls.length, openings: p.openings?.length ?? 0, drawingLevels: p.drawingLevels.length, coreJson: storeDocument(p).json().length };
|
||||
return { walls: p.walls.length, openings: p.openings?.length ?? 0, drawingLevels: p.drawingLevels.length, beams: p.beams?.length ?? 0, coreJson: storeDocument(p).json().length };
|
||||
},
|
||||
lines: () =>
|
||||
getState().project.drawings2d.flatMap((d) => (d.geom.shape === "line" ? [{ a: d.geom.a, b: d.geom.b }] : [])),
|
||||
|
||||
@@ -51,7 +51,7 @@ import { getPlanViewport, subscribePlanViewport } from "./planViewport";
|
||||
import { growRect, meshGripIndices } from "../core";
|
||||
import { patchItem, verticalExtents } from "../core";
|
||||
import { treeGripPatch, treeGripPoints } from "./treeGrips";
|
||||
import { cameraGripPoints } from "../core";
|
||||
import { beamGripPoints, cameraGripPoints } from "../core";
|
||||
import type { Selection } from "./selection";
|
||||
|
||||
export interface GripEditFieldsState {
|
||||
@@ -215,6 +215,9 @@ export function useGripEditing(opts: {
|
||||
const selectedTree = selectedTreeId ? (project.trees ?? []).find((x) => x.id === selectedTreeId) : undefined;
|
||||
// [213] Kamera: Griffe an Standpunkt, Ziel und Sichtkegel-Rand (Bildwinkel); nur auf dem Geschoss der Kamera.
|
||||
const selectedCameraId = single(selection, "cameras");
|
||||
// [280] Träger liegen im Auswahlkanal der Stützen: ein gewählter einzelner Träger zeigt Anfang-, Ende- und Mitte-Griff.
|
||||
const selectedColumnId = single(selection, "columns");
|
||||
const selectedBeam = selectedColumnId ? (project.beams ?? []).find((x) => x.id === selectedColumnId && x.floorId === levelId) : undefined;
|
||||
const selectedCamera = selectedCameraId ? (project.cameras ?? []).find((x) => x.id === selectedCameraId && x.floorId === levelId) : undefined;
|
||||
// [176] Schnitt-/Ansichtslinie im Grundriss: Griffe an Anfang, Knickpunkten (`bendPoints`) und Ende.
|
||||
const selectedSectionLineId = single(selection, "sectionLines");
|
||||
@@ -517,6 +520,11 @@ export function useGripEditing(opts: {
|
||||
pts.forEach((_, i) => { gripOwners.push({ localIndex: i }); gripOwnerRange.push([0, pts.length - 1]); });
|
||||
return pts;
|
||||
}
|
||||
if (selectedBeam && modelEditable && !selectedBeam.locked) {
|
||||
const pts = beamGripPoints(selectedBeam);
|
||||
pts.forEach((_, i) => { gripOwners.push({ localIndex: i }); gripOwnerRange.push([0, pts.length - 1]); });
|
||||
return pts;
|
||||
}
|
||||
if (selectedCamera && modelEditable && !selectedCamera.locked) {
|
||||
const pts = cameraGripPoints(selectedCamera, scaleDenominator);
|
||||
pts.forEach((_, i) => { gripOwners.push({ localIndex: i }); gripOwnerRange.push([0, pts.length - 1]); });
|
||||
@@ -1256,6 +1264,11 @@ export function useGripEditing(opts: {
|
||||
else if (st) moveStairBy(st.id, sub(pt, stairMoveHandle(st)));
|
||||
return;
|
||||
}
|
||||
// [280] Träger: Anfang, Ende bzw. Mitte live (Kern `grips.rs`), ein Undo-Schritt je Zug.
|
||||
if (selectedBeam) {
|
||||
if (!selectedBeam.locked) storeState().moveBeamGrip(selectedBeam.id, index, pt);
|
||||
return;
|
||||
}
|
||||
// [213] Kamera: Standpunkt, Ziel bzw. Sichtkegel-Rand live (Kern `camera::grip_edit`), ein Undo-Schritt je Zug.
|
||||
if (selectedCamera) {
|
||||
if (!selectedCamera.locked) storeState().moveCameraGrip(selectedCamera.id, index, pt);
|
||||
|
||||
@@ -145,7 +145,7 @@ export function useMouseSelectionHandlers(opts: {
|
||||
return (project.stairs ?? []).find((s) => s.id === sel.stairId)?.categoryCode;
|
||||
if (sel.roomId) return (project.rooms ?? []).find((r) => r.id === sel.roomId)?.categoryCode;
|
||||
if (sel.columnId)
|
||||
return (project.columns ?? []).find((c) => c.id === sel.columnId)?.categoryCode;
|
||||
return [...(project.columns ?? []), ...(project.beams ?? [])].find((c) => c.id === sel.columnId)?.categoryCode;
|
||||
if (sel.roofId) return (project.roofs ?? []).find((r) => r.id === sel.roofId)?.categoryCode;
|
||||
if (sel.drawingId)
|
||||
return project.drawings2d.find((d) => d.id === sel.drawingId)?.categoryCode;
|
||||
@@ -162,7 +162,7 @@ export function useMouseSelectionHandlers(opts: {
|
||||
if (sel.ceilingId) return (project.ceilings ?? []).find((c) => c.id === sel.ceilingId)?.floorId;
|
||||
if (sel.stairId) return (project.stairs ?? []).find((s) => s.id === sel.stairId)?.floorId;
|
||||
if (sel.roomId) return (project.rooms ?? []).find((r) => r.id === sel.roomId)?.floorId;
|
||||
if (sel.columnId) return (project.columns ?? []).find((c) => c.id === sel.columnId)?.floorId;
|
||||
if (sel.columnId) return [...(project.columns ?? []), ...(project.beams ?? [])].find((c) => c.id === sel.columnId)?.floorId;
|
||||
if (sel.roofId) return (project.roofs ?? []).find((r) => r.id === sel.roofId)?.floorId;
|
||||
if (sel.drawingId) return project.drawings2d.find((d) => d.id === sel.drawingId)?.levelId;
|
||||
return undefined;
|
||||
|
||||
@@ -173,6 +173,7 @@ export function useSelectionCommands(opts: {
|
||||
...removeItems(p, "rooms", rmids),
|
||||
...removeItems(p, "extrudedSolids", exids),
|
||||
...removeItems(p, "columns", colids),
|
||||
...removeItems(p, "beams", colids), // [280] Träger liegen im Auswahlkanal der Stützen
|
||||
// Öffnungen: eigene Auswahl löschen UND alle, deren Wirt (Wand, Dach, Decke [103]) entfällt.
|
||||
...removeItems(p, "openings", (o) => oids.has(o.id) || wids.has(o.hostWallId) || (!!o.hostRoofId && rfids.has(o.hostRoofId)) || (!!o.hostCeilingId && cids.has(o.hostCeilingId))),
|
||||
...removeItems(p, "context", ctxids),
|
||||
|
||||
@@ -40,7 +40,7 @@ export interface DesignOptionHandlers {
|
||||
/** Zahl der Elemente je Variante (Satz-Id → Varianten-Id → Anzahl). */
|
||||
function counts(project: Project): Map<string, number> {
|
||||
const out = new Map<string, number>();
|
||||
const lists = [project.walls, project.openings, project.ceilings, project.roofs, project.stairs, project.columns, project.extrudedSolids, project.rooms, project.drawings2d];
|
||||
const lists = [project.walls, project.openings, project.ceilings, project.roofs, project.stairs, project.columns, project.beams, project.extrudedSolids, project.rooms, project.drawings2d];
|
||||
for (const list of lists) {
|
||||
for (const e of (list ?? []) as { designOption?: { set: string; option: string } }[]) {
|
||||
if (!e.designOption) continue;
|
||||
|
||||
@@ -204,6 +204,14 @@ export const CommandIcon = memo(function CommandIcon({ name }: { name: string })
|
||||
<line x1="12" y1="9" x2="12" y2="13" />
|
||||
</svg>
|
||||
);
|
||||
case "traeger":
|
||||
// [280] Träger: Seitenansicht eines Balkens (Rechteck, Achsstrich).
|
||||
return (
|
||||
<svg {...common}>
|
||||
<rect x="1.5" y="5.5" width="13" height="5" />
|
||||
<line x1="1.5" y1="8" x2="14.5" y2="8" strokeDasharray="3 1.5 0.6 1.5" />
|
||||
</svg>
|
||||
);
|
||||
case "column":
|
||||
// Stütze: Quadrat-Querschnitt mit vertikalen Kanten (Pfeiler).
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user