[37] Text in Papiergrösse: Schrifthöhe in mm auf dem Blatt, gleich in jedem Massstab

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
Claude committed 2026-11-04 12:59:26 +00:00
1 parent 2abf9eeaa2
commit 69ab644b55
10 files changed
+62 -4

No files matched your search

+3 -1
View File
@@ -1697,7 +1697,9 @@ Reihenfolge = Abhängigkeiten. Neue Geometrie entsteht in Rust ([K]).
Unterkante bis „darunter sichtbar bis" gepunktet. Wirkt auf Wände (samt Öffnungen), Stützen, Treppen, Decken
(nur ausblenden), Dächer (nur ausblenden) und Extrusionen. Ohne Grenzen unverändert. CLI-Plan geprüft (Linux).
Offen: Dach/Decke über/unter gestrichelt statt nur ausblenden, Schnitt/Ansicht, Raum/Fenster eigenständig. · M
- ○ **[37] Beschriftung in Papiergrösse.** · M
- ◐ **[37] Beschriftung in Papiergrösse.** · M — 4.11.: Text `paperHeight` (mm auf dem Blatt, Rust-Modell): Plan rechnet
die Modellhöhe je Massstab (`drawings.rs`, Test `text_in_papiergroesse`), Textrahmen-Griffe ebenso; Objekt-Info
„Papiergrösse" (0 = aus). Offen: Vorgabe im Text-Werkzeug, Hinweislinien/Koten/Raumstempel, DXF-Export nutzt `height`.
- ✅ **[38] Assoziative Bemassung.** (30.10.) Rust `dim_assoc.rs`: gefangene Bemassungspunkte tragen
`Dimension.refs` (je Punkt `DimRef`: Wand-Linie/-Ende, Wandecke = Schnitt zweier Wandlinien, Öffnungs-
Leibung/-Mitte, Stütze/Decke/Dach/Raum Ecke/Kante/Mitte, 2D-Eckpunkt/-Kante/-Mittelpunkt; Anhängen über
+6
View File
@@ -513,6 +513,12 @@ pub enum Drawing2DGeom {
text: String,
height: f64,
angle: f64,
/// [37] Beschriftung in Papiergrösse: Schrifthöhe auf dem Papier in mm. Ist sie gesetzt, gilt sie in
/// jedem Massstab (Modellhöhe = mm × Massstab / 1000) und `height` ist nur der Wert ohne Massstab
/// (Modellbereich, Export ohne Bezug).
#[serde(rename = "paperHeight", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
paper_height: Option<f64>,
/// Optionale Spaltenbreite in Metern (Textspalte/Absatztext). Ist sie gesetzt,
/// wird der Text beim Rendern wortweise auf diese Breite umgebrochen; fehlt
/// sie, bleibt es einzeiliger Text (heutiges Verhalten).
+20 -2
View File
@@ -848,7 +848,9 @@ fn emit_inner(c: &Ctx, d: &Drawing2D, attrs: Attrs, geom: &Drawing2DGeom, greyed
emit_grid(&mut em, &spec, crate::grid::bubble_diameter(*bubble_mm, scale), scale);
}
}
Drawing2DGeom::Text { at, text: s, height, angle, width, marks, doc, leader_target, leader_bend_points, path_pts } => {
Drawing2DGeom::Text { at, text: s, height, angle, width, marks, doc, leader_target, leader_bend_points, path_pts, paper_height } => {
// [37] Papiergrösse: Schrifthöhe in mm auf dem Blatt, unabhängig vom Massstab.
let height = &paper_height.filter(|mm| mm.is_finite() && *mm > 0.0).map_or(*height, |mm| mm_to_model(mm, scale));
let color = marks.as_ref().and_then(|m| m.color.clone()).unwrap_or_else(|| em.color.to_string());
if let Some(path) = path_pts.as_ref().filter(|q| q.len() >= 2) {
em.sink.push(
@@ -1193,10 +1195,11 @@ pub fn mv_geom(g: &Drawing2DGeom, f: &dyn Fn(Vec2) -> Vec2) -> Drawing2DGeom {
};
G::Grid { origin: o, angle: ang, radial: *radial, a: a2, b: b2, extend: *extend, bubbles: *bubbles, bubble_mm: *bubble_mm, levels: levels.clone(), show_3d: *show_3d }
}
G::Text { at, text, height, angle, width, marks, doc, leader_target, leader_bend_points, path_pts } => G::Text {
G::Text { at, text, height, angle, width, marks, doc, leader_target, leader_bend_points, path_pts, paper_height } => G::Text {
at: f(*at),
text: text.clone(),
height: *height,
paper_height: *paper_height,
angle: *angle,
width: *width,
marks: marks.clone(),
@@ -1798,6 +1801,21 @@ mod tests {
assert_eq!(out.len(), MAX_BLOCK_DEPTH as usize);
}
/// [37] Text in Papiergrösse: 2.5 mm auf dem Blatt in jedem Massstab; ohne `paperHeight` gilt `height`.
#[test]
fn text_in_papiergroesse() {
let p = project(serde_json::json!({}));
let h = |geom: serde_json::Value, scale: f64| match render(&p, drawing(geom), scale).into_iter().next() {
Some(Primitive::DrawingText { height_m, .. }) => height_m,
o => panic!("{o:?}"),
};
let paper = serde_json::json!({"shape": "text", "at": {"x": 0, "y": 0}, "text": "A", "height": 0.3, "angle": 0, "paperHeight": 2.5});
assert!((h(paper.clone(), 100.0) - 0.25).abs() < 1e-12);
assert!((h(paper, 50.0) - 0.125).abs() < 1e-12);
let model = serde_json::json!({"shape": "text", "at": {"x": 0, "y": 0}, "text": "A", "height": 0.3, "angle": 0});
assert!((h(model, 50.0) - 0.3).abs() < 1e-12);
}
#[test]
fn bemassung_masszahl_und_striche() {
let p = project(serde_json::json!({}));
+3 -1
View File
@@ -56,7 +56,9 @@ export function drawingVertices(d: Drawing2D, scaleDenominator: number = DEFAULT
// NaN/±∞ als Marken (JSON hätte null daraus gemacht, das rechnet wie 0).
const f = core().grip_vertices(toMarkedJson(g), scaleDenominator);
if (f[0] === -1 && g.shape === "text") {
return textFrameCorners({ at: g.at, text: g.text, heightM: g.height, angle: g.angle, marks: g.marks, doc: g.doc, wrapWidth: g.width });
// [37] Papiergrösse: Schrifthöhe in mm auf dem Blatt → Modellmeter im aktuellen Massstab.
const heightM = g.paperHeight && g.paperHeight > 0 ? (g.paperHeight / 1000) * scaleDenominator : g.height;
return textFrameCorners({ at: g.at, text: g.text, heightM, angle: g.angle, marks: g.marks, doc: g.doc, wrapWidth: g.width });
}
const n = f[0] ?? 0;
const out: Vec2[] = new Array(n);
+1
View File
@@ -907,6 +907,7 @@ export const de = {
"objinfo.drawing.length": "Länge",
"objinfo.drawing.angle": "Winkel",
"objinfo.drawing.radius": "Radius",
"objinfo.drawing.paperHeight": "Papiergrösse",
"objinfo.drawing.startAngle": "Startwinkel",
"objinfo.drawing.endAngle": "Endwinkel",
"objinfo.wall.floorAboveNone": "Kein oberes Geschoss",
+1
View File
@@ -903,6 +903,7 @@ export const en: Record<TranslationKey, string> = {
"objinfo.drawing.length": "Length",
"objinfo.drawing.angle": "Angle",
"objinfo.drawing.radius": "Radius",
"objinfo.drawing.paperHeight": "Paper size",
"objinfo.drawing.startAngle": "Start angle",
"objinfo.drawing.endAngle": "End angle",
"levels.addFloor": "+ Floor",
+6
View File
@@ -966,6 +966,12 @@ export type Drawing2DGeom =
text: string;
height: number;
angle: number;
/**
* [37] Beschriftung in Papiergrösse: Schrifthöhe auf dem Papier in mm. Ist sie gesetzt, gilt sie in
* jedem Massstab (Modellhöhe = mm × Massstab / 1000) und `height` ist nur der Wert ohne Massstab
* (Modellbereich, Export ohne Bezug).
*/
paperHeight?: number;
/**
* Optionale Spaltenbreite in Metern (Textspalte/Absatztext). Ist sie gesetzt,
* wird der Text beim Rendern wortweise auf diese Breite umgebrochen; fehlt
+10
View File
@@ -277,6 +277,16 @@ export function ObjectInfoPanel() {
/>
</>
)}
{drawingShape === "text" && rawDrawing?.geom.shape === "text" && (
<DimensionField
label={t("objinfo.drawing.paperHeight")}
value={rawDrawing.geom.paperHeight ?? 0}
min={0}
step={0.5}
unit="mm"
onCommit={(v) => host.onSetDrawingTextPaperHeight(v)}
/>
)}
{drawingShape === "circle" && (
<DimensionField
label={t("objinfo.drawing.radius")}
+5
View File
@@ -387,6 +387,11 @@ export interface PanelHostValue {
* wenn die Selektion kein Kreis ist.
*/
onSetDrawingCircleRadius: (radius: number) => void;
/**
* [37] Schrifthöhe eines Texts in Papiergrösse (mm, in jedem Massstab gleich); 0 = aus (Modellhöhe gilt).
* No-op, wenn die Selektion kein Text ist.
*/
onSetDrawingTextPaperHeight: (mm: number) => void;
/**
* Setzt den Radius eines Bogens (Mittelpunkt + Winkel bleiben fix). No-op,
* wenn die Selektion kein Bogen ist.
+7
View File
@@ -774,6 +774,13 @@ export function usePanelHostBase(opts: {
if (!d || d.geom.shape !== "circle") return;
updateDrawing2D(selection.id, { geom: { ...d.geom, r: radius } });
},
onSetDrawingTextPaperHeight: (mm) => {
if (selection?.kind !== "drawing2d" || !isFinite(mm) || mm < 0) return;
const d = project.drawings2d.find((x) => x.id === selection.id);
if (!d || d.geom.shape !== "text") return;
const { paperHeight: _old, ...rest } = d.geom;
updateDrawing2D(selection.id, { geom: mm > 0 ? { ...rest, paperHeight: mm } : rest });
},
onSetDrawingArcRadius: (radius) => {
if (selection?.kind !== "drawing2d" || !isFinite(radius) || radius <= 0) return;
const d = project.drawings2d.find((x) => x.id === selection.id);