A block, the box from (0, −10, −10) to (30, 10, 0), with a line engraved into its top by a V bit that stops inside it at both ends.
The bit is a solid cone whose axis is the vertical line through (5, 0), its point at (5, 0, −2), 2 below the block's top, opening upward at 90° (each side 45° from the axis) to a flat top of radius 5 at z = 3.
It slides without turning along the x axis by 15, so that its point ends at (20, 0, −2). Cut from the block everything the bit passes through.
The bit's point lies on its axis, inside the block at both ends. The groove is a V 4 wide at the top and 2 deep, along 15, its flanks planes at 45°, ended at each end by half of the cone.
expected
closed form
volume
5931.62242
6000 − (15·2² + (π/3)·2³): the groove's section, the triangle 4 wide and 2 deep, along 15, and the cone below the top at its two ends together
area
2230.057975
2200 − (4π + 60) (the opening) + two flanks 2·15·2√2 + the cone's side below the top, half at each end, π·2·2√2
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
2.10 s; CPU time 2.59 s; peak memory 20.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 (0, −10, −10)–(30, 10, 0), engraved along x by a V bit — the solid cone about//! the vertical line through (5, 0), its point at (5, 0, −2), opening at 90° to a flat top of//! radius 5 at z = 3 — slid without turning 15 along x, its point inside the block at both ends.usecrate::sketch::block;
use cad_kernel::build::cone;
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;
constPOINT: V = [5., 0., -2.];
constTOP_RADIUS: f64 = 5.;
constHEIGHT: f64 = 5.;
constSLIDE: f64 = 15.;
/// How closely the bit is meshed for the sweep's membership reads.constBAR: f64 = 0.01;
pubfnbuild() -> Result<Brep, String> {
let stock = block([0., -10., -10.], [30., 10., 0.])?;
// the cone from its point (radius nothing) up to its flat toplet bit = cone(POINT, [0., 0., 1.], 0., TOP_RADIUS, HEIGHT)?;
// the slide along x: a screw that does not turn, advancing its whole length over a roll of τlet path = Trajectory::Twist(Screw {
origin: POINT, axis: [1., 0., 0.], ratio: 0., advance: SLIDE,
});
// the kernel's swept solid cut from the block on one arrangement: the cone at both end poses// and its two rulings square to the slide swept into the groove's flankslet size = stock.size().max(bit.size());
cut_from(&stock, &bit, &path, [0., TAU], BAR, tolerance(size))
.map_err(|why| format!("the bit's sweep not built: {why:?}"))
}
Time
642 ms; CPU time 642 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 V bit engraving a line that stops inside a block. A block, the box from (0, −10, −10) to (30,
10, 0), with a line engraved into its top by a V bit that stops inside it at both ends.
The bit is a solid cone whose axis is the vertical line through (5, 0), its point at (5, 0, −2), 2
below the block's top, opening upward at 90° (each side 45° from the axis) to a flat top of radius
5 at z = 3.
It slides without turning along the x axis by 15, so that its point ends at (20, 0, −2). Cut from
the block everything the bit passes through.
The bit's point lies on its axis, inside the block at both ends. The groove is a V 4 wide at the
top and 2 deep, along 15, its flanks planes at 45°, ended at each end by half of the cone."""import math
fromOCP.BRepPrimAPIimportBRepPrimAPI_MakeBox, BRepPrimAPI_MakeConefromOCP.gp import gp, gp_Ax2, gp_Pnt
from sweep import cut, plane, slid
BLOCK = ((0, -10, -10), (30, 10, 0))
POINT = (5, 0, -2) # the bit's point, on its upright axisTOP = 3# the height of its flat topHALF_ANGLE = 45SLIDE = (15, 0, 0)
defbuild():
height = TOP - POINT[2]
bit = BRepPrimAPI_MakeCone(gp_Ax2(gp_Pnt(*POINT), gp.DZ_s()), 0,
height * math.tan(math.radians(HALF_ANGLE)), height).Shape()
# The cone's normal, (cos 45°)·r̂ − (sin 45°)·ẑ at the line of it along r̂, is square to the# slide (x) where r̂ = ±ŷ: its two lines in the plane x = 5 through its axis. The flat top# slides in its own plane.
swept = slid(bit, SLIDE, [plane(POINT, (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
11 ms; CPU time 11 ms; peak memory 11.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, the box from (0, −10, −10) to (30, 10, 0), engraved by a V bit that stops inside it at//! both ends: the solid cone about the vertical line through (5, 0), its point at (5, 0, −2),//! opening upward at 90° to a flat top of radius 5 at z = 3, slid without turning along the x axis//! by 15. Everything the bit passes through, cut.//!//! The bit'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::{Cone, Cuboid};
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let block = Cuboid::from_corners(p(0.0, -10.0, -10.0), p(30.0, 10.0, 0.0)).build(m)?;
let bit = Cone::new(0.0, 5.0, 5.0).with_frame(frame(p(5.0, 0.0, -2.0), Direction::Z)).build(m)?;
let swept = sweep::solid(m, bit, &RigidMotion::Slide { by: v(15.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
94 ms; CPU time 94 ms; peak memory 48.1 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, −10, −10) to (30, 10, 0), with a line engraved into its top by a V//! bit: the solid cone about the vertical line through (5, 0), its point at (5, 0, −2), opening//! upward at 90° to a flat top of radius 5 at z = 3, slid without turning along x by 15.//!//! solidcraft-kernel has no sweep of a solid, so the bit's sweep is built by elementary geometry.//! Split by the plane x = 5 through its axis, square to the slide, the bit's back half leads with//! its flat cut face only (its cone faces back, and its top moves in its own plane), so it sweeps//! itself and that triangle slid 15; the front half likewise sweeps the triangle and itself where//! it stops. So the sweep is the back half where the bit starts, the triangle on x = 5 extruded//! along x by 15, and the front half where it stops.usecrate::solids::*;
use std::f64::consts::TAU;
/// The half of the bit about the vertical line through (`x`, 0) on the side `outward` points to.fnhalf_bit(x: f64, outward: Vec3) -> R<Body> {
let plane = Plane { origin: v3(x, 0.0, 0.0), x: Vec3::X, y: Vec3::Z };
let section = polygon(&[(0.0, -2.0), (5.0, 3.0), (0.0, 3.0)]);
let bit = one(solidcraft_kernel::revolve(&plane, &[section], Vec2::ZERO, Vec2::Y, TAU)?)?;
let cap = Plane::from_normal(plane.origin, outward)
.ok_or_else(|| KernelError::Invalid("the half bit's direction".into()))?;
solidcraft_kernel::half_space(&bit, &cap, true)?
.0
.ok_or_else(|| KernelError::Failed("the half bit is empty".into()))
}
pubfnbuild() -> R<Body> {
let stock = block((0.0, -10.0, -10.0), (30.0, 10.0, 0.0))?;
// the bit's section through its axis, in (y, z) on the plane x = 5, extruded along +xlet section = polygon(&[(0.0, -2.0), (5.0, 3.0), (-5.0, 3.0)]);
let plane = Plane { origin: v3(5.0, 0.0, 0.0), x: Vec3::Y, y: Vec3::Z };
letmut swept = extrude(&plane, section, 0.0, 15.0)?;
swept = union(&swept, &half_bit(5.0, -Vec3::X)?)?;
swept = union(&swept, &half_bit(20.0, Vec3::X)?)?;
cut(&stock, &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
37 ms; CPU time 41 ms; peak memory 26 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, -10, -10) to (30, 10, 0), less everything a V bit passes through as it slides// along x by 15: a cone on the vertical line through (5, 0), its point at (5, 0, -2), opening at// 90° to a flat top of radius 5 at z = 3.//// Sliding square to its axis, the cone sweeps itself where it starts and stops and, between them,// its section through the axis square to the slide (a triangle) carried along it.let m = model();
let block = m.box(30.0, 20.0, 10.0, #{ at: [0.0, -10.0, -10.0] });
block = block.subtract(m.tool(|m| m.cone(0.0, 5.0, 5.0, #{ at: [5.0, 0.0, -2.0] })));
block = block.subtract(m.tool(|m| m.cone(0.0, 5.0, 5.0, #{ at: [20.0, 0.0, -2.0] })));
block = block.subtract(m.tool(|m| m.profile(yz_at(5.0)).polygon([[0.0, -2.0], [5.0, 3.0], [-5.0, 3.0]])
.sketch("v_section").extrude(blind(15.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
14 ms; CPU time 13 ms; peak memory 18.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.
//! The block from (0, −10, −10) to (30, 10, 0), less everything a V bit passes through as it slides//! without turning along x by 15: the cone about the upright line through (5, 0) with its point at//! (5, 0, −2), opening at 90° to a flat top of radius 5 at z = 3.//!//! Through the kernel's whole sweep of a solid (`sweep_solid`): the bit, a solid of revolution//! about the upright line through (5, 0, 0) whose meridian is the cone's side from its point at z =//! −2 out to radius 5 at z = 3 and the flat top, slid 15 along x, and cut from the block.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 block = make_box_brep(p(0.0, -10.0, -10.0), 30.0, 20.0, 10.0)?;
let bit = revolved_tool(p(5.0, 0.0, 0.0), z, x, &[
Piece::Line { from: [0.0, -2.0], to: [5.0, 3.0] },
Piece::Line { from: [5.0, 3.0], to: [0.0, 3.0] },
Piece::Line { from: [0.0, 3.0], to: [0.0, -2.0] },
]);
less_all(block, vec![sweep_solid(&bit, &slide_by(p(15.0, 0.0, 0.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
4.3 ms; CPU time 4 ms; peak memory 9.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, −10, −10) to (30, 10, 0)) engraved by a V bit (a cone about the//! upright through (5, 0), its point at (5, 0, −2), opening at 90° to a top of radius 5 at z = 3)//! slid 15 along x, stopping inside it at both ends.//!//! The bit is cadrs's cone primitive; what it passes through is cadrs's sweep of a solid (one//! slide), cut from the block.usecrate::bench::{block, cone, cut, 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, -10.0, -10.0), p3(30.0, 10.0, 0.0))?;
let bit = cone(k, p3(5.0, 0.0, -2.0), v3(0.0, 0.0, 1.0), 0.0, 5.0, 5.0)?;
let swept = slid(k, bit, v3(15.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
11 ms; CPU time 9.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, −10, −10)–(30, 10, 0) less everything a V bit passes through as it slides along//! the x axis by 15: the cone about the upright line through (5, 0), pointed at (5, 0, −2), opening//! at 90° to a flat top of radius 5 at z = 3.use springrep::boolean::difference;
use springrep::primitive::cone;
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, -10.0, -10.0], [30.0, 10.0, 0.0], "block")?;
let bit = cone(&at([5.0, 0.0, -2.0]), 0.0, 5.0, 5.0, "bit").map_err(e)?;
let groove = solid(&bit, &Motion::Slide(v3(15.0, 0.0, 0.0)), "groove").map_err(e)?;
difference(&block, &groove).map_err(e)
}
Time
3.71 s; CPU time 4.17 s; peak memory 37.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, the box from (0, -10, -10) to (30, 10, 0), with a line engraved into its top by a V// bit stopping inside it. The bit is a cone about the vertical through (5, 0): its point at// (5, 0, -2), opening at 45 degrees to a flat top of radius 5 at z = 3, drawn as its half section// in the front plane and turned about its axis. It slides 15 along x, and the kernel's sweep of// it is cut from the block.unit mm
use std
use std.solids (cut)
use std.place (coords, above, horizontal)
use std.shapes
use std.motion (slides)
in std.top {
private mid := point
fix((15, 0)) mid
private outline := std.shapes.CenteredRectangle(mid, w: 30mm, h: 20mm)
}
part := solid(std.solids.Prism(outline.loop, from: -10mm, to: 0mm))
in std.front {
private tip := point
private lip := point hint((10, 3))
private back := point hint((5, 3))
tip coords(du: 5mm, dv: -2mm) std.front
back above(d: 5mm) tip
construction centerline spindle := line(tip, back)
(cone := line(tip, lip)) angle(45deg) spindle
horizontal (top := line(lip, back))
}
construction bit := solid(std.solids.Revolution(face(cone, top, spindle), about: spindle))
feed := frame
feed slides(15mm) std.x
construction groove := solid({ p | some t in (0deg, 360deg): p in bit at(under: feed) t })
groove cut part
Time
7.6 ms; CPU time 7.4 ms; peak memory 5.1 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 block from (0, −10, −10) to (30, 10, 0) less what a 90° V bit (its point at (5, 0, −2),//! opening up to radius 5 at z = 3) passes through, slid 15 along x.use anvil_brep::{Solid, extrude};
usecrate::shared::{at, block, cone, e, frame, polygon, region, subtract, union};
pubfnbuild() -> Result<Solid, String> {
let bit = |x: f64| cone(&at([x, 0., -2.]), 0., 5., 5.);
// anvil-brep has no sweep of a solid. Slid square to its axis the cone fills itself at each end// and the prism of its shadow along the slide between, the triangle |y| ≤ z + 2 up to z = 3let side = frame([5., 0., 0.], [1., 0., 0.], [0., 1., 0.])?;
let shadow = region(&[polygon(&[(0., -2.), (5., 3.), (-5., 3.)])])?;
let between = extrude::extrude(&side, &shadow, 0., 15.).map_err(e)?;
let swept = union(&union(&bit(5.)?, &between)?, &bit(20.)?)?;
subtract(&block([0., -10., -10.], [30., 10., 0.])?, &swept)
}