Fillets on solidcore: the largest size that fits is still the one the search builds; the kernel's names the edge

solidcore's fit is the largest size less a margin (34.99 where the L bracket's bend builds 35,
4.29 where #3435's ring builds 4.3), so the feature's search keeps naming the size, and solidcore's
is the answer only where the search finds none. The refusal keeps its words, "larger than the
faces beside its edges allow", with the edge after them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SdcgEu4Lr3moCCisdZShKz
This commit is contained in:
brett19
2026-11-01 23:13:17 -07:00
committed by jyviko
parent 881899bee1
commit 8a730c6273
5 changed files with 23 additions and 12 deletions
+11 -2
View File
@@ -32,12 +32,21 @@ pub fn largest_fit_note(size: &str, largest: f64) -> String {
format!("the largest {size} that fits is {} mm", trimmed_mm(largest))
}
/// Whether a refusal already names the largest size that fits ([`largest_fit_note`]), so no search
/// for it is needed.
/// Whether a refusal already names the largest size that fits ([`largest_fit_note`]).
pub fn names_largest_fit(why: &str) -> bool {
why.contains("that fits is ")
}
/// `why` with the largest size that fits it names ([`largest_fit_note`]) replaced by `largest`:
/// solidcore names the size less a margin (34.99 where 35 builds), a feature's search the
/// largest it built. `why` itself where it names none.
pub fn with_fit_note(why: &str, size: &str, largest: f64) -> String {
let Some(start) = why.find("the largest ") else { return why.to_owned() };
let Some(len) = why.get(start..).and_then(|rest| rest.find(" mm")) else { return why.to_owned() };
let (head, tail) = (why.get(..start).unwrap_or_default(), why.get(start + len + 3..).unwrap_or_default());
format!("{head}{}{tail}", largest_fit_note(size, largest))
}
/// `v` to the micrometre, without trailing zeros.
pub(crate) fn trimmed_mm(v: f64) -> String {
let s = format!("{v:.6}");
+3 -3
View File
@@ -447,8 +447,8 @@ mod imp {
SmError::NoRoom => KernelError::TooLarge(format!("the {what} is larger than the faces beside its edges allow")),
SmError::TooLarge { size, kind, at } => {
let beside = match at {
Some([x, y, z]) => format!("the edge at ({x:.3}, {y:.3}, {z:.3})"),
None => "its edges".to_owned(),
Some([x, y, z]) => format!(", at the edge at ({x:.3}, {y:.3}, {z:.3})"),
None => String::new(),
};
let fits = match kind {
solidcraft_smlib::FitKind::Scale => {
@@ -456,7 +456,7 @@ mod imp {
}
kind => crate::blend::largest_fit_note(kind.word(), size),
};
KernelError::TooLarge(format!("the {what} is larger than the faces beside {beside} allow; {fits}"))
KernelError::TooLarge(format!("the {what} is larger than the faces beside its edges allow{beside}; {fits}"))
}
SmError::Unported(why) => KernelError::Invalid(format!("not supported yet: {why}")),
e => failed(what, "operation", e),
+1
View File
@@ -158,6 +158,7 @@ pub mod watch;
pub use blend::{
ChamferSide, SETBACK_AT_LEAST, blend_edges, chamfer, chamfer_max, chamfer_sides, fillet, fillet_each, fillet_g2, fillet_g2_corners,
fillet_g2_with_g2_corners, fillet_least_setback, fillet_max, fillet_max_each, fillet_removing, fillet_setback, largest_fit_note, names_largest_fit, tangent_chain,
with_fit_note,
};
pub use blend_corner::fillet_radii;
pub use blend_variable::{RadiusSpline, Taper, fillet_chord, fillet_tapered, fillet_variable, fillet_variable_points, fillet_variable_spline, taper};