[65] Merge: Explosionsaxonometrie im 3D (Geschosse mit einstellbarem Abstand, Picking folgt, CLI --explode)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
16 files changed
+499
-16
No files matched your search
@@ -63,6 +63,10 @@ jobs:
|
||||
node dist-cli/dossier-cli.mjs :beispiel model3d --out smoke/m.json
|
||||
src-tauri/target/release/render_png smoke/m.json smoke/iso.png --view iso --style shaded-edges
|
||||
test "$(wc -c < smoke/iso.png)" -gt 5000
|
||||
# Explosionsaxonometrie ([65]): Geschosse 3 m auseinander.
|
||||
node dist-cli/dossier-cli.mjs :beispiel model3d --explode 3 --out smoke/explode.json
|
||||
src-tauri/target/release/render_png smoke/explode.json smoke/explode.png --view iso --style shaded-edges
|
||||
test "$(wc -c < smoke/explode.png)" -gt 5000
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
|
||||
@@ -1892,7 +1892,13 @@ Reihenfolge = Abhängigkeiten. Neue Geometrie entsteht in Rust ([K]).
|
||||
live) und PDF teilen den Weg; im DXF/DWG-Papierbereich eines Publikationssatzes als Blatt-Zeichnung (Weg gebaut, aber nicht mit echter Datei geprüft). Bedienung: „+ Legende“ in
|
||||
der Blatt-Leiste, Klick wählt sie, HUD: Titel, X/Y, Arten, „Auswahl festhalten“ / automatisch.
|
||||
Offen: Verschieben per Ziehen (heute X/Y-Felder), DXF-Legende nur im Satz-Export (nicht im allgemeinen DXF-Dialog).
|
||||
- ○ **[65] Explosionsaxonometrie.** · S–M
|
||||
- ◐ **[65] Explosionsaxonometrie.** · S–M — 4.11.: Kern `explode3d.rs` hebt im 3D jedes Geschoss (nach
|
||||
`baseElevation` sortiert) um Index × Abstand; Bauteile folgen `floorId`, Öffnungen ihrem Wirt, truck-Extrusionen
|
||||
`levelId`; Kontext bleibt. Modell (`model3dParts` `args[4]`), Pick-Geometrie und Auswahl-Hervorhebung gleich versetzt;
|
||||
Plan/Schnitt/Ansicht unberührt. Bedienung: Knopf unten rechts im 3D-Viewport (neben Raster) + Abstandsfeld
|
||||
(Ansichtszustand, nicht im Projekt). CLI `model3d --explode 3`; macOS-Rauchtest `smoke/explode.png`.
|
||||
Offen: nur im Linux-Container geprüft (Zahlen, kein Bild); mit Explosion keine Abzugskörper, 2D-Boden-Spuren
|
||||
und 3D-Griffe/Zeichnen-Vorschau bleiben unversetzt; natives Metal-3D-Fenster (`nativeSync`) ohne Explosion.
|
||||
- ◐ **[66] Präsentationspläne mit einem Klick.** · M — 4.11.: Standard-Ansichtsvorlagen (neue Projekte, „Standards
|
||||
laden/aktualisieren"): „Präsentation" (farbig, Schatten, ohne Referenzen/Konstruktion), „Eingabeplan 1:100" und
|
||||
„Ausführungsplan 1:50" (schwarz-weiss, fein, Strichstärken nach Massstab) — an Geschoss/Schnitt/Ansicht binden ([34]).
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
//! Explosionsaxonometrie ([65]): Geschosse im 3D senkrecht auseinandergezogen (Präsentation).
|
||||
//!
|
||||
//! Jedes Geschoss (nach `baseElevation` sortiert, Index ab dem tiefsten) wird um `Index × Abstand`
|
||||
//! angehoben; jedes Bauteil folgt seinem Geschoss (`floorId`), Öffnungen ihrem Wirt (Wand, Dach,
|
||||
//! Decke). Kontext (Gelände, Importe) und 2D-Boden-Spuren bleiben stehen. Nur das 3D-Modell, die
|
||||
//! Pick-Geometrie und die Hervorhebung verschieben sich — Plan, Schnitt und Ansicht nie.
|
||||
|
||||
use crate::model::{DrawingLevelKind, Project};
|
||||
use crate::model3d::{self, Parts, PickGeometry, RMesh, RRoofLayer, RSlab, RWall};
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// Versatz je Geschoss und Geschoss je Bauteil-id.
|
||||
pub struct Explode<'a> {
|
||||
/// Geschoss-id → Versatz (m).
|
||||
by_floor: HashMap<&'a str, f64>,
|
||||
/// Bauteil-id (Wand, Decke, Dach, Treppe, Stütze, Öffnung) → Geschoss-id.
|
||||
floor_of: HashMap<&'a str, &'a str>,
|
||||
}
|
||||
|
||||
impl<'a> Explode<'a> {
|
||||
/// `None` bei Abstand ≤ 0 oder ungültig (= aus).
|
||||
pub fn new(p: &'a Project, gap: f64) -> Option<Self> {
|
||||
if !(gap.is_finite() && gap > 0.0) {
|
||||
return None;
|
||||
}
|
||||
let mut floors: Vec<(&str, f64)> = p
|
||||
.drawing_levels
|
||||
.iter()
|
||||
.filter(|l| l.kind == DrawingLevelKind::Floor)
|
||||
.map(|l| (l.id.as_str(), l.base_elevation.filter(|z| z.is_finite()).unwrap_or(0.0)))
|
||||
.collect();
|
||||
floors.sort_by(|a, b| a.1.total_cmp(&b.1));
|
||||
let by_floor = floors.iter().enumerate().map(|(i, (id, _))| (*id, i as f64 * gap)).collect();
|
||||
let mut floor_of: HashMap<&str, &str> = HashMap::new();
|
||||
for w in &p.walls {
|
||||
floor_of.insert(&w.id, &w.floor_id);
|
||||
}
|
||||
for c in p.ceilings.as_deref().unwrap_or(&[]) {
|
||||
floor_of.insert(&c.id, &c.floor_id);
|
||||
}
|
||||
for r in p.roofs.as_deref().unwrap_or(&[]) {
|
||||
floor_of.insert(&r.id, &r.floor_id);
|
||||
}
|
||||
for s in p.stairs.as_deref().unwrap_or(&[]) {
|
||||
floor_of.insert(&s.id, &s.floor_id);
|
||||
}
|
||||
for c in p.columns.as_deref().unwrap_or(&[]) {
|
||||
floor_of.insert(&c.id, &c.floor_id);
|
||||
}
|
||||
for o in p.openings.as_deref().unwrap_or(&[]) {
|
||||
if let Some(f) = floor_of.get(o.host_wall_id.as_str()).copied() {
|
||||
floor_of.insert(&o.id, f);
|
||||
}
|
||||
}
|
||||
Some(Self { by_floor, floor_of })
|
||||
}
|
||||
|
||||
/// Versatz eines Geschosses (unbekannt: 0).
|
||||
pub fn floor(&self, floor_id: &str) -> f64 {
|
||||
self.by_floor.get(floor_id).copied().unwrap_or(0.0)
|
||||
}
|
||||
|
||||
/// Versatz eines Bauteils über sein Geschoss (unbekannt: 0).
|
||||
pub fn of(&self, id: &str) -> f64 {
|
||||
self.floor_of.get(id).map_or(0.0, |f| self.floor(f))
|
||||
}
|
||||
|
||||
/// Gehört ein Bauteil mit Geschoss `floor_id` zur Gruppe `group` (`None` = Geschoss unbekannt)?
|
||||
fn in_group(&self, floor_id: &str, group: Option<&str>) -> bool {
|
||||
match group {
|
||||
Some(g) => floor_id == g,
|
||||
None => !self.by_floor.contains_key(floor_id),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn shift_wall(w: &mut RWall, dz: f64) {
|
||||
w.base_elevation += dz;
|
||||
if let Some(tp) = w.top_plane.as_mut() {
|
||||
tp[0] += dz;
|
||||
}
|
||||
for h in w.holes.iter_mut().flatten() {
|
||||
h.z_bottom += dz;
|
||||
h.z_top += dz;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn shift_slab(s: &mut RSlab, dz: f64) {
|
||||
s.z_bottom += dz;
|
||||
s.z_top += dz;
|
||||
}
|
||||
|
||||
/// Mesh im Modellraum (x, y, z = Höhe).
|
||||
pub fn shift_mesh(m: &mut RMesh, dz: f64) {
|
||||
for c in m.positions.chunks_exact_mut(3) {
|
||||
c[2] += dz;
|
||||
}
|
||||
}
|
||||
|
||||
fn shift_roof_layer(l: &mut RRoofLayer, dz: f64) {
|
||||
for q in &mut l.polygon {
|
||||
q[2] += dz;
|
||||
}
|
||||
}
|
||||
|
||||
fn shifted<T>(mut v: Vec<T>, dz: f64, f: fn(&mut T, f64)) -> Vec<T> {
|
||||
if dz != 0.0 {
|
||||
for x in &mut v {
|
||||
f(x, dz);
|
||||
}
|
||||
}
|
||||
v
|
||||
}
|
||||
|
||||
/// `model3d::parts` mit auseinandergezogenen Geschossen; `gap` ≤ 0 liefert genau `parts`.
|
||||
pub fn parts(p: &Project, layered: bool, detail: f64, for_section: bool, gap: f64) -> Result<Parts, String> {
|
||||
let Some(ex) = Explode::new(p, gap) else { return model3d::parts(p, layered, detail, for_section) };
|
||||
let mut walls = model3d::emit_walls(p, layered)?;
|
||||
for w in &mut walls {
|
||||
shift_wall(w, ex.of(&w.wall_id));
|
||||
}
|
||||
// Decken und Treppen: `ceiling_id` ist die Decken- bzw. Treppen-id.
|
||||
let mut slabs = model3d::emit_slabs(p);
|
||||
slabs.extend(model3d::emit_stairs(p, for_section));
|
||||
for s in &mut slabs {
|
||||
shift_slab(s, ex.of(&s.ceiling_id));
|
||||
}
|
||||
// Mesh-Bauteile tragen keine id: je Geschoss nur dessen Stützen/Öffnungen/Treppen/Dächer emittieren.
|
||||
let mut q = p.clone();
|
||||
q.context = None;
|
||||
q.drawings2d.clear();
|
||||
let mut out = Parts {
|
||||
walls,
|
||||
slabs,
|
||||
context_meshes: model3d::emit_context_meshes(p),
|
||||
column_meshes: vec![],
|
||||
opening_meshes: vec![],
|
||||
stair_meshes: vec![],
|
||||
stair_railings: vec![],
|
||||
roof_meshes: vec![],
|
||||
roof_layers: vec![],
|
||||
};
|
||||
let mut groups: Vec<(Option<&str>, f64)> = ex.by_floor.iter().map(|(id, dz)| (Some(*id), *dz)).collect();
|
||||
groups.sort_by(|a, b| a.1.total_cmp(&b.1));
|
||||
groups.push((None, 0.0));
|
||||
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.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());
|
||||
q.openings = p.openings.as_ref().map(|v| v.iter().filter(|o| pick(ex.floor_of.get(o.id.as_str()).copied().unwrap_or(""))).cloned().collect());
|
||||
out.column_meshes.extend(shifted(model3d::emit_columns(&q), dz, shift_mesh));
|
||||
out.stair_meshes.extend(shifted(model3d::emit_stair_meshes(&q), dz, shift_mesh));
|
||||
out.stair_railings.extend(shifted(model3d::emit_stair_railings(&q), dz, shift_mesh));
|
||||
out.roof_meshes.extend(shifted(model3d::emit_roofs(&q, None)?, dz, shift_mesh));
|
||||
out.roof_layers.extend(shifted(model3d::emit_roof_cut_layers(&q)?, dz, shift_roof_layer));
|
||||
// Öffnungen brauchen alle Dächer (Dachfenster-Wirt liegt im selben Geschoss, Rest schadet nicht).
|
||||
q.roofs = p.roofs.clone();
|
||||
out.opening_meshes.extend(shifted(model3d::emit_opening_meshes(&q, detail), dz, shift_mesh));
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// Versatz je Geschoss-id (für die TS-seitigen truck-Extrusionen, `levelId`).
|
||||
pub fn floor_offsets(p: &Project, gap: f64) -> HashMap<String, f64> {
|
||||
Explode::new(p, gap).map(|ex| ex.by_floor.iter().map(|(k, v)| (k.to_string(), *v)).collect()).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Pick-Geometrie passend zu [`parts`]; 2D-Spuren und Kontext bleiben stehen wie im Modell.
|
||||
pub fn pick_geometry(p: &Project, gap: f64) -> Result<PickGeometry, String> {
|
||||
let mut g = model3d::pick_geometry(p)?;
|
||||
let Some(ex) = Explode::new(p, gap) else { return Ok(g) };
|
||||
for w in &mut g.walls {
|
||||
shift_wall(w, ex.of(&w.wall_id));
|
||||
}
|
||||
for s in &mut g.slabs {
|
||||
shift_slab(s, ex.of(&s.ceiling_id));
|
||||
}
|
||||
for o in &mut g.openings {
|
||||
o.base_elevation += ex.of(&o.opening_id);
|
||||
}
|
||||
for s in &mut g.stairs {
|
||||
let dz = ex.of(&s.stair_id);
|
||||
s.z_bottom += dz;
|
||||
s.z_top += dz;
|
||||
}
|
||||
// Dächer in Welt-Koordinaten (x, Höhe, y).
|
||||
for r in &mut g.roofs {
|
||||
let dz = ex.of(&r.roof_id);
|
||||
for v in r.tris.iter_mut().flatten() {
|
||||
v[1] += dz;
|
||||
}
|
||||
}
|
||||
Ok(g)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn project() -> Project {
|
||||
serde_json::from_value(serde_json::json!({
|
||||
"id": "p", "name": "t", "lineStyles": [], "hatches": [], "components": [], "wallTypes": [], "layers": [],
|
||||
"drawingLevels": [
|
||||
{"id": "OG", "name": "OG", "kind": "floor", "visible": true, "locked": false, "floorHeight": 3.0, "baseElevation": 3.0},
|
||||
{"id": "EG", "name": "EG", "kind": "floor", "visible": true, "locked": false, "floorHeight": 3.0, "baseElevation": 0.0}
|
||||
],
|
||||
"walls": [
|
||||
{"id": "w1", "type": "wall", "floorId": "EG", "categoryCode": "20", "start": {"x": 0, "y": 0}, "end": {"x": 5, "y": 0}, "wallTypeId": "", "height": 2.8},
|
||||
{"id": "w2", "type": "wall", "floorId": "OG", "categoryCode": "20", "start": {"x": 0, "y": 0}, "end": {"x": 5, "y": 0}, "wallTypeId": "", "height": 2.8}
|
||||
],
|
||||
"openings": [
|
||||
{"id": "o2", "type": "opening", "categoryCode": "21", "kind": "window", "hostWallId": "w2", "position": 2.5, "width": 1.0, "height": 1.2, "sillHeight": 0.9}
|
||||
],
|
||||
"ceilings": [
|
||||
{"id": "c1", "type": "ceiling", "floorId": "EG", "categoryCode": "30", "wallTypeId": "", "outline": [{"x": 0, "y": 0}, {"x": 5, "y": 0}, {"x": 5, "y": 4}, {"x": 0, "y": 4}], "thickness": 0.25}
|
||||
],
|
||||
"columns": [
|
||||
{"id": "k2", "type": "column", "floorId": "OG", "categoryCode": "25", "position": {"x": 2, "y": 2}, "profile": {"kind": "rect", "width": 0.3, "depth": 0.3}, "rotation": 0, "height": 2.5}
|
||||
],
|
||||
"context": [
|
||||
{"type": "importedMesh", "id": "m", "name": "M", "positions": [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0], "indices": [0.0, 1.0, 2.0]}
|
||||
]
|
||||
}))
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn min_z(meshes: &[RMesh]) -> f64 {
|
||||
meshes.iter().flat_map(|m| m.positions.chunks_exact(3).map(|c| c[2])).fold(f64::INFINITY, f64::min)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn abstand_null_ist_unveraendert() {
|
||||
let p = project();
|
||||
let a = serde_json::to_string(&model3d::parts(&p, true, 2.0, false).unwrap()).unwrap();
|
||||
let b = serde_json::to_string(&parts(&p, true, 2.0, false, 0.0).unwrap()).unwrap();
|
||||
assert_eq!(a, b);
|
||||
assert!(Explode::new(&p, f64::NAN).is_none());
|
||||
assert!(floor_offsets(&p, -1.0).is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn geschosse_um_index_mal_abstand_versetzt() {
|
||||
let p = project();
|
||||
let base = model3d::parts(&p, true, 2.0, false).unwrap();
|
||||
let ex = parts(&p, true, 2.0, false, 3.0).unwrap();
|
||||
let wall = |parts: &Parts, id: &str| parts.walls.iter().find(|w| w.wall_id == id).unwrap().base_elevation;
|
||||
assert!((wall(&ex, "w1") - wall(&base, "w1")).abs() < 1e-9, "EG (tiefstes) bleibt");
|
||||
assert!((wall(&ex, "w2") - wall(&base, "w2") - 3.0).abs() < 1e-9, "OG um 1 × 3 m");
|
||||
let slab = |parts: &Parts| parts.slabs.iter().find(|s| s.ceiling_id == "c1").unwrap().z_bottom;
|
||||
assert!((slab(&ex) - slab(&base)).abs() < 1e-9);
|
||||
// Öffnung folgt der Wand, Stütze ihrem Geschoss.
|
||||
assert_eq!(ex.opening_meshes.len(), base.opening_meshes.len());
|
||||
assert!(!ex.opening_meshes.is_empty());
|
||||
assert!((min_z(&ex.opening_meshes) - min_z(&base.opening_meshes) - 3.0).abs() < 1e-9);
|
||||
assert_eq!(ex.column_meshes.len(), base.column_meshes.len());
|
||||
assert!((min_z(&ex.column_meshes) - min_z(&base.column_meshes) - 3.0).abs() < 1e-9);
|
||||
// Kontext bleibt stehen.
|
||||
assert_eq!(serde_json::to_string(&ex.context_meshes).unwrap(), serde_json::to_string(&base.context_meshes).unwrap());
|
||||
let off = floor_offsets(&p, 3.0);
|
||||
assert_eq!(off.get("EG"), Some(&0.0));
|
||||
assert_eq!(off.get("OG"), Some(&3.0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pick_geometrie_folgt_dem_modell() {
|
||||
let p = project();
|
||||
let base = model3d::pick_geometry(&p).unwrap();
|
||||
let ex = pick_geometry(&p, 2.0).unwrap();
|
||||
let w2 = |g: &PickGeometry| g.walls.iter().find(|w| w.wall_id == "w2").unwrap().base_elevation;
|
||||
assert!((w2(&ex) - w2(&base) - 2.0).abs() < 1e-9);
|
||||
assert!((ex.openings[0].base_elevation - base.openings[0].base_elevation - 2.0).abs() < 1e-9);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hervorhebung_folgt_dem_modell() {
|
||||
let p = project();
|
||||
let args = |explode: f64| crate::highlight3d::Args { walls: vec!["w2".into()], explode, ..Default::default() };
|
||||
let a = crate::highlight3d::selection_highlight_lines(&p, &args(0.0)).unwrap();
|
||||
let b = crate::highlight3d::selection_highlight_lines(&p, &args(2.5)).unwrap();
|
||||
assert_eq!(a.len(), b.len());
|
||||
assert!(!a.is_empty());
|
||||
for (x, y) in a.chunks_exact(6).zip(b.chunks_exact(6)) {
|
||||
assert!((y[1] - x[1] - 2.5).abs() < 1e-5);
|
||||
assert_eq!(x[0], y[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,9 @@ pub struct Args {
|
||||
pub roofs: Vec<String>,
|
||||
pub context: Vec<String>,
|
||||
pub rgb: [f64; 3],
|
||||
/// Explosionsabstand ([65], `explode3d.rs`; fehlt/0 = aus): Linien folgen dem auseinandergezogenen Modell.
|
||||
#[serde(default)]
|
||||
pub explode: f64,
|
||||
}
|
||||
|
||||
const BOX_EDGES: [(usize, usize); 12] = [(0, 1), (0, 2), (0, 4), (1, 3), (1, 5), (2, 3), (2, 6), (3, 7), (4, 5), (4, 6), (5, 7), (6, 7)];
|
||||
@@ -98,32 +101,50 @@ fn set(ids: &[String]) -> HashSet<&str> {
|
||||
/// Linienliste der Hervorhebung (leer, wenn nichts gewählt ist).
|
||||
pub fn selection_highlight_lines(p: &Project, a: &Args) -> Result<Vec<f32>, String> {
|
||||
let mut out = Out { v: Vec::new(), rgb: a.rgb };
|
||||
// Explosionsaxonometrie: die Linien eines Bauteils ab Puffer-Index `from` um seinen Geschoss-Versatz heben (Welt-y).
|
||||
let ex = crate::explode3d::Explode::new(p, a.explode);
|
||||
let lift = |out: &mut Out, from: usize, id: &str| {
|
||||
let dz = ex.as_ref().map_or(0.0, |e| e.of(id)) as f32;
|
||||
if dz != 0.0 {
|
||||
for v in out.v[from..].chunks_exact_mut(6) {
|
||||
v[1] += dz;
|
||||
}
|
||||
}
|
||||
};
|
||||
let (walls, ceilings, openings, stairs, roofs, context) = (set(&a.walls), set(&a.ceilings), set(&a.openings), set(&a.stairs), set(&a.roofs), set(&a.context));
|
||||
if !walls.is_empty() {
|
||||
for w in emit_walls(p, true)? {
|
||||
if walls.contains(w.wall_id.as_str()) {
|
||||
let n = out.v.len();
|
||||
out.box_edges(w.start, w.end, w.thickness, w.height, w.base_elevation);
|
||||
lift(&mut out, n, &w.wall_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if !openings.is_empty() {
|
||||
for o in pick_openings(p) {
|
||||
if openings.contains(o.opening_id.as_str()) {
|
||||
let n = out.v.len();
|
||||
out.box_edges(o.start, o.end, o.thickness, o.height, o.base_elevation);
|
||||
lift(&mut out, n, &o.opening_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if !ceilings.is_empty() {
|
||||
for s in emit_slabs(p) {
|
||||
if ceilings.contains(s.ceiling_id.as_str()) {
|
||||
let n = out.v.len();
|
||||
out.prism_edges(&s.outline, s.z_bottom, s.z_top);
|
||||
lift(&mut out, n, &s.ceiling_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if !stairs.is_empty() {
|
||||
for st in pick_stairs(p) {
|
||||
if stairs.contains(st.stair_id.as_str()) {
|
||||
let n = out.v.len();
|
||||
out.prism_edges(&st.outline, st.z_bottom, st.z_top);
|
||||
lift(&mut out, n, &st.stair_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,6 +154,7 @@ pub fn selection_highlight_lines(p: &Project, a: &Args) -> Result<Vec<f32>, Stri
|
||||
continue;
|
||||
}
|
||||
let g = crate::roof::roof_geometry(&roof.params(), p.roof_base_elevation(roof));
|
||||
let n = out.v.len();
|
||||
for pts in g.planes.iter().chain(g.gables.iter()) {
|
||||
let m = pts.len();
|
||||
if m == 0 {
|
||||
@@ -145,6 +167,7 @@ pub fn selection_highlight_lines(p: &Project, a: &Args) -> Result<Vec<f32>, Stri
|
||||
j = i;
|
||||
}
|
||||
}
|
||||
lift(&mut out, n, &roof.id);
|
||||
}
|
||||
}
|
||||
if !context.is_empty() {
|
||||
|
||||
@@ -66,6 +66,7 @@ pub mod ops;
|
||||
pub mod mesh_section;
|
||||
pub mod model;
|
||||
pub mod model3d;
|
||||
pub mod explode3d;
|
||||
pub mod style;
|
||||
pub mod plan_elevation;
|
||||
pub mod hlr;
|
||||
|
||||
@@ -47,11 +47,20 @@ pub fn run(p: &Project, name: &str, args: &[f64], text: &str) -> Result<String,
|
||||
("surfaceOpening", _) => json(&crate::opening_shape::surface_opening_info(p, text)),
|
||||
("openingPreview", _) => json(&crate::opening_preview::opening_preview(p, text)),
|
||||
("scheduleCsv", 1) => Ok(export_schedule::export_schedule_csv(p, text, args[0] != 0.0)),
|
||||
("pickGeometry", _) => json(&model3d::pick_geometry(p)?),
|
||||
// `args[0]`: Explosionsabstand ([65], fehlt/0 = aus).
|
||||
("pickGeometry", _) => json(&crate::explode3d::pick_geometry(p, args.first().copied().unwrap_or(0.0))?),
|
||||
("modelJson", _) => crate::model::to_value_typed_only(p).map(|v| v.to_string()).map_err(|e| e.to_string()),
|
||||
// Mit Abzugskörpern (`args[3]` ≠ 0) zusätzlich `voidCuts`: die getroffenen Wände/Decken als
|
||||
// truck-Spezifikationen (`solid_specs.rs`).
|
||||
// `args[4]`: Explosionsabstand ([65], `explode3d.rs`; > 0 zusätzlich `floorOffsets`, ohne Abzugskörper).
|
||||
("model3dParts", n) if n >= 3 => {
|
||||
let explode = args.get(4).copied().filter(|g| g.is_finite() && *g > 0.0);
|
||||
if let Some(gap) = explode {
|
||||
let parts = crate::explode3d::parts(p, args[0] != 0.0, args[1], args[2] != 0.0, gap)?;
|
||||
let mut v = serde_json::to_value(&parts).map_err(|e| e.to_string())?;
|
||||
v["floorOffsets"] = serde_json::to_value(crate::explode3d::floor_offsets(p, gap)).map_err(|e| e.to_string())?;
|
||||
return Ok(v.to_string());
|
||||
}
|
||||
let parts = model3d::parts(p, args[0] != 0.0, args[1], args[2] != 0.0)?;
|
||||
if args.get(3).is_some_and(|v| *v != 0.0) {
|
||||
let cuts = crate::solid_specs::void_cuts(p, &parts.walls, &parts.slabs);
|
||||
|
||||
+3
-2
@@ -21,7 +21,7 @@
|
||||
// Bauteile ([B4]); Bericht als JSON auf stdout
|
||||
// dossier-cli <projekt.obp> import-mesh <datei.obj|stl|gltf|glb|ply> [--out neu.obp] [--unit mm|cm|m|inch|foot] [--up z|y|auto]
|
||||
// [--placement center|original] 3D-Modell als Kontext-Meshes; Bericht als JSON
|
||||
// dossier-cli <projekt.obp> model3d [--out modell.json] 3D-Modell fürs Headless-Rendern (render_png)
|
||||
// dossier-cli <projekt.obp> model3d [--explode 3] [--out modell.json] 3D-Modell fürs Headless-Rendern (render_png)
|
||||
// dossier-cli pointcloud-info <datei.las|laz|e57|ply|xyz|pts> [--voxel 0.05] [--max 2000000]
|
||||
// Punktwolke lesen ([B9]) und Bericht als JSON (ohne Projekt)
|
||||
// dossier-cli pdf-info <datei.pdf> [--page 1] Vektor-PDF lesen ([76]): Seiten, Pfade, Texte, BBox (pt) als JSON
|
||||
@@ -822,7 +822,8 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
await serveStdio(file);
|
||||
return 0;
|
||||
case "model3d":
|
||||
out(args, JSON.stringify(projectToModel3d(project)), `${project.name || "projekt"}.model3d.json`);
|
||||
// `--explode <m>`: Explosionsaxonometrie ([65]), Geschosse um Index × Abstand angehoben.
|
||||
out(args, JSON.stringify(projectToModel3d(project, { explode: Number(args.flags.get("explode") ?? 0) || 0 })), `${project.name || "projekt"}.model3d.json`);
|
||||
return 0;
|
||||
case "bench": {
|
||||
const runs = Number(args.flags.get("runs") ?? 10);
|
||||
|
||||
@@ -2778,6 +2778,9 @@ export const de = {
|
||||
"WebGPU konnte nicht initialisiert werden. In der Statusleiste auf WebGL2 umschalten, um die 3D-Ansicht weiter zu nutzen.",
|
||||
"viewport3d.grid.show": "Bodenraster einblenden",
|
||||
"viewport3d.grid.hide": "Bodenraster ausblenden",
|
||||
"viewport3d.explode.on": "Explosionsaxonometrie: Geschosse auseinanderziehen",
|
||||
"viewport3d.explode.off": "Explosionsaxonometrie beenden",
|
||||
"viewport3d.explode.gap": "Abstand zwischen den Geschossen (m)",
|
||||
"viewport3d.section.label": "Schnittebene",
|
||||
"viewport3d.section.show": "Schnittebene ein",
|
||||
"viewport3d.section.hide": "Schnittebene aus",
|
||||
|
||||
@@ -2765,6 +2765,9 @@ export const en: Record<TranslationKey, string> = {
|
||||
"WebGPU could not be initialized. Switch to WebGL2 in the status bar to keep using the 3D view.",
|
||||
"viewport3d.grid.show": "Show ground grid",
|
||||
"viewport3d.grid.hide": "Hide ground grid",
|
||||
"viewport3d.explode.on": "Exploded axonometric: pull storeys apart",
|
||||
"viewport3d.explode.off": "End exploded axonometric",
|
||||
"viewport3d.explode.gap": "Gap between storeys (m)",
|
||||
"viewport3d.section.label": "Section plane",
|
||||
"viewport3d.section.show": "Section plane on",
|
||||
"viewport3d.section.hide": "Section plane off",
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* [65] Explosionsaxonometrie: Fassade `projectToModel3d({ explode })`, `pickGeometry(…, explode)` und
|
||||
* `selectionHighlightLines(…, explode)` — Geschosse um Index × Abstand gehoben, 0 = unverändert.
|
||||
*/
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import { projectToModel3d, pickGeometry, selectionHighlightLines } from "./toWalls3d";
|
||||
|
||||
const floors = sampleProject.drawingLevels
|
||||
.filter((l) => l.kind === "floor")
|
||||
.sort((a, b) => (a.baseElevation ?? 0) - (b.baseElevation ?? 0));
|
||||
const index = new Map(floors.map((f, i) => [f.id, i]));
|
||||
const wallIndex = (id: string) => index.get(sampleProject.walls.find((w) => w.id === id)!.floorId) ?? 0;
|
||||
|
||||
describe("Explosionsaxonometrie", () => {
|
||||
it("Abstand 0 ändert nichts", () => {
|
||||
expect(JSON.stringify(projectToModel3d(sampleProject, { explode: 0 }))).toBe(JSON.stringify(projectToModel3d(sampleProject)));
|
||||
expect(JSON.stringify(pickGeometry(sampleProject, 0))).toBe(JSON.stringify(pickGeometry(sampleProject)));
|
||||
});
|
||||
|
||||
it("Wände heben sich um Geschoss-Index × Abstand, Modell und Pick stimmen überein", () => {
|
||||
expect(floors.length).toBeGreaterThan(1);
|
||||
const base = projectToModel3d(sampleProject);
|
||||
const ex = projectToModel3d(sampleProject, { explode: 3 });
|
||||
const pick = pickGeometry(sampleProject, 3);
|
||||
expect(ex.walls.length).toBe(base.walls.length);
|
||||
let lifted = 0;
|
||||
ex.walls.forEach((w, i) => {
|
||||
const dz = wallIndex(w.wallId) * 3;
|
||||
expect(w.baseElevation - base.walls[i].baseElevation).toBeCloseTo(dz, 9);
|
||||
if (dz > 0) lifted++;
|
||||
});
|
||||
expect(lifted).toBeGreaterThan(0);
|
||||
pick.walls.forEach((w, i) => expect(w.baseElevation).toBeCloseTo(ex.walls[i].baseElevation, 9));
|
||||
});
|
||||
|
||||
it("Hervorhebung folgt dem Versatz", () => {
|
||||
const w = sampleProject.walls.find((x) => wallIndex(x.id) > 0)!;
|
||||
const a = selectionHighlightLines(sampleProject, [w.id], [], [1, 0, 0]);
|
||||
const b = selectionHighlightLines(sampleProject, [w.id], [], [1, 0, 0], [], [], [], [], 2);
|
||||
expect(b.length).toBe(a.length);
|
||||
expect(b[1] - a[1]).toBeCloseTo(2 * wallIndex(w.id), 4);
|
||||
});
|
||||
});
|
||||
+23
-5
@@ -137,6 +137,12 @@ export interface Model3dOptions {
|
||||
* `toWalls3d/voids3d.ts`). Schnitt/Ansicht/Export behandeln Abzugskörper selbst.
|
||||
*/
|
||||
voids?: boolean;
|
||||
/**
|
||||
* Explosionsaxonometrie ([65]): Abstand (m) zwischen den Geschossen; 0/fehlt = aus. Jedes
|
||||
* Geschoss hebt sich um Index × Abstand (Kern `explode3d.rs`); Kontext bleibt stehen.
|
||||
* Mit Explosion keine Abzugskörper (die truck-Ergebnisse lägen am alten Ort).
|
||||
*/
|
||||
explode?: number;
|
||||
}
|
||||
|
||||
/** Das volle 3D-Modell: Wände (mit Öffnungen) + Deckenplatten + Kontext-Meshes. */
|
||||
@@ -144,14 +150,15 @@ export function projectToModel3d(project: Project, opts: Model3dOptions = {}): R
|
||||
const layered = opts.layeredWalls ?? true;
|
||||
const detail = opts.detail ?? "fein";
|
||||
// Mit `voids` liefert der Kern zusätzlich die getroffenen Wände/Decken als truck-Spezifikationen.
|
||||
const voids = !!opts.voids && typeof window !== "undefined";
|
||||
const explode = explodeGap(opts.explode);
|
||||
const voids = !!opts.voids && typeof window !== "undefined" && explode === 0;
|
||||
const parts = documentFor(project).query<Model3dParts>(
|
||||
"model3dParts",
|
||||
[layered ? 1 : 0, DETAIL_CODE[detail] ?? 3, opts.forSection ? 1 : 0, voids ? 1 : 0],
|
||||
[layered ? 1 : 0, DETAIL_CODE[detail] ?? 3, opts.forSection ? 1 : 0, voids ? 1 : 0, explode],
|
||||
);
|
||||
// Die truck-Körper (asynchron, mit Cache) kommen zwischen Kontext-Meshes und Stützen.
|
||||
const meshes: RMesh[] = [...parts.contextMeshes];
|
||||
for (const m of emitExtrudedSolids(project)) meshes.push(m);
|
||||
for (const m of emitExtrudedSolids(project, parts.floorOffsets)) meshes.push(m);
|
||||
for (const m of parts.columnMeshes) meshes.push(m);
|
||||
for (const m of parts.openingMeshes) meshes.push(m);
|
||||
for (const m of parts.stairMeshes) meshes.push(m);
|
||||
@@ -183,6 +190,13 @@ interface Model3dParts {
|
||||
roofLayers: RModel3d["roofLayers"];
|
||||
/** Nur mit Abzugskörpern: (Index im Modell, Bauteil − Körper) je getroffene Wand/Decke. */
|
||||
voidCuts?: VoidCuts;
|
||||
/** Nur mit Explosion: Versatz (m) je Geschoss-id (für die truck-Extrusionen). */
|
||||
floorOffsets?: Record<string, number>;
|
||||
}
|
||||
|
||||
/** Explosionsabstand bereinigt: endlich und > 0, sonst 0 (= aus). */
|
||||
function explodeGap(v: number | undefined): number {
|
||||
return typeof v === "number" && Number.isFinite(v) && v > 0 ? v : 0;
|
||||
}
|
||||
|
||||
const DETAIL_CODE: Record<string, number> = { grob: 0, mittel: 1, fein: 2 };
|
||||
@@ -200,6 +214,8 @@ const DETAIL_CODE: Record<string, number> = { grob: 0, mittel: 1, fein: 2 };
|
||||
*/
|
||||
export function pickGeometry(
|
||||
project: Project,
|
||||
/** Explosionsabstand ([65]) wie bei {@link projectToModel3d}; 0 = aus. */
|
||||
explode = 0,
|
||||
): {
|
||||
walls: RWall[];
|
||||
slabs: RSlab[];
|
||||
@@ -209,7 +225,7 @@ export function pickGeometry(
|
||||
contextMeshes: PickContextMesh[];
|
||||
drawings: PickDrawingSeg[];
|
||||
} {
|
||||
return documentFor(project).query("pickGeometry");
|
||||
return documentFor(project).query("pickGeometry", [explodeGap(explode)]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,11 +265,13 @@ export function selectionHighlightLines(
|
||||
stairIds: string[] = [],
|
||||
roofIds: string[] = [],
|
||||
contextObjectIds: string[] = [],
|
||||
/** Explosionsabstand ([65]); 0 = aus. */
|
||||
explode = 0,
|
||||
): Float32Array {
|
||||
const sel = { walls: wallIds, ceilings: ceilingIds, openings: openingIds, stairs: stairIds, roofs: roofIds, context: contextObjectIds };
|
||||
if (Object.values(sel).every((l) => l.length === 0)) return new Float32Array(0);
|
||||
// Gerechnet im Kern (`highlight3d.rs`); Antwort f32-LE.
|
||||
const b = documentFor(project).queryBin("selectionHighlight", [], JSON.stringify({ ...sel, rgb }));
|
||||
const b = documentFor(project).queryBin("selectionHighlight", [], JSON.stringify({ ...sel, rgb, explode: explodeGap(explode) }));
|
||||
return new Float32Array(b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength));
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,11 @@ function extrudedSolidSignature(solid: ExtrudedSolid): string {
|
||||
return `${solid.baseOffset ?? 0}|${solid.height}|${solid.taper ?? 0}|${solid.cornerRadius ?? 0}|${solid.chamfer ?? 0}|${brep}|${solid.points.map((p) => `${p.x},${p.y}`).join(";")}`;
|
||||
}
|
||||
|
||||
export function emitExtrudedSolids(project: Project): RMesh[] {
|
||||
export function emitExtrudedSolids(
|
||||
project: Project,
|
||||
/** Explosionsaxonometrie ([65]): Versatz (m) je Geschoss-id; der Cache bleibt unverschoben. */
|
||||
floorOffsets?: Record<string, number>,
|
||||
): RMesh[] {
|
||||
if (typeof window === "undefined") return [];
|
||||
const out: RMesh[] = [];
|
||||
// Cache-Einträge gelöschter/nicht mehr existierender Körper verwerfen (sonst
|
||||
@@ -94,7 +98,9 @@ export function emitExtrudedSolids(project: Project): RMesh[] {
|
||||
})
|
||||
.catch((e) => console.warn("truck-Extrusion fehlgeschlagen:", e));
|
||||
}
|
||||
if (entry.mesh) out.push(entry.mesh);
|
||||
if (!entry.mesh) continue;
|
||||
const dz = floorOffsets?.[solid.levelId] ?? 0;
|
||||
out.push(dz === 0 ? entry.mesh : { ...entry.mesh, positions: entry.mesh.positions.map((v, i) => (i % 3 === 2 ? v + dz : v)) });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@@ -37,6 +37,10 @@ export interface ViewSlice {
|
||||
// im Nordstern/WASM-Pfad — die three.js-Sicht zeigt ihr Raster unveraendert
|
||||
// immer; s. Wasm3DViewport.tsx).
|
||||
grid3dVisible: boolean;
|
||||
// Explosionsaxonometrie im 3D ([65]): Geschosse senkrecht auseinandergezogen (nur Ansicht,
|
||||
// nicht im Projekt) und der Abstand je Geschoss in Metern.
|
||||
explode3d: boolean;
|
||||
explode3dGap: number;
|
||||
// Farb-Modus des Grundrisses: "color" = Kategorie-/Element-Farben (heute),
|
||||
// "mono" = reiner Schwarz-Weiss-Plan (Tinte, keine Farb-/Schraffurfarben).
|
||||
planColorMode: "color" | "mono";
|
||||
@@ -65,6 +69,8 @@ export interface ViewSlice {
|
||||
setView3d: (v: View3d) => void;
|
||||
setFov: (n: number) => void;
|
||||
setGrid3dVisible: (b: boolean) => void;
|
||||
setExplode3d: (b: boolean) => void;
|
||||
setExplode3dGap: (m: number) => void;
|
||||
setPlanColorMode: (m: "color" | "mono") => void;
|
||||
setReferenceLines: (b: boolean) => void;
|
||||
setLineMode: (m: "display" | "print") => void;
|
||||
@@ -89,6 +95,8 @@ export function createViewSlice(api: StoreApi<ViewSlice>): ViewSlice {
|
||||
view3d: "perspective",
|
||||
fov: 50,
|
||||
grid3dVisible: true,
|
||||
explode3d: false,
|
||||
explode3dGap: 3,
|
||||
planColorMode: "color",
|
||||
referenceLines: false,
|
||||
lineMode: "display",
|
||||
@@ -114,6 +122,10 @@ export function createViewSlice(api: StoreApi<ViewSlice>): ViewSlice {
|
||||
setView3d: (v) => set({ view3d: v }),
|
||||
setFov: (n) => set({ fov: n }),
|
||||
setGrid3dVisible: (b) => set({ grid3dVisible: b }),
|
||||
setExplode3d: (b) => set({ explode3d: b }),
|
||||
setExplode3dGap: (m) => {
|
||||
if (Number.isFinite(m) && m > 0) set({ explode3dGap: Math.min(m, 100) });
|
||||
},
|
||||
setPlanColorMode: (m) => set({ planColorMode: m }),
|
||||
setReferenceLines: (b) => set({ referenceLines: b }),
|
||||
setLineMode: (m) => set({ lineMode: m }),
|
||||
|
||||
@@ -65,6 +65,7 @@ import type { Vec3 } from "../core";
|
||||
import { drawingGripVertices, drawingMoveAnchor } from "./drawingGrips";
|
||||
import { pointCloudSyncItems } from "./pointCloudSync";
|
||||
import { usePointClouds } from "../state/pointCloudStore";
|
||||
import { useStore } from "../state/appStore";
|
||||
import { projectGeoOrigin } from "../core";
|
||||
import {
|
||||
FOV_Y,
|
||||
@@ -562,6 +563,14 @@ export function Wasm3DViewport({
|
||||
groundElevationRef.current = groundElevation;
|
||||
const detailRef = useRef(detail);
|
||||
detailRef.current = detail;
|
||||
// Explosionsaxonometrie ([65], Ansichtszustand): Abstand je Geschoss, 0 = aus.
|
||||
const explodeOn = useStore((s) => s.explode3d);
|
||||
const explodeGap = useStore((s) => s.explode3dGap);
|
||||
const setExplodeOn = useStore((s) => s.setExplode3d);
|
||||
const setExplodeGap = useStore((s) => s.setExplode3dGap);
|
||||
const explode = explodeOn ? explodeGap : 0;
|
||||
const explodeRef = useRef(explode);
|
||||
explodeRef.current = explode;
|
||||
const {
|
||||
render,
|
||||
updateModel,
|
||||
@@ -606,9 +615,9 @@ export function Wasm3DViewport({
|
||||
// Snapshot) — nur das `view3d`-Effekt unten springt aktiv auf ein Praeset.
|
||||
useEffect(() => {
|
||||
if (!ready) return;
|
||||
updateModel(project, detail);
|
||||
updateModel(project, detail, explode);
|
||||
redrawRef.current();
|
||||
}, [ready, project, detail, updateModel]);
|
||||
}, [ready, project, detail, explode, updateModel]);
|
||||
|
||||
// Punktwolken abgleichen (neu/umgestellt/entfernt) und neu zeichnen, wenn sich etwas tat.
|
||||
useEffect(() => {
|
||||
@@ -633,7 +642,7 @@ export function Wasm3DViewport({
|
||||
useEffect(() => {
|
||||
if (!ready) return;
|
||||
const onMeshReady = () => {
|
||||
updateModel(projectRef.current, detailRef.current);
|
||||
updateModel(projectRef.current, detailRef.current, explodeRef.current);
|
||||
redrawRef.current();
|
||||
};
|
||||
window.addEventListener(TRUCK_MESH_READY_EVENT, onMeshReady);
|
||||
@@ -1371,6 +1380,7 @@ export function Wasm3DViewport({
|
||||
const ray = cameraRay(orbitCamera(o), ndc.ndcX, ndc.ndcY, ndc.aspect);
|
||||
const { walls, slabs, openings, stairs, roofs, contextMeshes, drawings } = pickGeometry(
|
||||
projectRef.current,
|
||||
explodeRef.current,
|
||||
);
|
||||
// Erweiterter Pick inkl. Öffnungen (Fenster/Türen) + Treppen + Kontext-
|
||||
// Meshes + freie 2D-Zeichnungen (Linie/Polylinie/Rechteck, s.
|
||||
@@ -1853,6 +1863,56 @@ export function Wasm3DViewport({
|
||||
</span>
|
||||
</button>
|
||||
)}
|
||||
{/* Explosionsaxonometrie ([65]): Umschalter links neben dem Raster-Knopf, aktiv mit Abstandsfeld. */}
|
||||
<div style={{ position: "absolute", right: onToggleGrid ? 48 : 10, bottom: 10, display: "flex", gap: 4, alignItems: "center" }}>
|
||||
{explodeOn && (
|
||||
<input
|
||||
type="number"
|
||||
min={0.5}
|
||||
max={100}
|
||||
step={0.5}
|
||||
value={explodeGap}
|
||||
aria-label={t("viewport3d.explode.gap")}
|
||||
title={t("viewport3d.explode.gap")}
|
||||
onChange={(e) => setExplodeGap(Number(e.target.value))}
|
||||
style={{
|
||||
width: 56,
|
||||
height: 30,
|
||||
boxSizing: "border-box",
|
||||
borderRadius: 7,
|
||||
border: "1px solid rgba(255,255,255,0.14)",
|
||||
background: "rgba(20,20,24,0.65)",
|
||||
color: "#f2f2f2",
|
||||
padding: "0 6px",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
data-testid="explode3d-toggle"
|
||||
onClick={() => setExplodeOn(!explodeOn)}
|
||||
title={t(explodeOn ? "viewport3d.explode.off" : "viewport3d.explode.on")}
|
||||
aria-pressed={explodeOn}
|
||||
style={{
|
||||
width: 30,
|
||||
height: 30,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
padding: 0,
|
||||
borderRadius: 7,
|
||||
border: "1px solid rgba(255,255,255,0.14)",
|
||||
background: explodeOn ? "rgba(255,255,255,0.14)" : "rgba(20,20,24,0.65)",
|
||||
color: explodeOn ? "#f2f2f2" : "#9a9a9a",
|
||||
cursor: "pointer",
|
||||
backdropFilter: "blur(4px)",
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-outlined" aria-hidden="true" style={{ fontSize: 18 }}>
|
||||
{explodeOn ? "unfold_less" : "unfold_more"}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
{failed && (
|
||||
<div className="viewport-fallback">
|
||||
<strong>{t("viewport3d.engineUnavailable")}</strong>
|
||||
|
||||
@@ -231,11 +231,11 @@ export function useWasm3dRenderer(
|
||||
|
||||
/** Modell bei Projektänderung neu setzen (re-extrudiert in Rust). `detail`
|
||||
* steuert den Öffnungs-Detailgrad (grob/mittel/fein) im 3D wie im Grundriss. */
|
||||
const updateModel = useCallback((project: Project, detail?: DetailLevel) => {
|
||||
const updateModel = useCallback((project: Project, detail?: DetailLevel, explode = 0) => {
|
||||
const r = rendererRef.current;
|
||||
if (!r || !project) return;
|
||||
try {
|
||||
r.set_model(JSON.stringify(projectToModel3d(project, { detail, voids: true })));
|
||||
r.set_model(JSON.stringify(projectToModel3d(project, { detail, voids: true, explode })));
|
||||
} catch (e) {
|
||||
console.warn("render3d set_model fehlgeschlagen:", e);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import { selectionHighlightLines } from "../core";
|
||||
import { clashHighlightLines } from "../analysis/clash";
|
||||
import { useClashSession } from "../panels/clashSession";
|
||||
import { applyGroupDimmingToPlan } from "../state/groupActions";
|
||||
import { useStore } from "../state/appStore";
|
||||
import { PlanView } from "./plan/PlanView";
|
||||
import type {
|
||||
GripHandlers,
|
||||
@@ -293,6 +294,8 @@ export const Content = memo(function Content({
|
||||
// die three.js-Sicht hebt die Auswahl weiterhin über ihr eigenes Material
|
||||
// hervor. Leere Auswahl → null (kein Highlight).
|
||||
const clashes = useClashSession().clashes;
|
||||
// Explosionsaxonometrie ([65]): Hervorhebung folgt dem auseinandergezogenen 3D-Modell.
|
||||
const explode = useStore((s) => (s.explode3d ? s.explode3dGap : 0));
|
||||
const selectionLines = useMemo(
|
||||
() =>
|
||||
selectedWallIds.length === 0 &&
|
||||
@@ -311,9 +314,11 @@ export const Content = memo(function Content({
|
||||
selectedStairIds,
|
||||
selectedRoofIds,
|
||||
selectedContextObjectIds,
|
||||
explode,
|
||||
),
|
||||
[
|
||||
project,
|
||||
explode,
|
||||
selectedWallIds,
|
||||
selectedCeilingIds,
|
||||
selectedOpeningIds,
|
||||
|
||||
Reference in new issue
Block a user