A block, the box from (−10, −10, −5) to (10, 10, 0), with a pocket cut into its top by an end mill turned about a line that passes through its own flat end, as spot facing is done off center.
The mill is a solid cylinder of radius 3 standing upright about the vertical line through (1.5, 0), from z = −2 up to z = 4: its flat end is 2 below the block's top, and the z axis passes through that end, 1.5 from its center.
It turns rigidly about the z axis, right-handed (from +x toward +y), by 120°, so that its axis ends on the vertical line through (1.5 cos 120°, 1.5 sin 120°). Cut from the block everything the mill passes through.
The pocket's floor, z = −2, is the region the end's disc sweeps: the disc where it starts and where it stops, and between them everything out to 4.5 from the axis. Near the axis the two discs and the turn overlap, so the pocket's wall there is only the parts of the two discs' rims the other does not cover.
expected
closed form
volume
1906.751339
2000 − 2·S, S the region the end's disc sweeps: πr² + 2θrd less what the turn covers twice near the axis, ((θ − 2π)(b² − (r − d)²)/2 + lens(b) − π(r − d)²), r = 3, d = 1.5, θ = 2π/3, b where the disc's half-angle about the axis is π − θ/2 (b² + 1.5b − 6.75 = 0), lens(b) the area of the disc within b of the axis
area
1249.356286
1200 + 2·P, P the region's perimeter: (r + d)θ + 2r·acos((b² − d² − r²)/2dr)
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
48 ms; CPU time 106 ms; peak memory 15.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 (−10, −10, −5)–(10, 10, 0), with a pocket cut into its top by an end mill, the//! solid cylinder of radius 3 about the vertical line through (1.5, 0) from z = −2 to 4, turned//! rigidly 120° about the z axis, which passes through its flat end.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};
constRADIUS: f64 = 3.;
constOFF_AXIS: f64 = 1.5;
constFLOOR: f64 = -2.;
constLENGTH: f64 = 6.;
constTURN: f64 = 120f64.to_radians();
/// How closely the mill is meshed for the sweep's membership reads: a hundred-and-fiftieth of its/// radius.constBAR: f64 = 0.02;
pubfnbuild() -> Result<Brep, String> {
let stock = block([-10., -10., -5.], [10., 10., 0.])?;
let up = [0., 0., 1.];
let mill = prism(&disc([OFF_AXIS, 0., FLOOR], up, RADIUS), 0., LENGTH)?;
// the turn about z: a screw that does not advance, turning a radian a radian of the rolllet path = Trajectory::Twist(Screw { origin: [0., 0., 0.], axis: up, ratio: 1., advance: 0. });
// the kernel's swept solid cut from the block on one arrangement: the mill's side about an// axis along the turn's, its end square to it kept in its own planelet size = stock.size().max(mill.size());
cut_from(&stock, &mill, &path, [0., TURN], BAR, tolerance(size))
.map_err(|why| format!("the mill's sweep not built: {why:?}"))
}
Time
630 ms; CPU time 629 ms; peak memory 368.5 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 pocket cut by an end mill turned about a line through its flat end. A block, the box from
(−10, −10, −5) to (10, 10, 0), with a pocket cut into its top by an end mill turned about a line
that passes through its own flat end, as spot facing is done off center.
The mill is a solid cylinder of radius 3 standing upright about the vertical line through (1.5, 0),
from z = −2 up to z = 4: its flat end is 2 below the block's top, and the z axis passes through
that end, 1.5 from its center.
It turns rigidly about the z axis, right-handed (from +x toward +y), by 120°, so that its axis ends
on the vertical line through (1.5 cos 120°, 1.5 sin 120°). Cut from the block everything the mill
passes through.
The pocket's floor, z = −2, is the region the end's disc sweeps: the disc where it starts and where
it stops, and between them everything out to 4.5 from the axis. Near the axis the two discs and the
turn overlap, so the pocket's wall there is only the parts of the two discs' rims the other does
not cover."""fromOCP.BRepPrimAPIimportBRepPrimAPI_MakeBox, BRepPrimAPI_MakeCylinderfromOCP.ShapeUpgradeimportShapeUpgrade_UnifySameDomainfromOCP.gp import gp, gp_Ax2, gp_Pnt
from sweep import cut, plane, turned
BLOCK = ((-10, -10, -5), (10, 10, 0))
FOOT = (1.5, 0, -2) # the middle of the mill's flat endRADIUS, HEIGHT = 3, 6TURN = 120# degrees about the z axisdefbuild():
mill = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(*FOOT), gp.DZ_s()), RADIUS, HEIGHT).Shape()
# The turn's axis and the mill's are parallel: its side meets the turn square-on along its# two lines in the plane y = 0 through both axes; its flat ends turn in their own planes.
swept = turned(mill, gp.OZ_s(), TURN, [plane((0, 0, 0), (0, 1, 0))])
pocketed = cut(BRepPrimAPI_MakeBox(gp_Pnt(*BLOCK[0]), gp_Pnt(*BLOCK[1])).Shape(), swept)
# The pocket's floor is left in pieces, the mill's end where it starts and where it stops# and the flat sweep of its rim between them, overlapping about the axis; one of them# BRepMesh cannot mesh. Merged into the one face they make, it can.
floor = ShapeUpgrade_UnifySameDomain(pocketed, True, True, True)
floor.Build()
return floor.Shape()
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
9 ms; CPU time 8.8 ms; peak memory 11.1 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 (−10, −10, −5) to (10, 10, 0), pocketed by an end mill turned about a//! line through its own flat end: the solid cylinder of radius 3 about the vertical line through//! (1.5, 0), from z = −2 to 4, turned rigidly about the z axis by 120°. Everything the mill passes//! through, cut.//!//! kentron's sweep of a solid (`sweep::solid`, one turn), which refuses it: the turn's axis passes//! through the mill, and kentron's sweep refuses a turn about an axis meeting the tool.usecrate::bench::{frame, p};
use kentron::math::{Axis, 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(-10.0, -10.0, -5.0), p(10.0, 10.0, 0.0)).build(m)?;
let mill = Cylinder::new(3.0, 6.0).with_frame(frame(p(1.5, 0.0, -2.0), Direction::Z)).build(m)?;
let swept = sweep::solid(m, mill, &RigidMotion::Turn { axis: Axis::Z, from: 0.0, to: 120f64.to_radians() })?;
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
267 ms; CPU time 266 ms; peak memory 49.2 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 (−10, −10, −5) to (10, 10, 0), with a pocket cut by an end mill turned//! 120° about the z axis, right-handed: the solid cylinder of radius 3 about the vertical line//! through (1.5, 0) from z = −2 to 4, whose flat end the z axis passes through.//!//! solidcraft-kernel has no sweep of a solid, so the turn is built by elementary geometry. The//! mill is a disc about (1.5, 0) at every height, which holds each circle about the z axis out to//! 1.5 whole and meets each farther one, out to 4.5, in one arc holding its point at 0°. So it//! passes over such an arc where it starts, the 120° on from there and the arc where it stops://! the sweep is its section by the half-plane at 0°, out from the axis to 4.5, revolved through//! the turn, with the mill's half behind that half-plane's plane where it starts (y ≤ 0) and its//! half ahead of it where it stops (each holding what the turn misses of the circles it holds//! whole).usesuper::drum_swung_partway_into_ring_sector::turned;
usecrate::solids::*;
pubfnbuild() -> R<Body> {
let block = block((-10.0, -10.0, -5.0), (10.0, 10.0, 0.0))?;
let mill = zcyl(1.5, 0.0, 3.0, -2.0, 4.0)?;
let half = |positive: bool| -> R<Body> {
let plane = Plane { origin: Vec3::ZERO, x: Vec3::Z, y: Vec3::X }; // normal +y
solidcraft_kernel::half_space(&mill, &plane, positive)?
.0
.ok_or_else(|| KernelError::Failed("the mill's half is empty".into()))
};
let fan = revolve_z(rect(0.0, -2.0, 4.5, 4.0), 120.0)?;
let swept = union(&union(&half(false)?, &fan)?, &turned(&half(true)?, 120.0)?)?;
cut(&block, &swept)
}
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
93 ms; CPU time 176 ms; peak memory 27.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 from (-10, -10, -5) to (10, 10, 0) less everything an end mill (radius 3 about the// vertical through (1.5, 0), z = -2 to 4) passes through as it turns 120° about the z axis.//// A turn about z sweeps the mill where it starts and stops and, between them, its shadow on a// half-plane through the axis revolved: the mill holds the axis and reaches 4.5 from it at every// height, so its shadow is the rectangle 0 ≤ ρ ≤ 4.5, -2 ≤ z ≤ 4.let m = model();
let b = m.box(20.0, 20.0, 5.0, #{ at: [-10.0, -10.0, -5.0] });
let pi = 3.141592653589793;
b = b.subtract(m.tool(|m| m.cylinder(3.0, 6.0, #{ at: [1.5, 0.0, -2.0] })));
b = b.subtract(m.tool(|m| m.profile(xz()).polygon([[0.0, -2.0], [4.5, -2.0], [4.5, 4.0], [0.0, 4.0]]).sketch("shadow")
.revolve(axis_at([0.0, 0.0, 0.0], [0.0, 0.0, 1.0]), blind(120.0))));
b = b.subtract(m.tool(|m| m.cylinder(3.0, 6.0, #{ at: [1.5 * cos(2.0 * pi / 3.0), 1.5 * sin(2.0 * pi / 3.0), -2.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
9.6 ms; CPU time 9.2 ms; peak memory 15.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.
//! A block pocketed by an end mill turned about a line through its own flat end.//!//! 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 3 about (1.5,//! 0) from z = −2 to z = 4, turned 120° about the z axis. Asked for within 14.5 of the z axis from//! z = −2 to 4 (a prism's sweep is asked for between its ends), which holds the pocket; 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(-10.0, -10.0, -5.0), 20.0, 20.0, 5.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: [1.5, 0.0], radius: 3.0, start: 0.0, end: TAU }],
from: -2.0,
to: 4.0,
};
let turn = SolidMotion {
steps: vec![ScrewStep { axis_origin: p(0.0, 0.0, 0.0), axis_direction: z, turn: 1.0, advance: 0.0 }],
from: 0.0,
to: 120f64.to_radians(),
};
let around_block = SweepClip {
axis_origin: p(0.0, -30.0, 0.0),
axis_direction: z,
reference: p(1.0, 0.0, 0.0),
radius: [19.0, 42.0],
axial: [-2.0, 4.0],
angle: None,
};
letmut operands = vec![block];
operands.extend(sweep_solid_within(&mill, &turn, &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
5.6 ms; CPU time 8.9 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 (−10, −10, −5) to (10, 10, 0)) pocketed by an end mill (radius 3 about//! the upright through (1.5, 0), from z = −2 to 4) turned 120° about the z axis, which passes//! through its flat end.//!//! The mill is a circle extruded; what it passes through is cadrs's sweep of a solid (one turn),//! cut from the block.usecrate::bench::{block, cut, cylinder, p3, v3};
usecrate::shared::swept::{swung, z_axis};
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let b = block(k, p3(-10.0, -10.0, -5.0), p3(10.0, 10.0, 0.0))?;
let mill = cylinder(k, p3(1.5, 0.0, -2.0), v3(0.0, 0.0, 1.0), 3.0, 6.0)?;
let swept = swung(k, mill, z_axis(), 0.0, 120.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
17 ms; CPU time 17 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 box (−10, −10, −5)–(10, 10, 0) less everything an end mill passes through as it turns 120°//! about the z axis: the cylinder of radius 3 about the upright line through (1.5, 0), from z = −2//! to 4, which the z axis passes through.use springrep::boolean::difference;
use springrep::primitive::cylinder;
use springrep::sweep::solid;
use springrep::topo::Brep;
usecrate::shared::swept::{boxed, deg, turning};
usecrate::shared::{at, e};
pubfnbuild() -> Result<Brep, String> {
let block = boxed([-10.0, -10.0, -5.0], [10.0, 10.0, 0.0], "block")?;
let mill = cylinder(&at([1.5, 0.0, -2.0]), 3.0, 6.0, "mill").map_err(e)?;
let pocket = solid(&mill, &turning(0.0, deg(120.0)), "pocket").map_err(e)?;
difference(&block, &pocket).map_err(e)
}
Time
93 ms; CPU time 170 ms; peak memory 32.1 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 (-10, -10, -5) to (10, 10, 0), its footprint in the top plane; an end mill,// the cylinder of radius 3 about the upright line through (1.5, 0) from z = -2 to z = 4, so the z// axis passes through its flat end; it is turned rigidly 120 degrees about the z axis,// right-handed (from +x toward +y), and everything it passes through cut from the block.unit mm
use std
use std.solids
use std.solids (cut)
use std.motion (turns)
in std.top {
a := point
b := point hint((10, -10))
c := point hint((10, 10))
d := point hint((-10, 10))
outline := horizontal line(a, b) -> vertical line(b, c) ->
horizontal line(c, d) -> vertical line(d, a) -> close
fix((-10, -10)) a
a distance(20) b
b distance(20) c
o := point
fix((1.5, 0)) o
rim := circle(center: o) hint(r: 3)
radius(3) rim
}
part := solid(std.solids.Prism(outline, from: -5mm, to: 0mm))
mill := solid(std.solids.Prism(face(rim), from: -2mm, to: 4mm))
swing := frame
swing turns(1) std.z
pocket := solid({ p | some t in (0deg, 120deg): p in mill at(under: swing) t })
pocket cut part
anvilcad left no solid to show.
Time
1.3 ms; CPU time 1.1 ms; peak memory 3.5 MB
Notes
refused anvil-brep has no sweep of a solid, and what this motion sweeps is bounded by envelopes of the body's surfaces under it (a rim or a face leaning to the motion) that follow from no elementary construction, which it would have to compute itself
//! A pocket cut by an end mill turned about a line through its flat end.use anvil_brep::Solid;
pubfnbuild() -> Result<Solid, String> {
Err("anvil-brep has no sweep of a solid, and what this motion sweeps is bounded by envelopes of the body's surfaces under it (a rim or a face leaning to the motion) that follow from no elementary construction, which it would have to compute itself".into())
}