forked from 1b-agent/opencadstudio-upstream
fix(3d): move and paste ACIS solids to the right place
Solids were missing from the entity transform dispatch, so move / rotate / scale / mirror were silently no-ops on a 3D solid (only its wires shifted) and a pasted solid stayed at its original location. Add a Transformable impl for Solid3D/Region/Body/Surface (delegating to acadrust, which now composes the move into the ACIS body placement) and register them in the dispatcher. Also make cross-drawing paste land at the cursor: the clipboard centroid is measured in the source drawing's offset-relative frame, so correct the paste translation by the source/target world_offset difference (zero within one drawing). Bumps acadrust for the solid-geometry transform fixes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
e45064f8a8
commit
de1f1c0e24
6 files changed
+49
-4
No files matched your search
+25
-2
@@ -6,13 +6,36 @@
|
||||
// fallback stays in sync; the caller (scene/mod.rs apply_grip) translates
|
||||
// the MeshModel vertices to match.
|
||||
|
||||
use acadrust::entities::{Body, Region, Solid3D};
|
||||
use acadrust::entities::{Body, Region, Solid3D, Surface};
|
||||
use glam::Vec3;
|
||||
|
||||
use crate::command::EntityTransform;
|
||||
use crate::entities::common::{center_grip, ro_prop as ro};
|
||||
use crate::entities::traits::{Grippable, PropertyEditable};
|
||||
use crate::entities::traits::{Grippable, PropertyEditable, Transformable};
|
||||
use crate::scene::model::object::{GripApply, GripDef, PropSection};
|
||||
|
||||
/// Shared transform for the ACIS volume entities. Translate / rotate / scale
|
||||
/// delegate to acadrust (which composes the move into the solid's ACIS
|
||||
/// placement), and mirror delegates via a reflection transform. Without this
|
||||
/// the entity dispatcher treated solids as non-transformable, so a moved or
|
||||
/// pasted solid stayed at its original ACIS placement.
|
||||
macro_rules! impl_acis_transformable {
|
||||
($ty:ty) => {
|
||||
impl Transformable for $ty {
|
||||
fn apply_transform(&mut self, t: &EntityTransform) {
|
||||
crate::scene::view::transform::apply_standard_entity_transform(self, t, |e, p1, p2| {
|
||||
let m = crate::scene::view::transform::reflection_about_xy_line(p1, p2);
|
||||
acadrust::Entity::apply_transform(e, &m);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
impl_acis_transformable!(Solid3D);
|
||||
impl_acis_transformable!(Region);
|
||||
impl_acis_transformable!(Body);
|
||||
impl_acis_transformable!(Surface);
|
||||
|
||||
// ── shared helpers ────────────────────────────────────────────────────────────
|
||||
|
||||
fn dvec3(v: &acadrust::types::Vector3) -> glam::DVec3 {
|
||||
|
||||
@@ -422,6 +422,7 @@ impl EntityTypeOps for EntityType {
|
||||
Tolerance, Solid, Face3D, PolygonMesh, PolyfaceMesh, Mesh,
|
||||
Table, MText, Point, Spline, Text, Viewport, Dimension,
|
||||
Leader, MultiLeader, Underlay, Shape, Ole2Frame,
|
||||
Solid3D, Region, Body, Surface,
|
||||
],
|
||||
_ => {},
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user