Give solid.move the copy half of its Move/Copy label (#498)
solid.move takes copy: true to keep the source bodies and transform a new copy of each, with a Create Copy box in the Move dialog. Designs without it save and load exactly as before.
This commit is contained in:
1 parent
69e54f85d2
commit
7d00df0a3f
15 files changed
+395
-11
No files matched your search
@@ -1854,7 +1854,12 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
|
||||
combo(ui, "sw_op", &OP_LABELS, operation);
|
||||
ui.end_row();
|
||||
}
|
||||
k @ Kind::Move { .. } => enter |= crate::dialogs_move::rows(ui, k),
|
||||
k @ Kind::Move { .. } => {
|
||||
enter |= crate::dialogs_move::rows(ui, k);
|
||||
row_label(ui, "Create Copy");
|
||||
extra_check(ui, &mut d.extra, "copy");
|
||||
ui.end_row();
|
||||
}
|
||||
Kind::Hole { diameter, depth, kind, cb_diameter, cb_depth, cs_diameter, cs_angle, opts } => {
|
||||
row_label(ui, "Extents");
|
||||
let cur = if to_object_on(&d.inputs) { 1 } else { usize::from(opts.all) * 2 };
|
||||
@@ -2195,9 +2200,12 @@ fn extra_choice(ui: &mut egui::Ui, extra: &mut serde_json::Map<String, Value>, i
|
||||
/// A checkbox stored in the dialog's extra parameters.
|
||||
fn extra_check(ui: &mut egui::Ui, extra: &mut serde_json::Map<String, Value>, key: &str) {
|
||||
let mut on = extra.get(key).and_then(Value::as_bool).unwrap_or(false);
|
||||
if ui.checkbox(&mut on, "").changed() {
|
||||
let r = ui.checkbox(&mut on, "");
|
||||
if r.changed() {
|
||||
extra.insert(key.into(), json!(on));
|
||||
}
|
||||
// The box carries no text of its own, so a scenario reaches it by its row handle.
|
||||
publish_row(&r);
|
||||
}
|
||||
|
||||
/// A value field stored in the dialog's extra parameters (`default` until edited).
|
||||
@@ -3776,9 +3784,9 @@ pub fn for_feature(app: &SolveApp, id: u64, marker: Option<usize>) -> Option<Dia
|
||||
}
|
||||
d
|
||||
}
|
||||
FeatureKind::Move { bodies, translate, rotate_axis, angle } => {
|
||||
FeatureKind::Move { bodies, translate, rotate_axis, angle, copy } => {
|
||||
let mut d = start("solid.move")?;
|
||||
crate::dialogs_move::for_feature(&mut d, bodies, translate, *rotate_axis, angle.as_ref());
|
||||
crate::dialogs_move::for_feature(&mut d, bodies, translate, *rotate_axis, angle.as_ref(), *copy);
|
||||
d
|
||||
}
|
||||
other => {
|
||||
|
||||
@@ -226,6 +226,9 @@ pub fn params(app: &SolveApp, d: &Dialog) -> Result<Value, String> {
|
||||
p["translate"] = num(at - from);
|
||||
}
|
||||
}
|
||||
if d.extra.get("copy").and_then(Value::as_bool).unwrap_or(false) {
|
||||
p["copy"] = json!(true);
|
||||
}
|
||||
Ok(p)
|
||||
}
|
||||
|
||||
@@ -285,7 +288,7 @@ pub fn drag(app: &SolveApp, d: &mut Dialog, g: Drag) {
|
||||
|
||||
/// The dialog for editing a move: Free Move with its translation and, about a world axis
|
||||
/// through the origin, its angle (another axis is kept as it is).
|
||||
pub fn for_feature(d: &mut Dialog, bodies: &[String], translate: &[String; 3], axis: Option<Vec3>, angle: Option<&String>) {
|
||||
pub fn for_feature(d: &mut Dialog, bodies: &[String], translate: &[String; 3], axis: Option<Vec3>, angle: Option<&String>, copy: bool) {
|
||||
let [x, y, z] = translate.clone();
|
||||
let mut k = kind(FREE);
|
||||
if let Kind::Move { x: kx, y: ky, z: kz, rx, ry, rz, .. } = &mut k {
|
||||
@@ -311,4 +314,7 @@ pub fn for_feature(d: &mut Dialog, bodies: &[String], translate: &[String; 3], a
|
||||
if let Some(inp) = d.inputs.first_mut() {
|
||||
inp.items = bodies.iter().map(|n| Sel::Body { name: n.clone() }).collect();
|
||||
}
|
||||
if copy {
|
||||
d.extra.insert("copy".into(), json!(true));
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,7 @@
|
||||
"ui.counterbore": "Tiefenbohrung",
|
||||
"ui.countersink": "Senkung",
|
||||
"ui.create": "Erstellen",
|
||||
"ui.create_copy": "Kopie erstellen",
|
||||
"ui.create_sketch": "Skizze erstellen",
|
||||
"ui.current": "aktuell",
|
||||
"ui.curvature": "Krümmung",
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
"ui.counterbore": "Counterbore",
|
||||
"ui.countersink": "Countersink",
|
||||
"ui.create": "Create",
|
||||
"ui.create_copy": "Create Copy",
|
||||
"ui.create_sketch": "Create Sketch",
|
||||
"ui.current": "current",
|
||||
"ui.curvature": "Curvature",
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
"ui.counterbore": "座ぐり",
|
||||
"ui.countersink": "皿もみ",
|
||||
"ui.create": "作成",
|
||||
"ui.create_copy": "コピーを作成",
|
||||
"ui.create_sketch": "スケッチを作成",
|
||||
"ui.current": "現在",
|
||||
"ui.curvature": "曲率",
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
"ui.counterbore": "카운터보어",
|
||||
"ui.countersink": "카운터싱크",
|
||||
"ui.create": "만들기",
|
||||
"ui.create_copy": "복사본 만들기",
|
||||
"ui.create_sketch": "스케치 만들기",
|
||||
"ui.current": "현재",
|
||||
"ui.curvature": "곡률",
|
||||
|
||||
Reference in new issue
Block a user