A curved block, grooved by a cutter turned past it about the block's own axis.
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 cutter is a torus whose axis passes through (5, 0, 0), leaning from the z axis toward +y by 25°: its direction is (0, sin 25°, cos 25°). Its center is (5, 0, 0); the circle through its tube's centers has radius 2.5, and its tube has radius 2. So, as placed, its tube reaches out to x = 9.5 along the x axis, into the block's inner side, but the cutter is turned out of the block before it starts.
The cutter 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 cutter passes through.
Leaning across the turn, the cutter's axis is skew to the block's, so the groove's wall is none of the torus's own circles.
expected
closed form
volume
57.57189968
no closed form: next.BREP and cadrs agree to 1e-9; the mean of their values
area
115.8366253
no closed form: next.BREP and cadrs agree to 3e-9; the mean of their values
Drawing
TopIsometricFrontRight
Third-angle projection, the three views at one scale. Drawn from next.BREP'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
11.6 s; CPU time 14.7 s; peak memory 20.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.
Data
its STEP's
expected
rel. error
volume
57.57190544
57.57189968
1.0e-07
area
115.836633
115.8366253
6.6e-08
agrees with
no other kernel
mesh
4730 triangles, closed
centre of gravity
(8.90519, 5.14142, -5.1188e-09) its STEP's solid
inertia
about it, of unit density: Ixx 464.552; Iyy 194.206; Izz 619.688; Ixy 234.127; Iyz 5.75505e-07; Izx -5.06228e-07
//! A ring sector (radii 8 to 12 about z, z from −1 to 1, polar angle 0° to 60°) grooved by a torus//! of radii 2.5 and 2 centred at (5, 0, 0), its axis leaning 25° from z towards +y, turned rigidly//! about z from −140° to +140°.//!//! Built by the kernel's sweep of a ring cut from a blank (`swept::closed::ring_cut_from`): a torus//! is a tool of revolution whose meridian is a loop clear of its axis, so its contact under the//! turn is read meridian by meridian in closed form though its axis is skew to the turn's, and//! each contact curve sweeps a tube, fitted. The sector is split by the tubes and the torus where//! it starts and stops at once, and kept where the sweep is not: no closed solid is built and then//! subtracted.usecrate::sketch::polygon;
use cad_kernel::build::{revolve, torus};
use cad_kernel::swept::closed::ring_cut_from;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
constLEAN: f64 = 25f64.to_radians();
constTURN: f64 = 140f64.to_radians();
/// How closely the torus is meshed for the sweep's membership reads: a two-hundredth of its tube's/// radius.constBAR: f64 = 0.01;
/// The tolerance the tubes are fitted and met to: a two-hundred-thousandth of the tube's radius.constTOL: f64 = 1e-5;
pubfnbuild() -> Result<Brep, String> {
// the sector: its section in the xz plane turned 60° about zlet section = polygon(&[[8., 0., -1.], [12., 0., -1.], [12., 0., 1.], [8., 0., 1.]]);
let sector = revolve(§ion, [0., 0., 0.], [0., 0., 1.], 60f64.to_radians())?;
let cutter = torus([5., 0., 0.], [0., LEAN.sin(), LEAN.cos()], 2.5, 2.)?;
// the turn about z: a screw that does not advancelet path = Trajectory::Twist(Screw { origin: [0., 0., 0.], axis: [0., 0., 1.], ratio: 1., advance: 0. });
ring_cut_from(§or, &cutter, &path, [-TURN, TURN], BAR, TOL)
.map_err(|why| format!("the cutter's sweep not built: {why:?}"))
}
occt left no solid to show.
Time
634 ms; CPU time 634 ms; peak memory 356.5 MB
Notes
refused occt cannot sweep this turn: BRepPrimAPI_MakeRevol takes no solid, and turns the torus's face whole, which returns a solid of volume 0; the groove's wall is the envelope of the turned torus, along a characteristic curve that is none of its circles, which occt has no operation to find
"""A curved block grooved by a leaning cutter turned past it. A curved block, grooved by a cutter
turned past it about the block's own axis.
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 towards +y).
The cutter is a torus whose axis passes through (5, 0, 0), leaning from the z axis towards +y by
25°: its direction is (0, sin 25°, cos 25°). Its centre is (5, 0, 0); the circle through its
tube's centres has radius 2.5, and its tube has radius 2. So, as placed, its tube reaches out to
x = 9.5 along the x axis, into the block's inner side, but the cutter is turned out of the block
before it starts.
The cutter turns rigidly about the z axis, right-handed (from +x towards +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 cutter passes through.
Leaning across the turn, the cutter's axis is skew to the block's, so the groove's wall is none
of the torus's own circles."""from bench importRefuseddefbuild():
# OCCT turns a shape about an axis (BRepPrimAPI_MakeRevol), but no solid ("Solids are not# Processed"). It does turn the cutter's shell, sweeping each face whole, and a face swept# whole is what it passes through only if the turn never runs along it inside it. On this# torus the turn runs along it on its characteristic curve, which is none of its circles# since its axis is skew to the turn's: turned 280° unsplit, the torus's face comes back as# a solid of volume 0, bounded only by the torus where it starts and where it ends. Splitting# the face along that curve first would be computing the envelope that walls the groove,# outside the kernel.raiseRefused("occt cannot sweep this turn: BRepPrimAPI_MakeRevol takes no solid, and turns ""the torus's face whole, which returns a solid of volume 0; the groove's wall ""is the envelope of the turned torus, along a characteristic curve that is ""none of its circles, which occt has no operation to find")
arris left no solid to show.
Time
1.4 ms; CPU time 1.2 ms; peak memory 3.7 MB
Notes
refused arris has no sweep of a solid; the groove's wall is the envelope of the leaning torus turned about the z axis, whose meridian outline it cannot build
//! A sector of a ring about the z axis (radius 8 to 12, z from −1 to 1, polar angle 0° to 60°),//! grooved by a torus (radii 2.5 and 2, centred at (5, 0, 0), its axis leaning 25° from z towards//! +y) turned rigidly about the z axis from −140° to +140°.//!//! Refused: arris has no sweep of a solid. A turn about the z axis would make this a revolution://! across the block, which the cutter passes wholly through, its sweep is the region the torus//! covers in the half plane through the z axis as it turns, revolved. But the cutter's axis is//! skew to the z axis, so that region's boundary is the outline of the torus seen round the axis,//! an envelope (the curve on the torus where the turn's velocity is tangent to it, carried round),//! none of the torus's own circles. arris cannot build it; it would have to be computed outside//! the kernel and fitted.usecrate::Refusal;
use arris::topo::{Body, Model};
pubfnbuild(_: &mutModel) -> Result<Body, Refusal> {
Err("arris has no sweep of a solid; the groove's wall is the envelope of the leaning torus \
turned about the z axis, whose meridian outline it cannot build"
.into())
}
Time
22 ms; CPU time 22 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.
Data
its STEP's
expected
rel. error
volume
57.57189969
57.57189968
1.7e-10
area
115.8366251
115.8366253
1.4e-09
agrees with
next.BREP, cadrs, springrep
mesh
2044 triangles, closed
centre of gravity
(8.90519, 5.14142, 4.19297e-16) its STEP's solid
inertia
about it, of unit density: Ixx 464.552; Iyy 194.206; Izz 619.687; Ixy 234.127; Iyz 4.63519e-14; Izx -2.42826e-16
//! 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 leaning cutter turned past it: the torus centred//! at (5, 0, 0) with radii 2.5 and 2, its axis (0, sin 25°, cos 25°), turned rigidly about the z//! axis from −140° to +140°. Everything the cutter passes through, cut.//!//! kentron's cut by a motion (`sweep::cut_by_motion`) takes the cutter as the solid of revolution//! of its tube's circle and the turn as one step. The cutter starts and ends clear of the block,//! so over the block what it fills is turned into itself: the groove's section in the meridian//! half-plane (distance from the z axis, height) is the region the cutter's characteristic curve//! (where the turn runs along it, none of its circles, its axis being skew to the turn's)//! projects to along the circles about the z axis. The block's meridian rectangle less that is//! revolved through the block's 60°.usecrate::bench::p;
use kentron::math::{Axis, Direction, Frame, Point2};
use kentron::sweep::{self, Blank, MeridianPiece, Motion, MotionStep, Tool};
use kentron::topology::{Model, Shape};
use std::f64::consts::{PI, TAU};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let block = Blank::RingSector { frame: Frame::WORLD, radii: [8.0, 12.0], heights: [-1.0, 1.0], angles: [0.0, PI / 3.0] };
let lean = 25f64.to_radians();
let frame = Frame::new(p(5.0, 0.0, 0.0), Direction::new(0.0, lean.sin(), lean.cos()), Direction::X);
let cutter = Tool::Revolved { frame, meridian: vec![MeridianPiece::Arc { centre: Point2::new(2.5, 0.0), radius: 2.0, start: 0.0, end: TAU }] };
let turn = MotionStep { axis: Axis::new(p(0.0, 0.0, 0.0), Direction::Z), turn: 1.0, advance: 0.0 };
let motion = Motion { steps: vec![turn], from: (-140f64).to_radians(), to: 140f64.to_radians() };
sweep::cut_by_motion(m, &block, &cutter, &motion)
}
vcad left no solid to show.
Time
1.5 ms; CPU time 1.3 ms; peak memory 4.8 MB
Notes
refused vcad has no sweep of a solid; the groove's wall is the envelope of the leaning torus turned about the z axis, none of its own circles, and would have to be computed outside the kernel
//! A sector of a ring about the z axis (radius 8 to 12, z from −1 to 1, polar angle 0° to 60°),//! grooved by a torus (radii 2.5 and 2, centred at (5, 0, 0), its axis leaning 25° from z towards//! +y) turned rigidly about the z axis from −140° to +140°.//!//! Refused: vcad has no sweep of a solid. A turn about the z axis would make this a revolution://! across the block, which the cutter passes wholly through, its sweep is the region the torus//! covers in the half plane through the z axis as it turns, revolved. But the cutter's axis is//! skew to the z axis, so that region's boundary is the outline of the torus seen round the axis,//! an envelope (the curve on the torus where the turn's velocity is tangent to it, carried round),//! none of the torus's own circles. vcad cannot build it (`Solid::revolve` turns only a sketch of//! lines); it would have to be computed outside the kernel.use vcad_kernel::Solid;
pubfnbuild() -> Result<Solid, crate::Refusal> {
Err("vcad has no sweep of a solid; the groove's wall is the envelope of the leaning torus \
turned about the z axis, none of its own circles, and would have to be computed outside \
the kernel"
.into())
}
solidcraft left no solid to show.
Time
1.7 ms; CPU time 1.5 ms; peak memory 4.6 MB
Notes
refused no layer (solidcraft-kernel, solidcore-ops, solidcore) has a sweep of a solid or an envelope: turned about the z axis, the leaning torus sweeps the revolve of its shadow through the axis, whose edge is an envelope and none of the torus's circles
//! Refused. The groove is what a torus, its axis leaning skew to the block's, passes through as it//! turns about the z axis. Turned about an axis, a solid sweeps the revolve of its shadow in the//! half-plane through the axis, but the leaning torus's shadow there is bounded by the envelope//! of its meridian curves, none of the torus's own circles. solidcraft-kernel has no sweep of a//! solid and no envelope, and that shadow computed here would be geometry made outside the kernel.usecrate::Refusal;
usecrate::solids::Body;
pubfnbuild() -> Result<Body, Refusal> {
Err("no layer (solidcraft-kernel, solidcore-ops, solidcore) has a sweep of a solid or an envelope: turned about the z axis, the \
leaning torus sweeps the revolve of its shadow through the axis, whose edge is an \
envelope and none of the torus's circles"
.into())
}
brepkit left no solid to show.
Time
1.1 ms; CPU time 910 µs; peak memory 3.6 MB
Notes
refused brepkit has no sweep of a solid (revolve turns a face), and the leaning torus turned about the z axis is bounded by its envelope, which brepkit cannot compute
//! A curved block grooved by a leaning torus turned past it about the z axis. brepkit has no//! sweep of a solid: revolve turns a face, not a solid. Since the torus's axis is skew to the//! turn's, the groove's wall is the envelope of the torus over the turn, none of its own circles,//! which brepkit has no operation to compute.use brepkit_topology::solid::SolidId;
use brepkit_topology::Topology;
usecrate::Refusal;
pubfnbuild(_topo: &mutTopology) -> Result<SolidId, Refusal> {
Err(
"brepkit has no sweep of a solid (revolve turns a face), and the leaning torus turned \
about the z axis is bounded by its envelope, which brepkit cannot compute"
.into(),
)
}
popkern left no solid to show.
Time
3.8 ms; CPU time 3.6 ms; peak memory 11.7 MB
Notes
refused popkern has no sweep of a solid, and this sweep's wall is an envelope: the cutter's axis is skew to the turn's, so the groove's wall is the torus's envelope, none of its own circles
// A curved block grooved by a leaning torus turned past it about the block's axis.//// Refused: popkern has no sweep of a solid (its sweeps carry a profile along a path), and this// one's shape does not follow from its other operations by elementary geometry: the cutter's axis// is skew to the turn's, so the groove's wall is the torus's envelope, none of its own circles. A// wall the script would compute itself, fitting curves to where the tool touches its own sweep, is// geometry made outside the kernel.throw"popkern has no sweep of a solid, and this sweep's wall is an envelope: the cutter's axis \
is skew to the turn's, so the groove's wall is the torus's envelope, none of its own \
circles";
aetheris left no solid to show.
Time
55 ms; CPU time 54 ms; peak memory 47.1 MB
Notes
refused Aetheris has no sweep of a solid and no general subtraction, and this sweep's wall is an envelope: the cutter's axis is skew to the turn's, so the groove's wall is none of the torus's own circles.
// A curved block grooved by a leaning torus turned past it about the block's axis.//// Refused: Aetheris has no sweep of a solid and no general subtraction, and this sweep's wall is// an envelope: the cutter's axis is skew to the turn's, so the groove's wall is none of the// torus's own circles.
Time
107 ms; CPU time 107 ms; peak memory 18.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.
Data
its STEP's
expected
rel. error
volume
57.57189969
57.57189968
3.1e-10
area
115.8366252
115.8366253
1.1e-09
agrees with
kentron, cadrs, springrep
mesh
3638 triangles, closed
centre of gravity
(8.90519, 5.14142, -5.00616e-15) its STEP's solid
inertia
about it, of unit density: Ixx 464.552; Iyy 194.206; Izz 619.687; Ixy 234.127; Iyz -2.85317e-13; Izx -6.07637e-13
//! A curved block grooved by a leaning torus cutter turned past it about the block's own axis.//!//! The kernel's sweep of a solid (`sweep_solid_within`): the cutter is a solid of revolution (its//! meridian the tube's circle, radius 2 at 2.5 from its axis), turned about the z axis from −140°//! to +140°. Asked for between 7.5 and 12.5 from the z axis, from z = −1.5 to 1.5 and from −10°//! to 70°, which holds the block and which neither end position reaches; cut from the block.usecrate::solids::p;
usecrate::Refusal;
use brep_kernel::{
boolean_operation_nary, make_line, revolve_profile_brep, sweep_solid_within, BooleanOperation,
BrepSolid, OutlinePiece, ScrewStep, SolidMotion, SweepClip, SweptTool,
};
use std::f64::consts::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)];
letmut outline = Vec::new();
for k in0..4 {
outline.push(make_line(section[k], section[(k + 1) % 4])?);
}
let block = revolve_profile_brep(&outline, p(0.0, 0.0, 0.0), z, 60.0f64.to_radians())?;
let lean = 25.0f64.to_radians();
let cutter = SweptTool::Revolved {
axis_origin: p(5.0, 0.0, 0.0),
axis_direction: p(0.0, lean.sin(), lean.cos()),
radial: p(1.0, 0.0, 0.0),
meridian: vec![OutlinePiece::Arc { centre: [2.5, 0.0], radius: 2.0, start: 0.0, end: TAU }],
};
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: (-140.0f64).to_radians(),
to: 140.0f64.to_radians(),
};
let around_block = 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: [-1.5, 1.5],
angle: Some([(-10.0f64).to_radians(), 70.0f64.to_radians()]),
};
letmut operands = vec![block];
operands.extend(sweep_solid_within(&cutter, &turn, &around_block)?);
Ok(boolean_operation_nary(&operands, BooleanOperation::Subtract)?)
}
geop left no solid to show.
Time
2.1 ms; CPU time 1.9 ms; peak memory 9.7 MB
Notes
refused geop has no sweep of a solid: what a torus turned about an axis skew to its own passes through is bounded by the envelope of its surface, which geop cannot build
//! A curved block grooved by a torus turned past it about the z axis, its axis skew to the turn.//!//! geop sweeps a profile along a path; it has no sweep of a solid, and what the torus passes//! through is bounded by the envelope of its surface as it turns — none of its own circles, since//! its axis is skew to the turn's — which would have to be computed here, outside geop.usecrate::{Bench, Refusal};
pubfnbuild(_: &mutBench) -> Result<(), Refusal> {
Err("geop has no sweep of a solid: what a torus turned about an axis skew to its own passes \
through is bounded by the envelope of its surface, which geop cannot build"
.into())
}
Time
39 ms; CPU time 72 ms; peak memory 12.2 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.
Data
its STEP's
expected
rel. error
volume
57.57189969
57.57189968
3.0e-10
area
115.8366252
115.8366253
1.2e-09
agrees with
kentron, next.BREP, springrep
mesh
2074 triangles, closed
centre of gravity
(8.90519, 5.14142, -9.01731e-12) its STEP's solid
inertia
about it, of unit density: Ixx 464.552; Iyy 194.206; Izz 619.687; Ixy 234.127; Iyz 1.14044e-10; Izx -2.45675e-09
//! A sector of a ring about the z axis (radii 8 to 12, z from −1 to 1, polar angle 0° to 60°),//! grooved by a torus (center (5, 0, 0), radii 2.5 and 2, its axis leaning 25° from z toward +y)//! turned rigidly about the z axis from −140° to +140°.//!//! The block is its section (r from 8 to 12, z from −1 to 1) revolved 60° about z; the torus is//! cadrs's torus primitive, its turn cadrs's sweep of a solid over part of a turn//! (`Kernel::cut_swept`, a rigid turn about the z axis from −140° to +140°), cut from the block.usecrate::bench::{p3, revolve, torus, v3};
usecrate::shared::swept::{cut_swept, swing, z_axis};
usecrate::Refusal;
use cadrs_kernel::{Axis, BodyId, DefaultKernel, Loop, Plane, Profile};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let z = Axis::new(p3(0.0, 0.0, 0.0), v3(0.0, 0.0, 1.0));
let ring = Profile::of(Plane::xz(0.0), vec![Loop::rectangle(8.0, -1.0, 12.0, 1.0)]);
let block = revolve(k, &ring, z, Some(60.0))?;
let (s, c) = 25f64.to_radians().sin_cos();
let cutter = torus(k, p3(5.0, 0.0, 0.0), v3(0.0, s, c), 2.5, 2.0)?;
cut_swept(k, block, cutter, &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
340 ms; CPU time 340 ms; peak memory 11.3 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no sweep of a whole tool: the tool is cut to the block's reach before the sweep
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
57.57189971
57.57189968
5.2e-10
area
115.8366252
115.8366253
1.3e-09
agrees with
kentron, next.BREP, cadrs
mesh
4076 triangles, closed
centre of gravity
(8.90519, 5.14142, -7.1721e-13) its STEP's solid
inertia
about it, of unit density: Ixx 464.552; Iyy 194.206; Izz 619.687; Ixy 234.127; Iyz 7.09208e-11; Izx 8.90427e-11
//! The ring sector (radii 8 to 12, heights −1 to 1, angles 0° to 60°) less everything a torus//! (radii 2.5 and 2 about (5, 0, 0), its axis leaning 25° toward +y) passes through as it turns//! about the z axis from −140° to 140°.use springrep::boolean::difference;
use springrep::math::{Frame, Vec3};
use springrep::primitive::{cylinder, torus};
use springrep::sweep::solid;
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{deg, sector_block, turning, v3};
pubfnbuild() -> Result<Brep, String> {
let lean = deg(25.0);
let axis =
Frame::new(v3(5.0, 0.0, 0.0), v3(0.0, lean.sin(), lean.cos()), Vec3::X).map_err(e)?;
let cutter = torus(&axis, 2.5, 2.0, "cutter").map_err(e)?;
// No sweep of the whole tool: a turn keeps each point's distance from its axis, so only the// cutter beyond the block's inner radius, 8, reaches the block, and only that part is swept.let core = cylinder(&crate::shared::at([0.0, 0.0, -10.0]), 7.9, 20.0, "core").map_err(e)?;
let reach = difference(&cutter, &core).map_err(e)?;
let swept = solid(&reach, &turning(deg(-140.0), deg(140.0)), "turn").map_err(e)?;
difference(§or_block()?, &swept).map_err(e)
}
Time
224 ms; CPU time 276 ms; peak memory 32.5 MB
Notes
wrong volume 57.5721404475 against 57.5718996751 (its STEP's); area 115.836929578 against 115.83662531 (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
57.57214045
57.57189968
4.2e-06
area
115.8369296
115.8366253
2.6e-06
agrees with
no other kernel
mesh
2300 triangles, closed
centre of gravity
(8.90519, 5.14141, 5.68879e-17) its STEP's solid
inertia
about it, of unit density: Ixx 464.554; Iyy 194.207; Izz 619.69; Ixy 234.128; Iyz -1.16611e-11; Izx 3.11949e-15
// A curved block grooved by a leaning torus turned past it. The block is the ring 8 to 12 from// the z axis, |z| <= 1, its section in the front plane turned 60 degrees about z from +x toward// +y. The cutter is a torus about the axis through (5, 0, 0) leaning from z toward +y by 25// degrees, its tube (radius 2) 2.5 from that axis: the tube's circle drawn in the plane through// the axis and x, and turned about the axis. It turns right-handed about z from -140 to 140// degrees, and the kernel's sweep of it is cut from the block.unit mm
use std
use std.solids (cut)
use std.place (coords, on_u)
use std.motion (turns)
lean := 25deg// how far the cutter's axis leans from upright, toward +y// the cutter, drawn in the plane through its axis and xprivate across := axis
fix(dir == (1, 0, 0)) across
private along := axis
fix(dir == (0, sin(lean), cos(lean))) along
holder := plane(u: across, v: along)
fix(origin == (5, 0, 0)) holder
in holder {
private ta := point
private tb := point
ta coords(du: 0mm, dv: -1mm) holder
tb coords(du: 0mm, dv: 1mm) holder
private cutter_axis := line(ta, tb)
private tc := point
tc on_u(d: 2.5mm) holder
private tip := circle(center: tc) hint(r: 2)
radius(2mm) tip
}
construction cutter := solid(std.solids.Revolution(face(tip), about: cutter_axis))
// the block: the ring's section in the front plane, turned a sixth of a turn about zin std.front {
construction centerline ax := line(std.origin, hint((0, 1)))
fix((0, 1)) ax.p2
private q0 := point
private q1 := point hint((12, -1))
private q2 := point hint((12, 1))
private q3 := point hint((8, 1))
q0 coords(du: 8mm, dv: -1mm) std.front
q0 distance(4mm) q1
q1 distance(2mm) q2
horizontal (underside := line(q0, q1)) -> vertical (wall_out := line(q1, q2)) ->
horizontal (topside := line(q2, q3)) -> vertical (wall_in := line(q3, q0)) -> close
}
part := solid(std.solids.Revolution(face(wall_in, underside, wall_out, topside), about: ax, to: 60deg))
swing := frame
swing turns(1) ax
construction groove := solid({ p | some t in (-140deg, 140deg): p in cutter at(under: swing) t })
groove cut part
anvilcad left no solid to show.
Time
1.3 ms; CPU time 1.1 ms; peak memory 3.7 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 curved block grooved by a leaning cutter turned past it.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())
}