A gear blank with one tooth space cut by a rack tooth rolled around it, as a gear is generated: module 2, 20 teeth, 20° pressure angle.
The blank is a disk of radius 22 about the y axis, from y = 0 to y = 6. Its pitch circle, in the plane y = 0, has radius 20.
The rack's tooth is a prism whose section, in the plane y = 0, is the trapezoid symmetric about the x axis with corners (18, ±0.842856) and (24, ±3.026666) in (x, z): its tip is 2 inside the pitch circle, it is π wide where it crosses x = 20, and its flanks lean 20° from the x axis. The prism runs from y = −2 to y = 8, through the blank with room to spare.
The rack moves so that its pitch line, the line x = 20 in the plane y = 0, rolls without slipping on the blank's pitch circle, the tooth carried with it; as placed, the line touches the circle at (20, 0, 0), the middle of the tooth. Seen from the blank, the rack rolls from 60° on one side of that place to 60° on the other. Cut from the blank everything the tooth passes through.
Equivalently, as a machine does it: the blank turns about the y axis while the rack slides along the pitch line, 2π·20 for every turn of the blank, over a third of a turn.
The space's flanks are involutes of the base circle (radius 20·cos 20°), and its root is the curve the tooth's tip corners trace.
expected
closed form
volume
9042.502789
no closed form: next.BREP and cadrs agree to 8e-11; the mean of their values
area
3872.683532
no closed form: next.BREP and cadrs agree to 1e-10; 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
87 ms; CPU time 188 ms; peak memory 15.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.
Data
its STEP's
expected
rel. error
volume
9042.502789
9042.502789
3.8e-11
area
3872.683532
3872.683532
5.4e-11
agrees with
kentron, next.BREP, cadrs, springrep
mesh
28850 triangles, closed
centre of gravity
(-0.181295, 3, -1.27913e-13) its STEP's solid
inertia
about it, of unit density: Ixx 1.13093e+06; Iyy 2.17401e+06; Izz 1.09733e+06; Ixy -1.99222e-12; Iyz 7.27596e-12; Izx 2.44869e-08
//! A gear blank, the disc of radius 22 about y from y = 0 to 6, with one tooth space cut by a rack//! tooth — the prism on the trapezoid (18, ±0.842856), (24, ±3.026666) in (x, z), from y = −2 to//! 8 — whose pitch line x = 20 rolls without slipping on the pitch circle of radius 20, from 60°//! on one side of (20, 0, 0) to 60° on the other.//!//! The kernel's one sweep operation builds the tooth's swept solid alone, over the case's whole//! roll, and the ordinary Boolean cuts it from the blank. Seen from the blank the rack rolls in the//! plane y = 0 and the tooth is a prism square to it, so `swept::closed::closed` builds the region//! the trapezoid sweeps in that plane — its flanks' envelopes (involutes of the base circle), its tip//! corners' trochoids and the trapezoid at each end pose, each stretch kept where it stands outside//! the trapezoid at every pose — fitted and carried through the tooth's length (#880 Q2), and judges//! it by the sweep's definition before returning it.usecrate::sketch::polygon;
use cad_kernel::boolean::{combined, Op};
use cad_kernel::build::{disc, prism};
use cad_kernel::geom::tolerance;
use cad_kernel::swept::closed::closed;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
use std::f64::consts::{PI, TAU};
/// How closely the tooth is meshed for the sweep's membership reads (its faces are flat).constBAR: f64 = 0.01;
pubfnbuild() -> Result<Brep, String> {
let blank = prism(&disc([0., 0., 0.], [0., 1., 0.], 22.), 0., 6.)?;
// the trapezoid in the plane y = −2, walked so that it faces +y, carried 10 along ylet (tip, root) = (0.842856, 3.026666);
let section = polygon(&[[18., -2., -tip], [18., -2., tip], [24., -2., root], [24., -2., -root]]);
let tooth = prism(§ion, 0., 10.)?;
// the blank turns about y while the rack slides along the pitch line, 2π·20 a turn the way the// blank's rim moves at the pitch point: the tooth seen from the blanklet rack = Trajectory::Twist(Screw { origin: [0.; 3], axis: [0., 0., 1.], ratio: 0., advance: -TAU * 20. });
let blank_turn = Trajectory::Twist(Screw { origin: [0.; 3], axis: [0., 1., 0.], ratio: 1., advance: 0. });
let path = Trajectory::Relative { source: Box::new(rack), observer: Box::new(blank_turn) };
let swept = closed(&tooth, &path, [-PI / 3., PI / 3.], BAR, tolerance(tooth.size()))
.map_err(|why| format!("the tooth's sweep not built: {why:?}"))?;
Ok(combined(&blank, &swept, Op::Cut, 0.)?)
}
occt left no solid to show.
Time
617 ms; CPU time 616 ms; peak memory 356.6 MB
Notes
refused occt has no sweep of a solid along a rolling motion: it slides, turns, or follows a path it is given, and the rack's path seen from the blank is an involute the implementation would have to build from its formula; the space's involute flanks and trochoid root are the envelope of the tooth, which occt has no operation to find
"""A tooth space cut by a rack. A gear blank with one tooth space cut by a rack tooth rolled round
it, as a gear is generated: module 2, 20 teeth, 20° pressure angle.
The blank is a disc of radius 22 about the y axis, from y = 0 to y = 6. Its pitch circle, in the
plane y = 0, has radius 20.
The rack's tooth is a prism whose section, in the plane y = 0, is the trapezoid symmetric about
the x axis with corners (18, ±0.842856) and (24, ±3.026666) in (x, z): its tip is 2 inside the
pitch circle, it is π wide where it crosses x = 20, and its flanks lean 20° from the x axis. The
prism runs from y = −2 to y = 8, through the blank with room to spare.
The rack moves so that its pitch line, the line x = 20 in the plane y = 0, rolls without slipping
on the blank's pitch circle, the tooth carried with it; as placed, the line touches the circle at
(20, 0, 0), the middle of the tooth. Seen from the blank, the rack rolls from 60° on one side of
that place to 60° on the other. Cut from the blank everything the tooth passes through.
Equivalently, as a machine does it: the blank turns about the y axis while the rack slides along
the pitch line, 2π·20 for every turn of the blank, over a third of a turn.
The space's flanks are involutes of the base circle (radius 20·cos 20°), and its root is the
curve the tooth's tip corners trace."""from bench importRefuseddefbuild():
# OCCT's sweeps slide (BRepPrimAPI_MakePrism), turn (BRepPrimAPI_MakeRevol) or carry a shape# along a path under a law of its trihedron (BRepOffsetAPI_MakePipe, MakePipeShell). Seen# from the blank, the rolling rack does none of these: its frame would have to follow an# involute of the pitch circle, with a cusp where the tooth's middle touches, and that path# exists only if the implementation builds the involute from its formula. And swept face by# face, each flat flank would first have to be split along the line where the roll runs# along it, which moves across the flank: the flanks and root of the space are the envelope# of the tooth, which occt has no operation to find.raiseRefused("occt has no sweep of a solid along a rolling motion: it slides, turns, or ""follows a path it is given, and the rack's path seen from the blank is an ""involute the implementation would have to build from its formula; the ""space's involute flanks and trochoid root are the envelope of the tooth, ""which occt has no operation to find")
arris left no solid to show.
Time
1.2 ms; CPU time 1 ms; peak memory 3.9 MB
Notes
refused arris has no sweep of a solid along a rolling motion, and no involute or trochoid: the tooth space's flanks and root are envelopes of the rolling rack it cannot build
//! A gear blank, a disc of radius 22 about the y axis from y = 0 to y = 6, with one tooth space//! cut by a rack tooth (module 2, 20° pressure angle) whose pitch line rolls without slipping on//! the blank's pitch circle of radius 20, 60° each side of the middle of the tooth.//!//! Refused: arris has no sweep of a solid, and none along a rolling motion. The space's flanks//! are involutes of the base circle, the envelopes of the rack's flanks as it rolls, and its root//! the trochoid the tooth's tip corners trace; arris has no involute or trochoid curve, and//! building either from its formula as a spline would be computing the envelope outside the//! kernel.usecrate::Refusal;
use arris::topo::{Body, Model};
pubfnbuild(_: &mutModel) -> Result<Body, Refusal> {
Err("arris has no sweep of a solid along a rolling motion, and no involute or trochoid: the \
tooth space's flanks and root are envelopes of the rolling rack it cannot build"
.into())
}
Time
45 ms; CPU time 61 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
9042.502789
9042.502789
3.8e-11
area
3872.683532
3872.683532
5.4e-11
agrees with
cad-kernel, next.BREP, cadrs, springrep
mesh
2372 triangles, closed
centre of gravity
(-0.181295, 3, -4.01613e-15) its STEP's solid
inertia
about it, of unit density: Ixx 1.13093e+06; Iyy 2.17401e+06; Izz 1.09733e+06; Ixy -3.5249e-13; Iyz 7.29194e-12; Izx -5.62432e-11
//! A gear blank with one tooth space cut by a rack tooth rolled round it (module 2, 20 teeth, 20°//! pressure angle). The blank: the disc of radius 22 about the y axis from y = 0 to y = 6, pitch//! circle 20. The tooth: the prism from y = −2 to y = 8 on the trapezoid with corners//! (18, ±0.842856) and (24, ±3.026666) in (x, z). The rack's pitch line x = 20 rolls without//! slipping on the pitch circle from 60° on one side of (20, 0, 0) to 60° on the other; cut from//! the blank everything the tooth passes through.//!//! kentron's cut by a motion (`sweep::cut_by_motion`) takes the tooth as a prism and the roll as//! the blank sees it: the rack slid along the pitch line by 20φ, then turned by φ about the y//! axis, for φ from −60° to 60° (the pitch line's point (20, 0, −20φ) carried to the pitch circle//! at φ, where it stands still). Both are in the blank's plane and the tooth runs through all of//! its height, so the cut is planar: the blank's disc less the region the trapezoid sweeps, its//! flanks' envelopes (the involutes) and its tip corners' paths (the root), extruded through the//! blank.usecrate::bench::p;
use kentron::math::{Axis, Direction, Frame, Point2};
use kentron::sweep::{self, Blank, Motion, MotionStep, Tool};
use kentron::topology::{Model, Shape};
use std::f64::consts::PI;
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
// (The blank's and the tooth's frames: y their axis, x their first; in (x, z) the frames'// second coordinate is −z, which the symmetric trapezoid does not see.)let plane = Frame::new(p(0.0, 0.0, 0.0), Direction::Y, Direction::X);
let blank = Blank::Disc { frame: plane, radius: 22.0, height: 6.0 };
let corners = [[18.0, -0.842856], [24.0, -3.026666], [24.0, 3.026666], [18.0, 0.842856]];
let tooth = Tool::Prism { frame: plane, outline: corners.iter().map(|&[x, y]| Point2::new(x, y)).collect(), from: -2.0, to: 8.0 };
let slide = MotionStep { axis: Axis::new(p(0.0, 0.0, 0.0), Direction::Z), turn: 0.0, advance: 20.0 };
let turn = MotionStep { axis: Axis::new(p(0.0, 0.0, 0.0), Direction::Y), turn: 1.0, advance: 0.0 };
let motion = Motion { steps: vec![slide, turn], from: -PI / 3.0, to: PI / 3.0 };
sweep::cut_by_motion(m, &blank, &tooth, &motion)
}
vcad left no solid to show.
Time
1.1 ms; CPU time 940 µs; peak memory 4.8 MB
Notes
refused vcad has no sweep of a solid along a rolling motion, and no involute or trochoid (a sketch holds only lines and circular arcs): the tooth space's flanks are envelopes of the rack's
//! A gear blank, a disc of radius 22 about the y axis from y = 0 to y = 6, with one tooth space//! cut by a rack tooth (module 2, 20° pressure angle) whose pitch line rolls without slipping on//! the blank's pitch circle of radius 20, 60° each side of the middle of the tooth.//!//! Refused: vcad has no sweep of a solid (`Solid::sweep`, `sweep_cylindrical` and `loft` move a//! sketch profile), and none along a rolling motion. The space's flanks are involutes of the base//! circle, the envelopes of the rack's flanks as it rolls, and its root the trochoid the tooth's//! tip corners trace; a vcad sketch holds only lines and circular arcs, and building either curve//! from its formula would be computing the envelope outside the kernel.use vcad_kernel::Solid;
pubfnbuild() -> Result<Solid, crate::Refusal> {
Err("vcad has no sweep of a solid along a rolling motion, and no involute or trochoid (a \
sketch holds only lines and circular arcs): the tooth space's flanks are envelopes of \
the rack's"
.into())
}
solidcraft left no solid to show.
Time
1.5 ms; CPU time 1.3 ms; peak memory 4.7 MB
Notes
refused no layer (solidcraft-kernel, solidcore-ops, solidcore) has a sweep of a solid or an envelope: the tooth space is the envelope of the rack tooth rolled round the blank, which no sweep of a profile along a path, a helix or a revolve makes
//! Refused. The tooth space is cut by a rack tooth rolled round the blank: seen from the blank,//! the tooth turns as it slides, and the space's flanks (involutes) and root are the envelope of//! the tooth's sides and tip corners over the motion. solidcraft-kernel has no sweep of a solid//! and no envelope, and its sweeps of a profile only follow a path, a helix or a revolve, none of//! which is this rolling; an envelope 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: the tooth space is the \
envelope of the rack tooth rolled round the blank, which no sweep of a profile along a \
path, a helix or a revolve makes"
.into())
}
brepkit left no solid to show.
Time
1.1 ms; CPU time 920 µs; peak memory 3.5 MB
Notes
refused brepkit has no sweep of a solid along a rolling motion, and the tooth space's flanks are the envelope of the rack tooth's (involutes), which brepkit cannot compute
//! A tooth space cut by a rack tooth rolled round a gear blank. brepkit has no sweep of a solid,//! and none along a rolling motion; the space's flanks are the envelope of the tooth's flanks//! over the motion (involutes of the base circle) and its root the curve its tip corners trace,//! which brepkit has no operation to compute and no involute curve to build them from.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 along a rolling motion, and the tooth space's flanks are \
the envelope of the rack tooth's (involutes), which brepkit cannot compute"
.into(),
)
}
popkern left no solid to show.
Time
3.4 ms; CPU time 3.2 ms; peak memory 11.5 MB
Notes
refused popkern has no sweep of a solid, and this sweep's wall is an envelope: the space's flanks are the envelope of the tooth's flanks (involutes) and its root the curve its tip corners trace
// A gear blank with one tooth space cut by a rack tooth rolled round it.//// 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 space's flanks// are the envelope of the tooth's flanks (involutes) and its root the curve its tip corners trace.// 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 space's flanks \
are the envelope of the tooth's flanks (involutes) and its root the curve its tip corners \
trace";
aetheris left no solid to show.
Time
57 ms; CPU time 57 ms; peak memory 47.4 MB
Notes
refused Aetheris has no sweep of a solid and no general subtraction. The space's flanks are involutes and its root the curve the tooth's corners trace: an envelope of the rolling rack. Aetheris's involute gears are made whole from a standard, not generated by a rack.
// A gear blank with one tooth space cut by a rack tooth rolled round it.//// Refused: Aetheris has no sweep of a solid and no general subtraction. The space's flanks are// involutes and its root the curve the tooth's corners trace: an envelope of the rolling rack.// Aetheris's involute gears are made whole from a standard, not generated by a rack.
Time
20 ms; CPU time 20 ms; peak memory 11.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.
Data
its STEP's
expected
rel. error
volume
9042.502789
9042.502789
3.8e-11
area
3872.683532
3872.683532
5.4e-11
agrees with
cad-kernel, kentron, cadrs, springrep
mesh
4984 triangles, closed
centre of gravity
(-0.181295, 3, 3.39271e-15) its STEP's solid
inertia
about it, of unit density: Ixx 1.13093e+06; Iyy 2.17401e+06; Izz 1.09733e+06; Ixy 1.05904e-12; Iyz -3.606e-12; Izx 1.42656e-10
//! A gear blank with one tooth space cut by a rack tooth rolled around it.//!//! The kernel's sweep of a solid (`sweep_solid_within`): the tooth is its trapezoid extruded from//! y = −2 to 8, moved, as seen from the blank, by the rack's slide along its pitch line (−20 along//! z per radian) and then the blank's turn taken back (θ about the y axis, from +x toward +z), so//! the pitch line rolls without slipping on the pitch circle, for θ from −60° to 60°. Asked for//! within 22.5 of the blank's axis from y = −1 to 7, which holds the blank; cut from the blank.//! The cut is made in the plane (`cut_planar_sweep_from_prism`): the blank's disc less the tooth's//! exact swept region, extruded once over the blank's height; where the kernel does not draw it so,//! the sweep's bodies are subtracted from the blank's cylinder.usecrate::solids::p;
usecrate::Refusal;
use brep_kernel::{
boolean_operation_nary, make_cylinder_brep, sweep_solid_within, BooleanOperation, BrepSolid,
OutlinePiece, ScrewStep, SolidMotion, SweepClip, SweptTool,
};
use std::f64::consts::PI;
pubfnbuild() -> Result<BrepSolid, Refusal> {
let y = p(0.0, 1.0, 0.0);
let blank = make_cylinder_brep(p(0.0, 0.0, 0.0), y, 22.0, 6.0)?;
// The trapezoid in the tooth's plane coordinates (x, −z).let corners = [[18.0, -0.842856], [24.0, -3.026666], [24.0, 3.026666], [18.0, 0.842856]];
let outline = (0..4)
.map(|k| OutlinePiece::Line { from: corners[k], to: corners[(k + 1) % 4] })
.collect();
let tooth = SweptTool::Prism {
origin: p(0.0, 0.0, 0.0),
normal: y,
x_axis: p(1.0, 0.0, 0.0),
outline,
from: -2.0,
to: 8.0,
};
let rolling = SolidMotion {
steps: vec![
ScrewStep { axis_origin: p(0.0, 0.0, 0.0), axis_direction: p(0.0, 0.0, 1.0), turn: 0.0, advance: -20.0 },
ScrewStep { axis_origin: p(0.0, 0.0, 0.0), axis_direction: p(0.0, -1.0, 0.0), turn: 1.0, advance: 0.0 },
],
from: -PI / 3.0,
to: PI / 3.0,
};
let around_blank = SweepClip {
axis_origin: p(0.0, 0.0, 0.0),
axis_direction: y,
reference: p(1.0, 0.0, 0.0),
radius: [15.0, 22.5],
axial: [-1.0, 7.0],
angle: None,
};
let disc = SweptTool::Prism {
origin: p(0.0, 0.0, 0.0),
normal: y,
x_axis: p(1.0, 0.0, 0.0),
outline: vec![OutlinePiece::Arc { centre: [0.0, 0.0], radius: 22.0, start: 0.0, end: 2.0 * PI }],
from: 0.0,
to: 6.0,
};
ifletSome(mut cut) = brep_kernel::cut_planar_sweep_from_prism(&disc, &tooth, &rolling, &around_blank)? {
if cut.len() == 1 {
returnOk(cut.remove(0));
}
}
letmut operands = vec![blank];
operands.extend(sweep_solid_within(&tooth, &rolling, &around_blank)?);
Ok(boolean_operation_nary(&operands, BooleanOperation::Subtract)?)
}
geop left no solid to show.
Time
1.8 ms; CPU time 1.6 ms; peak memory 9.5 MB
Notes
refused geop has no sweep of a solid through a motion: the space the rolling rack tooth cuts is bounded by the envelope of its flanks, which geop cannot build
//! A gear blank with one tooth space cut by a rack tooth rolled round it, as a gear is generated.//!//! geop sweeps a profile along a path, turning it with the path; it has no sweep of a solid//! through a motion, and the space's flanks are the envelope of the tooth's flanks as the rack//! rolls — involutes that would have to be computed here, outside geop.usecrate::{Bench, Refusal};
pubfnbuild(_: &mutBench) -> Result<(), Refusal> {
Err("geop has no sweep of a solid through a motion: the space the rolling rack tooth cuts is \
bounded by the envelope of its flanks, which geop cannot build"
.into())
}
Time
103 ms; CPU time 297 ms; peak memory 11.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.
Data
its STEP's
expected
rel. error
volume
9042.502789
9042.502789
2.8e-11
area
3872.683532
3872.683532
2.9e-11
agrees with
cad-kernel, kentron, next.BREP, springrep
mesh
6960 triangles, closed
centre of gravity
(-0.181295, 3, 1.25024e-11) its STEP's solid
inertia
about it, of unit density: Ixx 1.13093e+06; Iyy 2.17401e+06; Izz 1.09733e+06; Ixy 3.50799e-13; Iyz 1.77636e-14; Izx -2.05451e-06
//! A gear blank, the disk of radius 22 about the y axis from y = 0 to y = 6, with one tooth space//! cut by a rack tooth (module 2, 20° pressure angle) rolled on its pitch circle of radius 20//! from 60° on one side to 60° on the other.//!//! The blank is a circle on the plane y = 0 extruded 6; the tooth is its trapezoid (corners//! (18, ±0.842856) and (24, ±3.026666) in (x, z)) on the plane y = −2 extruded 10. Seen from the//! blank the rack rolls on the pitch circle: slid 20φ along its pitch line (along z) and turned//! φ about the y axis together, φ from −60° to 60° (its pitch point at rest on the circle).//! cadrs's `Kernel::sweep_solid` with that planar motion gives what the tooth fills, cut from the//! blank.usecrate::bench::{cut, extrude, p3, v3};
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel, Kernel, Loop, PlanarStep, Plane, Profile, SolidMotion};
use std::f64::consts::PI;
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
// Planes square to y with sketch x along the model's x and sketch y along its z.let at = |y: f64| Plane::new(p3(0.0, y, 0.0), v3(1.0, 0.0, 0.0), v3(0.0, -1.0, 0.0));
let blank = extrude(k, &Profile::of(at(0.0), vec![Loop::circle([0.0, 0.0], 22.0)]), -6.0)?;
let tooth = [(18.0, -0.842856), (24.0, -3.026666), (24.0, 3.026666), (18.0, 0.842856)];
let rack = extrude(k, &Profile::of(at(-2.0), vec![Loop::polygon(&tooth.map(|(x, y)| [x, y]))]), -10.0)?;
let (f0, f1) = (-PI / 3.0, PI / 3.0);
let motion = SolidMotion::Planar {
normal: crate::bench::unit(v3(0.0, 1.0, 0.0)),
steps: vec![
PlanarStep::Slide { from: v3(0.0, 0.0, 20.0 * f0), to: v3(0.0, 0.0, 20.0 * f1) },
PlanarStep::Turn { about: p3(0.0, 0.0, 0.0), from: f0, to: f1 },
],
};
let swept = k.sweep_solid(rack, &motion)?;
let swept = swept.bodies.first().copied().ok_or_else(|| Refusal::from("the sweep made no body"))?;
cut(k, blank, 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
2.91 s; CPU time 2.91 s; peak memory 15.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.
Data
its STEP's
expected
rel. error
volume
9042.502789
9042.502789
4.1e-11
area
3872.683532
3872.683532
5.4e-11
agrees with
cad-kernel, kentron, next.BREP, cadrs
mesh
10480 triangles, closed
centre of gravity
(-0.181295, 3, -6.52758e-18) its STEP's solid
inertia
about it, of unit density: Ixx 1.13093e+06; Iyy 2.17401e+06; Izz 1.09733e+06; Ixy 1.01593e-12; Iyz 4.74944e-29; Izx -1.73188e-10
//! A gear blank (radius 22 about the y axis) with one tooth space cut by a rack tooth rolled//! around it.use std::f64::consts::PI;
use springrep::boolean::difference;
use springrep::math::{Frame, Point3, Vec3};
use springrep::primitive::cylinder;
use springrep::sweep::{Motion, extrude, solid};
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{polygon, v3};
pubfnbuild() -> Result<Brep, String> {
let face = Frame::new(Point3::ZERO, Vec3::Y, Vec3::X).map_err(e)?;
let blank = cylinder(&face, 22.0, 6.0, "blank").map_err(e)?;
// Turned by φ the blank carries its pitch circle past the line x = 20 by 20φ toward −z; seen// from the blank the tooth slides that far along the line and turns back by φ. It is drawn// where it is at φ = −60°.let start = 20.0 * PI / 3.0;
let section = polygon(
&[
(18.0, -0.842856),
(24.0, -3.026666),
(24.0, 3.026666),
(18.0, 0.842856),
],
"tooth",
);
let sketch = Frame::new(v3(0.0, -2.0, start), Vec3::Y, Vec3::X).map_err(e)?;
let tooth = extrude(§ion, &sketch, 10.0, "tooth").map_err(e)?;
let rolled = Motion::Then(
Box::new(Motion::Slide(v3(0.0, 0.0, -2.0 * start))),
Box::new(Motion::Turn {
origin: Point3::ZERO,
axis: Vec3::Y,
from: PI / 3.0,
to: -PI / 3.0,
}),
);
let swept = solid(&tooth, &rolled, "rack").map_err(e)?;
difference(&blank, &swept).map_err(e)
}
Time
438 ms; CPU time 1.05 s; peak memory 96.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
9042.502714
9042.502789
8.3e-09
area
3872.683453
3872.683532
2.0e-08
agrees with
no other kernel
mesh
10702 triangles, closed
centre of gravity
(-0.181295, 3, 2.43081e-15) its STEP's solid
inertia
about it, of unit density: Ixx 1.13093e+06; Iyy 2.17401e+06; Izz 1.09733e+06; Ixy -3.90604e-12; Iyz 1.80549e-11; Izx 1.68901e-10
// One tooth space of a spur gear (module 2, 20 teeth, 20 degree pressure angle) cut by a rack// tooth. The blank is the disc of radius 22 about the y axis, drawn in the front plane (x, z) and// extruded from y = 0 to 6. The tooth is the trapezoid with corners (18, +-0.842856) and// (24, +-3.026666) in (x, z), extruded from y = -2 to 8. The blank turns about y while the rack// slides along its pitch line x = 20, 2 pi 20 a turn, so the line rolls on the pitch circle; the// kernel's sweep of the tooth as the blank sees it, over -60..60 degrees, is cut from the blank.unit mm
use std
use std.solids (cut)
use std.place (vertical)
use std.motion (spins, slides)
in std.front {
o := point
fix((0, 0)) o
rim := circle(center: o) hint(r: 22)
radius(22mm) rim
// the pitch line, tangent to the pitch circle (radius 20) at the middle of the tooth
s0 := point
fix((20, 0)) s0
construction pitch_line := vertical line(s0, hint((20, 10)))
length(10mm) pitch_line
// the rack's tooth, as given
t0 := point hint((18, -0.84))
t1 := point hint((18, 0.84))
t2 := point hint((24, 3.03))
t3 := point hint((24, -3.03))
fix((18, -0.842856)) t0
fix((18, 0.842856)) t1
fix((24, 3.026666)) t2
fix((24, -3.026666)) t3
}
// the front plane's normal is -y, so the ordinates along it are minus y
part := solid(std.solids.Prism(face(rim), from: -6mm, to: 0mm))
construction tooth := solid(std.solids.Prism(face(t0, t1, t2, t3, -> close), from: -8mm, to: 2mm))
// the blank turning about its centre, and the rack sliding a pitch circumference a turn
turn := frame
turn spins(1) o
rack := frame
rack slides(2 * pi * 20mm) pitch_line
construction space := solid({ p | some t in (-60deg, 60deg): p in tooth at(under: rack, seen_from: turn) t })
space cut part
anvilcad left no solid to show.
Time
1.2 ms; CPU time 1.1 ms; peak memory 3.7 MB
Notes
refused anvil-brep has no sweep of a solid: the cutter, carried by two motions at once relative to the blank, sweeps envelopes of its faces that it would have to compute itself
//! A tooth space cut by a rack.use anvil_brep::Solid;
pubfnbuild() -> Result<Solid, String> {
Err("anvil-brep has no sweep of a solid: the cutter, carried by two motions at once relative to the blank, sweeps envelopes of its faces that it would have to compute itself".into())
}