forked from 1b-agent/opencadstudio-upstream
Merge pull request #1070 from ramox81/codex/filletedge-parity
# Conflicts: # Cargo.lock
This commit is contained in:
commit
7ec07f3222
21 files changed
+1544
-138
No files matched your search
@@ -733,6 +733,7 @@ impl OpenCADStudio {
|
||||
&result,
|
||||
CmdResult::Relaunch(..)
|
||||
| CmdResult::Dispatch(..)
|
||||
| CmdResult::SolidEdgeBlend { .. }
|
||||
| CmdResult::SolidSubtract { .. }
|
||||
| CmdResult::SliceEntities { .. }
|
||||
| CmdResult::SliceSurfaceEntities { .. }
|
||||
@@ -4105,11 +4106,20 @@ impl OpenCADStudio {
|
||||
|
||||
CmdResult::SolidEdgeBlend {
|
||||
handle,
|
||||
pick,
|
||||
edges,
|
||||
base_face,
|
||||
value,
|
||||
other_value,
|
||||
fillet,
|
||||
} => {
|
||||
let task = self.solid_edge_blend(handle, pick, value, fillet);
|
||||
let task = self.solid_edge_blend(
|
||||
handle,
|
||||
&edges,
|
||||
base_face,
|
||||
value,
|
||||
other_value,
|
||||
fillet,
|
||||
);
|
||||
self.tabs[i].active_cmd = None;
|
||||
self.tabs[i].snap_result = None;
|
||||
self.tabs[i].scene.clear_preview_wire();
|
||||
|
||||
+92
-12
@@ -1,6 +1,6 @@
|
||||
use super::*;
|
||||
|
||||
fn selected_solid(app: &OpenCADStudio, tab: usize) -> Option<acadrust::Handle> {
|
||||
fn selected_edge_body(app: &OpenCADStudio, tab: usize) -> Option<acadrust::Handle> {
|
||||
let scene = &app.tabs.get(tab)?.scene;
|
||||
let selected = scene.selected_handles_in_order();
|
||||
let [handle] = selected.as_slice() else {
|
||||
@@ -9,7 +9,7 @@ fn selected_solid(app: &OpenCADStudio, tab: usize) -> Option<acadrust::Handle> {
|
||||
|
||||
if matches!(
|
||||
scene.document.get_entity(*handle),
|
||||
Some(acadrust::EntityType::Solid3D(_))
|
||||
Some(acadrust::EntityType::Solid3D(_) | acadrust::EntityType::Surface(_))
|
||||
) {
|
||||
Some(*handle)
|
||||
} else {
|
||||
@@ -17,6 +17,36 @@ fn selected_solid(app: &OpenCADStudio, tab: usize) -> Option<acadrust::Handle> {
|
||||
}
|
||||
}
|
||||
|
||||
fn solid_edge_sources(
|
||||
app: &mut OpenCADStudio,
|
||||
tab: usize,
|
||||
) -> Vec<(acadrust::Handle, cadkernel::brep::Body)> {
|
||||
let handles = app.tabs[tab]
|
||||
.scene
|
||||
.document
|
||||
.entities()
|
||||
.filter_map(|entity| {
|
||||
matches!(
|
||||
entity,
|
||||
acadrust::EntityType::Solid3D(_) | acadrust::EntityType::Surface(_)
|
||||
)
|
||||
.then_some(entity.common().handle)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
app.tabs[tab].scene.restore_solid_models(&handles);
|
||||
handles
|
||||
.into_iter()
|
||||
.filter_map(|handle| {
|
||||
app.tabs[tab]
|
||||
.scene
|
||||
.solid_models
|
||||
.get(&handle)
|
||||
.cloned()
|
||||
.map(|body| (handle, body))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
impl OpenCADStudio {
|
||||
pub(super) fn dispatch_dim(&mut self, cmd: &str, i: usize) -> Option<Task<Message>> {
|
||||
match cmd {
|
||||
@@ -960,16 +990,30 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"SOLIDFILLET" => {
|
||||
"FILLETEDGE" | "SOLIDFILLET" => {
|
||||
use crate::modules::model::edge_cmd::{EdgeOperation, SolidEdgeCommand};
|
||||
let command = SolidEdgeCommand::new(EdgeOperation::Fillet, selected_solid(self, i));
|
||||
let target = selected_edge_body(self, i);
|
||||
let bodies = solid_edge_sources(self, i);
|
||||
let command = SolidEdgeCommand::new(
|
||||
EdgeOperation::Fillet,
|
||||
target,
|
||||
bodies,
|
||||
crate::scene::WireModel::SELECTED,
|
||||
);
|
||||
self.command_line.push_info(&command.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(command));
|
||||
}
|
||||
|
||||
"FILLET" if selected_solid(self, i).is_some() => {
|
||||
"FILLET" if selected_edge_body(self, i).is_some() => {
|
||||
use crate::modules::model::edge_cmd::{EdgeOperation, SolidEdgeCommand};
|
||||
let command = SolidEdgeCommand::new(EdgeOperation::Fillet, selected_solid(self, i));
|
||||
let target = selected_edge_body(self, i);
|
||||
let bodies = solid_edge_sources(self, i);
|
||||
let command = SolidEdgeCommand::new(
|
||||
EdgeOperation::Fillet,
|
||||
target,
|
||||
bodies,
|
||||
crate::scene::WireModel::SELECTED,
|
||||
);
|
||||
self.command_line.push_info(&command.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(command));
|
||||
}
|
||||
@@ -1107,16 +1151,52 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"SOLIDCHAMFER" => {
|
||||
use crate::modules::model::edge_cmd::{EdgeOperation, SolidEdgeCommand};
|
||||
let command = SolidEdgeCommand::new(EdgeOperation::Chamfer, selected_solid(self, i));
|
||||
"CHAMFEREDGE" | "SOLIDCHAMFER" => {
|
||||
use crate::modules::model::edge_cmd::SolidEdgeCommand;
|
||||
let target = selected_edge_body(self, i);
|
||||
let header = &self.tabs[i].scene.document.header;
|
||||
let distances = (header.chamfer_distance_a, header.chamfer_distance_b);
|
||||
let bodies = solid_edge_sources(self, i);
|
||||
let command = SolidEdgeCommand::new_chamfer(
|
||||
target,
|
||||
bodies,
|
||||
crate::scene::WireModel::SELECTED,
|
||||
distances,
|
||||
);
|
||||
let distances = command.chamfer_distances();
|
||||
self.command_line.push_output(
|
||||
crate::tf!(
|
||||
"Distance1 = {:.4}, Distance2 = {:.4}",
|
||||
distances.0,
|
||||
distances.1
|
||||
)
|
||||
.as_ref(),
|
||||
);
|
||||
self.command_line.push_info(&command.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(command));
|
||||
}
|
||||
|
||||
"CHAMFER" if selected_solid(self, i).is_some() => {
|
||||
use crate::modules::model::edge_cmd::{EdgeOperation, SolidEdgeCommand};
|
||||
let command = SolidEdgeCommand::new(EdgeOperation::Chamfer, selected_solid(self, i));
|
||||
"CHAMFER" if selected_edge_body(self, i).is_some() => {
|
||||
use crate::modules::model::edge_cmd::SolidEdgeCommand;
|
||||
let target = selected_edge_body(self, i);
|
||||
let header = &self.tabs[i].scene.document.header;
|
||||
let distances = (header.chamfer_distance_a, header.chamfer_distance_b);
|
||||
let bodies = solid_edge_sources(self, i);
|
||||
let command = SolidEdgeCommand::new_chamfer(
|
||||
target,
|
||||
bodies,
|
||||
crate::scene::WireModel::SELECTED,
|
||||
distances,
|
||||
);
|
||||
let distances = command.chamfer_distances();
|
||||
self.command_line.push_output(
|
||||
crate::tf!(
|
||||
"Distance1 = {:.4}, Distance2 = {:.4}",
|
||||
distances.0,
|
||||
distances.1
|
||||
)
|
||||
.as_ref(),
|
||||
);
|
||||
self.command_line.push_info(&command.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(command));
|
||||
}
|
||||
|
||||
@@ -335,9 +335,9 @@ impl OpenCADStudio {
|
||||
"PERSP" => return Some(Task::done(Message::SetProjection(false))),
|
||||
"LAYERS" => return Some(Task::done(Message::ToggleLayers)),
|
||||
|
||||
// SCRIPT <path> — run a command script: each non-blank, non-comment
|
||||
// SCRIPT <path> — run a command script: each non-comment
|
||||
// line is fed through the same command path the `--script` startup
|
||||
// flag uses, so the behaviour matches headless automation exactly.
|
||||
// flag uses. Blank rows submit Enter to the active command.
|
||||
"SCRIPT" | "SCR" => {
|
||||
use crate::command::ValuePromptCommand;
|
||||
let c = ValuePromptCommand::new("SCRIPT", "SCRIPT path to the .scr file:");
|
||||
@@ -352,10 +352,8 @@ impl OpenCADStudio {
|
||||
let cmds: Vec<Task<Message>> = text
|
||||
.lines()
|
||||
.map(str::trim)
|
||||
.filter(|l| {
|
||||
!l.is_empty() && !l.starts_with('#') && !l.starts_with(';')
|
||||
})
|
||||
.map(|l| Task::done(Message::Command(l.to_string())))
|
||||
.filter(|l| !l.starts_with('#') && !l.starts_with(';'))
|
||||
.map(|l| Task::done(Message::ScriptLine(l.to_string())))
|
||||
.collect();
|
||||
self.command_line.push_output(crate::tf!(
|
||||
"SCRIPT: running {} command(s) from {p}.",
|
||||
|
||||
+5
-1
@@ -2117,6 +2117,10 @@ pub enum Message {
|
||||
CommandInput(String),
|
||||
CommandSubmit,
|
||||
Command(String),
|
||||
/// Execute one complete line read from a command script. Unlike UI/ribbon
|
||||
/// dispatch, this accepts an interactive verb and all of its arguments on
|
||||
/// the same line (`BOX 0,0,0 10,10,0 10`).
|
||||
ScriptLine(String),
|
||||
/// Append one typed character to the command-line input from the
|
||||
/// global key-press subscription. Used when the text-input widget
|
||||
/// itself isn't focused (focus parked on viewport / button / etc.)
|
||||
@@ -3832,7 +3836,7 @@ impl OpenCADStudio {
|
||||
Task::batch(
|
||||
cfg.script_lines
|
||||
.into_iter()
|
||||
.map(|line| Task::done(Message::Command(line))),
|
||||
.map(|line| Task::done(Message::ScriptLine(line))),
|
||||
)
|
||||
};
|
||||
s.queue_startup_prompts();
|
||||
|
||||
+231
-45
@@ -7,7 +7,7 @@ use acadrust::{
|
||||
objects::SolidHistoryOperation,
|
||||
EntityType, Handle,
|
||||
};
|
||||
use cadkernel::brep::Body;
|
||||
use cadkernel::brep::{Body, EdgeKey, FaceKey};
|
||||
use iced::Task;
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -273,6 +273,29 @@ fn entity_with_boolean_body(mut source: EntityType, body: &Body) -> Option<Entit
|
||||
Some(source)
|
||||
}
|
||||
|
||||
fn entity_with_history_body(mut source: EntityType, body: &Body) -> Option<EntityType> {
|
||||
let document = crate::scene::convert::acis_export::solid_to_sat(body)?;
|
||||
let wires = solid_model::edge_wires(body);
|
||||
match &mut source {
|
||||
EntityType::Solid3D(entity) => {
|
||||
entity.wires = wires;
|
||||
entity.silhouettes.clear();
|
||||
entity.set_sat_document(&document);
|
||||
}
|
||||
EntityType::Surface(entity) => {
|
||||
entity.wires = wires;
|
||||
entity.silhouettes.clear();
|
||||
if entity.kind != SurfaceKind::Plane {
|
||||
entity.kind = SurfaceKind::Generic;
|
||||
entity.surface_data = SurfaceData::Generic;
|
||||
}
|
||||
entity.acis_data = AcisData::from_sat(&document.to_sat_string());
|
||||
}
|
||||
_ => return None,
|
||||
}
|
||||
Some(source)
|
||||
}
|
||||
|
||||
enum IntersectBodyOutcome {
|
||||
Area(Body),
|
||||
Touching,
|
||||
@@ -580,44 +603,169 @@ impl super::OpenCADStudio {
|
||||
groups
|
||||
}
|
||||
|
||||
fn replace_solid_body(&mut self, handle: Handle, result: Body, label: &str) -> bool {
|
||||
fn replace_solid_body_with_fillet(
|
||||
&mut self,
|
||||
handle: Handle,
|
||||
source: &Body,
|
||||
result: Body,
|
||||
edges: &[EdgeKey],
|
||||
radius: f64,
|
||||
) -> bool {
|
||||
let i = self.active_tab;
|
||||
let Some(document) =
|
||||
crate::scene::convert::acis_export::solid_to_sat(&result)
|
||||
else {
|
||||
self.command_line
|
||||
.push_error(crate::t!("The result could not be encoded as ACIS.").as_ref());
|
||||
return false;
|
||||
};
|
||||
let Some(EntityType::Solid3D(mut entity)) =
|
||||
self.tabs[i].scene.document.get_entity(handle).cloned()
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
entity.wires = solid_model::edge_wires(&result);
|
||||
entity.silhouettes.clear();
|
||||
entity.history_handle = None;
|
||||
entity.set_sat_document(&document);
|
||||
|
||||
let Some(display) = self.tabs[i].scene.prepare_solid_model_display(handle, &result)
|
||||
let Some(display) = self.tabs[i]
|
||||
.scene
|
||||
.prepare_solid_model_display(handle, &result)
|
||||
.filter(|display| display.0.complete)
|
||||
else {
|
||||
self.command_line.push_error(crate::t!("The result could not be displayed completely. The original solid was retained.").as_ref());
|
||||
self.command_line.push_error(crate::t!("The result could not be displayed completely. The original edge body was retained.").as_ref());
|
||||
return false;
|
||||
};
|
||||
self.push_undo_snapshot(i, label);
|
||||
self.tabs[i].scene.delete_solid_history(handle);
|
||||
if !self.tabs[i]
|
||||
.scene
|
||||
.update_entity(EntityType::Solid3D(entity))
|
||||
let ordered = source.edge_keys().collect::<Vec<_>>();
|
||||
let Some(history_edges) = edges
|
||||
.iter()
|
||||
.map(|edge| {
|
||||
ordered
|
||||
.iter()
|
||||
.position(|candidate| candidate == edge)
|
||||
.and_then(|ordinal| i32::try_from(ordinal).ok())
|
||||
})
|
||||
.collect::<Option<Vec<_>>>()
|
||||
else {
|
||||
self.command_line
|
||||
.push_error(crate::t!("A selected edge no longer belongs to the body.").as_ref());
|
||||
return false;
|
||||
};
|
||||
|
||||
self.push_undo_snapshot(i, "FILLETEDGE");
|
||||
if self.tabs[i].scene.document.solid_history_graph(handle).is_none()
|
||||
&& !self.tabs[i]
|
||||
.scene
|
||||
.create_solid_history(handle, solid_history::brep_op(source))
|
||||
{
|
||||
self.command_line
|
||||
.push_error(crate::t!("The solid could not be updated.").as_ref());
|
||||
.push_error(crate::t!("The edge body history could not be created.").as_ref());
|
||||
return false;
|
||||
}
|
||||
let history = solid_history::brep_op(&result);
|
||||
self.tabs[i].scene.create_solid_history(handle, history);
|
||||
self.tabs[i].scene.register_prepared_solid_model(handle, result, display);
|
||||
if !self.tabs[i].scene.append_solid_history(
|
||||
handle,
|
||||
solid_history::fillet_op(history_edges, radius),
|
||||
) {
|
||||
self.command_line
|
||||
.push_error(crate::t!("The fillet history could not be recorded.").as_ref());
|
||||
return false;
|
||||
}
|
||||
let _ = self.tabs[i].scene.apply_solid_history_choice(
|
||||
handle,
|
||||
solid_history::PROP_HISTORY,
|
||||
"Record",
|
||||
);
|
||||
let Some(entity) = self.tabs[i].scene.document.get_entity(handle).cloned() else {
|
||||
return false;
|
||||
};
|
||||
let Some(entity) = entity_with_history_body(entity, &result) else {
|
||||
return false;
|
||||
};
|
||||
if !self.tabs[i].scene.update_entity(entity) {
|
||||
self.command_line
|
||||
.push_error(crate::t!("The edge body could not be updated.").as_ref());
|
||||
return false;
|
||||
}
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.register_prepared_solid_model(handle, result, display);
|
||||
self.tabs[i].scene.deselect_all();
|
||||
self.tabs[i].scene.select_entity(handle, false);
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
true
|
||||
}
|
||||
|
||||
fn replace_edge_body_with_chamfer(
|
||||
&mut self,
|
||||
handle: Handle,
|
||||
source: &Body,
|
||||
result: Body,
|
||||
edges: &[EdgeKey],
|
||||
base_face: FaceKey,
|
||||
base_distance: f64,
|
||||
other_distance: f64,
|
||||
) -> bool {
|
||||
let i = self.active_tab;
|
||||
let Some(display) = self.tabs[i]
|
||||
.scene
|
||||
.prepare_solid_model_display(handle, &result)
|
||||
.filter(|display| display.0.complete)
|
||||
else {
|
||||
self.command_line.push_error(crate::t!("The result could not be displayed completely. The original edge body was retained.").as_ref());
|
||||
return false;
|
||||
};
|
||||
let ordered_edges = source.edge_keys().collect::<Vec<_>>();
|
||||
let Some(history_edges) = edges
|
||||
.iter()
|
||||
.map(|edge| {
|
||||
ordered_edges
|
||||
.iter()
|
||||
.position(|candidate| candidate == edge)
|
||||
.and_then(|ordinal| i32::try_from(ordinal).ok())
|
||||
})
|
||||
.collect::<Option<Vec<_>>>()
|
||||
else {
|
||||
self.command_line
|
||||
.push_error(crate::t!("A selected edge no longer belongs to the body.").as_ref());
|
||||
return false;
|
||||
};
|
||||
let Some(history_face) = source
|
||||
.face_keys()
|
||||
.position(|candidate| candidate == base_face)
|
||||
.and_then(|ordinal| i32::try_from(ordinal).ok())
|
||||
else {
|
||||
self.command_line
|
||||
.push_error(crate::t!("The selected base face no longer belongs to the body.").as_ref());
|
||||
return false;
|
||||
};
|
||||
|
||||
self.push_undo_snapshot(i, "CHAMFEREDGE");
|
||||
if self.tabs[i].scene.document.solid_history_graph(handle).is_none()
|
||||
&& !self.tabs[i]
|
||||
.scene
|
||||
.create_solid_history(handle, solid_history::brep_op(source))
|
||||
{
|
||||
self.command_line
|
||||
.push_error(crate::t!("The edge body history could not be created.").as_ref());
|
||||
return false;
|
||||
}
|
||||
if !self.tabs[i].scene.append_solid_history(
|
||||
handle,
|
||||
solid_history::chamfer_op(
|
||||
history_edges,
|
||||
history_face,
|
||||
base_distance,
|
||||
other_distance,
|
||||
),
|
||||
) {
|
||||
self.command_line
|
||||
.push_error(crate::t!("The chamfer history could not be recorded.").as_ref());
|
||||
return false;
|
||||
}
|
||||
let _ = self.tabs[i].scene.apply_solid_history_choice(
|
||||
handle,
|
||||
solid_history::PROP_HISTORY,
|
||||
"Record",
|
||||
);
|
||||
let Some(entity) = self.tabs[i].scene.document.get_entity(handle).cloned() else {
|
||||
return false;
|
||||
};
|
||||
let Some(entity) = entity_with_history_body(entity, &result) else {
|
||||
return false;
|
||||
};
|
||||
if !self.tabs[i].scene.update_entity(entity) {
|
||||
self.command_line
|
||||
.push_error(crate::t!("The edge body could not be updated.").as_ref());
|
||||
return false;
|
||||
}
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.register_prepared_solid_model(handle, result, display);
|
||||
self.tabs[i].scene.deselect_all();
|
||||
self.tabs[i].scene.select_entity(handle, false);
|
||||
self.tabs[i].dirty = true;
|
||||
@@ -628,20 +776,21 @@ impl super::OpenCADStudio {
|
||||
pub(super) fn solid_edge_blend(
|
||||
&mut self,
|
||||
handle: Handle,
|
||||
pick: glam::DVec3,
|
||||
edges: &[EdgeKey],
|
||||
base_face: Option<FaceKey>,
|
||||
value: f64,
|
||||
other_value: f64,
|
||||
fillet: bool,
|
||||
) -> Task<Message> {
|
||||
let i = self.active_tab;
|
||||
if self.reject_locked_edit(i, handle) {
|
||||
return Task::none();
|
||||
}
|
||||
if !matches!(
|
||||
self.tabs[i].scene.document.get_entity(handle),
|
||||
Some(EntityType::Solid3D(_))
|
||||
) {
|
||||
if !matches!(self.tabs[i].scene.document.get_entity(handle), Some(
|
||||
EntityType::Solid3D(_) | EntityType::Surface(_)
|
||||
)) {
|
||||
self.command_line
|
||||
.push_error(crate::t!("Select a 3D solid edge.").as_ref());
|
||||
.push_error(crate::t!("Select a 3D solid or surface edge.").as_ref());
|
||||
return Task::none();
|
||||
}
|
||||
self.tabs[i].scene.restore_solid_models(&[handle]);
|
||||
@@ -650,15 +799,35 @@ impl super::OpenCADStudio {
|
||||
.push_error(crate::t!("The solid geometry could not be restored.").as_ref());
|
||||
return Task::none();
|
||||
};
|
||||
let Some(edge) = solid_model::nearest_edge(&body, pick.to_array()) else {
|
||||
self.command_line
|
||||
.push_error(crate::t!("Select a solid edge.").as_ref());
|
||||
return Task::none();
|
||||
};
|
||||
let result = if fillet {
|
||||
cadkernel::brep::fillet(&body, edge, value)
|
||||
match cadkernel::brep::fillet_edges(&body, edges, value) {
|
||||
Ok(result) => Some(result),
|
||||
Err(error) => {
|
||||
self.command_line
|
||||
.push_error(&format!("FILLETEDGE: {error}"));
|
||||
return Task::none();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cadkernel::brep::chamfer(&body, edge, value)
|
||||
let Some(base_face) = base_face else {
|
||||
self.command_line
|
||||
.push_error(crate::t!("CHAMFEREDGE: select a base face edge.").as_ref());
|
||||
return Task::none();
|
||||
};
|
||||
match cadkernel::brep::chamfer_edges(
|
||||
&body,
|
||||
edges,
|
||||
base_face,
|
||||
value,
|
||||
other_value,
|
||||
) {
|
||||
Ok(result) => Some(result),
|
||||
Err(error) => {
|
||||
self.command_line
|
||||
.push_error(&format!("CHAMFEREDGE: {error}"));
|
||||
return Task::none();
|
||||
}
|
||||
}
|
||||
};
|
||||
let Some(result) = result else {
|
||||
self.command_line.push_error(
|
||||
@@ -667,8 +836,25 @@ impl super::OpenCADStudio {
|
||||
);
|
||||
return Task::none();
|
||||
};
|
||||
let label = if fillet { "SOLIDFILLET" } else { "SOLIDCHAMFER" };
|
||||
if self.replace_solid_body(handle, result, label) {
|
||||
let label = if fillet { "FILLETEDGE" } else { "CHAMFEREDGE" };
|
||||
let updated = if fillet {
|
||||
self.replace_solid_body_with_fillet(handle, &body, result, edges, value)
|
||||
} else {
|
||||
self.replace_edge_body_with_chamfer(
|
||||
handle,
|
||||
&body,
|
||||
result,
|
||||
edges,
|
||||
base_face.expect("checked chamfer face"),
|
||||
value,
|
||||
other_value,
|
||||
)
|
||||
};
|
||||
if updated {
|
||||
if !fillet {
|
||||
self.tabs[i].scene.document.header.chamfer_distance_a = value;
|
||||
self.tabs[i].scene.document.header.chamfer_distance_b = other_value;
|
||||
}
|
||||
self.command_line
|
||||
.push_output(crate::tf!("{label}: solid updated.").as_ref());
|
||||
}
|
||||
|
||||
@@ -740,6 +740,14 @@ impl OpenCADStudio {
|
||||
.as_mut()
|
||||
.map(|c| c.on_preview_wires(cur))
|
||||
.unwrap_or_default();
|
||||
let preview_hidden = self.tabs[i]
|
||||
.active_cmd
|
||||
.as_ref()
|
||||
.map(|command| command.preview_hidden_handles().to_vec())
|
||||
.unwrap_or_default();
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.set_command_preview_hidden(&preview_hidden);
|
||||
self.tabs[i].scene.set_preview_wires(previews);
|
||||
}
|
||||
}
|
||||
@@ -1969,6 +1969,14 @@ impl OpenCADStudio {
|
||||
self.dispatch_command(&cmd)
|
||||
}
|
||||
|
||||
Message::ScriptLine(line) => {
|
||||
if line.trim().is_empty() {
|
||||
self.feed_command(crate::command::StepInput::Enter)
|
||||
} else {
|
||||
self.run_command_line(&line)
|
||||
}
|
||||
}
|
||||
|
||||
Message::ToggleLayers => {
|
||||
if self.active_modal == Some(super::ModalKind::Layers) {
|
||||
self.ribbon.deactivate_tool_if("LAYERS");
|
||||
|
||||
@@ -2468,6 +2468,14 @@ impl OpenCADStudio {
|
||||
previews.push(guide);
|
||||
}
|
||||
}
|
||||
let preview_hidden = self.tabs[i]
|
||||
.active_cmd
|
||||
.as_ref()
|
||||
.map(|command| command.preview_hidden_handles().to_vec())
|
||||
.unwrap_or_default();
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.set_command_preview_hidden(&preview_hidden);
|
||||
self.tabs[i].scene.set_preview_wires(previews);
|
||||
} else {
|
||||
self.tabs[i].snap_result = None;
|
||||
|
||||
Reference in new issue
Block a user