A block, the box from (0, −5, 0) to (20, 5, 10), with a slot cut across its top by an end mill.
The end mill is a solid cylinder of radius 2 standing upright about the vertical line through (−5, 0), from z = 7 up to z = 15: its flat end is 3 below the block's top.
It slides without turning along the x axis by 30, from x = −5 to x = 25, from clear before the block to clear past it. Cut from the block everything the mill passes through.
Its flat end, which the slide keeps in its own plane, touches all over and sweeps the slot's floor; the two lines of its side square to the slide sweep the walls, meeting the floor in sharp edges. The slot is |y| ≤ 2, z ≥ 7, along the block's whole length.
As a set:
$$\bigl([0,20]\times[-5,5]\times[0,10]\bigr) \setminus \bigl(T \oplus \{\,s\,(30,0,0) : 0 \le s \le
1\,\}\bigr), \quad T = \{\,(x+5)^2 + y^2 \le 2^2,\ 7 \le z \le 15\,\}$$
expected
closed form
volume
1760
20·10·10 − 20·(2·2)·3
area
1096
1000 − 80 − 2·12 + 80 + 2·20·3
Drawing
TopIsometricFrontRight
Third-angle projection, the three views at one scale. Drawn from occt'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
38 ms; CPU time 56 ms; peak memory 13.8 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
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.
//! A block, the box (0, −5, 0)–(20, 5, 10), with a slot cut across its top by an end mill, the//! solid cylinder of radius 2 about the vertical line through (−5, 0) from z = 7 to 15, slid//! without turning 30 along x.usecrate::sketch::block;
use cad_kernel::build::{disc, prism};
use cad_kernel::geom::tolerance;
use cad_kernel::swept::closed::cut_from;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
use std::f64::consts::TAU;
constRADIUS: f64 = 2.;
constFLOOR: f64 = 7.;
constLENGTH: f64 = 8.;
constSLIDE: f64 = 30.;
/// How closely the mill is meshed for the sweep's membership reads: a hundredth of its radius.constBAR: f64 = 0.02;
pubfnbuild() -> Result<Brep, String> {
let stock = block([0., -5., 0.], [20., 5., 10.])?;
let up = [0., 0., 1.];
let mill = prism(&disc([-5., 0., FLOOR], up, RADIUS), 0., LENGTH)?;
// the slide along x: a screw that does not turn, advancing its whole length over a roll of τlet path = Trajectory::Twist(Screw {
origin: [-5., 0., FLOOR], axis: [1., 0., 0.], ratio: 0., advance: SLIDE,
});
// the kernel's swept solid cut from the block on one arrangement: the mill's flat end kept in// its plane, its side's two rulings square to the slide swept into the slot's wallslet size = stock.size().max(mill.size());
cut_from(&stock, &mill, &path, [0., TAU], BAR, tolerance(size))
.map_err(|why| format!("the mill's sweep not built: {why:?}"))
}
Time
635 ms; CPU time 634 ms; peak memory 368.3 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no sweep of a solid
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.
"""A slot cut by an end mill slid across a block. A block, the box from (0, −5, 0) to (20, 5, 10),
with a slot cut across its top by an end mill.
The end mill is a solid cylinder of radius 2 standing upright about the vertical line through (−5,
0), from z = 7 up to z = 15: its flat end is 3 below the block's top.
It slides without turning along the x axis by 30, from x = −5 to x = 25, from clear before the
block to clear past it. Cut from the block everything the mill passes through.
Its flat end, which the slide keeps in its own plane, touches all over and sweeps the slot's floor;
the two lines of its side square to the slide sweep the walls, meeting the floor in sharp edges.
The slot is |y| ≤ 2, z ≥ 7, along the block's whole length."""fromOCP.BRepPrimAPIimportBRepPrimAPI_MakeBox, BRepPrimAPI_MakeCylinderfromOCP.gp import gp, gp_Ax2, gp_Pnt
from sweep import cut, plane, slid
BLOCK = ((0, -5, 0), (20, 5, 10))
MILL_FOOT = (-5, 0, 7) # the middle of the mill's flat endRADIUS, HEIGHT = 2, 8SLIDE = (30, 0, 0)
defbuild():
mill = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(*MILL_FOOT), gp.DZ_s()), RADIUS, HEIGHT).Shape()
# The mill's side is square to the slide along its two lines at y = ±2, where its normal is# along ±y: the plane x = −5 through its axis cuts it there. Its flat ends slide in their# own planes.
swept = slid(mill, SLIDE, [plane(MILL_FOOT, (1, 0, 0))])
returncut(BRepPrimAPI_MakeBox(gp_Pnt(*BLOCK[0]), gp_Pnt(*BLOCK[1])).Shape(), swept)
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.
Time
8.3 ms; CPU time 8.1 ms; peak memory 11 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
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.
//! A block, the box from (0, −5, 0) to (20, 5, 10), with a slot cut across its top by an end mill://! the solid cylinder of radius 2 about the vertical line through (−5, 0), from z = 7 up to 15,//! slid without turning along the x axis by 30, from clear before the block to clear past it.//! Everything the mill passes through, cut.//!//! The mill's sweep is kentron's sweep of a solid (`sweep::solid`, one slide), cut from the block.usecrate::bench::{frame, p, v};
use kentron::math::Direction;
use kentron::primitives::{Cuboid, Cylinder};
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let block = Cuboid::from_corners(p(0.0, -5.0, 0.0), p(20.0, 5.0, 10.0)).build(m)?;
let mill = Cylinder::new(2.0, 8.0).with_frame(frame(p(-5.0, 0.0, 7.0), Direction::Z)).build(m)?;
let swept = sweep::solid(m, mill, &RigidMotion::Slide { by: v(30.0, 0.0, 0.0) })?;
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.
Time
12 ms; CPU time 12 ms; peak memory 41.7 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no sweep of a solid
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.
//! A block, the box from (0, −5, 0) to (20, 5, 10), with a slot cut across its top by an end mill,//! the solid cylinder of radius 2 about the vertical line through (−5, 0) from z = 7 to z = 15,//! slid without turning along x by 30.//!//! solidcraft-kernel has no sweep of a solid, so the mill's sweep is built by elementary geometry.//! Split by the plane x = −5 through its axis, square to the slide, the mill's back half leads//! with its flat cut face only (its curved side faces back, and its ends move in their own//! planes), so it sweeps itself and that rectangle slid 30; the front half likewise sweeps the//! rectangle and itself where it stops. So the sweep is the back half where the mill starts, the//! box from (−5, −2, 7) to (25, 2, 15) and the front half where it stops; the halves lie wholly//! before x = −5 and past x = 25, clear of the block, so the box is what the sweep takes from it.usecrate::solids::*;
pubfnbuild() -> R<Body> {
let stock = block((0.0, -5.0, 0.0), (20.0, 5.0, 10.0))?;
cut(&stock, &block((-5.0, -2.0, 7.0), (25.0, 2.0, 15.0))?)
}
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.
Time
10 ms; CPU time 10 ms; peak memory 24.2 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
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.
// A block from (0, -5, 0) to (20, 5, 10), less everything an upright end mill (radius 2, z = 7 to// 15) passes through as it slides along x from x = -5 to 25.//// What a cylinder sliding square to its axis sweeps is the mill where it starts and where it stops,// and between them its section through the axis square to the slide carried along it.let m = model();
let block = m.box(20.0, 10.0, 10.0, #{ at: [0.0, -5.0, 0.0] });
let swept = m.tool(|m| m.box(30.0, 4.0, 8.0, #{ at: [-5.0, -2.0, 7.0] }));
block = block.subtract(swept);
block = block.subtract(m.tool(|m| m.cylinder(2.0, 8.0, #{ at: [-5.0, 0.0, 7.0] })));
block = block.subtract(m.tool(|m| m.cylinder(2.0, 8.0, #{ at: [25.0, 0.0, 7.0] })));
m
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
5.3 ms; CPU time 5 ms; peak memory 16.3 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
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.
//! A block slotted across its top by an end mill slid past it.//!//! The kernel's sweep of a solid (`sweep_solid_within`, its planar motion of a prism, which//! includes the end positions exactly): the mill is the prism of the circle of radius 2 about (−5,//! 0) from z = 7 to z = 15, slid 30 along the x axis. Asked for between 24 and 37 from the vertical//! line through (10, −30), an axis off the sweep,, from z = 7 to 15 (a prism's sweep is asked for//! between its ends), which holds the slot; cut from the block.usecrate::solids::p;
usecrate::Refusal;
use brep_kernel::{
boolean_operation_nary, make_box_brep, sweep_solid_within, BooleanOperation, BrepSolid,
OutlinePiece, ScrewStep, SolidMotion, SweepClip, SweptTool,
};
use std::f64::consts::TAU;
pubfnbuild() -> Result<BrepSolid, Refusal> {
let z = p(0.0, 0.0, 1.0);
let block = make_box_brep(p(0.0, -5.0, 0.0), 20.0, 10.0, 10.0)?;
let mill = SweptTool::Prism {
origin: p(0.0, 0.0, 0.0),
normal: z,
x_axis: p(1.0, 0.0, 0.0),
outline: vec![OutlinePiece::Arc { centre: [-5.0, 0.0], radius: 2.0, start: 0.0, end: TAU }],
from: 7.0,
to: 15.0,
};
let slide = SolidMotion {
steps: vec![ScrewStep { axis_origin: p(0.0, 0.0, 0.0), axis_direction: p(1.0, 0.0, 0.0), turn: 0.0, advance: 30.0 }],
from: 0.0,
to: 1.0,
};
let around_block = SweepClip {
axis_origin: p(10.0, -30.0, 0.0),
axis_direction: z,
reference: p(1.0, 0.0, 0.0),
radius: [24.0, 37.0],
axial: [7.0, 15.0],
angle: None,
};
letmut operands = vec![block];
operands.extend(sweep_solid_within(&mill, &slide, &around_block)?);
Ok(boolean_operation_nary(&operands, 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
4.5 ms; CPU time 4.2 ms; peak memory 9.4 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
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.
//! A block (the box from (0, −5, 0) to (20, 5, 10)) slotted across its top by an end mill (radius 2//! about the upright through (−5, 0), from z = 7 to 15) slid 30 along x.//!//! The mill is a circle extruded; what it passes through is cadrs's sweep of a solid (one slide),//! cut from the block.usecrate::bench::{block, cut, cylinder, p3, v3};
usecrate::shared::swept::slid;
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let b = block(k, p3(0.0, -5.0, 0.0), p3(20.0, 5.0, 10.0))?;
let mill = cylinder(k, p3(-5.0, 0.0, 7.0), v3(0.0, 0.0, 1.0), 2.0, 8.0)?;
let swept = slid(k, mill, v3(30.0, 0.0, 0.0))?;
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.
Time
7.6 ms; CPU time 6.9 ms; peak memory 8.9 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
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.
//! The block (0, −5, 0)–(20, 5, 10) less everything an end mill passes through as it slides along//! the x axis by 30: the cylinder of radius 2 about the upright line through (−5, 0), from z = 7//! to 15.use springrep::boolean::difference;
use springrep::primitive::cylinder;
use springrep::sweep::{Motion, solid};
use springrep::topo::Brep;
usecrate::shared::swept::{boxed, v3};
usecrate::shared::{at, e};
pubfnbuild() -> Result<Brep, String> {
let block = boxed([0.0, -5.0, 0.0], [20.0, 5.0, 10.0], "block")?;
let mill = cylinder(&at([-5.0, 0.0, 7.0]), 2.0, 8.0, "mill").map_err(e)?;
let slot = solid(&mill, &Motion::Slide(v3(30.0, 0.0, 0.0)), "slot").map_err(e)?;
difference(&block, &slot).map_err(e)
}
Time
59 ms; CPU time 79 ms; peak memory 26.6 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
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.
// A block, the box from (0, -5, 0) to (20, 5, 10), its footprint in the top plane; an end mill, the// cylinder of radius 2 about the upright line through (-5, 0) from z = 7 to z = 15, slid without// turning 30 along x, from clear before the block to clear past it, and everything it passes// through cut from the block.unit mm
use std
use std.solids
use std.solids (cut)
use std.motion (slides)
in std.top {
a := point
b := point hint((20, -5))
c := point hint((20, 5))
d := point hint((0, 5))
outline := horizontal line(a, b) -> vertical line(b, c) ->
horizontal line(c, d) -> vertical line(d, a) -> close
fix((0, -5)) a
a distance(20) b
b distance(10) c
o := point
fix((-5, 0)) o
rim := circle(center: o) hint(r: 2)
radius(2) rim
}
part := solid(std.solids.Prism(outline, from: 0mm, to: 10mm))
mill := solid(std.solids.Prism(face(rim), from: 7mm, to: 15mm))
// the feed, 30 along x over the roll
feed := frame
feed slides(30mm) std.x
slot := solid({ p | some t in (0deg, 360deg): p in mill at(under: feed) t })
slot cut part
Time
9.3 ms; CPU time 9.1 ms; peak memory 4.9 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no sweep of a solid
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.
//! A block from (0, −5, 0) to (20, 5, 10) less what an upright end mill (radius 2, from z = 7 to//! 15) passes through, slid along x from x = −5 to 25.use anvil_brep::Solid;
usecrate::shared::{at, block, cylinder, subtract, union};
pubfnbuild() -> Result<Solid, String> {
// anvil-brep has no sweep of a solid. A cylinder slid square to its axis fills itself at each// end and the box its shadow along the slide sweeps betweenlet mill = |x: f64| cylinder(&at([x, 0., 0.]), 2., 7., 15.);
let swept = union(&union(&mill(-5.)?, &block([-5., -2., 7.], [25., 2., 15.])?)?, &mill(25.)?)?;
subtract(&block([0., -5., 0.], [20., 5., 10.])?, &swept)
}