A curved block with a notch cut into it by a ring lying flat, swung partway into it.
The block is a sector of a ring about the z axis: everything with distance from the z axis between 8 and 12, with z between −1 and 1, and with polar angle between 0° and 60° (measured from +x toward +y).
The ring is a torus whose axis is the vertical line through (10, 0): the circle through its tube's centers has radius 1 and lies in the plane z = 0, and its tube has radius 0.4.
It turns rigidly about the z axis, right-handed (from +x toward +y), from −140° to +30°: it starts clear of the block and stops halfway across it. Cut from the block everything the ring passes through.
The ring's top and bottom circles stay in their planes and sweep the notch's flat roof and floor. A circle about the z axis can meet the ring in two arcs, either side of its hole, whose sweeps run into one another.
expected
closed form
volume
70.58608248
no closed form: next.BREP, cad-kernel and OCCT give the same volume and area to the twelve figures the board publishes
area
181.7592189
no closed form: next.BREP, cad-kernel and OCCT give the same volume and area to the twelve figures the board publishes
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
7.92 s; CPU time 29.9 s; peak memory 38.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 ring sector (radii 8 to 12 about z, z from −1 to 1, polar angle 0° to 60°) notched by a ring//! lying flat, the torus about the vertical line through (10, 0) of radii 1 and 0.4 centred on//! z = 0, turned rigidly about z from −140° to +30°: it starts clear of the block and stops halfway//! across it.usecrate::sketch::polygon;
use cad_kernel::build::{revolve, torus};
use cad_kernel::geom::tolerance;
use cad_kernel::swept::closed::cut_from;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
constSECTOR: f64 = 60f64.to_radians();
constROLL: [f64; 2] = [-140f64.to_radians(), 30f64.to_radians()];
/// How closely the ring is meshed for the sweep's membership reads: a hundredth of its tube's/// radius.constBAR: f64 = 0.004;
/// The ring sector about z: radii 8 to 12, heights −1 to 1, polar angles 0° to 60° — its section in/// the half-plane y = 0, x > 0 turned right-handed about z.fnsector() -> Result<Brep, String> {
let section = polygon(&[[8., 0., -1.], [12., 0., -1.], [12., 0., 1.], [8., 0., 1.]]);
revolve(§ion, [0., 0., 0.], [0., 0., 1.], SECTOR)
}
pubfnbuild() -> Result<Brep, String> {
let up = [0., 0., 1.];
let ring = torus([10., 0., 0.], up, 1., 0.4)?;
// the turn about z: a screw that does not advance, turning a radian a radian of the roll, the// ring drawn where the roll is nothinglet path = Trajectory::Twist(Screw { origin: [0., 0., 0.], axis: up, ratio: 1., advance: 0. });
// the kernel's swept solid cut from the sector on one arrangement: a torus about an axis along// the turn'slet blank = sector()?;
let size = blank.size().max(ring.size());
cut_from(&blank, &ring, &path, ROLL, BAR, tolerance(size))
.map_err(|why| format!("the ring's sweep not built: {why:?}"))
}
Time
710 ms; CPU time 709 ms; peak memory 371.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 ring lying flat, swung partway into a curved block. A curved block with a notch cut into it by
a ring lying flat, swung partway into it.
The block is a sector of a ring about the z axis: everything with distance from the z axis between
8 and 12, with z between −1 and 1, and with polar angle between 0° and 60° (measured from +x toward
+y).
The ring is a torus whose axis is the vertical line through (10, 0): the circle through its tube's
centers has radius 1 and lies in the plane z = 0, and its tube has radius 0.4.
It turns rigidly about the z axis, right-handed (from +x toward +y), from −140° to +30°: it starts
clear of the block and stops halfway across it. Cut from the block everything the ring passes
through.
The ring's top and bottom circles stay in their planes and sweep the notch's flat roof and floor. A
circle about the z axis can meet the ring in two arcs, either side of its hole, whose sweeps run
into one another."""import math
fromOCP.BRepBuilderAPIimportBRepBuilderAPI_MakeFacefromOCP.BRepPrimAPIimportBRepPrimAPI_MakeTorusfromOCP.gp import gp, gp_Ax2, gp_Ax3, gp_Cylinder, gp_Pnt
from sweep import cut, plane, ring_sector, turn, turned
BLOCK = (8, 12, -1, 1, 0, 60) # radii, heights and polar anglesCENTRE = (10, 0, 0) # the ring's centre; its axis is the vertical line through itRING, TUBE = 1, 0.4# the radius of the circle through the tube's centres, and the tube'sSTART, STOP = -140, 30# degrees about the z axisdefbuild():
ring = BRepPrimAPI_MakeTorus(gp_Ax2(gp_Pnt(*CENTRE), gp.DZ_s()), RING, TUBE).Shape()
# The turn's axis and the ring's are parallel. The ring's normal is square to the turn's# velocity where it lies in the plane y = 0 through both axes, and on its top and bottom# circles, where it is upright: the plane and the cylinder of radius 1 about the ring's axis# cut it along that contact.
cylinder = BRepBuilderAPI_MakeFace(gp_Cylinder(gp_Ax3(gp_Pnt(*CENTRE), gp.DZ_s()), RING),
0, 2 * math.pi, -2 * TUBE, 2 * TUBE).Face()
tool = turn(ring, gp.OZ_s(), START)
cuts = [turn(plane((0, 0, 0), (0, 1, 0)), gp.OZ_s(), START), turn(cylinder, gp.OZ_s(), START)]
returncut(ring_sector(*BLOCK), turned(tool, gp.OZ_s(), STOP - START, cuts))
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
349 ms; CPU time 591 ms; peak memory 28 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 curved block, the sector of the ring about the z axis between radii 8 and 12, z from −1 to 1//! and polar angle from 0° to 60°, notched by a ring lying flat swung partway into it: the torus//! about the vertical line through (10, 0), radii 1 and 0.4, centred on the plane z = 0, turned//! rigidly about the z axis from −140° to +30°. Everything the ring passes through, cut.//!//! The ring's sweep is kentron's sweep of a solid (`sweep::solid`, one turn), cut from the block.usecrate::bench::{frame, p};
usecrate::shared::swept::ring_sector;
use kentron::math::{Axis, Direction};
use kentron::primitives::Torus;
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let block = ring_sector(m)?;
let ring = Torus::new(1.0, 0.4).with_frame(frame(p(10.0, 0.0, 0.0), Direction::Z)).build(m)?;
let turn = RigidMotion::Turn { axis: Axis::Z, from: (-140f64).to_radians(), to: 30f64.to_radians() };
let swept = sweep::solid(m, ring, &turn)?;
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
157 ms; CPU time 157 ms; peak memory 48.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 ring sector, everything between 8 and 12 from the z axis with |z| ≤ 1 and polar angle from//! 0° to 60°, notched by a ring lying flat swung about the z axis from −140° to +30°: the torus//! about the vertical line through (10, 0) whose tube, of radius 0.4, is centred on the circle of//! radius 1 in the plane z = 0.//!//! solidcraft-kernel has no sweep of a solid, so the swing is built by elementary geometry//! ([`swung_partway`]). A circle about the z axis through the ring's hole meets it in two arcs,//! either side of the hole, a few degrees apart: far less than the turn, so on each circle the//! ring passes over everything from its first point where it starts to its last where it stops,//! as the ring with its hole filled does (everything within 1 + √(0.4² − z²) of its axis at//! height z). That filled ring meets each circle in one arc holding the circle's point at 0°, so//! its section through its axis, a stadium, is the shadow, revolved through the turn, with its//! half ahead of that section where it stops.usesuper::drum_swung_partway_into_ring_sector::{half_ahead, swung_partway};
usecrate::solids::*;
use solidcore_record::Seg2;
use std::f64::consts::{FRAC_PI_2, PI};
pubfnbuild() -> R<Body> {
let line = |a: (f64, f64), b: (f64, f64)| Seg2::Line { a: v2(a.0, a.1), b: v2(b.0, b.1) };
// the tube's half circle on the outer side of the ring's axis (x = 11) or the inner (x = 9)let tube = |x: f64, start: f64| Seg2::Arc { center: v2(x, 0.0), radius: 0.4, start, sweep: PI };
let stadium = vec![
line((9.0, -0.4), (11.0, -0.4)),
tube(11.0, -FRAC_PI_2),
line((11.0, 0.4), (9.0, 0.4)),
tube(9.0, FRAC_PI_2),
];
let half = vec![
line((10.0, -0.4), (11.0, -0.4)),
tube(11.0, -FRAC_PI_2),
line((11.0, 0.4), (10.0, 0.4)),
line((10.0, 0.4), (10.0, -0.4)),
];
let region = |segs: Vec<Seg2>| Region2 { outer: Loop2 { segs }, holes: vec![] };
swung_partway(region(stadium), Some(half_ahead(region(half))?))
}
// A ring sector (8 to 12 from the z axis, |z| ≤ 1, 0° to 60°) less everything a flat ring (a torus about the vertical through (10, 0), middle radius 1, tube 0.4) passes through as it turns about z from -140° to 30°. Its shadow is everything within 1.4 of the vertical through (10, 0) at z = 0, rounded by the tube top and bottom.//// A turn about the z axis sweeps the tool where it starts and where it stops and, between them, the// shadow of the tool on a half-plane through the axis (each point carried there round its circle// about the axis) revolved through the turn: here the tool is symmetric about its own plane through// the axis, so the shadow is its section in that plane.fnblock(m) {
m.profile(xz()).polygon([[8.0, -1.0], [12.0, -1.0], [12.0, 1.0], [8.0, 1.0]]).sketch("block")
.revolve(axis_at([0.0, 0.0, 0.0], [0.0, 0.0, 1.0]), blind(60.0))
}
fnswing(m, section, from, to) {
section.sketch("shadow").revolve(axis_at([0.0, 0.0, 0.0], [0.0, 0.0, 1.0]), blind(to - from))
.rotate(axis_at([0.0, 0.0, 0.0], [0.0, 0.0, 1.0]), from)
}
fnturned(body, angle) { body.rotate(axis_at([0.0, 0.0, 0.0], [0.0, 0.0, 1.0]), angle) }
fncutter(m) { m.torus(1.0, 0.4, #{ at: [10.0, 0.0, 0.0] }) }
let m = model();
let b = block(m);
b = b.subtract(m.tool(|m| turned(cutter(m), -140.0)));
b = b.subtract(m.tool(|m| swing(m, m.profile(xz()).path(9.0, -0.4).line_to(11.0, -0.4).arc_to([11.4, 0.0], [11.0, 0.4]).line_to(9.0, 0.4).arc_to([8.6, 0.0], [9.0, -0.4]).close(), -140.0, 30.0)));
b = b.subtract(m.tool(|m| turned(cutter(m), 30.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
31 ms; CPU time 31 ms; peak memory 23.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 ring sector 8 ≤ ρ ≤ 12, −1 ≤ z ≤ 1, 0° to 60° about the z axis, less everything a ring lying//! flat passes through as it turns rigidly about the z axis from −140° to +30°: the torus about the//! upright line through (10, 0), the circle through its tube's centres of radius 1 in z = 0, its//! tube of radius 0.4.//!//! Through the kernel's whole sweep of a solid (`sweep_solid`): the ring, a solid of revolution//! about the upright line through (10, 0, 0) whose meridian is the circle of radius 0.4 about the//! point 1 from the axis, turned about the z axis from −140° to +30°, its end positions included,//! and cut from the block.usecrate::solids::p;
usecrate::solids::swept::{less_all, revolved_tool, ring_sector, turn_about_z, Piece};
usecrate::Refusal;
use brep_kernel::{sweep_solid, BrepSolid};
use std::f64::consts::{TAU};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let (x, z) = (p(1.0, 0.0, 0.0), p(0.0, 0.0, 1.0));
let ring = revolved_tool(p(10.0, 0.0, 0.0), z, x, &[
Piece::Arc { centre: [1.0, 0.0], radius: 0.4, start: 0.0, end: TAU },
]);
less_all(ring_sector(8.0, 12.0, -1.0, 1.0, 0.0, 60f64.to_radians())?, vec![sweep_solid(&ring, &turn_about_z((-140f64).to_radians(), 30f64.to_radians(), 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
8.4 ms; CPU time 12 ms; peak memory 9.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 curved block (the ring sector between radii 8 and 12, heights ±1, polar angles 0° to 60°)//! notched by a ring lying flat (the torus about the upright through (10, 0), radii 1 and 0.4)//! turned about the z axis from −140° to +30°.//!//! The ring is cadrs's torus primitive; what it passes through is cadrs's sweep of a solid (one//! turn), cut from the block (cadrs's cylindrical box).usecrate::bench::{cut, p3, torus, v3};
usecrate::shared::swept::{ring_sector, swung, z_axis};
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let block = ring_sector(k, (8.0, 12.0), (-1.0, 1.0), (0.0, 60.0))?;
let ring = torus(k, p3(10.0, 0.0, 0.0), v3(0.0, 0.0, 1.0), 1.0, 0.4)?;
let swept = swung(k, ring, z_axis(), -140.0, 30.0)?;
cut(k, block, 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
130 ms; CPU time 130 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.
//! The ring sector (radii 8 to 12, heights −1 to 1, angles 0° to 60°) less everything a ring passes//! through as it turns about the z axis from −140° to 30°: the torus about the upright line through//! (10, 0), its tube's centers on the circle of radius 1 in the plane z = 0, its tube of radius 0.4.use springrep::boolean::difference;
use springrep::primitive::torus;
use springrep::sweep::solid;
use springrep::topo::Brep;
usecrate::shared::swept::{deg, sector_block, turning};
usecrate::shared::{at, e};
pubfnbuild() -> Result<Brep, String> {
let ring = torus(&at([10., 0., 0.]), 1., 0.4, "ring").map_err(e)?;
let notch = solid(&ring, &turning(deg(-140.), deg(30.)), "notch").map_err(e)?;
difference(§or_block()?, ¬ch).map_err(e)
}
Time
695 ms; CPU time 2.14 s; peak memory 39.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 curved block, the ring sector between radii 8 and 12 about the z axis, z within 1, polar angle// from 0 to 60 degrees: its section in the front plane (x, z) turned 60 degrees about the z axis.// A ring lying flat: the torus whose tube, of radius 0.4, is centred on the circle of radius 1// about the upright line through (10, 0) in the plane z = 0; its tube's circle drawn in the front// plane and turned about that line. It is turned rigidly about the z axis from -140 to +30// degrees, and everything it passes through cut from the block.unit mm
use std
use std.solids
use std.solids (cut)
use std.motion (turns)
use std.place (horizontal)
in std.front {
a := point
b := point hint((12, -1))
c := point hint((12, 1))
d := point hint((8, 1))
meridian := horizontal line(a, b) -> vertical line(b, c) ->
horizontal line(c, d) -> vertical line(d, a) -> close
fix((8, -1)) a
a distance(4) b
b distance(2) c
}
part := solid(std.solids.Revolution(meridian, about: std.z, to: 60deg))
in std.front {
o := point
up := point hint((10, 1))
fix((10, 0)) o
o distance(1) up
ring_axis := vertical line(o, up)
m := point hint((11, 0))
o distance(1, along: u) m
o horizontal m
tube := circle(center: m) hint(r: 0.4)
radius(0.4) tube
}
ring := solid(std.solids.Revolution(face(tube), about: ring_axis))
swing := frame
swing turns(1) std.z
notch := solid({ p | some t in (-140deg, 30deg): p inringat(under: swing) t })
notch cut part
anvilcad left no solid to show.
Time
9.8 ms; CPU time 9.6 ms; peak memory 5.1 MB
Notes
refused not supported yet: the surfaces touch along their intersection
//! The ring sector 8 ≤ ρ ≤ 12, |z| ≤ 1, 0° ≤ φ ≤ 60° less what a ring lying flat (a torus about the vertical through (10, 0), middle circle 1, tube 0.4) passes through, turned about//! the z axis from −140° to 30°.use anvil_brep::Solid;
use std::f64::consts::FRAC_PI_2;
use anvil_brep::profile::Segment;
usecrate::shared::{at, cut_all, line, rect, swung, torus, turn_z, v2};
pubfnbuild() -> Result<Solid, String> {
let sector = swung(rect((8., -1.), (12., 1.)).segments, 0., 60.)?;
let tool = torus(&at([10., 0., 0.]), 1., 0.4)?;
let fan = swung(
vec![
line(v2(9., -0.4), v2(11., -0.4)),
Segment::Arc { center: v2(11., 0.), radius: 0.4, start: -FRAC_PI_2, sweep: 2. * FRAC_PI_2 },
line(v2(11., 0.4), v2(9., 0.4)),
Segment::Arc { center: v2(9., 0.), radius: 0.4, start: FRAC_PI_2, sweep: 2. * FRAC_PI_2 },
],
-140.,
170.,
)?;
// anvil-brep has no sweep of a solid. Turned about the z axis the tool fills the revolve of// what it covers in a half-plane through the axis, the stadium from 9 to 11 out within |z| ≤ 0.4, ended by half disks of radius 0.4, and itself where it starts and stopscut_all(sector, [Ok(fan), Ok(tool.transformed(&turn_z(-140.))), Ok(tool.transformed(&turn_z(30.)))])
}