feat: preserve body history and placed modelling workflows
Record ownership transfers in the timeline so earlier Join/Cut membership, world placement, machining data and styles survive component moves, edits, independent copying, undo and reopening. Preserve pending positions in history snapshots and keep constructor transfers ordered during feature redefinition. Retain shallow sheet pockets and exact planar intersection islands through unfold/refold, with depth-aware flat previews and DXF export. Store explicit 3D wire coordinate spaces and migrate known legacy provenance without moving saved points or analytic fits. Infer unique eligible cylindrical Emboss targets, align Revolve manipulators with actual extent geometry, and discard obsolete preview errors after input correction. Certify constructed and immutable imported face styles using exact source metadata while preserving legacy face names. Upgrade designs to format10 with bounded validation and geometry-preserving legacy migration.
This commit is contained in:
1 parent
0398a813c8
commit
c1d819f235
86 files changed
+6011
-488
No files matched your search
@@ -714,9 +714,17 @@ pub fn overlay(painter: &egui::Painter, rect: Rect, d: &Dialog) -> bool {
|
||||
if !(lo.0.is_finite() && hi.0 > lo.0 && hi.1 > lo.1) {
|
||||
return true;
|
||||
}
|
||||
// Fit with a margin, leaving the dialog's side free.
|
||||
let area = Rect::from_min_max(rect.min + vec2(40.0, 60.0), rect.max - vec2(320.0, 60.0));
|
||||
let area = if area.width() < 100.0 { rect.shrink(40.0) } else { area };
|
||||
// Fit all retained islands to the exposed viewport. The command panel can grow
|
||||
// to its width limit, so its actual edge, rather than a fixed reserve, bounds the view.
|
||||
let panel_left = painter
|
||||
.ctx()
|
||||
.memory(|m| m.area_rect(egui::Id::new(("sc_dialog", "FLAT PATTERN"))))
|
||||
.map(|panel| panel.left())
|
||||
.unwrap_or(rect.right() - crate::frame::DIALOG_MAX_W);
|
||||
let area = Rect::from_min_max(rect.min + vec2(40.0, 60.0), pos2(panel_left.min(rect.right()) - 20.0, rect.bottom() - 60.0));
|
||||
if area.width() <= 0.0 || area.height() <= 0.0 {
|
||||
return true;
|
||||
}
|
||||
let scale = (f64::from(area.width()) / (hi.0 - lo.0)).min(f64::from(area.height()) / (hi.1 - lo.1));
|
||||
let ox = f64::from(area.center().x) - (lo.0 + hi.0) * 0.5 * scale;
|
||||
let oy = f64::from(area.center().y) + (lo.1 + hi.1) * 0.5 * scale;
|
||||
@@ -733,6 +741,26 @@ pub fn overlay(painter: &egui::Painter, rect: Rect, d: &Dialog) -> bool {
|
||||
painter.add(egui::Shape::closed_line(pts, Stroke::new(1.4, t.text)));
|
||||
}
|
||||
}
|
||||
// A pocket retains material below (or above) the cut. Dashed contours and a depth
|
||||
// annotation distinguish it from the solid through-cut boundaries.
|
||||
let pockets: Vec<&Value> = v["pockets"].as_array().into_iter().flatten().collect();
|
||||
for pocket in &pockets {
|
||||
let outer: Vec<(f64, f64)> = pocket["outline"].as_array().into_iter().flatten().filter_map(read).collect();
|
||||
for contour in std::iter::once(&pocket["outline"]).chain(pocket["cutouts"].as_array().into_iter().flatten()) {
|
||||
let mut pts: Vec<Pos2> = contour.as_array().into_iter().flatten().filter_map(read).map(to).collect();
|
||||
if pts.len() >= 3 {
|
||||
pts.push(pts[0]);
|
||||
painter.extend(egui::Shape::dashed_line(&pts, Stroke::new(1.6, t.accent), 3.0, 3.0));
|
||||
}
|
||||
}
|
||||
if !outer.is_empty() {
|
||||
let bounds = outer.iter().map(|p| to(*p)).fold(Rect::NOTHING, |r, p| r.union(Rect::from_min_max(p, p)));
|
||||
let anchor = bounds.center_top() - vec2(0.0, 6.0);
|
||||
if let Some(label) = pocket_label(pocket) {
|
||||
painter.text(anchor, Align2::CENTER_BOTTOM, label, FontId::proportional(12.0), t.accent);
|
||||
}
|
||||
}
|
||||
}
|
||||
for b in v["bends"].as_array().into_iter().flatten() {
|
||||
let (Some(a), Some(e)) = (read(&b["start"]), read(&b["end"])) else { continue };
|
||||
let col = if b["direction"] == "up" { up_col } else { down_col };
|
||||
@@ -746,9 +774,33 @@ pub fn overlay(painter: &egui::Painter, rect: Rect, d: &Dialog) -> bool {
|
||||
painter.line_segment([pos2(rect.left() + 14.0, y + 7.0), pos2(rect.left() + 38.0, y + 7.0)], Stroke::new(2.0, col));
|
||||
painter.text(pos2(rect.left() + 44.0, y), Align2::LEFT_TOP, label, FontId::proportional(12.0), t.text_dim);
|
||||
}
|
||||
if !pockets.is_empty() {
|
||||
y += 20.0;
|
||||
painter.extend(egui::Shape::dashed_line(
|
||||
&[pos2(rect.left() + 14.0, y + 7.0), pos2(rect.left() + 38.0, y + 7.0)],
|
||||
Stroke::new(1.6, t.accent),
|
||||
3.0,
|
||||
3.0,
|
||||
));
|
||||
painter.text(pos2(rect.left() + 44.0, y), Align2::LEFT_TOP, "Pocket boundary (material remains)", FontId::proportional(12.0), t.text_dim);
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn pocket_label(pocket: &Value) -> Option<String> {
|
||||
let depth = pocket["depth_mm"].as_f64()?;
|
||||
if !depth.is_finite() || depth <= 0.0 {
|
||||
return None;
|
||||
}
|
||||
let side = match pocket["side"].as_str()? {
|
||||
"top" => "Top",
|
||||
"bottom" => "Bottom",
|
||||
"internal" => "Internal",
|
||||
_ => return None,
|
||||
};
|
||||
Some(format!("{side} pocket: {depth} mm deep"))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "dialogs_sheet_tests.rs"]
|
||||
mod tests;
|
||||
Reference in new issue
Block a user