A curved block with a notch cut into it by a small bar 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 bar is the box 10 ≤ x ≤ 11, −0.5 ≤ y ≤ 0.5, −0.6 ≤ z ≤ 0.6.
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 bar passes through.
The notch's far wall is the cylinder of radius √(11² + 0.5²) that the bar's outer corners sweep, its near wall the cylinder of radius 10 its inner face sweeps, and it ends in the bar's own faces where it stops.
expected
closed form
volume
76.49537613
80π/3 − 1.2∫ρ(a(ρ) + π/6) dρ from 10 to √(11² + 0.5²), a(ρ) = asin(min(0.5, √(ρ² − 10²))/ρ) the bar's farthest angle from its middle plane at ρ; ∫ρ acos(a/ρ) and ∫ρ asin(a/ρ) in closed form
area
168.1861552
40π + 16 − 1.2(√121.25 − 10) (the opening at 0°) + floor and roof 2∫ρ(a + π/6) dρ + the walls 1.2(10π/6 + √121.25·(π/6 + asin(0.5/√121.25)) + 0.5 + 1), the last two the leading halves of the bar's inner face and its leading face
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
96 ms; CPU time 189 ms; peak memory 20.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 the box//! 10 ≤ x ≤ 11, −0.5 ≤ y ≤ 0.5, −0.6 ≤ z ≤ 0.6 turned rigidly about z, right-handed, from −140° to//! +30°: it starts clear and stops halfway across.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::FRAC_PI_3;
constUP: V = [0., 0., 1.];
constBAR_LO: V = [10., -0.5, -0.6];
constBAR_HI: V = [11., 0.5, 0.6];
/// The turn's start and stop, in degrees.constFROM: f64 = -140.;
constTO: f64 = 30.;
/// The ring sector: its section in the half-plane at 0° turned 60° about z.fnsector() -> Result<Brep, String> {
let section = polygon(&[[8., 0., -1.], [12., 0., -1.], [12., 0., 1.], [8., 0., 1.]]);
revolve(§ion, [0.; 3], UP, FRAC_PI_3)
}
pubfnbuild() -> Result<Brep, String> {
let blank = sector()?;
let bar = block(BAR_LO, BAR_HI)?;
// the turn about z: a screw that does not advance, a radian a radian of the rolllet path = Trajectory::Twist(Screw { origin: [0.; 3], axis: UP, ratio: 1., advance: 0. });
// the kernel's closed swept solid cut from the sector on one arrangement: every edge of the// box turned (a line along the axis into a cylinder, one square to it into a level plane) and// its faces at both end poses (a box's flat faces mesh exactly, at any bar)let size = blank.size().max(bar.size());
cut_from(&blank, &bar, &path, [FROM.to_radians(), TO.to_radians()], size, tolerance(size))
.map_err(|why| format!("the bar's sweep not built: {why:?}"))
}
Time
658 ms; CPU time 657 ms; peak memory 369 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 small bar swung partway into a curved block. A curved block with a notch cut into it by a
small bar 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 bar is the box 10 ≤ x ≤ 11, −0.5 ≤ y ≤ 0.5, −0.6 ≤ z ≤ 0.6.
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 bar passes
through.
The notch's far wall is the cylinder of radius √(11² + 0.5²) that the bar's outer corners sweep,
its near wall the cylinder of radius 10 its inner face sweeps, and it ends in the bar's own faces
where it stops."""fromOCP.BRepPrimAPIimportBRepPrimAPI_MakeBoxfromOCP.gp import gp, gp_Pnt
from sweep import cut, flat_contacts_turned, ring_sector, turn, turned
BLOCK = (8, 12, -1, 1, 0, 60) # radii, heights and polar anglesBAR = ((10, -0.5, -0.6), (11, 0.5, 0.6))
START, STOP = -140, 30# degrees about the z axisdefbuild():
bar = turn(BRepPrimAPI_MakeBox(gp_Pnt(*BAR[0]), gp_Pnt(*BAR[1])).Shape(), gp.OZ_s(), START)
# Each flat face meets the turn square-on along the plane through the axis and its normal:# the faces x = 10 and x = 11 along their middles, y = 0; the others nowhere, or, level, not# at all.
swept = turned(bar, gp.OZ_s(), STOP - START, flat_contacts_turned(bar, gp.OZ_s()))
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
53 ms; CPU time 62 ms; peak memory 12.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 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 bar swung partway into it: the box 10 ≤ x ≤ 11,//! |y| ≤ 0.5, |z| ≤ 0.6, turned rigidly about the z axis from −140° to +30°. Everything the bar//! passes through, cut.//!//! The bar'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;
use kentron::primitives::Cuboid;
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let block = ring_sector(m)?;
let bar = Cuboid::from_corners(p(10.0, -0.5, -0.6), p(11.0, 0.5, 0.6)).build(m)?;
let turn = RigidMotion::Turn { axis: Axis::Z, from: (-140f64).to_radians(), to: 30f64.to_radians() };
let swept = sweep::solid(m, bar, &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
69 ms; CPU time 69 ms; peak memory 49.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 bar, the box 10 ≤ x ≤ 11, |y| ≤ 0.5, |z| ≤ 0.6, swung about the z axis//! from −140° to +30°.//!//! solidcraft-kernel has no sweep of a solid, so the swing is built by elementary geometry//! ([`swung_partway`]). Out from 10 to 11 the bar meets each circle about the z axis in one arc//! holding its point at 0°; out from 11 to its outer corners, √(11² + 0.5²), in two arcs, beside//! its corners, a few degrees apart: far less than the turn, so on each circle the bar passes over//! everything from its first point where it starts to its last where it stops, as does the bar//! filled out to the arc through its outer corners about the z axis. That meets each circle in one//! arc holding the point at 0°, so its section there, out from 10 to √(11² + 0.5²) at |z| ≤ 0.6,//! is the shadow, revolved through the turn; where the bar stops, its filled half ahead of the//! section is the half of the bar there (y ≥ 0) with the sliver from x = 11 out to the arc.usesuper::drum_swung_partway_into_ring_sector::swung_partway;
usecrate::solids::*;
use solidcore_record::Seg2;
pubfnbuild() -> R<Body> {
let corner = (11f64 * 11.0 + 0.25).sqrt();
let line = |a: (f64, f64), b: (f64, f64)| Seg2::Line { a: v2(a.0, a.1), b: v2(b.0, b.1) };
// the filled half in plan, from the inner face along the section out to the arc about the// z axis, round it to the leading outer corner and back along the leading facelet plan = vec![
line((10.0, 0.0), (corner, 0.0)),
Seg2::Arc { center: v2(0.0, 0.0), radius: corner, start: 0.0, sweep: 0.5f64.atan2(11.0) },
line((11.0, 0.5), (10.0, 0.5)),
line((10.0, 0.5), (10.0, 0.0)),
];
let level = Plane { origin: Vec3::ZERO, x: Vec3::X, y: Vec3::Y };
let lead = extrude(&level, Region2 { outer: Loop2 { segs: plan }, holes: vec![] }, -0.6, 0.6)?;
swung_partway(rect(10.0, -0.6, corner, 0.6), Some(lead))
}
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
632 ms; CPU time 804 ms; peak memory 28.8 MB
Notes
refused FeatureFailed at bar_swung_partway_into_ring_sector.rhai:21:7: feature 'boolean-3' (boolean) failed: result validation failed: cellular result invalid: Half-edge HalfEdgeHandle(38v1) in loop LoopHandle(9v1) ends at VertexHandle(18v1) but its successor HalfEdgeHandle(43v1) starts at VertexHandle(15v1)
// A ring sector (8 to 12 from the z axis, |z| ≤ 1, 0° to 60°) less everything a bar (10 ≤ x ≤ 11, |y| ≤ 0.5, |z| ≤ 0.6) passes through as it turns about z from -140° to 30°. Its shadow runs from its inner face, 10 from the axis, to its outer corners, √(11² + 0.5²).//// 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.box(1.0, 1.0, 1.2, #{ at: [10.0, -0.5, -0.6] }) }
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([[10.0, -0.6], [sqrt(121.25), -0.6], [sqrt(121.25), 0.6], [10.0, 0.6]]), -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 27.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 ring sector notched by a small bar swung partway into it.//!//! The kernel's sweep of a solid (`sweep_solid_within`, its planar motion of a prism, which//! includes the end positions exactly): the bar is the rectangle 10 ≤ x ≤ 11, |y| ≤ 0.5 from z =//! −0.6 to 0.6, 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.6 to 0.6 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: {
let corners = [[10.0, -0.5], [11.0, -0.5], [11.0, 0.5], [10.0, 0.5]];
(0..4).map(|k| OutlinePiece::Line { from: corners[k], to: corners[(k + 1) % 4] }).collect()
},
from: -0.6,
to: 0.6,
};
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.6, 0.6],
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
20 ms; CPU time 41 ms; peak memory 13.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.
//! A curved block (the ring sector between radii 8 and 12, heights ±1, polar angles 0° to 60°)//! notched by a bar (the box 10 ≤ x ≤ 11, |y| ≤ 0.5, |z| ≤ 0.6) turned about the z axis from//! −140° to +30°.//!//! What the bar passes through is cadrs's sweep of a solid (one turn: the bar where it starts,//! with what its leading faces sweep, its faces x = 10 and 11 split along y = 0), cut from the//! block (cadrs's cylindrical box).usecrate::bench::{block, cut, p3};
usecrate::shared::swept::{ring_sector, swung, z_axis};
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let sector = ring_sector(k, (8.0, 12.0), (-1.0, 1.0), (0.0, 60.0))?;
let bar = block(k, p3(10.0, -0.5, -0.6), p3(11.0, 0.5, 0.6))?;
let swept = swung(k, bar, z_axis(), -140.0, 30.0)?;
cut(k, sector, 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
52 ms; CPU time 52 ms; peak memory 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 the bar//! 10 ≤ x ≤ 11, |y| ≤ 0.5, |z| ≤ 0.6 passes through as it turns about the z axis from −140° to 30°.use springrep::boolean::difference;
use springrep::sweep::solid;
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{boxed, deg, sector_block, turning};
pubfnbuild() -> Result<Brep, String> {
let bar = boxed([10.0, -0.5, -0.6], [11.0, 0.5, 0.6], "bar")?;
let notch = solid(&bar, &turning(deg(-140.0), deg(30.0)), "notch").map_err(e)?;
difference(§or_block()?, ¬ch).map_err(e)
}
Time
136 ms; CPU time 251 ms; peak memory 36.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 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 small bar, the box 10 <= x <= 11, |y| <= 0.5, |z| <= 0.6, 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)
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 {
e := point
f := point hint((11, -0.5))
g := point hint((11, 0.5))
h := point hint((10, 0.5))
footprint := horizontal line(e, f) -> vertical line(f, g) ->
horizontal line(g, h) -> vertical line(h, e) -> close
fix((10, -0.5)) e
e distance(1) f
f distance(1) g
}
bar := solid(std.solids.Prism(footprint, from: -0.6mm, to: 0.6mm))
swing := frame
swing turns(1) std.z
notch := solid({ p | some t in (-140deg, 30deg): p in bar at(under: swing) t })
notch cut part
Time
14 ms; CPU time 14 ms; peak memory 5.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.
//! The ring sector 8 ≤ ρ ≤ 12, |z| ≤ 1, 0° ≤ φ ≤ 60° less what a bar (10 ≤ x ≤ 11, |y| ≤ 0.5, |z| ≤ 0.6) passes through, turned about//! the z axis from −140° to 30°.use anvil_brep::Solid;
usecrate::shared::{block, cut_all, intersect, rect, swung, turn_z};
pubfnbuild() -> Result<Solid, String> {
let sector = swung(rect((8., -1.), (12., 1.)).segments, 0., 60.)?;
let tool = block([10., -0.5, -0.6], [11., 0.5, 0.6])?;
let fan = swung(rect((10., -0.6), (121.25f64.sqrt(), 0.6)).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 its inner face, 10 out, to the circle √(11² + 0.5²) its outer corners run on, within |z| ≤ 0.6, and itself where it starts and stops// Between 11 and √(11² + 0.5²) from the axis the bar covers, on a circle about it, only the// angles between its outer face and its side, so the fan leaves out a sliver past the stop at// 30°, which the outer corners sweep: what the bar, carried on past its outer face, covers// there within the fan's reachlet longer = block([10., -0.5, -0.6], [11.5, 0.5, 0.6])?;
let beyond = swung(rect((10., -0.6), (121.25f64.sqrt(), 0.6)).segments, 0., 90.)?;
let sliver = intersect(&longer, &beyond)?.transformed(&turn_z(30.));
cut_all(
sector,
[Ok(fan), Ok(tool.transformed(&turn_z(-140.))), Ok(tool.transformed(&turn_z(30.))), Ok(sliver)],
)
}