A block, the box from (−10, −10, −8) to (30, 25, 0), with a groove cut into its top by a bull-nose mill run along a spline that loops over itself, so that the groove crosses itself.
The curve is the cubic Bézier curve in the plane z = 0 whose control points are (0, 0, 0), (30, 20, 0), (−10, 20, 0) and (20, 0, 0), run from its first end to its last. It crosses itself once, near (9.98, 8.54), and at its sharpest it turns on a radius of about 1.79, tighter than the mill.
The mill is a solid of revolution about an upright axis that rides the curve: a cylinder of radius 2, from 1.5 below the block's top up to 5 above it, whose bottom corner is rounded to radius 0.5 (a flat bottom of radius 1.5 joined to the side by a quarter torus of tube radius 0.5). Its axis starts on the vertical line through the curve's first point and stays upright, its foot on the curve, as it runs the whole curve. Cut from the block everything the mill passes through.
Where the curve crosses itself the groove comes back onto itself: the sheet the mill sweeps passes through its own earlier part. Where it turns tighter than the mill, the groove's inner wall folds and is cut away by the mill itself.
Unsettled. This solid has no closed form, and no two kernels yet agree on it to 1e-8, so it has no answer to grade against. Below is what each kernel builds: built means a watertight, consistently oriented solid, whatever its measures; the table says which kernels agree with which.
Drawing
TopIsometricFrontRight
Third-angle projection, the three views at one scale. Drawn from next.BREP's result, which passed.
† works around a missing feature. Pick an entry to see its solid, its measures and its code.
Drag to turn, scroll or pinch to zoom, right-drag to move. The solid as its STEP file has it, meshed in the browser by Open CASCADE (occt-import-js): each face colored by the kind of its surface, and the edges that bound each face drawn between them.
Drag to turn, scroll or pinch to zoom, right-drag to move. Black lines are where the surface turns sharply; red ones, seen through the solid, are open edges, where the mesh is not closed.
Time
1.97 s; CPU time 2.55 s; peak memory 20 MB
Notes
built A watertight, consistently oriented solid; the case has no settled answer yet to grade it against.
Data
measured
volume
10956.9864558
area
4101.93716919
agrees with
no other kernel
faces
13 bspline, 2 cylinder, 7 plane, 2 torus
mesh
16572 triangles, closed
centre of gravity
(10, 7.52554, -4.07229) its triangles
inertia
about it, of unit density: Ixx 1.19378e+06; Iyy 1.54305e+06; Izz 2.62273e+06; Ixy 0.010374; Iyz -935.076; Izx -0.011038
not by the harness, which graded the runner's own measures instead: cannot measure: face #12292: a loop whose path on its surface breaks (an edge laid across a place where its surface meets itself?)
//! A block, the box (−10, −10, −8)–(30, 25, 0), with a groove cut into its top by a bull-nose mill//! — radius 2 from 1.5 below the top to 5 above it, its bottom corner rounded to 0.5 — whose//! upright axis rides the cubic Bézier curve (0, 0, 0), (30, 20, 0), (−10, 20, 0), (20, 0, 0) in//! the top from its first end to its last, its foot on the curve. The curve crosses itself, so the//! groove does, and turns tighter than the mill.//!//! The motion is the mill carried without turning along the curve, the kernel's own B-spline: no//! slide, turn or screw, nor a path of them, so a motion the kernel reads by evaluating it//! (`Trajectory::General`, its K2 road), which takes a convex tool of revolution.//!//! Refused by the kernel at run time: the sheet each instant's contact sweeps cannot be fitted to//! the arrangement's tolerance (`Unbuilt::Failed`: it fits only to about 1.9 along the loop and 1.4//! along the roll), before its fold or its return onto itself is reached. The same refusal stands//! with the mill carried by the kernel's own frame along the curve (`trajectory::Along`, which//! turns it only about its own axis, so sweeps the same set); the mill is no prism, so the planar//! road (`swept::planar_solid`) does not take it.usecrate::sketch::block;
use cad_kernel::build::{revolve, Profile, ProfileEdge};
use cad_kernel::geom::{tolerance, Frame, V};
use cad_kernel::nurbs::BSpline;
use cad_kernel::swept::closed::cut_from;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Motion, Path, Stretch, Trajectory};
use cad_kernel::util::interval::Interval;
use cad_kernel::util::space::{norm, scale, sub};
use cad_kernel::KernelError;
use std::f64::consts::{FRAC_PI_2, TAU};
use std::sync::Arc;
constSTOCK_LO: V = [-10., -10., -8.];
constSTOCK_HI: V = [30., 25., 0.];
constCONTROL: [V; 4] = [[0., 0., 0.], [30., 20., 0.], [-10., 20., 0.], [20., 0., 0.]];
/// The mill: the middle of its flat bottom, its radius, its corner's and its top.constFOOT: V = [0., 0., -1.5];
constRADIUS: f64 = 2.;
constCORNER: f64 = 0.5;
constTOP: f64 = 5.;
/// How closely the mill is meshed for the sweep's membership reads: a two-hundred-and-fiftieth of/// its corner's radius.constBAR: f64 = 0.002;
/// The mill about the vertical line through the curve's first point: its meridian in the/// half-plane y = 0 beyond the axis — out along its flat bottom, round its corner, up its side,/// back across its top and down its axis — turned once about the axis.fnmill() -> Result<Brep, String> {
let at = |x: f64, z: f64| [x, 0., z];
let [_, _, z0] = FOOT;
let corner = Frame::new(at(RADIUS - CORNER, z0 + CORNER), [0., -1., 0.], [1., 0., 0.]);
let edges = vec![
ProfileEdge::Line { a: at(0., z0), b: at(RADIUS - CORNER, z0) },
ProfileEdge::Arc { frame: corner, r: CORNER, span: Some([-FRAC_PI_2, 0.]) },
ProfileEdge::Line { a: at(RADIUS, z0 + CORNER), b: at(RADIUS, TOP) },
ProfileEdge::Line { a: at(RADIUS, TOP), b: at(0., TOP) },
ProfileEdge::Line { a: at(0., TOP), b: at(0., z0) },
];
let meridian = Profile { origin: FOOT, normal: [0., 1., 0.], loops: vec![edges],
names: Vec::new() };
revolve(&meridian, FOOT, [0., 0., 1.], TAU)
}
/// The mill carried without turning along the curve: at `t` moved by the curve's point there less/// its first, at the curve's rate.#[derive(Debug)]structAlong(BSpline);
implPathforAlong {
fnat(&self, t: f64) -> Result<Motion, KernelError> {
let (point, rate) = self.0.d1(t);
Motion::translation(sub(point, CONTROL[0]), rate)
.map_err(|e| KernelError::from(format!("the curve's pose at {t}: {e:?}")))
}
/// What the motion does over any stretch, enclosed, as the kernel's membership reads its speed/// bound: the curve within its poles' box (a Bézier curve lies in its control polygon's hull),/// so the move within that box less the first pole; no turn; its speed within the longest of/// its hodograph's poles.fnstretch(&self, _: f64, _: f64) -> Option<Stretch> {
let moved = CONTROL.map(|p| sub(p, CONTROL[0]));
let one = |i: usize, j: usize| Interval::point(if i == j { 1. } else { 0. }).ok();
let turn = [[one(0, 0)?, one(0, 1)?, one(0, 2)?], [one(1, 0)?, one(1, 1)?, one(1, 2)?],
[one(2, 0)?, one(2, 1)?, one(2, 2)?]];
let speed = hodograph().iter().map(|&h| norm(h)).fold(0., f64::max);
Some(Stretch { point: hull(&moved)?, turn, speed, spin: 0., origin: [0.; 3] })
}
}
/// The box holding `points`, as intervals.fnhull(points: &[V]) -> Option<[Interval; 3]> {
let side = |k: usize| {
let (lo, hi) = points.iter().fold((f64::INFINITY, f64::NEG_INFINITY),
|(lo, hi), p| (lo.min(p[k]), hi.max(p[k])));
Interval::new(lo, hi).ok()
};
Some([side(0)?, side(1)?, side(2)?])
}
/// The Bézier curve's hodograph's poles, `3 (P[i+1] − P[i])`: its rate is a weighted mean of them.fnhodograph() -> [V; 3] {
std::array::from_fn(|i| scale(sub(CONTROL[i + 1], CONTROL[i]), 3.))
}
pubfnbuild() -> Result<Brep, String> {
let stock = block(STOCK_LO, STOCK_HI)?;
let tool = mill()?;
// the curve as cad-kernel holds a Bézier segment: a cubic B-spline on clamped knotslet knots = vec![0., 0., 0., 0., 1., 1., 1., 1.];
let curve = BSpline::new(3, knots, CONTROL.to_vec())?;
let path = Trajectory::General(Arc::new(Along(curve)));
// the kernel's closed swept solid cut from the block on one arrangement: the sheet each// instant's contact sweeps, fitted, and the mill where it starts and where it stopslet size = stock.size().max(tool.size());
cut_from(&stock, &tool, &path, [0., 1.], BAR, tolerance(size))
.map_err(|why| format!("the mill's sweep not built: {why:?}"))
}
occt left no solid to show.
Time
618 ms; CPU time 617 ms; peak memory 356.6 MB
Notes
refused occt has no sweep of a solid, and where the curve turns tighter than the mill (radius 1.79 against 2) the sheet the mill's inner side sweeps along it folds through itself; occt's Booleans take no self-intersecting solid and it has no operation to trim a sweep where it folds
"""A groove that crosses itself: a mill run round a looping spline. A block, the box from (−10,
−10, −8) to (30, 25, 0), with a groove cut into its top by a bull-nose mill run along a spline that
loops over itself, so that the groove crosses itself.
The curve is the cubic Bézier curve in the plane z = 0 whose control points are (0, 0, 0), (30, 20,
0), (−10, 20, 0) and (20, 0, 0), run from its first end to its last. It crosses itself once, near
(9.98, 8.54), and at its sharpest it turns on a radius of about 1.79, tighter than the mill.
The mill is a solid of revolution about an upright axis that rides the curve: a cylinder of radius
2, from 1.5 below the block's top up to 5 above it, whose bottom corner is rounded to radius 0.5 (a
flat bottom of radius 1.5 joined to the side by a quarter torus of tube radius 0.5). Its axis
starts on the vertical line through the curve's first point and stays upright, its foot on the
curve, as it runs the whole curve. Cut from the block everything the mill passes through.
Where the curve crosses itself the groove comes back onto itself: the sheet the mill sweeps passes
through its own earlier part. Where it turns tighter than the mill, the groove's inner wall folds
and is cut away by the mill itself."""from bench importRefuseddefbuild():
# The mill is a solid of revolution about the upright axis riding the curve, so it touches# what it sweeps along its meridians square to the curve, and each piece of it split there# could be carried along the curve by BRepOffsetAPI_MakePipeShell. But the curve turns on a# radius of about 1.79, tighter than the mill's 2: the sheet the mill's inner side sweeps# folds back through itself there, and OCCT's Booleans take no solid whose boundary passes# through itself; it has no operation that trims a sweep where it folds.raiseRefused("occt has no sweep of a solid, and where the curve turns tighter than the ""mill (radius 1.79 against 2) the sheet the mill's inner side sweeps along it ""folds through itself; occt's Booleans take no self-intersecting solid and it ""has no operation to trim a sweep where it folds")
arris left no solid to show.
Time
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
kentron left no solid to show.
Time
3.3 ms; CPU time 3.1 ms; peak memory 8.6 MB
Notes
refused invalid input: a turning motion running along a face of the tool beside faces it carries: the face's edges sweep regions of its surface over one another
//!//! The mill is its half section revolved about its axis. It is carried in the frame riding the//! curve (`shared::swept::level_bezier_frame`), its axis on the curve (how it turns about its own//! axis changes nothing it fills); the motion is given by its places//! (`sweep::RigidMotion::Carried`) for kentron's sweep of a solid (`sweep::solid`), cut from the//! block. kentron's sweep refuses it: the mill's flat end turns in its own plane beside faces the//! motion carries out, and that end's edges sweep regions of its plane over one another.usecrate::bench::p;
usecrate::shared::parts::xz_plane;
usecrate::shared::swept::level_bezier_frame;
use kentron::math::Axis;
use kentron::primitives::Cuboid;
use kentron::sketch::{self, Outcome, Step};
use kentron::sweep::{self, Carriage, RigidMotion};
use kentron::topology::{Model, Shape};
use std::f64::consts::TAU;
use std::sync::Arc;
constCURVE: [(f64, f64); 4] = [(0.0, 0.0), (30.0, 20.0), (-10.0, 20.0), (20.0, 0.0)];
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
useStep::{ArcasRound, Start, To};
let block = Cuboid::from_corners(p(-10.0, -10.0, -8.0), p(30.0, 25.0, 0.0)).build(m)?;
// The mill: its half section, out from its axis (the flat bottom to 1.5, the round's quarter// circle about (1.5, −1), the side up to the top), turned whole about it.let half = [Start(0.0, -1.5), To(1.5, -1.5), Round { radius: 0.5, angle: 90.0 }, To(2.0, 5.0), To(0.0, 5.0)];
let half = sketch::profile(m, xz_plane(0.0), &half, Outcome::Face)?;
let mill = sweep::revolve(m, half, Axis::Z, TAU)?.shape;
let along = RigidMotion::Carried(Carriage(Arc::new(|t| level_bezier_frame(&CURVE, t))));
let swept = sweep::solid(m, mill, &along)?;
kentron::boolean::difference(m, block, swept)
}
vcad left no solid to show.
Time
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
solidcraft left no solid to show.
Time
1.8 ms; CPU time 1.5 ms; peak memory 4.6 MB
Notes
refused no layer (solidcraft-kernel, solidcore-ops, solidcore) has a sweep of a solid or an envelope: along this curve, which turns tighter than the mill and crosses itself, the mill's section swept along it folds through itself, and the groove's walls are where the mill cuts its own sweep
//! A block, the box from (−10, −10, −8) to (30, 25, 0), with a groove cut into its top by the//! bull-nose mill of `bull-nose-along-line-arc-line`, its upright axis's foot run along the cubic//! Bézier curve in the top face through (0, 0, 0), (30, 20, 0), (−10, 20, 0) and (20, 0, 0), which//! crosses itself and turns tighter than the mill.//!//! Refused. The mill's sweep is every point within R(z) of the curve at each height z, which is//! the mill's section through its axis, square to the curve, swept along it, with a half mill at//! each end. But where the curve turns tighter than R(z) that swept section folds through itself,//! and where the curve crosses itself it passes through its own earlier part: the swept section//! is not a solid. Trimming the fold away is finding where the mill cuts its own sweep, an//! envelope.usecrate::Refusal;
usecrate::solids::Body;
pubfnbuild() -> Result<Body, Refusal> {
Err("no layer (solidcraft-kernel, solidcore-ops, solidcore) has a sweep of a solid or an \
envelope: along this curve, which turns tighter than the mill and crosses itself, the \
mill's section swept along it folds through itself, and the groove's walls are where \
the mill cuts its own sweep"
.into())
}
brepkit left no solid to show.
Time
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
popkern left no solid to show.
Time
3.4 ms; CPU time 3.2 ms; peak memory 11.6 MB
Notes
refused popkern has no sweep of a solid, and this sweep's wall is an envelope its other operations do not make
// A groove that crosses itself: a mill run round a looping spline.//// Refused: popkern has no sweep of a solid (its sweeps carry a profile along a path), and this// one's boundary is an envelope of the moving solid that its other operations do not make.throw"popkern has no sweep of a solid, and this sweep's wall is an envelope its other operations do not make";
aetheris left no solid to show.
Time
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
Time
4.84 s; CPU time 4.83 s; peak memory 105 MB
Notes
built A watertight, consistently oriented solid; the case has no settled answer yet to grade it against.
Its volume and area are its STEP file's, as the harness measures them from the file's exact geometry (harness/mass/); its triangles are Open CASCADE's mesh of the file, for the pictures.
Data
its STEP's
volume
10956.9864743
area
4101.93721992
agrees with
no other kernel
mesh
60346 triangles, closed, 4 degenerate
centre of gravity
(10, 7.52557, -4.07233) its STEP's solid
inertia
about it, of unit density: Ixx 1.19377e+06; Iyy 1.54305e+06; Izz 2.62272e+06; Ixy 9.05008e-10; Iyz -936.057; Izx -3.85688e-07
//! A block grooved by an upright bull-nose mill run along a cubic Bézier curve that loops over//! itself and turns tighter than the mill.//!//! Through the kernel's sweep of a solid carried by a frame along a curve (`sweep_solid_along`)://! the curve is the cubic Bézier (0, 0, 0), (30, 20, 0), (−10, 20, 0), (20, 0, 0), the frame's up//! the z axis; the mill, drawn in the frame at the curve's start, is a solid of revolution about the//! upright through (0, 0, −1.5), its meridian the flat end out to 1.5, the quarter circle of//! radius 0.5 about (1.5, 0.5), the side at 2 up to 6.5 and the flat top; cut from the block, the//! box from (−10, −10, −8) to (30, 25, 0). The kernel builds the upright mill's sweep from the//! planar distance to the curve, its folded inner wall and the island inside the loop included.usecrate::solids::p;
usecrate::Refusal;
use brep_kernel::{
boolean_operation_nary, make_box_brep, sweep_solid_along, BooleanOperation, BrepSolid, FrameCurve, OutlinePiece, SolidTool,
};
use std::f64::consts::FRAC_PI_2;
pubfnbuild() -> Result<BrepSolid, Refusal> {
let block = make_box_brep(p(-10.0, -10.0, -8.0), 40.0, 35.0, 8.0)?;
let mill = SolidTool::Revolved {
axis_origin: p(0.0, 0.0, -1.5),
axis_direction: p(0.0, 0.0, 1.0),
radial: p(1.0, 0.0, 0.0),
meridian: vec![
OutlinePiece::Line { from: [0.0, 0.0], to: [1.5, 0.0] },
OutlinePiece::Arc { centre: [1.5, 0.5], radius: 0.5, start: -FRAC_PI_2, end: 0.0 },
OutlinePiece::Line { from: [2.0, 0.5], to: [2.0, 6.5] },
OutlinePiece::Line { from: [2.0, 6.5], to: [0.0, 6.5] },
OutlinePiece::Line { from: [0.0, 6.5], to: [0.0, 0.0] },
],
};
let path = FrameCurve {
control: [p(0.0, 0.0, 0.0), p(30.0, 20.0, 0.0), p(-10.0, 20.0, 0.0), p(20.0, 0.0, 0.0)],
up: p(0.0, 0.0, 1.0),
};
let swept = sweep_solid_along(&mill, &path)?;
Ok(boolean_operation_nary(&[block, swept], BooleanOperation::Subtract)?)
}
geop left no solid to show.
Time
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
Time
1.34 s; CPU time 3.42 s; peak memory 48.5 MB
Notes
built A watertight, consistently oriented solid; the case has no settled answer yet to grade it against.
Its volume and area are its STEP file's, as the harness measures them from the file's exact geometry (harness/mass/); its triangles are Open CASCADE's mesh of the file, for the pictures.
Data
its STEP's
volume
10956.9397927
area
4101.82068953
agrees with
no other kernel
mesh
35124 triangles, closed
centre of gravity
(10, 7.52555, -4.07234) its STEP's solid
inertia
about it, of unit density: Ixx 1.19377e+06; Iyy 1.54305e+06; Izz 2.62272e+06; Ixy -2.56705e-10; Iyz -935.504; Izx -2.63222e-10
//! A block (the box from (−10, −10, −8) to (30, 25, 0)) grooved by an upright bull-nose mill (a//! cylinder of radius 2 from z = −1.5 to 5, its bottom corner rounded to radius 0.5) run along the//! cubic Bézier curve on (0, 0, 0), (30, 20, 0), (−10, 20, 0), (20, 0, 0), which loops over itself.//!//! The mill is its half section turned about its axis; what it passes through is cadrs's sweep of//! a solid along a path (exact: an upright solid of revolution's slot), cut from the block.usecrate::bench::{block, cut, p3, v3};
usecrate::shared::geometry::Section;
usecrate::shared::swept::{bezier_path, carried};
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel, Plane};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let b = block(k, p3(-10.0, -10.0, -8.0), p3(30.0, 25.0, 0.0))?;
let w = 2f64.sqrt() / 2.0;
let section = Section::on(Plane::xz(0.0))
.line((0.0, -1.5), (1.5, -1.5))
.conic((1.5, -1.5), (2.0, -1.5), w, (2.0, -1.0))
.line((2.0, -1.0), (2.0, 5.0))
.line((2.0, 5.0), (0.0, 5.0))
.line((0.0, 5.0), (0.0, -1.5));
let mill = section.turned(k, p3(0.0, 0.0, 0.0), v3(0.0, 0.0, 1.0))?;
let path = bezier_path([(0.0, 0.0), (30.0, 20.0), (-10.0, 20.0), (20.0, 0.0)]);
let swept = carried(k, mill, path)?;
cut(k, b, swept)
}
smlib left no solid to show.
Time
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
springrep left no solid to show.
Time
163 ms; CPU time 163 ms; peak memory 17.5 MB
Notes
refused springrep's path sweep of the mill's section folds where the curve turns tighter than the mill: invalid result: faces 3 and 7 share no edge but meet at (7.493370, 8.685275, -1.000000): the solid passes through itself; faces 3 and 6 share no edge but meet at (7.493370, 8.685275, -1.000000): the solid passes through itself; faces 4 and 7 share no edge but meet at (7.493370, 8.685275, -1.000000): the solid passes through itself; faces 4 and 6 share no edge but meet at (7.493370, 8.685275, 5.000000): the solid passes through itself
//! The box (−10, −10, −8)–(30, 25, 0) less everything a bull-nose mill passes through as its//! upright axis runs along the cubic Bézier curve with control points (0, 0, 0), (30, 20, 0),//! (−10, 20, 0) and (20, 0, 0), which crosses itself: a cylinder of radius 2 from z = −1.5 to 5,//! its bottom corner rounded to 0.5.//!//! springrep's sweep of a solid is exact only under a slide, a turn or a screw. The mill is a solid//! of revolution about an upright axis that slides along a level curve without turning, so at each//! instant its distance from any point is least where the point lies in its section square to the//! curve through its axis: the mill sweeps that section carried along the curve (springrep's path//! sweep, which keeps a level curve's up direction), and itself where it starts and stops.use std::f64::consts::{FRAC_PI_2, PI};
use springrep::boolean::difference;
use springrep::geom::{BSpline, Curve};
use springrep::sweep::along_curve;
use springrep::topo::Brep;
usecrate::shared::swept::{arc, boxed, line, outline, shifted, unite, upright, v3};
usecrate::shared::{e, frame};
pubfnbuild() -> Result<Brep, String> {
let block = boxed([-10.0, -10.0, -8.0], [30.0, 25.0, 0.0], "block")?;
let meridian = outline(vec![
line((0.0, -1.5), (1.5, -1.5), "bottom"),
arc((1.5, -1.0), 0.5, -FRAC_PI_2, FRAC_PI_2, "round"),
line((2.0, -1.0), (2.0, 5.0), "side"),
line((2.0, 5.0), (0.0, 5.0), "top"),
line((0.0, 5.0), (0.0, -1.5), "axis"),
]);
let mill = upright(&meridian, 0.0, 0.0, "mill")?;
let section = outline(vec![
line((-1.5, -1.5), (1.5, -1.5), "floor"),
arc((1.5, -1.0), 0.5, -FRAC_PI_2, FRAC_PI_2, "round"),
line((2.0, -1.0), (2.0, 5.0), "wall"),
line((2.0, 5.0), (-2.0, 5.0), "top"),
line((-2.0, 5.0), (-2.0, -1.0), "wall"),
arc((-1.5, -1.0), 0.5, PI, FRAC_PI_2, "round"),
]);
let ctrl = vec![v3(0.0, 0.0, 0.0), v3(30.0, 20.0, 0.0), v3(-10.0, 20.0, 0.0), v3(20.0, 0.0, 0.0)];
let path = Curve::BSpline(
BSpline::new(3, vec![0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0], ctrl).map_err(e)?,
);
// the section square to the curve where it starts, heading along (3, 2, 0), sketch y uplet heading = [3.0, 2.0, 0.0];
let start = frame([0.0, 0.0, 0.0], heading, [-2.0, 3.0, 0.0])?;
let channel = along_curve(§ion, &start, &path, (0.0, 1.0), 0.0, "groove").map_err(|why| {
format!("springrep's path sweep of the mill's section folds where the curve turns tighter than the mill: {why}")
})?;
let groove = unite(&[&mill, &channel, &shifted(&mill, v3(20.0, 0.0, 0.0))])?;
difference(&block, &groove).map_err(e)
}
geomsolver left no solid to show.
Time
120 ms; CPU time 272 ms; peak memory 28.9 MB
Notes
refused error[E080]: `groove` is outside the generating-sweep class (M1: the motion is rotations about fixed axes at constant ratios, or one screw, turn or slide (a joint driven by a law alone read as its joint over the values the law reaches)): temporal contacts are read of constant rates, and a frame along a path turns as its path does (#398)
// A block, the box from (-10, -10, -8) to (30, 25, 0), its top in the top plane; an upright// bull-nose mill, radius 2 from its flat bottom 1.5 below the top up to 5 above it, the corner of// its bottom rounded to 0.5, a turn of its half-section in the front plane, its axis on the// vertical line through the start of the cubic Bezier through (0, 0), (30, 20), (-10, 20) and// (20, 0) of the top face. A frame riding the curve carries it, upright, along the whole curve,// and everything it passes through is cut from the block.unit mm
use std
use std.solids
use std.solids (cut)
use std.stations
in std.top {
a := point
b := point hint((30, -10))
c := point hint((30, 25))
d := point hint((-10, 25))
outline := horizontal line(a, b) -> vertical line(b, c) ->
horizontal line(c, d) -> vertical line(d, a) -> close
fix((-10, -10)) a
a distance(40) b
b distance(35) c
// the path, a spline over its four control points
k0 := point
k1 := point hint((30, 20))
k2 := point hint((-10, 20))
k3 := point hint((20, 0))
fix((0, 0)) k0
fix((30, 20)) k1
fix((-10, 20)) k2
fix((20, 0)) k3
route := spline(k0, k1, k2, k3)
}
part := solid(std.solids.Prism(outline, from: -8mm, to: 0mm))
in std.front {
e0 := point
q := point hint((2, -1.5))
e2 := point hint((2, 5))
e3 := point hint((0, 5))
fix((0, -1.5)) e0
e0 distance(2) q
fix((0, 5)) e3
// the side meets the flat bottom at q, the corner rounded to 0.5
half := horizontal line(e0, q) -> round(r: 0.5mm) vertical line(q, e2) ->
horizontal line(e2, e3) -> vertical (spindle := line(e3, e0)) -> close
}
mill := solid(std.solids.Revolution(half, about: spindle))
// the frame that carries it along the whole spline
along := std.stations.Along(route, up: std.z)
groove := solid({ p | some t in (0rad, 1rad): p in mill at(under: along.f) t })
groove cut part
anvilcad left no solid to show.
Time
1.2 ms; CPU time 980 µs; peak memory 3.5 MB
Notes
refused anvil-brep has no sweep of a solid, and no spline curve to carry anything along: its sweeps follow lines and arcs only
//! A groove that crosses itself: a mill run round a looping spline.use anvil_brep::Solid;
pubfnbuild() -> Result<Solid, String> {
Err("anvil-brep has no sweep of a solid, and no spline curve to carry anything along: its sweeps follow lines and arcs only".into())
}