[279] Geländer als eigenes Bauteil: Modell, Grundriss, Schnitt, Ansicht, 3D, 3D-Dokument, IFC IfcRailing, DXF-Ebene, Umbau und Varianten, Befehl gelaender, Objekt-Info, Griffe, Beispiel Wettbewerb
This commit is contained in:
103 files changed
+2289
-73
No files matched your search
@@ -32,6 +32,8 @@ pub enum Owner {
|
||||
Roof(usize),
|
||||
Column(usize),
|
||||
Tree(usize),
|
||||
/// [279] Index in `Project::railings`.
|
||||
Railing(usize),
|
||||
Stair(usize),
|
||||
Context(usize),
|
||||
/// [115] Index in `Project::extruded_solids`.
|
||||
@@ -49,6 +51,7 @@ impl Owner {
|
||||
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::Tree(i) => at(&p.trees, i).map(|e| e.id.as_str()),
|
||||
Owner::Railing(i) => at(&p.railings, 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()),
|
||||
Owner::Solid(i) => at(&p.extruded_solids, i).map(|e| e.id.as_str()),
|
||||
@@ -157,6 +160,9 @@ impl ClassFilter {
|
||||
for t in p.trees.as_deref().unwrap_or(&[]) {
|
||||
add(&t.category_code, &t.id, &t.floor_id);
|
||||
}
|
||||
for t in p.railings.as_deref().unwrap_or(&[]) {
|
||||
add(&t.category_code, &t.id, &t.floor_id);
|
||||
}
|
||||
for s in p.extruded_solids.as_deref().unwrap_or(&[]) {
|
||||
add(&s.category_code, &s.id, "");
|
||||
}
|
||||
@@ -187,6 +193,7 @@ impl ClassFilter {
|
||||
.chain(p.stairs.iter().flatten().map(|s| &s.id))
|
||||
.chain(p.columns.iter().flatten().map(|c| &c.id))
|
||||
.chain(p.trees.iter().flatten().map(|t| &t.id))
|
||||
.chain(p.railings.iter().flatten().map(|t| &t.id))
|
||||
.chain(p.extruded_solids.iter().flatten().map(|s| &s.id))
|
||||
.chain(p.drawings2d.iter().map(|d| &d.id))
|
||||
.chain(p.openings.iter().flatten().map(|o| &o.id));
|
||||
@@ -306,6 +313,7 @@ impl ClassFilter {
|
||||
g.stair_meshes.retain(|s| k(&s.stair_id));
|
||||
g.drawing_meshes.retain(|d| k(&d.drawing_id));
|
||||
g.trees.retain(|t| k(&t.tree_id));
|
||||
g.railings.retain(|t| k(&t.railing_id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,6 +329,7 @@ pub fn parts_filtered(p: &Project, layered: bool, detail: f64, for_section: bool
|
||||
column_meshes: {
|
||||
let mut m = emit_columns(p);
|
||||
m.extend(emit_trees(p));
|
||||
m.extend(emit_railings(p));
|
||||
m
|
||||
},
|
||||
opening_meshes: emit_opening_meshes_with(p, detail, &|o| f.keep_opening(o)),
|
||||
|
||||
@@ -24,6 +24,7 @@ use crate::jsnum::round;
|
||||
mod ceilings;
|
||||
pub(crate) mod bearing;
|
||||
mod columns;
|
||||
mod railings;
|
||||
mod walls;
|
||||
mod wall_body;
|
||||
mod openings;
|
||||
@@ -39,6 +40,7 @@ mod arc_zone_tests;
|
||||
|
||||
pub use ceilings::*;
|
||||
pub use columns::*;
|
||||
pub use railings::*;
|
||||
pub use walls::*;
|
||||
pub use openings::*;
|
||||
pub use stairs::*;
|
||||
@@ -100,6 +102,8 @@ pub enum SlabSource {
|
||||
Stair { index: usize },
|
||||
/// [141] Index in `Project::columns` (Stützen-Prisma, je Höhenabschnitt von [`column_pieces`]).
|
||||
Column { index: usize },
|
||||
/// [279] Index in `Project::railings` (Prisma je Teil, `railing::pieces`).
|
||||
Railing { index: usize, fill: bool },
|
||||
}
|
||||
|
||||
/// Ein rohes Dreiecks-Mesh (`RMesh`).
|
||||
|
||||
@@ -48,6 +48,14 @@ pub struct PickColumn {
|
||||
pub column_id: String,
|
||||
}
|
||||
|
||||
/// [279] Geländer für den 3D-Pick.
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PickRailing {
|
||||
pub tris: Vec<Tri>,
|
||||
pub railing_id: String,
|
||||
}
|
||||
|
||||
/// [149] Baum für den 3D-Pick.
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@@ -115,6 +123,8 @@ pub struct PickGeometry {
|
||||
pub drawing_meshes: Vec<PickDrawingMesh>,
|
||||
/// [149] Bäume (Stamm + Krone).
|
||||
pub trees: Vec<PickTree>,
|
||||
/// [279] Geländer.
|
||||
pub railings: Vec<PickRailing>,
|
||||
}
|
||||
|
||||
/// Öffnungen als Quader (Laibung zu Laibung, Wanddicke, Brüstung bis Sturz) für Pick und Hervorhebung.
|
||||
@@ -275,6 +285,7 @@ pub fn pick_geometry(p: &Project) -> Result<PickGeometry, String> {
|
||||
stair_meshes: pick_stair_railings(p),
|
||||
drawing_meshes: pick_drawing_meshes(p, &HashMap::new()),
|
||||
trees: pick_trees(p),
|
||||
railings: pick_railings(p),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
//! [279] Geländer im 3D: Netze (`emit_railings`, im 3D bei den Stützen eingereiht), Platten für Schnitt, Ansicht und
|
||||
//! 3D-Dokument (`railing_slabs`, Herkunft `SlabSource::Railing`) und die Pick-Geometrie. Die Körper liefert
|
||||
//! `crate::railing::pieces` (lotrechte Prismen), eine Quelle für alle Ableitungen.
|
||||
|
||||
use super::*;
|
||||
use crate::railing::{self, Part, Piece};
|
||||
|
||||
/// Prismen der Teile `pieces` als ein Netz (Modell x, y, z).
|
||||
fn merge<'a>(pieces: impl Iterator<Item = &'a Piece>) -> Option<(Vec<f64>, Vec<u32>)> {
|
||||
let (mut positions, mut indices) = (Vec::new(), Vec::new());
|
||||
for q in pieces {
|
||||
if q.outline.len() < 3 || !(q.z1 - q.z0 > 1e-6) || !q.outline.iter().all(|v| v[0].is_finite() && v[1].is_finite()) {
|
||||
continue;
|
||||
}
|
||||
let (pp, ii) = crate::columns3d::prism(&q.outline, q.z0, q.z1);
|
||||
let base = (positions.len() / 3) as u32;
|
||||
positions.extend(pp);
|
||||
indices.extend(ii.into_iter().map(|i| i + base));
|
||||
}
|
||||
(!indices.is_empty()).then_some((positions, indices))
|
||||
}
|
||||
|
||||
/// Geländer als Netze: je Geländer die Tafel (Glas, Lochblech, Brüstung) und das Gestänge (Pfosten, Stäbe, Schienen,
|
||||
/// Handlauf) als eigene Netze mit eigener Farbe.
|
||||
pub fn emit_railings(p: &Project) -> Vec<RMesh> {
|
||||
let mut out = Vec::new();
|
||||
for (ri, r) in p.railings.as_deref().unwrap_or(&[]).iter().enumerate() {
|
||||
let pcs = railing::pieces(p, r);
|
||||
for fill in [true, false] {
|
||||
let Some((positions, indices)) = merge(pcs.iter().filter(|q| (q.part == Part::Fill) == fill)) else { continue };
|
||||
let color = railing::color(p, r, if fill { Part::Fill } else { Part::Rail });
|
||||
out.push(RMesh { crease_angle: None, positions, indices, kind: "extrusion", color, vertex_colors: None, material_index: None, owner: Owner::Railing(ri) });
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Geländer als lotrechte Prismen-Platten (Schnitt, Ansicht, 3D-Dokument), Herkunft `SlabSource::Railing`.
|
||||
pub fn railing_slabs(p: &Project) -> Vec<RSlab> {
|
||||
let mut out = Vec::new();
|
||||
for (index, r) in p.railings.as_deref().unwrap_or(&[]).iter().enumerate() {
|
||||
for q in railing::pieces(p, r) {
|
||||
if q.z1 - q.z0 > 1e-6 && q.outline.len() >= 3 {
|
||||
let color = railing::color(p, r, q.part);
|
||||
let fill = q.part == Part::Fill;
|
||||
out.push(RSlab { outline: q.outline, z_bottom: q.z0, z_top: q.z1, color, ceiling_id: r.id.clone(), hatch: None, cut: None, monolith: None, source: SlabSource::Railing { index, fill } });
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Geländer als Welt-Dreiecke für den 3D-Pick (wie [`emit_railings`]).
|
||||
pub fn pick_railings(p: &Project) -> Vec<PickRailing> {
|
||||
let mut out = Vec::new();
|
||||
for r in p.railings.as_deref().unwrap_or(&[]) {
|
||||
let pcs = railing::pieces(p, r);
|
||||
if let Some((pos, idx)) = merge(pcs.iter()) {
|
||||
let tris = extrusion_tris(&pos, &idx);
|
||||
if !tris.is_empty() {
|
||||
out.push(PickRailing { tris, railing_id: r.id.clone() });
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
Reference in new issue
Block a user