A plate, the box from (0, −5, 0) to (20, 5, 4), with a hole bored through it by a drill.
The drill is a solid of revolution about the vertical line through (10, 0): a cylinder of radius 2 from z = 6 + 2/tan 59° up to z = 14, ended below in a cone of 118° (each side 59° from the axis) whose point is (10, 0, 6).
It slides without turning straight down along its axis by 20, from where its point is 2 above the plate to where its top is 6 below it. Cut from the plate everything the drill passes through.
Every circle of the drill about its axis meets the motion at one angle all round, so it touches all round or nowhere, and the circle of greatest radius sweeps the hole's wall. The drill passes wholly through, so the hole is the cylinder of radius 2, whatever its point.
expected
closed form
volume
749.7345175
20·10·4 − π2²·4
area
665.1327412
640 − 2·π2² + 2π·2·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
796 ms; CPU time 824 ms; peak memory 16.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 plate, the box (0, −5, 0)–(20, 5, 4), with a hole bored through it by a drill about the//! vertical line through (10, 0) — a cylinder of radius 2 up to z = 14, ended below by a cone of//! 118° whose point is (10, 0, 6) — slid without turning straight down along its axis by 20.usecrate::sketch::{block, polygon};
use cad_kernel::build::revolve;
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.];
constPOINT: V = [10., 0., 6.];
constRADIUS: f64 = 2.;
constTOP: f64 = 14.;
/// Each side of the point's cone from its axis, in degrees.constHALF_ANGLE: f64 = 59.;
constPUSH: f64 = 20.;
/// How closely the drill 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)?;
// the drill: its meridian in the half-plane y = 0 beyond its axis — from the point up the// cone to the rim, up the side, back across the top and down the axis — turned oncelet [x0, _, z0] = POINT;
let rim = z0 + RADIUS / HALF_ANGLE.to_radians().tan();
let meridian = polygon(&[POINT, [x0 + RADIUS, 0., rim], [x0 + RADIUS, 0., TOP], [x0, 0., TOP]]);
let up = [0., 0., 1.];
let drill = revolve(&meridian, POINT, up, TAU)?;
// the slide down its axis: a screw that does not turn, advancing its whole length over a roll// of τlet down = [0., 0., -1.];
let path = Trajectory::Twist(Screw { origin: POINT, axis: down, ratio: 0., advance: PUSH });
// the kernel's closed swept solid cut from the plate on one arrangement: the side, a cylinder// along the slide, swept along itself, and the cone's face at both end poseslet size = plate.size().max(drill.size());
cut_from(&plate, &drill, &path, [0., TAU], BAR, tolerance(size))
.map_err(|why| format!("the drill's sweep not built: {why:?}"))
}
Time
624 ms; CPU time 624 ms; peak memory 366.8 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 hole bored by a drill pushed along its own axis. A plate, the box from (0, −5, 0) to (20, 5,
4), with a hole bored through it by a drill.
The drill is a solid of revolution about the vertical line through (10, 0): a cylinder of radius 2
from z = 6 + 2/tan 59° up to z = 14, ended below in a cone of 118° (each side 59° from the axis)
whose point is (10, 0, 6).
It slides without turning straight down along its axis by 20, from where its point is 2 above the
plate to where its top is 6 below it. Cut from the plate everything the drill passes through.
Every circle of the drill about its axis meets the motion at one angle all round, so it touches all
round or nowhere, and the circle of greatest radius sweeps the hole's wall. The drill passes wholly
through, so the hole is the cylinder of radius 2, whatever its point."""import math
fromOCP.BRepBuilderAPIimportBRepBuilderAPI_MakeFace, BRepBuilderAPI_MakePolygonfromOCP.BRepPrimAPIimportBRepPrimAPI_MakeBox, BRepPrimAPI_MakeRevolfromOCP.gp import gp, gp_Ax1, gp_Pnt
from sweep import cut, slid
PLATE = ((0, -5, 0), (20, 5, 4))
AXIS = (10, 0) # the drill's axis is the vertical line through this pointPOINT, TOP = 6, 14# heights of the drill's point and its flat topRADIUS = 2HALF_ANGLE = 59# of the point, from the axisPUSH = (0, 0, -20)
defbuild():
x, y = AXIS
shoulder = POINT + RADIUS / math.tan(math.radians(HALF_ANGLE))
# the drill's half-section beside its axis, turned about the axis: a cone and a cylinder
profile = [gp_Pnt(x, y, POINT), gp_Pnt(x + RADIUS, y, shoulder), gp_Pnt(x + RADIUS, y, TOP),
gp_Pnt(x, y, TOP)]
half = BRepBuilderAPI_MakeFace(BRepBuilderAPI_MakePolygon(*profile, True).Wire()).Face()
drill = BRepPrimAPI_MakeRevol(half, gp_Ax1(gp_Pnt(x, y, 0), gp.DZ_s())).Shape()
# Pushed along its axis, the drill's cylinder slides along itself, its cone leads all over# and its flat top trails: no face needs splitting.
swept = slid(drill, PUSH)
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.8 ms; CPU time 7.5 ms; peak memory 10.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 plate, the box from (0, −5, 0) to (20, 5, 4), with a hole bored through it by a drill about//! the vertical line through (10, 0): a cylinder of radius 2 from z = 6 + 2/tan 59° up to 14, ended//! below in a cone of 118° whose point is (10, 0, 6), slid without turning straight down its axis//! by 20. Everything the drill passes through, cut.//!//! The drill is its half section revolved about its axis; its sweep is kentron's sweep of a solid//! (`sweep::solid`, one slide), cut from the plate.usecrate::bench::{p, v};
usecrate::shared::parts::xz_plane;
use kentron::math::{Axis, Direction};
use kentron::primitives::Cuboid;
use kentron::sketch::{self, Outcome, Step};
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
use std::f64::consts::TAU;
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
useStep::{Start, To};
let plate = Cuboid::from_corners(p(0.0, -5.0, 0.0), p(20.0, 5.0, 4.0)).build(m)?;
// Where the cone meets the cylinder.let rim = 6.0 + 2.0 / 59f64.to_radians().tan();
let half = [Start(10.0, 6.0), To(12.0, rim), To(12.0, 14.0), To(10.0, 14.0)];
let half = sketch::profile(m, xz_plane(0.0), &half, Outcome::Face)?;
let drill = sweep::revolve(m, half, Axis::new(p(10.0, 0.0, 0.0), Direction::Z), TAU)?.shape;
let swept = sweep::solid(m, drill, &RigidMotion::Slide { by: v(0.0, 0.0, -20.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
29 ms; CPU time 29 ms; peak memory 47.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 plate, the box from (0, −5, 0) to (20, 5, 4), with a hole bored through it by a drill: the//! solid of revolution about the vertical line through (10, 0) of a cylinder of radius 2 from//! z = 6 + 2/tan 59° up to z = 14 ended below in a cone of 118° whose point is (10, 0, 6), slid//! without turning straight down along its axis by 20.//!//! solidcraft-kernel has no sweep of a solid, so the drill's sweep is built by elementary//! geometry. A slide along the axis commutes with the turns about it, so the sweep is the solid//! of revolution of the drill's half section slid down 20. The section's width only grows up to//! the top of the cone and then stays 2, so slid it covers the drill's cone where it stops (its//! point at z = −14) and the full width from there up to z = 14.usecrate::solids::*;
use std::f64::consts::TAU;
pubfnbuild() -> R<Body> {
let plate = block((0.0, -5.0, 0.0), (20.0, 5.0, 4.0))?;
let cone = 2.0 / 59f64.to_radians().tan();
// the half section in (r, z), drawn on the plane through the axislet section = polygon(&[(0.0, -14.0), (2.0, -14.0 + cone), (2.0, 14.0), (0.0, 14.0)]);
let plane = Plane { origin: v3(10.0, 0.0, 0.0), x: Vec3::X, y: Vec3::Z };
let swept = one(solidcraft_kernel::revolve(&plane, &[section], Vec2::ZERO, Vec2::Y, TAU)?)?;
cut(&plate, &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
12 ms; CPU time 14 ms; peak memory 25.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 drill passes through as it slides 20// down its own axis, the vertical line through (10, 0): a cylinder of radius 2 ended in a cone of// 118° whose point starts at (10, 0, 6).//// The drill slides along its own axis, so what it sweeps is the drill lengthened: its point where// the slide ends, its top where it starts, and the cylinder between, the section below revolved.let m = model();
let pi = 3.141592653589793;
let rise = 2.0 / tan(59.0 * pi / 180.0);
let plate = m.box(20.0, 10.0, 4.0, #{ at: [0.0, -5.0, 0.0] });
let swept = m.tool(|m| m.profile(xz()).path(10.0, -14.0).line_to(12.0, -14.0 + rise).line_to(12.0, 14.0)
.line_to(10.0, 14.0).close().sketch("drill_swept").revolve(axis_at([10.0, 0.0, 0.0], [0.0, 0.0, 1.0]), full_circle()));
plate = plate.subtract(swept);
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
12 ms; CPU time 7.5 ms; peak memory 17.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.
//! The plate from (0, −5, 0) to (20, 5, 4), less everything a drill passes through as it slides//! straight down its own axis by 20: about the upright line through (10, 0), a cylinder of radius 2//! from z = 6 + 2/tan 59° to 14, ended below by a cone of 118° with its point at (10, 0, 6).//!//! Through the kernel's whole sweep of a solid (`sweep_solid`): the drill, a solid of revolution//! about the upright line through (10, 0, 0) whose meridian is the cone's side from its point, the//! cylinder's side and the flat top, slid 20 straight down, and cut from the plate.usecrate::solids::p;
usecrate::solids::swept::{less_all, revolved_tool, slide_by, Piece};
usecrate::Refusal;
use brep_kernel::{make_box_brep, sweep_solid, BrepSolid};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let (x, z) = (p(1.0, 0.0, 0.0), p(0.0, 0.0, 1.0));
let plate = make_box_brep(p(0.0, -5.0, 0.0), 20.0, 10.0, 4.0)?;
let shoulder = 6.0 + 2.0 / 59f64.to_radians().tan();
let drill = revolved_tool(p(10.0, 0.0, 0.0), z, x, &[
Piece::Line { from: [0.0, 6.0], to: [2.0, shoulder] },
Piece::Line { from: [2.0, shoulder], to: [2.0, 14.0] },
Piece::Line { from: [2.0, 14.0], to: [0.0, 14.0] },
Piece::Line { from: [0.0, 14.0], to: [0.0, 6.0] },
]);
less_all(plate, vec![sweep_solid(&drill, &slide_by(p(0.0, 0.0, -20.0)))?])
}
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.2 ms; CPU time 8.7 ms; peak memory 9.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 from (0, −5, 0) to (20, 5, 4)) bored by a drill (a cylinder of radius 2 about//! the upright through (10, 0) up to z = 14, ended below by a cone of 118° with its point at//! (10, 0, 6)) pushed straight down 20, wholly through it.//!//! The drill is its half section turned about its axis; what it passes through is cadrs's sweep//! of a solid (one slide), cut from the plate.usecrate::bench::{block, cut, p3, v3};
usecrate::shared::geometry::Section;
usecrate::shared::swept::slid;
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel, Plane};
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 shoulder = 6.0 + 2.0 / 59f64.to_radians().tan();
let section = Section::on(Plane::xz(0.0))
.line((10.0, 6.0), (12.0, shoulder))
.line((12.0, shoulder), (12.0, 14.0))
.line((12.0, 14.0), (10.0, 14.0))
.line((10.0, 14.0), (10.0, 6.0));
let drill = section.turned(k, p3(10.0, 0.0, 0.0), v3(0.0, 0.0, 1.0))?;
let swept = slid(k, drill, v3(0.0, 0.0, -20.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
4.7 ms; CPU time 4.5 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 plate (0, −5, 0)–(20, 5, 4) less everything a drill passes through as it slides straight//! down by 20: a cylinder of radius 2 about the upright line through (10, 0) up to z = 14, ended//! below in a 118° cone pointed at (10, 0, 6).use springrep::boolean::difference;
use springrep::sweep::{Motion, solid};
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{boxed, deg, polygon, upright, v3};
pubfnbuild() -> Result<Brep, String> {
let plate = boxed([0.0, -5.0, 0.0], [20.0, 5.0, 4.0], "plate")?;
let rim = 6.0 + 2.0 / deg(59.0).tan();
let meridian = polygon(&[(0.0, 6.0), (2.0, rim), (2.0, 14.0), (0.0, 14.0)], "drill");
let drill = upright(&meridian, 10.0, 0.0, "drill")?;
let hole = solid(&drill, &Motion::Slide(v3(0.0, 0.0, -20.0)), "hole").map_err(e)?;
difference(&plate, &hole).map_err(e)
}
Time
84 ms; CPU time 137 ms; peak memory 37.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 plate, the box from (0, -5, 0) to (20, 5, 4), its footprint in the top plane; a drill about the// upright line through (10, 0), a cylinder of radius 2 up to z = 14 ended below in a cone of 118// degrees (each side 59 degrees from the axis) whose point is (10, 0, 6), a turn of its// half-section in the front plane; slid without turning 20 straight down along its axis, 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.front {
tip := point
lip := point hint((12, 7.2))
shank := point hint((12, 14))
back := point hint((10, 14))
fix((10, 6)) tip
fix((10, 14)) back
tip distance(2, along: u) lip
half := (cone := line(tip, lip)) -> vertical line(lip, shank) ->
horizontal line(shank, back) -> vertical (spindle := line(back, tip)) -> close
cone angle(59deg) std.z
}
drill := solid(std.solids.Revolution(half, about: spindle))
// the push, 20 straight down over the roll
down := axis hint(dir: (0, 0, -1))
down parallel(sense: opposite) std.z
ram := frame
ram slides(20mm) down
hole := solid({ p | some t in (0deg, 360deg): p in drill at(under: ram) t })
hole cut part
Time
6.9 ms; CPU time 6.7 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, no cone primitive
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 what a drill (radius 2, a 118° point at (10, 0, 6),//! up to z = 14) passes through, pushed 20 down along its axis.use anvil_brep::Solid;
usecrate::shared::{at, block, cone, cylinder, subtract, union};
pubfnbuild() -> Result<Solid, String> {
// anvil-brep has no sweep of a solid. Pushed along its own axis the drill fills its own// cylinder lengthened by the push, from where its point ends up to where its top startslet shoulder = 2. / 59f64.to_radians().tan();
let point = cone(&at([10., 0., 6. - 20.]), 0., 2., shoulder)?;
let swept = union(&point, &cylinder(&at([10., 0., 0.]), 2., 6. - 20. + shoulder, 14.)?)?;
subtract(&block([0., -5., 0.], [20., 5., 4.])?, &swept)
}