forked from 1b-agent/opencadstudio-upstream
Carry hatch origin through creation and pattern editing
This commit is contained in:
1 parent
dbd85c0559
commit
6272722baa
11 files changed
+42
-85
No files matched your search
@@ -1674,6 +1674,7 @@ impl Scene {
|
||||
let fill_plane_boundary = Some(Arc::new(fill_plane.1));
|
||||
let fill_plane = Some(fill_plane.0);
|
||||
models.push(HatchModel {
|
||||
pattern_origin: None,
|
||||
render_instance,
|
||||
boundary: Arc::new(boundary),
|
||||
boundary_wcs: None,
|
||||
@@ -2107,6 +2108,7 @@ impl Scene {
|
||||
|
||||
let storage = crate::entities::curve::ocs_plane(dxf.normal, dxf.elevation);
|
||||
Some(HatchModel {
|
||||
pattern_origin: Some([dxf.pattern_origin().x, dxf.pattern_origin().y]),
|
||||
render_instance: None,
|
||||
boundary: std::sync::Arc::new(boundary_f32),
|
||||
boundary_wcs: None,
|
||||
@@ -2429,6 +2431,7 @@ impl Scene {
|
||||
})
|
||||
.collect();
|
||||
HatchModel {
|
||||
pattern_origin: None,
|
||||
render_instance: None,
|
||||
boundary: std::sync::Arc::new(boundary),
|
||||
boundary_wcs: None,
|
||||
@@ -2663,6 +2666,9 @@ impl Scene {
|
||||
// carries `world_origin: [0, 0]`, which after the world_offset removal
|
||||
// leaves the fill mis-placed and effectively invisible until a later
|
||||
// edit rebuilds it from the DXF — so keep the seed, don't overwrite it.
|
||||
if let Some(origin) = model.pattern_origin {
|
||||
dxf.record_pattern_origin(Vector2::new(origin[0], origin[1]));
|
||||
}
|
||||
let mut entity = EntityType::Hatch(dxf);
|
||||
|
||||
if let Some(layer) = layer {
|
||||
|
||||
@@ -3794,6 +3794,7 @@ impl Scene {
|
||||
let ((x0, y0), (x1, y1)) = self.paper_limits()?;
|
||||
let (x0, y0, x1, y1) = (x0 as f32, y0 as f32, x1 as f32, y1 as f32);
|
||||
Some(HatchModel {
|
||||
pattern_origin: None,
|
||||
render_instance: None,
|
||||
world_origin: [0.0, 0.0],
|
||||
boundary: Arc::new(vec![[x0, y0], [x1, y0], [x1, y1], [x0, y1], [x0, y0]]),
|
||||
|
||||
@@ -208,6 +208,8 @@ pub struct FillPlane {
|
||||
/// A hatched region defined by a closed polygon boundary.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct HatchModel {
|
||||
/// Recorded hatch origin in its fill plane, independent of intrinsic PAT line bases.
|
||||
pub pattern_origin: Option<[f64; 2]>,
|
||||
pub render_instance: Option<super::instance_model::RenderInstance>,
|
||||
/// World XY anchor (in the same offset-relative coordinate space as
|
||||
/// the rest of the scene — `world_offset` already subtracted, but
|
||||
|
||||
@@ -154,6 +154,7 @@ impl Scene {
|
||||
return None;
|
||||
}
|
||||
let mut model = HatchModel {
|
||||
pattern_origin: None,
|
||||
render_instance: None,
|
||||
world_origin: origin,
|
||||
boundary: std::sync::Arc::new(boundary),
|
||||
|
||||
@@ -2886,6 +2886,7 @@ impl Scene {
|
||||
}
|
||||
boundary.push(boundary[0]);
|
||||
hatches.push(HatchModel {
|
||||
pattern_origin: None,
|
||||
render_instance: wire.render_instance.clone(),
|
||||
world_origin: [0.0, 0.0],
|
||||
boundary: Arc::new(boundary),
|
||||
|
||||
Reference in new issue
Block a user