A plate, the box from (0, −5, 0) to (20, 5, 4), with a slot punched through it by a drum.
The drum is a solid cylinder of radius 2 lying on its side: its axis is the line y = 0, z = −5, and it runs from x = 6 to x = 14, its ends flat.
It slides without turning straight up by 16, from wholly below the plate to wholly above it. Cut from the plate everything the drum passes through.
The drum touches what it sweeps along a closed curve: along its side's lowest and highest lines nowhere (they move along themselves), along the two lines of its side at y = ±2, and across both flat ends, which the push keeps in their own planes. The slot is its shadow along the push, the rectangle 6 ≤ x ≤ 14, |y| ≤ 2, through the plate.
As a set:
$$\bigl([0,20]\times[-5,5]\times[0,4]\bigr) \setminus \bigl(T \oplus \{\,s\,(0,0,16) : 0 \le s \le
1\,\}\bigr), \quad T = \{\,y^2 + (z+5)^2 \le 2^2,\ 6 \le x \le 14\,\}$$
expected
closed form
volume
672
800 − 8·(2·2)·4
area
672
640 − 2·32 + (2·8 + 2·4)·4
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
24 ms; CPU time 44 ms; peak memory 13.7 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 plate, the box (0, −5, 0)–(20, 5, 4), with a slot punched through it by a drum — the cylinder//! of radius 2 about the line y = 0, z = −5 from x = 6 to 14, its ends flat — slid without turning//! straight up by 16, from wholly below the plate to wholly above it.usecrate::sketch::block;
use cad_kernel::build::{disc, prism};
use cad_kernel::geom::{tolerance, V};
use cad_kernel::swept::closed::cut_from;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
use std::f64::consts::TAU;
constPLATE_LO: V = [0., -5., 0.];
constPLATE_HI: V = [20., 5., 4.];
/// The middle of the drum's near end, its radius and its length along x.constEND: V = [6., 0., -5.];
constRADIUS: f64 = 2.;
constLENGTH: f64 = 8.;
constPUSH: f64 = 16.;
/// How closely the drum is meshed for the sweep's membership reads: a thousandth of its radius.constBAR: f64 = 0.002;
pubfnbuild() -> Result<Brep, String> {
let plate = block(PLATE_LO, PLATE_HI)?;
let drum = prism(&disc(END, [1., 0., 0.], RADIUS), 0., LENGTH)?;
// the slide up z: a screw that does not turn, advancing its whole length over a roll of τlet up = [0., 0., 1.];
let path = Trajectory::Twist(Screw { origin: END, axis: up, ratio: 0., advance: PUSH });
// the kernel's closed swept solid cut from the plate on one arrangement: the side's rulings// whose normal is square to the push swept into the planes tangent along them, the flat ends// kept in their planes, the rims swept along their own planeslet size = plate.size().max(drum.size());
cut_from(&plate, &drum, &path, [0., TAU], BAR, tolerance(size))
.map_err(|why| format!("the drum's sweep not built: {why:?}"))
}
Time
640 ms; CPU time 639 ms; peak memory 368.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 slot punched by a drum pushed edge first. A plate, the box from (0, −5, 0) to (20, 5, 4), with
a slot punched through it by a drum.
The drum is a solid cylinder of radius 2 lying on its side: its axis is the line y = 0, z = −5, and
it runs from x = 6 to x = 14, its ends flat.
It slides without turning straight up by 16, from wholly below the plate to wholly above it. Cut
from the plate everything the drum passes through.
The drum touches what it sweeps along a closed curve: along its side's lowest and highest lines
nowhere (they move along themselves), along the two lines of its side at y = ±2, and across both
flat ends, which the push keeps in their own planes. The slot is its shadow along the push, the
rectangle 6 ≤ x ≤ 14, |y| ≤ 2, through the plate."""fromOCP.BRepPrimAPIimportBRepPrimAPI_MakeBox, BRepPrimAPI_MakeCylinderfromOCP.gp import gp, gp_Ax2, gp_Pnt
from sweep import cut, plane, slid
PLATE = ((0, -5, 0), (20, 5, 4))
DRUM_START = (6, 0, -5) # the middle of the drum's end at x = 6, on its axisDRUM_RADIUS, DRUM_LENGTH = 2, 8PUSH = (0, 0, 16)
defbuild():
drum = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(*DRUM_START), gp.DX_s()), DRUM_RADIUS,
DRUM_LENGTH).Shape()
# The drum's side is square to the push along its two lines at y = ±2, where its normal is# level: the plane z = −5 through its axis cuts it there. Its flat ends slide in their own# planes.
swept = slid(drum, PUSH, [plane(DRUM_START, (0, 0, 1))])
returncut(BRepPrimAPI_MakeBox(gp_Pnt(*PLATE[0]), gp_Pnt(*PLATE[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
7 ms; CPU time 6.8 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 plate, the box from (0, −5, 0) to (20, 5, 4), with a slot punched through it by a drum: the//! solid cylinder of radius 2 about the line y = 0, z = −5, from x = 6 to 14, slid without turning//! straight up by 16, from wholly below the plate to wholly above it. Everything the drum passes//! through, cut.//!//! The drum's sweep is kentron's sweep of a solid (`sweep::solid`, one slide), cut from the plate.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 plate = Cuboid::from_corners(p(0.0, -5.0, 0.0), p(20.0, 5.0, 4.0)).build(m)?;
let drum = Cylinder::new(2.0, 8.0).with_frame(frame(p(6.0, 0.0, -5.0), Direction::X)).build(m)?;
let swept = sweep::solid(m, drum, &RigidMotion::Slide { by: v(0.0, 0.0, 16.0) })?;
kentron::boolean::difference(m, plate, 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 42 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 plate, the box from (0, −5, 0) to (20, 5, 4), with a slot punched through it by a drum, the//! solid cylinder of radius 2 about the line y = 0, z = −5 from x = 6 to x = 14, slid without//! turning straight up by 16.//!//! solidcraft-kernel has no sweep of a solid, so the drum's sweep is built by elementary geometry.//! Split by the plane z = −5 through its axis, the drum's lower half leads with its flat top only//! (its curved side faces down, away from the slide, and its ends move in their own planes), so//! it sweeps itself and that rectangle slid up 16; the upper half likewise sweeps the rectangle//! and itself where it stops. So the sweep is the lower half where the drum starts, the box from//! (6, −2, −5) to (14, 2, 11) and the upper half where it stops; the halves lie wholly below//! z = −5 and above z = 11, clear of the plate, so the box is what the sweep takes from it.usecrate::solids::*;
pubfnbuild() -> R<Body> {
let plate = block((0.0, -5.0, 0.0), (20.0, 5.0, 4.0))?;
cut(&plate, &block((6.0, -2.0, -5.0), (14.0, 2.0, 11.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 11 ms; peak memory 24.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 plate from (0, -5, 0) to (20, 5, 4), less everything a drum (radius 2 about y = 0, z = -5,// x = 6 to 14) passes through as it slides 16 straight up.//// Sliding square to its axis, the drum sweeps itself where it starts and stops and, between them,// its section square to the slide (the rectangle 6 ≤ x ≤ 14, |y| ≤ 2) carried along it.let m = model();
let plate = m.box(20.0, 10.0, 4.0, #{ at: [0.0, -5.0, 0.0] });
plate = plate.subtract(m.tool(|m| m.box(8.0, 4.0, 16.0, #{ at: [6.0, -2.0, -5.0] })));
plate = plate.subtract(m.tool(|m| m.cylinder(2.0, 8.0, #{ at: [6.0, 0.0, -5.0], axis: [1.0, 0.0, 0.0], ref: [0.0, 1.0, 0.0] })));
plate = plate.subtract(m.tool(|m| m.cylinder(2.0, 8.0, #{ at: [6.0, 0.0, 11.0], axis: [1.0, 0.0, 0.0], ref: [0.0, 1.0, 0.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.2 ms; CPU time 5 ms; peak memory 15.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 plate slotted by a drum, lying on its side, pushed straight up through it.//!//! The kernel's sweep of a solid (`sweep_solid_within`, its planar motion of a prism, which//! includes the end positions exactly): the drum is the prism along the x axis of the circle of//! radius 2 about (y, z) = (0, −5), from x = 6 to x = 14, slid 16 up the z axis, square to its//! length. Asked for within 5.5 of the line y = 0, z = 2 from x = 6 to 14 (a prism's sweep is asked//! for between its ends), which holds the slot; cut from the plate.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 x = p(1.0, 0.0, 0.0);
let plate = make_box_brep(p(0.0, -5.0, 0.0), 20.0, 10.0, 4.0)?;
// The prism's plane coordinates run along y and along x × y = z.let drum = SweptTool::Prism {
origin: p(0.0, 0.0, 0.0),
normal: x,
x_axis: p(0.0, 1.0, 0.0),
outline: vec![OutlinePiece::Arc { centre: [0.0, -5.0], radius: 2.0, start: 0.0, end: TAU }],
from: 6.0,
to: 14.0,
};
let push = SolidMotion {
steps: vec![ScrewStep { axis_origin: p(0.0, 0.0, 0.0), axis_direction: p(0.0, 0.0, 1.0), turn: 0.0, advance: 16.0 }],
from: 0.0,
to: 1.0,
};
let around_plate = SweepClip {
axis_origin: p(0.0, -30.0, 2.0),
axis_direction: x,
reference: p(0.0, 1.0, 0.0),
radius: [24.5, 35.5],
axial: [6.0, 14.0],
angle: None,
};
letmut operands = vec![plate];
operands.extend(sweep_solid_within(&drum, &push, &around_plate)?);
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.4 ms; CPU time 4.2 ms; peak memory 9.5 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 plate (the box from (0, −5, 0) to (20, 5, 4)) slotted by a drum (radius 2 about the line y = 0,//! z = −5, from x = 6 to 14) pushed straight up 16, wholly through it.//!//! The drum is a circle extruded; what it passes through is cadrs's sweep of a solid (one slide),//! cut from the plate.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 plate = block(k, p3(0.0, -5.0, 0.0), p3(20.0, 5.0, 4.0))?;
let drum = cylinder(k, p3(6.0, 0.0, -5.0), v3(1.0, 0.0, 0.0), 2.0, 8.0)?;
let swept = slid(k, drum, v3(0.0, 0.0, 16.0))?;
cut(k, plate, 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.2 ms; CPU time 5.7 ms; peak memory 8.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.
//! The plate (0, −5, 0)–(20, 5, 4) less everything a drum passes through as it slides straight up//! by 16: the cylinder of radius 2 about the line y = 0, z = −5, from x = 6 to 14.use springrep::boolean::difference;
use springrep::primitive::cylinder;
use springrep::sweep::{Motion, solid};
use springrep::topo::Brep;
usecrate::shared::swept::{boxed, v3};
usecrate::shared::{e, frame};
pubfnbuild() -> Result<Brep, String> {
let plate = boxed([0.0, -5.0, 0.0], [20.0, 5.0, 4.0], "plate")?;
let end = frame([6.0, 0.0, -5.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0])?;
let drum = cylinder(&end, 2.0, 8.0, "drum").map_err(e)?;
let slot = solid(&drum, &Motion::Slide(v3(0.0, 0.0, 16.0)), "slot").map_err(e)?;
difference(&plate, &slot).map_err(e)
}
Time
54 ms; CPU time 67 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 plate, the box from (0, -5, 0) to (20, 5, 4), its footprint in the top plane; a drum lying on// its side, the cylinder of radius 2 about the line y = 0, z = -5 from x = 6 to x = 14 (its end// circle drawn in the side plane, carried along x), slid without turning 16 straight up, and// everything it passes through cut from the plate.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
}
part := solid(std.solids.Prism(outline, from: 0mm, to: 4mm))
in std.side {
o := point
fix((0, -5)) o
rim := circle(center: o) hint(r: 2)
radius(2) rim
}
drum := solid(std.solids.Prism(face(rim), from: 6mm, to: 14mm))
// the push, 16 straight up over the roll
ram := frame
ram slides(16mm) std.z
slot := solid({ p | some t in (0deg, 360deg): p in drum at(under: ram) t })
slot cut part
anvilcad left no solid to show.
Time
6.9 ms; CPU time 6.7 ms; peak memory 4.9 MB
Notes
refused boolean operation failed: the result is not a closed solid (edge DVec3(6.0, 2.0, 11.0) -> DVec3(14.0, 2.0, 11.0) used 0/1 by ["s1f2"])
//! A plate from (0, −5, 0) to (20, 5, 4) less what a drum on its side (radius 2, its axis//! y = 0, z = −5 from x = 6 to 14) passes through, pushed 16 straight up.use anvil_brep::Solid;
usecrate::shared::{block, rod, subtract, union};
pubfnbuild() -> Result<Solid, String> {
// anvil-brep has no sweep of a solid. Pushed square to its axis the drum fills itself at each// end and the box its shadow along the push sweeps betweenlet drum = |z: f64| rod([6., 0., z], [14., 0., z], 2.);
let swept = union(&union(&drum(-5.)?, &block([6., -2., -5.], [14., 2., 11.])?)?, &drum(11.)?)?;
subtract(&block([0., -5., 0.], [20., 5., 4.])?, &swept)
}