From eefbcc4860992a685ee0921cae360e3e55cded8c Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Fri, 9 Oct 2026 13:32:04 +0300 Subject: [PATCH] Dimensions: place the picture block where the dimension says MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A dimension carries its graphics in a block of its own, drawn in that block's frame, and the entity records where the frame sits. The renderer inserted it at the origin instead, so every dimension whose file carries a non-zero insertion point drew far from the geometry it measures — the whole picture offset by that point. Dimensions inside block definitions are where this shows: a drawing of plan blocks scattered their dimension graphics thousands of units away, over empty sheet. The picture now follows the dimension's insertion point, rotation, scale and extrusion, the way any block reference is placed. Co-Authored-By: Claude Opus 5 --- src/scene/render_graph.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/scene/render_graph.rs b/src/scene/render_graph.rs index dcb8a0199..facb3b27a 100644 --- a/src/scene/render_graph.rs +++ b/src/scene/render_graph.rs @@ -814,8 +814,25 @@ fn entity_owned_block_uses( if let Some(record) = block_record_by_name(document, name) .filter(|record| !record.entity_handles.is_empty()) { - let mut insert = Insert::new(record.name.clone(), Vector3::ZERO); - insert.common = dimension.base().common.clone(); + let base = dimension.base(); + // The picture block draws the dimension in its own frame, and + // the dimension says where that frame sits. Placing it at the + // origin instead draws the whole dimension offset by the + // insertion point — far off the geometry it measures whenever + // the file carries a non-zero one, which is what a dimension + // saved inside a block definition usually has. + let mut insert = Insert::new(record.name.clone(), base.insertion_point) + .with_scale( + base.insertion_scale.x, + base.insertion_scale.y, + base.insertion_scale.z, + ) + .with_rotation(base.insertion_rotation); + // The insertion point is in the dimension's own object + // coordinates, so the picture follows its extrusion the way + // any block reference does. + insert.normal = base.normal; + insert.common = base.common.clone(); let picture = !crate::scene::annotative::is_annotative(document, entity); vec![block_use( document,