forked from 1b-agent/opencadstudio-upstream
Merge pull request #1681 from ramox81/codex/dimension-picture-insertion
Dimensions: place the picture block where the dimension says
This commit is contained in:
commit
7567724e14
1 file changed
+19
-2
@@ -789,8 +789,25 @@ fn entity_owned_block_uses(
|
|||||||
if let Some(record) = block_record_by_name(document, name)
|
if let Some(record) = block_record_by_name(document, name)
|
||||||
.filter(|record| !record.entity_handles.is_empty())
|
.filter(|record| !record.entity_handles.is_empty())
|
||||||
{
|
{
|
||||||
let mut insert = Insert::new(record.name.clone(), Vector3::ZERO);
|
let base = dimension.base();
|
||||||
insert.common = dimension.base().common.clone();
|
// 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);
|
let picture = !crate::scene::annotative::is_annotative(document, entity);
|
||||||
vec![block_use(
|
vec![block_use(
|
||||||
document,
|
document,
|
||||||
|
|||||||
Reference in new issue
Block a user