A curved block with a notch cut into it by half a drum swung partway into it, flat face first.
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 tool is half of the solid cylinder of radius 1 about the vertical line through (10, 0), from z = −0.5 to z = 0.5: the half with y ≤ 0, cut off by the plane y = 0 through its axis. Its flat face is the rectangle 9 ≤ x ≤ 11, y = 0, |z| ≤ 0.5, and its round side faces −y.
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 half drum passes through.
The half drum leads with its flat face, so the notch is the ring between radii 9 and 11 and heights ±0.5 from the block's edge at 0° to the flat face where it stops, at 30°. Its round side's arcs end at that face, at the two corners whose paths are the notch's inner and outer edges.
expected
closed form
volume
73.30382858
80π/3 − (π/6)(11² − 9²)/2·1: the half drum leads with its flat cut, so each circle about the axis between 9 and 11 loses exactly the sector's first 30°
area
173.0796327
40π + 16 − 2 (the opening at 0°) + floor and roof 2·10π/3 + the walls (π/6)(9 + 11) + the half drum's flat face 2·1 where it stops
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
45 ms; CPU time 98 ms; peak memory 15.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 ring sector (radii 8 to 12 about z, z from −1 to 1, polar angle 0° to 60°) notched by a half//! drum — the half y ≤ 0 of the solid cylinder of radius 1 about the vertical line through (10, 0)//! from z = −0.5 to 0.5 — turned rigidly about z from −140° to +30°, flat face first.usecrate::sketch::polygon;
use cad_kernel::build::{disc, kept, prism, revolve};
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 half drum is meshed for the sweep's membership reads: a hundredth of its/// radius.constBAR: f64 = 0.01;
/// 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.];
// the drum, kept on the side y ≤ 0 of the plane through its axislet drum = prism(&disc([10., 0., -0.5], up, 1.), 0., 1.)?;
let half = kept(&drum, [10., 0., 0.], [0., -1., 0.], 0.)?;
// 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 sector on one arrangement: a cylinder about an axis// along the turn's, its flat faces planeslet blank = sector()?;
let size = blank.size().max(half.size());
cut_from(&blank, &half, &path, ROLL, BAR, tolerance(size))
.map_err(|why| format!("the half drum's sweep not built: {why:?}"))
}
Time
649 ms; CPU time 649 ms; peak memory 368.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 half drum swung partway into a curved block, its arcs ending at its cut. A curved block with a
notch cut into it by half a drum swung partway into it, flat face first.
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 tool is half of the solid cylinder of radius 1 about the vertical line through (10, 0), from z
= −0.5 to z = 0.5: the half with y ≤ 0, cut off by the plane y = 0 through its axis. Its flat face
is the rectangle 9 ≤ x ≤ 11, y = 0, |z| ≤ 0.5, and its round side faces −y.
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 half drum passes
through.
The half drum leads with its flat face, so the notch is the ring between radii 9 and 11 and heights
±0.5 from the block's edge at 0° to the flat face where it stops, at 30°. Its round side's arcs end
at that face, at the two corners whose paths are the notch's inner and outer edges."""import math
fromOCP.BRepPrimAPIimportBRepPrimAPI_MakeCylinderfromOCP.gp import gp, gp_Ax2, gp_Pnt
from sweep import cut, ring_sector, turn, turned
BLOCK = (8, 12, -1, 1, 0, 60) # radii, heights and polar anglesAXIS = 10# the drum's axis is the vertical line through (10, 0)RADIUS, LOW, HIGH = 1, -0.5, 0.5START, STOP = -140, 30# degrees about the z axisdefbuild():
# half a turn of the drum's section, from −x round through −y to +x: the half with y ≤ 0
half = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(AXIS, 0, LOW), gp.DZ_s(), gp.DX_s().Reversed()),
RADIUS, HIGH - LOW, math.pi).Shape()
tool = turn(half, gp.OZ_s(), START)
# Its round side meets the turn square-on only along its two edges in the plane y = 0# through both axes, and trails everywhere between; its flat face, in a plane through the# turn's axis, leads all over; its ends turn in their own planes. No face needs splitting.
swept = turned(tool, gp.OZ_s(), STOP - START)
returncut(ring_sector(*BLOCK), 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
22 ms; CPU time 22 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 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 half a drum swung partway into it: the half with//! y ≤ 0 of the solid cylinder of radius 1 about the vertical line through (10, 0), |z| ≤ 0.5, its//! flat face the rectangle 9 ≤ x ≤ 11, y = 0, turned rigidly about the z axis from −140° to +30°.//! Everything the half drum passes through, cut.//!//! The half drum's sweep is kentron's sweep of a solid (`sweep::solid`, one turn), cut from the//! block.usecrate::bench::p;
usecrate::shared::swept::ring_sector;
use kentron::math::{Axis, Direction, Frame};
use kentron::primitives::Cylinder;
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
use std::f64::consts::PI;
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let block = ring_sector(m)?;
// The half of the cylinder from polar angle 180° to 360° about its axis, the side facing −y.let axis = Frame::new(p(10.0, 0.0, -0.5), Direction::Z, Direction::NEG_X);
let half = Cylinder::new(1.0, 1.0).with_angle(PI).with_frame(axis).build(m)?;
let turn = RigidMotion::Turn { axis: Axis::Z, from: (-140f64).to_radians(), to: 30f64.to_radians() };
let swept = sweep::solid(m, half, &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
46 ms; CPU time 46 ms; peak memory 47.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 ring sector, everything between 8 and 12 from the z axis with |z| ≤ 1 and polar angle from//! 0° to 60°, notched by a half drum swung about the z axis from −140° to +30°: the half with//! y ≤ 0 of the solid cylinder of radius 1 about the vertical line through (10, 0) from z = −0.5//! to 0.5, its flat face leading.//!//! solidcraft-kernel has no sweep of a solid, so the swing is built by elementary geometry//! ([`swung_partway`]): the half drum meets each circle about the z axis in one arc ending at the//! circle's point at 0°, on its flat face, so its section by the half-plane at 0°, that face, is//! its shadow, and nothing of it lies ahead of the face. What it sweeps in the block is the face//! revolved through the turn.usesuper::drum_swung_partway_into_ring_sector::swung_partway;
usecrate::solids::*;
pubfnbuild() -> R<Body> {
swung_partway(rect(9.0, -0.5, 11.0, 0.5), None)
}
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.
popkern left no solid to show.
Time
413 ms; CPU time 657 ms; peak memory 30.9 MB
Notes
refused FeatureFailed at half_drum_swung_partway_into_ring_sector.rhai:21:7: feature 'boolean-5' (boolean) failed: result validation failed: cellular result invalid: Half-edge HalfEdgeHandle(59v1) in loop LoopHandle(11v1) ends at VertexHandle(22v1) but its successor HalfEdgeHandle(26v1) starts at VertexHandle(23v1)
// A ring sector (8 to 12 from the z axis, |z| ≤ 1, 0° to 60°) less everything half a drum (the half with y ≤ 0 of the cylinder of radius 1 about the vertical through (10, 0), |z| ≤ 0.5) passes through as it turns about z from -140° to 30°, flat face first. Its flat face lies in the half-plane through the axis, so its shadow is that face.//// 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.cylinder(1.0, 1.0, #{ at: [10.0, 0.0, -0.5] }).subtract(m.tool(|m| m.box(4.0, 2.0, 2.0, #{ at: [8.0, 0.0, -1.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()).polygon([[9.0, -0.5], [11.0, -0.5], [11.0, 0.5], [9.0, 0.5]]), -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
15 ms; CPU time 15 ms; peak memory 18.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 notched by half a drum swung partway into it, flat face first.//!//! The kernel's sweep of a solid (`sweep_solid_within`, its planar motion of a prism, which//! includes the end positions exactly): the half drum is the half with y ≤ 0 of the circle of//! radius 1 about (10, 0) (its arc from (11, 0) clockwise through (10, −1) to (9, 0), closed by its//! diameter), from z = −0.5 to 0.5, a prism along the z axis, turned about the z axis from −140° to//! +30°. Asked for between 7.5 and 12.5 from the z axis, from z = −0.5 to 0.5 along it (a prism's//! sweep is asked for between its ends) and from −10° to 70°, which holds the notch; cut from the//! block, the rectangle 8 ≤ x ≤ 12, |z| ≤ 1 revolved from 0° to 60°.usecrate::solids::{p, polygon};
usecrate::Refusal;
use brep_kernel::{
boolean_operation_nary, revolve_profile_brep, sweep_solid_within, BooleanOperation, BrepSolid,
OutlinePiece, ScrewStep, SolidMotion, SweepClip, SweptTool,
};
#[allow(unused_imports)]use std::f64::consts::{PI, TAU};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let z = p(0.0, 0.0, 1.0);
let section = [p(8.0, 0.0, -1.0), p(12.0, 0.0, -1.0), p(12.0, 0.0, 1.0), p(8.0, 0.0, 1.0)];
let block = revolve_profile_brep(&polygon(§ion)?, p(0.0, 0.0, 0.0), z, 60f64.to_radians())?;
let tool = 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: [10.0, 0.0], radius: 1.0, start: 0.0, end: -PI },
OutlinePiece::Line { from: [9.0, 0.0], to: [11.0, 0.0] },
],
from: -0.5,
to: 0.5,
};
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: (-140f64).to_radians(),
to: 30f64.to_radians(),
};
let around_notch = SweepClip {
axis_origin: p(0.0, 0.0, 0.0),
axis_direction: z,
reference: p(1.0, 0.0, 0.0),
radius: [7.5, 12.5],
axial: [-0.5, 0.5],
angle: Some([(-10f64).to_radians(), 70f64.to_radians()]),
};
letmut operands = vec![block];
operands.extend(sweep_solid_within(&tool, &turn, &around_notch)?);
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
7.9 ms; CPU time 14 ms; peak memory 10.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 curved block (the ring sector between radii 8 and 12, heights ±1, polar angles 0° to 60°)//! notched by half a drum (radius 1 about the upright through (10, 0), from z = −0.5 to 0.5, the//! half with y ≤ 0) turned about the z axis from −140° to +30°, flat face first.//!//! The half drum is the half disc sketched and extruded; what it passes through is cadrs's sweep//! of a solid (one turn), cut from the block (cadrs's cylindrical box).usecrate::bench::{arc, cut, extrude, p2};
usecrate::shared::swept::{ring_sector, swung, z_axis};
usecrate::Refusal;
use cadrs_kernel::{BodyId, Curve2, DefaultKernel, Loop, Plane, Profile};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let block = ring_sector(k, (8.0, 12.0), (-1.0, 1.0), (0.0, 60.0))?;
let half = Loop::new(vec![arc(p2(10.0, 0.0), 1.0, 180.0, 180.0), Curve2::line(p2(11.0, 0.0), p2(9.0, 0.0))]);
let tool = extrude(k, &Profile::of(Plane::xy(-0.5), vec![half]), 1.0)?;
let swept = swung(k, tool, 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
10 ms; CPU time 9.8 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 ring sector (radii 8 to 12, heights −1 to 1, angles 0° to 60°) less everything half a drum//! passes through as it turns about the z axis from −140° to 30°: the half with y ≤ 0 of the drum//! of radius 1 about the upright line through (10, 0), from z = −0.5 to 0.5, flat face first.use std::f64::consts::PI;
use springrep::boolean::difference;
use springrep::sweep::{extrude, solid};
use springrep::topo::Brep;
usecrate::shared::swept::{arc, deg, line, outline, sector_block, turning};
usecrate::shared::{at, e};
pubfnbuild() -> Result<Brep, String> {
let half = outline(vec![
arc((10.0, 0.0), 1.0, PI, PI, "side"),
line((11.0, 0.0), (9.0, 0.0), "face"),
]);
let tool = extrude(&half, &at([0.0, 0.0, -0.5]), 1.0, "half_drum").map_err(e)?;
let notch = solid(&tool, &turning(deg(-140.0), deg(30.0)), "notch").map_err(e)?;
difference(§or_block()?, ¬ch).map_err(e)
}
Time
91 ms; CPU time 170 ms; peak memory 32.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 half drum, the half with y <= 0 of the cylinder of radius 1 about the upright line through// (10, 0) from z = -0.5 to 0.5: its footprint the half disc under the diameter from (9, 0) to// (11, 0). It is turned rigidly about the z axis from -140 to +30 degrees, flat face first, 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.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.top {
o := point
fix((10, 0)) o
w := point hint((9, 0))
e := point hint((11, 0))
w distance(1) o
o distance(1) e
// counter-clockwise from w round under the centre to e, and back along the diameter
footprint := (round := arc(center: o, start: w, end: e)) -> horizontal (flat := line(e, w)) ->
close
}
half := solid(std.solids.Prism(footprint, from: -0.5mm, to: 0.5mm))
swing := frame
swing turns(1) std.z
notch := solid({ p | some t in (-140deg, 30deg): p in half at(under: swing) t })
notch cut part
Time
9.5 ms; CPU time 9.2 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
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, |z| ≤ 1, 0° ≤ φ ≤ 60° less what half a drum (the half y ≤ 0 of radius 1 about the vertical through (10, 0), from z = −0.5 to 0.5) passes through, turned about//! the z axis from −140° to 30°.use anvil_brep::Solid;
usecrate::shared::{at, block, cut_all, cylinder, rect, subtract, swung, turn_z};
pubfnbuild() -> Result<Solid, String> {
let sector = swung(rect((8., -1.), (12., 1.)).segments, 0., 60.)?;
let tool = subtract(&cylinder(&at([10., 0., 0.]), 1., -0.5, 0.5)?, &block([8., 0., -1.], [12., 2., 1.])?)?;
let fan = swung(rect((9., -0.5), (11., 0.5)).segments, -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, from 9 to 11 out within |z| ≤ 0.5, and itself where it starts and stopscut_all(sector, [Ok(fan), Ok(tool.transformed(&turn_z(-140.))), Ok(tool.transformed(&turn_z(30.)))])
}