A curved block grooved by a bar drafted both ways from the plane its section is drawn in, as a tool forged or cast from a parting line is, turned past the block.
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 drawn in the plane through the origin spanned by u = (1, 0, 0) and v = (0, cos 20°, −sin 20°), leaning 20° across the turn; its normal is n = (0, sin 20°, cos 20°). The bar is every point a u + b v + h n with |h| ≤ 4, 10 + |h| tan 2° ≤ a ≤ 13 − |h| tan 2° and |b| ≤ 2 − |h| tan 2°: the rectangle 10 ≤ a ≤ 13, |b| ≤ 2 in that plane, its four sides drafted 2° inward both ways from it. Each side folds at the plane in a convex crease.
It turns rigidly about the z axis, right-handed (from +x toward +y), from −140° to +140°: it starts clear of the block, passes through it, and ends clear of it. Cut from the block everything the bar passes through.
expected
closed form
volume
38.02835464
no closed form: OCCT and cadrs agree to 2e-10; the mean of their values
area
84.17825374
no closed form: OCCT and cadrs agree to 2e-10; the mean of their values
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.78 s; CPU time 8.89 s; peak memory 109.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°) grooved by a bar//! turned about z, right-handed, from −140° to +140°: the rectangle 10 ≤ a ≤ 13, |b| ≤ 2 at//! a u + b v, u = (1, 0, 0), v = (0, cos 20°, −sin 20°), carried 4 each way along its normal//! n = (0, sin 20°, cos 20°), its four sides drafted 2° inward both ways from that plane.//!//! Built by the kernel's closed sweep cut from the sector (`swept::closed::cut_from`), whose//! arrangement meets the bar's edges with its turned candidates, surfaces of revolution.usecrate::sketch::polygon;
use cad_kernel::build::{drafted, 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 cad_kernel::util::space::{add, scale};
use std::f64::consts::FRAC_PI_3;
constUP: V = [0., 0., 1.];
/// How far the section's plane leans across the turn, in degrees.constLEAN: f64 = 20.;
constA: [f64; 2] = [10., 13.];
constHALF_B: f64 = 2.;
/// How far the bar runs either way from its section's plane, and its sides' draft, in degrees.constREACH: f64 = 4.;
constDRAFT: f64 = 2.;
/// How far the turn carries the bar each way from where it is drawn, in degrees.constTURN: f64 = 140.;
/// 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 (s, c) = LEAN.to_radians().sin_cos();
let (u, v) = ([1., 0., 0.], [0., c, -s]);
// the section, walked counter-clockwise in (a, b), so that its normal is u × v = nlet at = |a: f64, b: f64| add(scale(u, a), scale(v, b));
let section = polygon(&[at(A[0], -HALF_B), at(A[1], -HALF_B), at(A[1], HALF_B),
at(A[0], HALF_B)]);
// the kernel's drafted prism: each side tapered into the material away from the section's// plane, either way, the two halves glued at the parting plane in a convex creaselet bar = drafted(§ion, -REACH, REACH, DRAFT.to_radians())?;
// 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 (a polyhedron's flat// faces mesh exactly, at any bar)let size = blank.size().max(bar.size());
let turn = TURN.to_radians();
cut_from(&blank, &bar, &path, [-turn, turn], size, tolerance(size))
.map_err(|why| format!("the bar's sweep not built: {why:?}"))
}
Time
1.47 s; CPU time 1.47 s; peak memory 377.9 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 groove cut by a bar drafted both ways from a parting line. A curved block grooved by a bar
drafted both ways from the plane its section is drawn in, as a tool forged or cast from a parting
line is, turned past the block.
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 drawn in the plane through the origin spanned by u = (1, 0, 0) and v = (0, cos 20°, −sin
20°), leaning 20° across the turn; its normal is n = (0, sin 20°, cos 20°). The bar is every point
a u + b v + h n with |h| ≤ 4, 10 + |h| tan 2° ≤ a ≤ 13 − |h| tan 2° and |b| ≤ 2 − |h| tan 2°: the
rectangle 10 ≤ a ≤ 13, |b| ≤ 2 in that plane, its four sides drafted 2° inward both ways from it.
Each side folds at the plane in a convex crease.
It turns rigidly about the z axis, right-handed (from +x toward +y), from −140° to +140°: it starts
clear of the block, passes through it, and ends clear of it. Cut from the block everything the bar
passes through."""import math
fromOCP.BRepBuilderAPIimport (BRepBuilderAPI_MakeFace, BRepBuilderAPI_MakePolygon,
BRepBuilderAPI_MakeSolid, BRepBuilderAPI_Sewing)
fromOCP.BRepLibimportBRepLibfromOCP.TopAbsimportTopAbs_SHELLfromOCP.TopoDSimportTopoDSfromOCP.gp import gp, gp_Pnt
from bench importRefusedfrom sweep import cut, flat_contacts_turned, found, ring_sector, turn, turned
BLOCK = (8, 12, -1, 1, 0, 60) # radii, heights and polar anglesTILT = math.radians(20)
DRAFT = math.tan(math.radians(2))
INNER, OUTER, HALF_WIDTH = 10, 13, 2# the rectangle in the parting plane, in (a, b)HALF_HEIGHT = 4# |h|START, STOP = -140, 140# degrees about the z axisdefpoint(a, b, h):
u, v, n = (1, 0, 0), (0, math.cos(TILT), -math.sin(TILT)), (0, math.sin(TILT), math.cos(TILT))
returngp_Pnt(*(a * x + b * y + h * z for x, y, z inzip(u, v, n)))
defbar():
"""The bar's ten flat faces sewn into a solid: its rectangle in the parting plane shrunk by
|h| tan 2° on every side at h = ±4, its ends there, and the four sides between, each folded
at the parting plane."""defcorners(h):
shrink = abs(h) * DRAFTreturn [point(a, b, h) for a, b in ((INNER + shrink, -HALF_WIDTH + shrink),
(OUTER - shrink, -HALF_WIDTH + shrink),
(OUTER - shrink, HALF_WIDTH - shrink),
(INNER + shrink, HALF_WIDTH - shrink))]
low, middle, high = corners(-HALF_HEIGHT), corners(0), corners(HALF_HEIGHT)
loops = [low, high]
for i inrange(4):
j = (i + 1) % 4
loops += [[low[i], low[j], middle[j], middle[i]], [middle[i], middle[j], high[j], high[i]]]
sewing = BRepBuilderAPI_Sewing(1e-7)
for loop in loops:
sewing.Add(BRepBuilderAPI_MakeFace(BRepBuilderAPI_MakePolygon(*loop, True).Wire()).Face())
sewing.Perform()
solid = BRepBuilderAPI_MakeSolid(TopoDS.Shell(found(sewing.SewedShape(), TopAbs_SHELL)[0]))
ifnot solid.IsDone():
raiseRefused("BRepBuilderAPI_MakeSolid declined the bar's sewn faces")
solid = solid.Solid()
BRepLib.OrientClosedSolid_s(solid)
return solid
defbuild():
tool = turn(bar(), gp.OZ_s(), START)
# Each flat face meets the turn square-on along the plane through the axis and its normal,# which cuts it along its contact where it reaches it.
swept = turned(tool, gp.OZ_s(), STOP - START, flat_contacts_turned(tool, 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
254 ms; CPU time 416 ms; peak memory 28.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°, grooved by a bar drafted both ways from a parting plane, turned//! past it: with u = (1, 0, 0), v = (0, cos 20°, −sin 20°) and n = (0, sin 20°, cos 20°), every//! a u + b v + h n with |h| ≤ 4, 10 + |h| tan 2° ≤ a ≤ 13 − |h| tan 2° and |b| ≤ 2 − |h| tan 2°,//! turned rigidly about the z axis from −140° to +140°. Everything the bar passes through, cut.//!//! The bar is the parting rectangle extruded 4 each way along ±n with its sides drafted in 2°//! (`sweep::extrude_drafted`), the two halves joined; its sweep is kentron's sweep of a solid//! (`sweep::solid`, one turn), cut from the block.usecrate::bench::v;
usecrate::shared::loft::flat;
usecrate::shared::swept::ring_sector;
use kentron::math::{Axis, Point};
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let block = ring_sector(m)?;
let (s20, c20) = 20f64.to_radians().sin_cos();
let (u, w, n) = (v(1.0, 0.0, 0.0), v(0.0, c20, -s20), v(0.0, s20, c20));
let at = |a: f64, b: f64| -> Point { Point::ORIGIN + u * a + w * b };
let parting = [at(10.0, -2.0), at(13.0, -2.0), at(13.0, 2.0), at(10.0, 2.0)];
let draft = 2f64.to_radians();
letmut halves = Vec::new();
for side in [1.0, -1.0] {
let face = flat(m, &parting)?;
halves.push(sweep::extrude_drafted(m, face, n * (4.0 * side), draft)?);
}
let bar = kentron::boolean::union(m, halves[0], halves[1])?;
let turn = RigidMotion::Turn { axis: Axis::Z, from: (-140f64).to_radians(), to: 140f64.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
952 ms; CPU time 952 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°, grooved by a bar drafted both ways from a parting plane, turned about the z axis//! from −140° to +140°. With u = (1, 0, 0), v = (0, cos 20°, −sin 20°) and n = (0, sin 20°,//! cos 20°), the bar is every a u + b v + h n with |h| ≤ 4, 10 + |h| tan 2° ≤ a ≤ 13 − |h| tan 2°//! and |b| ≤ 2 − |h| tan 2°.//!//! solidcore-ops has no sweep of a solid, so the turn is built by elementary geometry, from the//! kernel's revolves of flat faces about the z axis ([`leading_faces_turned`]). The bar is convex//! (its sides fold outward at the parting plane): its ends at h = ±4 and its four sides, each two//! flat pieces meeting at h = 0. It starts clear of the block, so what it takes from it is what its//! leading faces sweep.usesuper::bar_end_turned_into_a_floor::{leading_faces_turned, ring_sector};
usecrate::bench::{cut_all, rotated};
usecrate::Refusal;
use solidcore_ops::Body;
pubfnbuild() -> Result<Body, Refusal> {
let (s20, c20) = 20f64.to_radians().sin_cos();
let draft = 2f64.to_radians().tan();
let (u, v, n) = ([1.0, 0.0, 0.0], [0.0, c20, -s20], [0.0, s20, c20]);
let point = |a: f64, b: f64, h: f64| -> [f64; 3] {
letmut p = [0.0; 3];
for i in0..3 {
p[i] = a * u[i] + b * v[i] + h * n[i];
}
p
};
// the rectangle 10 ≤ a ≤ 13, |b| ≤ 2 shrunk by |h| tan 2° on every side, at h = −4, 0 and 4letmut corners = Vec::new();
for h in [-4.0f64, 0.0, 4.0] {
let k = h.abs() * draft;
for (a, b) in [(10.0 + k, -2.0 + k), (13.0 - k, -2.0 + k), (13.0 - k, 2.0 - k), (10.0 + k, 2.0 - k)] {
corners.push(point(a, b, h));
}
}
letmut faces = vec![vec![0, 1, 2, 3], vec![8, 9, 10, 11]];
for i in0..4 {
let j = (i + 1) % 4;
faces.push(vec![i, j, j + 4, i + 4]);
faces.push(vec![i + 4, j + 4, j + 8, i + 8]);
}
let swept = leading_faces_turned(&corners, &faces, 280.0)?
.into_iter()
.map(|b| rotated(b, [0.0; 3], [0.0, 0.0, 1.0], -140.0))
.collect::<Result<Vec<_>, _>>()?;
cut_all(ring_sector()?, 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.
popkern left no solid to show.
Time
4 ms; CPU time 3.7 ms; peak memory 11.7 MB
Notes
refused popkern has no sweep of a solid, and this motion's envelope is not one its extrudes, revolves and booleans make exactly
// A groove cut by a bar drafted both ways from a parting line.//// Refused: popkern has no sweep of a solid (its sweeps carry a profile along a path), and the// envelope this motion leaves is not one its extrudes, revolves and booleans make exactly: the// tool is not symmetric about the planes of its motion, or the motion is a screw or a curve.throw"popkern has no sweep of a solid, and this motion's envelope is not one its extrudes, revolves and booleans make exactly";
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
40 ms; CPU time 39 ms; peak memory 19.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 ring sector grooved by a bar drafted both ways from its parting plane, turned past it.//!//! Through the kernel's sweep of a solid within a region (`sweep_solid_clipped`, asked for 7.5 to//! 12.5 from the z axis, z from −1.5 to 1.5, angles −10° to 70°, which holds the block): the bar as a convex polyhedron,//! every point a u + b v + h n with |h| ≤ 4, 10 + |h| tan 2° ≤ a ≤ 13 − |h| tan 2° and//! |b| ≤ 2 − |h| tan 2°, u = (1, 0, 0), v = (0, cos 20°, −sin 20°), n = (0, sin 20°, cos 20°): its//! twelve corners (four on the crease, four at each end) and ten faces; turned about the z axis from//! −140° to +140°; cut from the block (the rectangle 8 ≤ x ≤ 12, |z| ≤ 1 revolved from 0° to 60°).usecrate::solids::p;
usecrate::Refusal;
use brep_kernel::{
boolean_operation_nary, revolve_profile_brep, sweep_solid_clipped, BooleanOperation, BrepSolid, ScrewStep,
SolidMotion, SolidTool, SweepClip,
};
pubfnbuild() -> Result<BrepSolid, Refusal> {
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(&crate::solids::polygon(§ion)?, p(0.0, 0.0, 0.0), p(0.0, 0.0, 1.0), 60f64.to_radians())?;
let lean = 20f64.to_radians();
let u = p(1.0, 0.0, 0.0);
let v = p(0.0, lean.cos(), -lean.sin());
let n = p(0.0, lean.sin(), lean.cos());
let draft = 2f64.to_radians().tan();
let at = |a: f64, b: f64, h: f64| u.scale(a).add(v.scale(b)).add(n.scale(h));
// corners: 4k + j, k = 0 crease, 1 top (h = 4), 2 bottom (h = −4); j round the rectangleletmut vertices = Vec::new();
for h in [0.0f64, 4.0, -4.0] {
let d = h.abs() * draft;
for (a, b) in [(10.0 + d, -(2.0 - d)), (13.0 - d, -(2.0 - d)), (13.0 - d, 2.0 - d), (10.0 + d, 2.0 - d)] {
vertices.push(at(a, b, h));
}
}
letmut faces = vec![vec![4, 5, 6, 7], vec![8, 9, 10, 11]];
for j in0..4 {
let k = (j + 1) % 4;
faces.push(vec![j, k, 4 + k, 4 + j]);
faces.push(vec![j, k, 8 + k, 8 + j]);
}
let motion = SolidMotion {
steps: vec![ScrewStep { axis_origin: p(0.0, 0.0, 0.0), axis_direction: p(0.0, 0.0, 1.0), turn: 1.0, advance: 0.0 }],
from: (-140f64).to_radians(),
to: 140f64.to_radians(),
};
let around_block = SweepClip {
axis_origin: p(0.0, 0.0, 0.0),
axis_direction: p(0.0, 0.0, 1.0),
reference: p(1.0, 0.0, 0.0),
radius: [7.5, 12.5],
axial: [-1.5, 1.5],
angle: Some([(-10f64).to_radians(), 70f64.to_radians()]),
};
let swept = sweep_solid_clipped(&SolidTool::Polyhedron { vertices, faces }, &motion, &around_block)?;
Ok(boolean_operation_nary(&[block, swept], 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
14 ms; CPU time 24 ms; peak memory 11.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°)//! grooved by a bar drafted 2° both ways from the plane of its section, turned about the z axis//! from −140° to +140°.//!//! The bar's section is the rectangle 10 ≤ a ≤ 13, |b| ≤ 2 in the plane through the origin//! spanned by u = (1, 0, 0) and v = (0, cos 20°, −sin 20°); each half of it is cadrs's solid Loft//! from that rectangle to the one 4 along ±n (n = u × v) whose sides are drawn in by 4 tan 2°, and//! the bar is the two united. What it passes through is cut from the block by cadrs's cut of a//! swept solid (one turn: the block less the bar where it starts and less each of its leading//! faces' sweeps).usecrate::bench::{p3, union, v3};
usecrate::shared::loft::loft;
usecrate::shared::swept::{cut_swept, ring_sector, swing, z_axis};
usecrate::Refusal;
use cadrs_kernel::{BodyId, 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 t = 20f64.to_radians();
let (u, n) = (v3(1.0, 0.0, 0.0), v3(0.0, t.sin(), t.cos()));
// (The sketch's y axis, n × u, is v.)let at = |h: f64| Plane::new(p3(0.0, 0.0, 0.0) + n * h, u, n);
let d = 4.0 * 2f64.to_radians().tan();
let section = |h: f64, d: f64| Profile::of(at(h), vec![Loop::rectangle(10.0 + d, -2.0 + d, 13.0 - d, 2.0 - d)]);
let up = loft(k, vec![section(0.0, 0.0), section(4.0, d)])?;
let down = loft(k, vec![section(-4.0, d), section(0.0, 0.0)])?;
let bar = union(k, up, down)?;
cut_swept(k, block, bar, &swing(z_axis(), -140.0, 140.0))
}
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
1.06 s; CPU time 1.06 s; peak memory 11.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 bar//! drafted 2° both ways from a plane leaning 20° across the turn passes through as it turns//! about the z axis from −140° to 140°.use springrep::boolean::{difference, intersection};
use springrep::math::{Frame, Vec3};
use springrep::primitive::block;
use springrep::sweep::solid;
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{deg, sector_block, turning, v3};
/// The points `x` with `(x − p)·m ≥ 0`, within 50 of `p`.fnhalf_space(p: Vec3, m: Vec3) -> Result<Brep, String> {
let m = m.unit().ok_or("no normal")?;
let x = m.cross(Vec3::X).unit().ok_or("a normal along x")?;
let corner = Frame::new(p - (x + m.cross(x)) * 50.0, m, x).map_err(e)?;
block(&corner, v3(100.0, 100.0, 50.0), "draft").map_err(e)
}
pubfnbuild() -> Result<Brep, String> {
let (s, c) = deg(20.0).sin_cos();
let (u, v, n) = (Vec3::X, v3(0.0, c, -s), v3(0.0, s, c));
let t = deg(2.0).tan();
let corner = Frame::new(u * 10.0 - v * 2.0 - n * 4.0, n, u).map_err(e)?;
letmut bar = block(&corner, v3(3.0, 4.0, 8.0), "bar").map_err(e)?;
// each side leans in by 2° from the plane through the bar's middle both ways: two half-spacesfor side in [1.0, -1.0] {
for (p, m) in [(u * 10.0, u), (u * 13.0, -u), (v * 2.0, -v), (v * -2.0, v)] {
bar = intersection(&bar, &half_space(p, m - n * (side * t))?).map_err(e)?;
}
}
let swept = solid(&bar, &turning(deg(-140.0), deg(140.0)), "turn").map_err(e)?;
difference(§or_block()?, &swept).map_err(e)
}
Time
393 ms; CPU time 690 ms; peak memory 56.2 MB
Notes
wrong volume 38.0288789692 against 38.028354638 (its STEP's)
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.
Data
its STEP's
expected
rel. error
volume
38.02887897
38.02835464
1.4e-05
area
84.17817219
84.17825374
9.7e-07
agrees with
no other kernel
mesh
9226 triangles, closed
centre of gravity
(7.48055, 4.3189, -8.86446e-15) its STEP's solid
inertia
about it, of unit density: Ixx 219.613; Iyy 92.8349; Izz 286.981; Ixy 109.793; Iyz -3.13521e-09; Izx 2.79371e-13
// 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.// The bar is drawn in the plane through the origin whose u is x and whose v = (0, cos 20, -sin 20)// (y turned -20 degrees about x), leaning 20 degrees across the turn: its section the rectangle// 10 <= u <= 13, |v| <= 2 there, carried 4 either way along the plane's normal and drafted 2// degrees inward both ways from the plane, a convex crease along it. It is turned rigidly about the// z axis from -140 to +140 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))
along := axis hint(dir: (0, 0.94, -0.34))
along perpendicular std.x
std.y angle(-20deg, about: std.x) along
across := axis hint(dir: (1, 0, 0))
across parallel(sense: same) std.x
holder := plane(u: across, v: along)
fix(origin == (0, 0, 0)) holder
in holder {
b0 := point
b1 := point hint((13, -2))
b2 := point hint((13, 2))
b3 := point hint((10, 2))
section := horizontal line(b0, b1) -> vertical line(b1, b2) ->
horizontal line(b2, b3) -> vertical line(b3, b0) -> close
fix((10, -2)) b0
b0 distance(3) b1
b1 distance(4) b2
}
bar := solid(std.solids.Drafted(section, from: -4mm, to: 4mm, draft: 2deg))
swing := frame
swing turns(1) std.z
groove := solid({ p | some t in (-140deg, 140deg): p in bar at(under: swing) t })
groove cut part
anvilcad left no solid to show.
Time
1.4 ms; CPU time 1.2 ms; peak memory 3.5 MB
Notes
refused anvil-brep has no sweep of a solid, and what this motion sweeps is bounded by envelopes of the body's surfaces under it (a rim or a face leaning to the motion) that follow from no elementary construction, which it would have to compute itself
//! A groove cut by a bar drafted both ways from a parting line.use anvil_brep::Solid;
pubfnbuild() -> Result<Solid, String> {
Err("anvil-brep has no sweep of a solid, and what this motion sweeps is bounded by envelopes of the body's surfaces under it (a rim or a face leaning to the motion) that follow from no elementary construction, which it would have to compute itself".into())
}