[140] Plandarstellung: Strichstärken-Rangfolge (Massstab, Schnittkante, Silhouette, Symbole, Bemassung)
This commit is contained in:
12 files changed
+166
-40
No files matched your search
@@ -419,7 +419,7 @@ fn model_to_mm(m: f64, scale: f64) -> f64 {
|
||||
}
|
||||
|
||||
/// Standard-Schrifthöhe der Masszahl (Papier-mm, `DIM_DEFAULTS_MM.textHeight`).
|
||||
const DIM_TEXT_HEIGHT_MM: f64 = 4.0;
|
||||
const DIM_TEXT_HEIGHT_MM: f64 = 2.5;
|
||||
|
||||
/// `dimTextFrame` der TS-Fassade: bei nicht endlichen Eingaben alles NaN.
|
||||
fn dim_frame(a: (f64, f64), b: (f64, f64), offset: f64, h: f64) -> ((f64, f64), (f64, f64), (f64, f64)) {
|
||||
|
||||
@@ -134,7 +134,8 @@ fn terrain_contours(c: &Ctx, t: &TerrainMesh, out: &mut Vec<Primitive>) {
|
||||
for l in crate::terrain::isolines(st.current(), iv, 0.0) {
|
||||
let k = (l.level / iv).round() as i64;
|
||||
let index = k.rem_euclid(every) == 0;
|
||||
let w = if index { 0.25 } else { 0.1 };
|
||||
// [140] Zähllinie mittel (0.18), Höhenlinie fein (0.1): Gelände bleibt unter dem Gebäude zurück.
|
||||
let w = if index { 0.18 } else { 0.1 };
|
||||
let n = l.pts.len();
|
||||
let segs = if l.closed { n } else { n - 1 };
|
||||
let seg_len = |i: usize| (l.pts[(i + 1) % n][0] - l.pts[i][0]).hypot(l.pts[(i + 1) % n][1] - l.pts[i][1]);
|
||||
@@ -373,7 +374,7 @@ mod tests {
|
||||
let mut out = Vec::new();
|
||||
plan_context(&Ctx::new(&p, &a), &mut out);
|
||||
let w = |m: f64| out.iter().filter(|q| matches!(q, Primitive::Line { weight_mm, color: Some(c), .. } if *weight_mm == m && c == TERRAIN_INK)).count();
|
||||
assert!(w(0.1) > 4 && w(0.25) > 0, "{} {}", w(0.1), w(0.25));
|
||||
assert!(w(0.1) > 4 && w(0.18) > 0, "{} {}", w(0.1), w(0.18));
|
||||
let labels: Vec<&str> = out.iter().filter_map(|q| if let Primitive::DrawingText { text, .. } = q { Some(text.as_str()) } else { None }).collect();
|
||||
assert!(labels.contains(&"5"), "{labels:?}");
|
||||
let ex = out.iter().filter(|q| matches!(q, Primitive::Line { color: Some(c), .. } if c == EXCAVATION_INK)).count();
|
||||
@@ -381,7 +382,7 @@ mod tests {
|
||||
// Die Zähllinie ist unter ihrer Beschriftung unterbrochen: keine Linie läuft durch den Textmittelpunkt.
|
||||
let at = out.iter().find_map(|q| if let Primitive::DrawingText { text, at, .. } = q { (text == "5").then_some(*at) } else { None }).unwrap();
|
||||
let near = out.iter().filter(|q| matches!(q, Primitive::Line { a, b, weight_mm, color: Some(c), .. }
|
||||
if *weight_mm == 0.25 && c == TERRAIN_INK && (a.x.min(b.x) - 0.01..=a.x.max(b.x) + 0.01).contains(&at.x) && (a.y.min(b.y) - 0.01..=a.y.max(b.y) + 0.01).contains(&at.y))).count();
|
||||
if *weight_mm == 0.18 && c == TERRAIN_INK && (a.x.min(b.x) - 0.01..=a.x.max(b.x) + 0.01).contains(&at.x) && (a.y.min(b.y) - 0.01..=a.y.max(b.y) + 0.01).contains(&at.y))).count();
|
||||
assert_eq!(near, 0, "Linie läuft durch das Etikett bei {at:?}");
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,9 @@ pub const DEFAULT_SCALE_DENOMINATOR: f64 = 100.0;
|
||||
// Bemassung (SIA 400 B.5.3): Defaults in Papier-mm (`model/dimension.ts`).
|
||||
const DIM_GAP_MM: f64 = 1.0;
|
||||
const DIM_OVERSHOOT_MM: f64 = 1.0;
|
||||
const DIM_TICK_LEN_MM: f64 = 3.0;
|
||||
const DIM_TEXT_HEIGHT_MM: f64 = 4.0;
|
||||
// [140] Masszahl 2.5 mm, Schrägstrich 2 mm (vorher 4 / 3 — grösser als Raumstempel).
|
||||
const DIM_TICK_LEN_MM: f64 = 2.0;
|
||||
const DIM_TEXT_HEIGHT_MM: f64 = 2.5;
|
||||
|
||||
// Höhenkote (SIA 400 B.5.4), fixe Modell-Meter.
|
||||
const KOTE_TRI_SIZE_M: f64 = 0.15;
|
||||
@@ -1858,7 +1859,7 @@ mod tests {
|
||||
match &out[5] {
|
||||
Primitive::DrawingText { text, height_m, .. } => {
|
||||
assert_eq!(text, "3.25");
|
||||
assert!((height_m - 0.2).abs() < 1e-12);
|
||||
assert!((height_m - 0.125).abs() < 1e-12);
|
||||
}
|
||||
o => panic!("{o:?}"),
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ const K_INSERT: usize = 7;
|
||||
/// Bemassungs-Standards in Papier-mm (`DIM_DEFAULTS_MM`).
|
||||
const DIM_GAP: f64 = 1.0;
|
||||
const DIM_OVERSHOOT: f64 = 1.0;
|
||||
const DIM_TICK: f64 = 3.0;
|
||||
const DIM_TEXT: f64 = 4.0;
|
||||
const DIM_TICK: f64 = 2.0;
|
||||
const DIM_TEXT: f64 = 2.5;
|
||||
|
||||
/// Optionen des Exports.
|
||||
pub struct DxfOptions {
|
||||
|
||||
@@ -15,6 +15,10 @@ use std::collections::HashMap;
|
||||
|
||||
const EDGE_INK: &str = "#2b3039";
|
||||
const EDGE_MM: f64 = 0.13;
|
||||
/// [140] Silhouette (Umriss aller Bauteile zusammen) mittelstark: hebt den Baukörper von Details ab.
|
||||
const SILHOUETTE_MM: f64 = 0.35;
|
||||
/// [140] Abstand (m), bis zu dem eine Kante als Teil der Silhouette gilt.
|
||||
const SILHOUETTE_TOL: f64 = 2e-3;
|
||||
const FRAME_MM: f64 = 0.18;
|
||||
const GLASS_FILL_MONO: &str = "#c4c8cd";
|
||||
const GLASS_FILL_COLOR: &str = "#9fc2d9";
|
||||
@@ -1096,6 +1100,26 @@ fn outline_line(a: Pt, b: Pt) -> Primitive {
|
||||
line(v2(a[0], a[1]), v2(b[0], b[1]), "elevation-outline", EDGE_MM, EDGE_INK)
|
||||
}
|
||||
|
||||
/// [140] Ränder der vereinigten Bauteilflächen (Silhouette des Baukörpers in der Ansicht).
|
||||
fn silhouette_rings(faces: &[Face]) -> Vec<Vec<Pt>> {
|
||||
let polys: Vec<crate::flat::Polygon> = faces.iter().filter(|f| f.pts.len() >= 3).map(|f| vec![f.pts.clone()]).collect();
|
||||
crate::polygon_bool::union(&polys).into_iter().flatten().collect()
|
||||
}
|
||||
|
||||
/// Liegt `q` (bis [`SILHOUETTE_TOL`]) auf einem der Ringe?
|
||||
fn on_rings(rings: &[Vec<Pt>], q: Pt) -> bool {
|
||||
rings.iter().any(|r| {
|
||||
(0..r.len()).any(|i| {
|
||||
let (a, b) = (r[i], r[(i + 1) % r.len()]);
|
||||
let (dx, dy) = (b[0] - a[0], b[1] - a[1]);
|
||||
let l2 = dx * dx + dy * dy;
|
||||
let t = if l2 > 0.0 { (((q[0] - a[0]) * dx + (q[1] - a[1]) * dy) / l2).clamp(0.0, 1.0) } else { 0.0 };
|
||||
let (ex, ey) = (a[0] + t * dx - q[0], a[1] + t * dy - q[1]);
|
||||
ex * ex + ey * ey <= SILHOUETTE_TOL * SILHOUETTE_TOL
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
fn poly_prim(pts: Vec<Vec2>, fill: &str, stroke: &str, w: f64, opening: Option<&str>) -> Primitive {
|
||||
let mut pr = polygon(pts, fill, stroke, w, no_hatch());
|
||||
if let (Primitive::Polygon { opening_id, .. }, Some(id)) = (&mut pr, opening) {
|
||||
@@ -1495,6 +1519,7 @@ pub fn elevation_primitives(p: &Project, level: &LevelSpec, shadows: bool, mono:
|
||||
});
|
||||
let mut prims: Vec<Primitive> = items.into_iter().map(|it| it.prim).collect();
|
||||
// Exakt sichtbare Kanten liegen über allen Füllungen (die Füllungen bleiben Maler-Ordnung).
|
||||
let silhouette = silhouette_rings(&faces);
|
||||
for e in &edges {
|
||||
acc.add(e.a[0], e.a[1]);
|
||||
acc.add(e.b[0], e.b[1]);
|
||||
@@ -1504,6 +1529,8 @@ pub fn elevation_primitives(p: &Project, level: &LevelSpec, shadows: bool, mono:
|
||||
*dash = Some(Some(HIDDEN_DASH.to_vec()));
|
||||
}
|
||||
prims.push(l);
|
||||
} else if on_rings(&silhouette, [(e.a[0] + e.b[0]) / 2.0, (e.a[1] + e.b[1]) / 2.0]) {
|
||||
prims.push(line(v2(e.a[0], e.a[1]), v2(e.b[0], e.b[1]), "elevation-outline", SILHOUETTE_MM, EDGE_INK));
|
||||
} else {
|
||||
prims.push(outline_line(e.a, e.b));
|
||||
}
|
||||
@@ -2125,6 +2152,25 @@ mod tests {
|
||||
}
|
||||
|
||||
/// [132] Stützen erscheinen in der Ansicht (Fläche mit Pick-Id, Umriss); runde ohne Facettenfugen.
|
||||
/// [140] Ansicht: Silhouette des Baukörpers mittel (0.35), innere Kanten fein (0.13), Grundlinie schwer.
|
||||
#[test]
|
||||
fn silhouette_mittel_details_fein() {
|
||||
let p = proj132(
|
||||
serde_json::json!([]),
|
||||
serde_json::json!([
|
||||
{"id": "C1", "type": "column", "floorId": "F", "categoryCode": "25", "position": {"x": 2, "y": 2}, "profile": {"kind": "rect", "width": 0.2, "depth": 0.2}, "rotation": 0, "height": 2.5},
|
||||
{"id": "C2", "type": "column", "floorId": "F", "categoryCode": "25", "position": {"x": 2, "y": 4}, "profile": {"kind": "rect", "width": 0.6, "depth": 0.2}, "rotation": 0, "height": 1.5}
|
||||
]),
|
||||
);
|
||||
let prims = view132(&p, "s");
|
||||
let ws: Vec<f64> = prims.iter().filter_map(|q| match q { Primitive::Line { cls, weight_mm, .. } if cls == "elevation-outline" => Some(*weight_mm), _ => None }).collect();
|
||||
assert!(ws.contains(&SILHOUETTE_MM), "Silhouette fehlt: {ws:?}");
|
||||
// C1 (schmal, vorne) steht vor C2 (breiter, niedriger): die Oberkante von C2 ist Silhouette, die
|
||||
// Kanten von C1 innerhalb von C2 sind fein.
|
||||
assert!(ws.contains(&EDGE_MM), "innere Kanten fehlen: {ws:?}");
|
||||
assert!(GROUND_MM > SILHOUETTE_MM && SILHOUETTE_MM > EDGE_MM);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stuetzen_in_der_ansicht() {
|
||||
let p = proj132(
|
||||
|
||||
@@ -364,19 +364,34 @@ pub fn cut_z(p: &Project, floor: &str) -> f64 {
|
||||
// ── Schwarz-Weiss und Strichstärken ─────────────────────────────────────────────────────────────
|
||||
|
||||
const REFERENCE_SCALE: f64 = 100.0;
|
||||
const MIN_FACTOR: f64 = 0.5;
|
||||
const MAX_FACTOR: f64 = 1.6;
|
||||
const MIN_FACTOR: f64 = 0.4;
|
||||
const MAX_FACTOR: f64 = 2.0;
|
||||
/// [140] Sockel (Papier-mm), der nicht mit dem Massstab wächst/schrumpft: feine Linien (Schraffur,
|
||||
/// Bemassung) ändern sich kaum, Haarlinien darunter gar nicht.
|
||||
const FINE_MM: f64 = 0.09;
|
||||
|
||||
/// Strichstärken-Faktor für 1:`scale` ([32], nur mit `Project.scaleLineWeights`): (100/n)^0.25,
|
||||
/// begrenzt auf 0,5–1,6; sonst 1.
|
||||
/// Strichstärken-Faktor für 1:`scale` ([32], nur mit `Project.scaleLineWeights`): (100/n)^0.5 (1:50 ≈ 1.41,
|
||||
/// 1:200 ≈ 0.71, 1:500 ≈ 0.45), begrenzt auf 0,4–2; sonst 1. Wirkt über [`scale_weight`] je nach Stärke.
|
||||
pub fn line_weight_factor(p: &Project, scale: f64) -> f64 {
|
||||
if p.scale_line_weights != Some(true) || !(scale > 0.0) || !scale.is_finite() {
|
||||
return 1.0;
|
||||
}
|
||||
let f = jsnum::pow(REFERENCE_SCALE / scale, 0.25);
|
||||
let f = jsnum::pow(REFERENCE_SCALE / scale, 0.5);
|
||||
jsnum::min(MAX_FACTOR, jsnum::max(MIN_FACTOR, f))
|
||||
}
|
||||
|
||||
/// [140] Stärke `w` (Papier-mm, bezogen auf 1:100) beim Massstabsfaktor `f`: nur der Anteil über dem
|
||||
/// Sockel [`FINE_MM`] skaliert (w' = 0.09 + (w − 0.09)·f). Schwere Linien folgen dem Massstab fast ganz
|
||||
/// (Schnittkante 0.5 → 0.67 bei 1:50, → 0.38 bei 1:200), feine kaum (0.13 → 0.15 / 0.12) — die Rangfolge
|
||||
/// bleibt in jedem Massstab erhalten (linear, steigend), und Schraffuren fallen in 1:200/1:500 nicht unter
|
||||
/// die Druckgrenze. Linien bis 0.09 (Haarlinien) bleiben unverändert.
|
||||
pub fn scale_weight(w: f64, f: f64) -> f64 {
|
||||
if f == 1.0 || !(w > FINE_MM) || !f.is_finite() {
|
||||
return w;
|
||||
}
|
||||
FINE_MM + (w - FINE_MM) * f
|
||||
}
|
||||
|
||||
/// Nachbearbeitung beim Schreiben (`plan::buf::Writer::post`): Schwarz-Weiss (alle Farben auf Tinte
|
||||
/// bzw. Papier; eine Vollpoché bleibt schwarz) und Strichstärken-Faktor — in dieser Reihenfolge wie
|
||||
/// früher `toMono` und `scalePrimitiveWeights`.
|
||||
@@ -399,7 +414,7 @@ impl Post {
|
||||
h.color = (if h.pattern == HatchPattern::Solid { HATCH_INK } else { MONO_INK }).into();
|
||||
}
|
||||
if self.lw != 1.0 {
|
||||
h.line_weight *= self.lw;
|
||||
h.line_weight = scale_weight(h.line_weight, self.lw);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,7 +431,7 @@ impl Post {
|
||||
}
|
||||
self.hatch(hatch);
|
||||
if self.lw != 1.0 {
|
||||
*stroke_width_mm *= self.lw;
|
||||
*stroke_width_mm = scale_weight(*stroke_width_mm, self.lw);
|
||||
}
|
||||
}
|
||||
Primitive::Text { color, .. } => {
|
||||
@@ -429,12 +444,12 @@ impl Post {
|
||||
*color = Some(MONO_INK.into());
|
||||
}
|
||||
if self.lw != 1.0 {
|
||||
*weight_mm *= self.lw;
|
||||
*weight_mm = scale_weight(*weight_mm, self.lw);
|
||||
}
|
||||
}
|
||||
Primitive::Arc { weight_mm, .. } | Primitive::DrawingCircle { weight_mm, .. } | Primitive::DrawingArc { weight_mm, .. } => {
|
||||
if self.lw != 1.0 {
|
||||
*weight_mm *= self.lw;
|
||||
*weight_mm = scale_weight(*weight_mm, self.lw);
|
||||
}
|
||||
}
|
||||
Primitive::DrawingText { .. } | Primitive::DrawingTextPath { .. } | Primitive::DrawingImage { .. } => {}
|
||||
@@ -443,7 +458,7 @@ impl Post {
|
||||
|
||||
/// Farbe und Stärke einer Linie.
|
||||
pub fn line<'a>(&self, color: Option<&'a str>, w: f64) -> (Option<&'a str>, f64) {
|
||||
(if self.mono { Some(MONO_INK) } else { color }, if self.lw != 1.0 { w * self.lw } else { w })
|
||||
(if self.mono { Some(MONO_INK) } else { color }, scale_weight(w, self.lw))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,7 +472,7 @@ pub fn scale_line_weights(p: &Project, scale: f64, prims: &mut [Primitive]) {
|
||||
let post = Post { mono: false, lw, sketch: 0.0 };
|
||||
for q in prims.iter_mut() {
|
||||
match q {
|
||||
Primitive::Line { weight_mm, .. } => *weight_mm *= lw,
|
||||
Primitive::Line { weight_mm, .. } => *weight_mm = scale_weight(*weight_mm, lw),
|
||||
_ => post.apply(q),
|
||||
}
|
||||
}
|
||||
@@ -658,9 +673,10 @@ mod tests {
|
||||
let mut on = sample();
|
||||
on.scale_line_weights = Some(true);
|
||||
assert_eq!(line_weight_factor(&on, 100.0), 1.0);
|
||||
assert!((line_weight_factor(&on, 200.0) - 0.5f64.powf(0.25)).abs() < 1e-12);
|
||||
assert!((line_weight_factor(&on, 50.0) - 2f64.powf(0.25)).abs() < 1e-12);
|
||||
assert_eq!(line_weight_factor(&on, 100000.0), 0.5);
|
||||
assert!((line_weight_factor(&on, 200.0) - 0.5f64.sqrt()).abs() < 1e-12);
|
||||
assert!((line_weight_factor(&on, 50.0) - 2f64.sqrt()).abs() < 1e-12);
|
||||
assert_eq!(line_weight_factor(&on, 100000.0), 0.4);
|
||||
assert_eq!(line_weight_factor(&on, 1.0), 2.0);
|
||||
assert_eq!(line_weight_factor(&sample(), 200.0), 1.0);
|
||||
assert_eq!(line_weight_factor(&on, f64::NAN), 1.0);
|
||||
}
|
||||
@@ -674,13 +690,34 @@ mod tests {
|
||||
let mut a = lines();
|
||||
scale_line_weights(&on, 200.0, &mut a);
|
||||
let Primitive::Line { weight_mm, .. } = &a[0] else { unreachable!() };
|
||||
assert!((weight_mm - 0.5 * 0.5f64.powf(0.25)).abs() < 1e-12);
|
||||
assert!((weight_mm - (0.09 + 0.41 * 0.5f64.sqrt())).abs() < 1e-12);
|
||||
let mut b = lines();
|
||||
scale_line_weights(&sample(), 200.0, &mut b);
|
||||
let Primitive::Line { weight_mm, .. } = &b[0] else { unreachable!() };
|
||||
assert_eq!(*weight_mm, 0.5);
|
||||
}
|
||||
|
||||
/// [140] Rangfolge der Strichstärken je Massstab: Schnittkante 0.5 (1:100) → ≈ 0.67 (1:50) / ≈ 0.38
|
||||
/// (1:200); feine Linien (Schraffur 0.1, Bemassung 0.13) ändern sich kaum, nie unter 0.09; die
|
||||
/// Reihenfolge schwer > mittel > fein > Schraffur bleibt in jedem Massstab.
|
||||
#[test]
|
||||
fn strichstaerken_rangfolge_je_massstab() {
|
||||
let mut on = sample();
|
||||
on.scale_line_weights = Some(true);
|
||||
let at = |w: f64, s: f64| scale_weight(w, line_weight_factor(&on, s));
|
||||
assert!((at(0.5, 50.0) - 0.67).abs() < 0.01);
|
||||
assert!((at(0.5, 200.0) - 0.38).abs() < 0.01);
|
||||
assert_eq!(at(0.5, 100.0), 0.5);
|
||||
assert!((at(0.13, 50.0) - 0.13).abs() < 0.02 && (at(0.13, 200.0) - 0.13).abs() < 0.02);
|
||||
for s in [20.0, 50.0, 100.0, 200.0, 500.0, 1000.0] {
|
||||
let class = [0.7, 0.5, 0.35, 0.25, 0.18, 0.13, 0.1].map(|w| at(w, s));
|
||||
assert!(class.windows(2).all(|p| p[0] > p[1]), "1:{s}: {class:?}");
|
||||
assert!(at(0.1, s) >= 0.09 && at(0.13, s) >= 0.09, "1:{s}: feine Linien druckbar");
|
||||
}
|
||||
assert_eq!(scale_weight(0.02, 0.5), 0.02, "Haarlinien bleiben");
|
||||
assert_eq!(scale_weight(f64::NAN, 2.0).is_nan(), true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn blatt_ebene_ohne_strichstaerken_faktor() {
|
||||
let mut p = sample();
|
||||
|
||||
@@ -20,7 +20,10 @@ use std::collections::{HashMap, HashSet};
|
||||
const SECTION_INK: &str = "#1f242c";
|
||||
const SECTION_VISIBLE_INK: &str = "#2b3039";
|
||||
const SECTION_HIDDEN_INK: &str = "#8a929c";
|
||||
const SECTION_CUT_OUTLINE_MM: f64 = 0.35;
|
||||
/// [140] Umriss der geschnittenen Masse (Vereinigung aller Schnittflächen): schwer wie die Wand im Grundriss.
|
||||
const SECTION_CUT_OUTLINE_MM: f64 = 0.5;
|
||||
/// [140] Fugen zwischen Schichten/Bauteilen innerhalb der geschnittenen Masse: fein.
|
||||
const SECTION_JOINT_MM: f64 = 0.13;
|
||||
const SECTION_VISIBLE_MM: f64 = 0.18;
|
||||
const SECTION_GROUND_MM: f64 = 0.5;
|
||||
const SECTION_HIDDEN_MM: f64 = 0.13;
|
||||
@@ -2265,6 +2268,7 @@ pub fn section_primitives(out: &Output, mono: bool, hidden_lines: bool, vis: &Vi
|
||||
let mut prims = Vec::new();
|
||||
let mut acc = Acc::new();
|
||||
let shown = |code: &str| vis.visible(code) && vis.render(code);
|
||||
let mut cut_rings: Vec<crate::flat::Polygon> = Vec::new();
|
||||
// [T6] Erdreich zuerst (unter allem), ohne Umriss; Kategorie wie das Gelände.
|
||||
let terrain_shown = out.profiles.iter().all(|pr| pr.category.as_deref().is_none_or(shown));
|
||||
if terrain_shown {
|
||||
@@ -2305,7 +2309,7 @@ pub fn section_primitives(out: &Output, mono: bool, hidden_lines: bool, vis: &Vi
|
||||
(fill.to_string(), hatch)
|
||||
};
|
||||
let src = cp.source_id.clone();
|
||||
let mut pr = polygon(pts, &fill, SECTION_INK, SECTION_CUT_OUTLINE_MM, hatch);
|
||||
let mut pr = polygon(pts, &fill, SECTION_INK, SECTION_JOINT_MM, hatch);
|
||||
if let Primitive::Polygon { wall_id, ceiling_id, roof_id, stair_id, extruded_solid_id, no_stroke_edges, greyed, .. } = &mut pr {
|
||||
*wall_id = if cp.kind == Kind::Wall { src.clone() } else { None };
|
||||
*ceiling_id = if cp.kind == Kind::Slab && cp.stair_id.is_none() { src.clone() } else { None };
|
||||
@@ -2315,8 +2319,18 @@ pub fn section_primitives(out: &Output, mono: bool, hidden_lines: bool, vis: &Vi
|
||||
*no_stroke_edges = cp.nse.clone();
|
||||
*greyed = Some(cp.category.as_deref().is_some_and(|c| vis.greyed(c)));
|
||||
}
|
||||
cut_rings.push(vec![cp.pts.clone()]);
|
||||
prims.push(pr);
|
||||
}
|
||||
// [140] Schnittkante: Umriss der vereinigten Schnittflächen schwer, Fugen dazwischen bleiben fein.
|
||||
for poly in crate::polygon_bool::union(&cut_rings) {
|
||||
for ring in &poly {
|
||||
for i in 0..ring.len() {
|
||||
let (a, b) = (ring[i], ring[(i + 1) % ring.len()]);
|
||||
prims.push(line(v2(a[0], a[1]), v2(b[0], b[1]), "section-cut-outline", SECTION_CUT_OUTLINE_MM, SECTION_INK));
|
||||
}
|
||||
}
|
||||
}
|
||||
for pr in &out.profiles {
|
||||
if let Some(code) = pr.category.as_deref() {
|
||||
if !shown(code) {
|
||||
@@ -3630,6 +3644,22 @@ mod ts_faelle {
|
||||
assert_eq!(zero.visible.len(), all.visible.len());
|
||||
}
|
||||
|
||||
/// [140] Rangfolge im Schnitt: Umriss der geschnittenen Masse schwer (0.5), Fuge zwischen zwei
|
||||
/// aneinanderstossenden Bauteilen fein (0.13), Ansichtskanten dazwischen (0.18).
|
||||
#[test]
|
||||
fn schnittkante_schwer_fugen_fein() {
|
||||
let out = Output { cuts: vec![band(0.0, 1.0, 0.0, 1.0, None, "#fff"), band(1.0, 2.0, 0.0, 1.0, None, "#fff")], ..Default::default() };
|
||||
let (prims, _) = section_primitives(&out, false, false, &Visibility::default());
|
||||
let joints: Vec<f64> = prims.iter().filter_map(|q| match q { Primitive::Polygon { stroke_width_mm, .. } => Some(*stroke_width_mm), _ => None }).collect();
|
||||
assert_eq!(joints, [SECTION_JOINT_MM, SECTION_JOINT_MM]);
|
||||
let outline: Vec<(Vec2, Vec2)> = prims.iter().filter_map(|q| match q { Primitive::Line { a, b, cls, weight_mm, .. } if cls == "section-cut-outline" => { assert_eq!(*weight_mm, SECTION_CUT_OUTLINE_MM); Some((*a, *b)) } _ => None }).collect();
|
||||
// Umriss = Rechteck 2 × 1 (die Fuge bei x = 1 gehört nicht dazu).
|
||||
let len: f64 = outline.iter().map(|(a, b)| (b.x - a.x).hypot(b.y - a.y)).sum();
|
||||
assert!((len - 6.0).abs() < 1e-6, "{len}");
|
||||
assert!(outline.iter().all(|(a, b)| !((a.x - 1.0).abs() < 1e-6 && (b.x - 1.0).abs() < 1e-6)));
|
||||
assert!(SECTION_CUT_OUTLINE_MM > SECTION_VISIBLE_MM && SECTION_VISIBLE_MM > SECTION_JOINT_MM);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn primitive_pick_ids_und_kategorien() {
|
||||
let mut w = band(0.0, 1.0, 0.0, 1.0, None, "#fff");
|
||||
|
||||
@@ -8,6 +8,12 @@ pub const POCHE_STROKE: &str = "#1a1a1a";
|
||||
pub const MONO_INK: &str = "#111111";
|
||||
pub const LAYER_LINE_MM: f64 = 0.02;
|
||||
pub const SYMBOL_HAIRLINE_MM: f64 = 0.02;
|
||||
/// [140] Feine Symbol-Linien der Türen/Fenster im Grundriss (Blatt, Aufschlag, Glas, Bank), solange der Typ
|
||||
/// keine eigene Stärke trägt — vorher Haarlinie 0.02 (im Druck kaum sichtbar).
|
||||
pub const SYMBOL_LINE_MM: f64 = 0.13;
|
||||
/// [140] Schichtfugen im Wandschnitt ohne eigene Fugenstärke (`Layer.jointWeightMm`): fein, aber druckbar
|
||||
/// (vorher 0.02); bewusst unter der Schraffur-Stärke, damit dünne Schichten in 1:100 nicht zulaufen.
|
||||
pub const LAYER_JOINT_MM: f64 = 0.09;
|
||||
/// Kanten über der Schnittebene (Decken-/Dachränder, Bauteile „über Schnitt"): Strichpunktlinie nach
|
||||
/// SIA 400 B.3.3 (Strich, Lücke, Punkt, Lücke; Punkt = Länge 0 mit runder Kappe).
|
||||
pub const OVERHEAD_DASH: [f64; 4] = [0.4, 0.12, 0.0, 0.12];
|
||||
@@ -40,9 +46,11 @@ impl Detail {
|
||||
/// Stärke der Wand-Umrisslinie als Faktor auf die Ebenen-lw.
|
||||
pub fn outline_factor(self) -> f64 {
|
||||
match self {
|
||||
Detail::Grob => 1.6,
|
||||
// [140] Fein (1:50/1:20) behält die volle Schnittkante (vorher 0.6 — dünner als die
|
||||
// Fugen-Rangfolge verlangt); Grob (1:200/1:500, Vollpoché) etwas kräftiger.
|
||||
Detail::Grob => 1.2,
|
||||
Detail::Mittel => 1.0,
|
||||
Detail::Fein => 0.6,
|
||||
Detail::Fein => 1.0,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ fn wall_poche(c: &Ctx, out: &mut Vec<Primitive>, e: &EffWall, gaps: &[(f64, f64)
|
||||
let angle = atan2(w.end.y - w.start.y, w.end.x - w.start.x) * 180.0 / std::f64::consts::PI;
|
||||
let stroke = e.color.as_deref().unwrap_or(POCHE_STROKE);
|
||||
let outline_mm = wall_lw * detail.outline_factor();
|
||||
let layer_mm = LAYER_LINE_MM * detail.layer_factor();
|
||||
let layer_mm = LAYER_JOINT_MM * detail.layer_factor();
|
||||
let thick: Vec<f64> = wt.layers.iter().map(|l| l.thickness).collect();
|
||||
let f = crate::plan::wall_poche::wall_poche(&encode_wall_poche(w, &thick, total, ref_off, gaps, cuts, detail == Detail::Grob, view_only, reveals));
|
||||
if f.is_empty() {
|
||||
@@ -420,11 +420,11 @@ fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, colo
|
||||
b.push(shading.map_or(0.0, |s| s.r#box.width));
|
||||
b.push(shading.map_or(0.0, |s| s.r#box.height));
|
||||
// Strichstärken
|
||||
b.push(SYMBOL_HAIRLINE_MM);
|
||||
b.push(o.frame_line.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_HAIRLINE_MM));
|
||||
b.push(SYMBOL_LINE_MM);
|
||||
b.push(o.frame_line.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_LINE_MM));
|
||||
b.push(frame_view_weight);
|
||||
b.push(o.sash_line.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_HAIRLINE_MM));
|
||||
b.push(o.sill_line_style.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_HAIRLINE_MM));
|
||||
b.push(o.sash_line.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_LINE_MM));
|
||||
b.push(o.sill_line_style.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_LINE_MM));
|
||||
// Details ([94]): Anschlag, Fensterbank, Storenkasten.
|
||||
// Anschlag: je Seite verschieden ⇒ zeichnet `opening_detail_plan`.
|
||||
let rebate_sides = det.as_ref().map(|f| f.rebate).filter(|r| (r.left - r.right).abs() > 1e-9 || dframe.is_some());
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
// Erzeugungszeit also bekannt und eindeutig.
|
||||
|
||||
/**
|
||||
* Defaults in PAPIER-MILLIMETERN (übliche Zeichnungswerte; entsprechen bei
|
||||
* 1:50 genau den früheren festen Modellwerten 0.05/0.05/0.15/0.2 m).
|
||||
* Defaults in PAPIER-MILLIMETERN (übliche Zeichnungswerte; [140]: Masszahl 2.5 mm,
|
||||
* Schrägstrich 2 mm — eine Stufe unter dem Raumstempel).
|
||||
*/
|
||||
export const DIM_DEFAULTS_MM = {
|
||||
gap: 1,
|
||||
overshoot: 1,
|
||||
tickLen: 3,
|
||||
textHeight: 4,
|
||||
tickLen: 2,
|
||||
textHeight: 2.5,
|
||||
} as const;
|
||||
|
||||
/** Default-Grösse der Linienenden (Pfeil, Punkt, …) in Papier-Millimetern (wie im Kern). */
|
||||
|
||||
@@ -389,7 +389,8 @@ export const sampleProject: Project = {
|
||||
code: "20",
|
||||
name: "Wände",
|
||||
color: "#0a0a0a",
|
||||
lw: 0.35,
|
||||
// [140] Schnittkante 0.5 bei 1:100 (mit `scaleLineWeights` ≈ 0.7 bei 1:50, ≈ 0.35 bei 1:200).
|
||||
lw: 0.5,
|
||||
visible: true,
|
||||
locked: false,
|
||||
children: [
|
||||
@@ -400,13 +401,15 @@ export const sampleProject: Project = {
|
||||
},
|
||||
{ code: "30", name: "Decken", color: "#605850", lw: 0.35, visible: true, locked: false },
|
||||
{ code: "31", name: "Dächer", color: "#7a4a3a", lw: 0.35, visible: true, locked: false },
|
||||
{ code: "40", name: "Treppen", color: "#4a6a58", lw: 0.35, visible: true, locked: false },
|
||||
{ code: "40", name: "Treppen", color: "#4a6a58", lw: 0.25, visible: true, locked: false },
|
||||
{ code: "35", name: "Träger", color: "#a87858", lw: 0.5, visible: true, locked: false },
|
||||
{ code: "50", name: "Text", color: "#d0d0d0", lw: 0.13, visible: true, locked: false },
|
||||
{ code: "60", name: "Räume", color: "#5a7a9a", lw: 0.13, visible: true, locked: false },
|
||||
{ code: "90", name: "Referenzen", color: "#585860", lw: 0.13, visible: true, locked: false },
|
||||
{ code: "99", name: "Konstruktion", color: "#404048", lw: 0.13, visible: true, locked: false },
|
||||
],
|
||||
// [140] Strichstärken folgen dem Massstab (neue Projekte; bestehende behalten ihre Einstellung).
|
||||
scaleLineWeights: true,
|
||||
walls: [
|
||||
// ── EG: 5 × 4 m Raum (CCW) ──
|
||||
// Süd (unten)
|
||||
|
||||
@@ -688,7 +688,7 @@ const snap = (id: string, name: string, level: string, scale: number, center: Ve
|
||||
function views(): Pick<Project, "viewTemplates" | "viewSnapshots" | "viewSnapshotFolders" | "layouts" | "masterLayouts" | "layoutFolders" | "publishSets" | "overrideRules"> {
|
||||
return {
|
||||
overrideRules: [
|
||||
{ id: "or-brand", name: "Brandschutztüren rot", enabled: true, condition: { type: "layer_name", operator: "contains", value: "Türen" }, actions: { color: "#c0392b", lineweight: 0.35 } },
|
||||
{ id: "or-brand", name: "Brandschutztüren rot", enabled: false, condition: { type: "layer_name", operator: "contains", value: "Türen" }, actions: { color: "#c0392b", lineweight: 0.35 } },
|
||||
],
|
||||
viewTemplates: [
|
||||
{ id: "vt-gr100", name: "Grundriss 1:100", detail: "mittel", scaleDenominator: 100, scaleLineWeights: true, cutHeight: 1.0 },
|
||||
|
||||
Reference in new issue
Block a user