A rod, the cylinder of radius 5 about the z axis from z = 0 to z = 20, threaded by a bar whose section is a closed B-spline curve, carried along a screw.
The bar's section lies in the plane y = 0: it is the closed, uniform, periodic cubic B-spline curve (non-rational, knots evenly spaced, each span the cubic blend of four consecutive control points) whose seven control points, in (x, z) and in order round the loop, are (3.5, 0), (4.5, −1.5), (8, −1.5), (12, −1), (12, 1), (8, 1.5) and (4.5, 1.5). Its point nearest the rod's axis is (23/6, 0, 0), about 1.17 inside the rod. The bar is everything within that curve carried from y = −8 to y = 8: a prism, its sides one surface of extrusion of the spline.
The screw is about the z axis: the tool turns right-handed about it (from +x toward +y) and rises 6 for every whole turn, rigidly. It runs from a turn of −90° (lowered 1.5, the tool wholly below the rod) to a turn of 1350° (raised 22.5, wholly above it). Cut from the rod everything the bar passes through.
Its contact under the screw has no closed form on a spline: it must be found on the surface numerically, at each ruling.
expected
closed form
volume
1335.319592
no closed form: cad-kernel, next.BREP and cadrs agree to 1e-9; the mean of their values
area
810.5682318
no closed form: cad-kernel, next.BREP and cadrs agree to 3e-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
2.52 s; CPU time 6.00 s; peak memory 63.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.
Data
its STEP's
expected
rel. error
volume
1335.319582
1335.319592
7.5e-09
area
810.5682252
810.5682318
8.1e-09
agrees with
next.BREP, cadrs, springrep, geomsolver
mesh
104114 triangles, closed
centre of gravity
(-0.0246825, -0.0427513, 10) its STEP's solid
inertia
about it, of unit density: Ixx 51875.6; Iyy 51899.2; Izz 14753.5; Ixy 20.4777; Iyz -158.815; Izx 275.076
//! A rod, the cylinder of radius 5 about z from z = 0 to 20, threaded by a bar whose section, in//! the plane y = 0, is the closed uniform periodic cubic B-spline on the control points//! (3.5, 0), (4.5, −1.5), (8, −1.5), (12, −1), (12, 1), (8, 1.5), (4.5, 1.5) in (x, z), carried//! from y = −8 to 8; screwed about z — right-handed, rising 6 a turn — from a turn of −90° to//! 1350°.//!//! The kernel's closed sweep (`swept::closed::cut_from`) takes the bar whole: under a screw its//! closed class takes planes, balls, and cylinders and cones about axes along the screw's, and//! refuses the spline's surface of extrusion (`Unbuilt::Curved`); since 0.12.0 such a tool goes//! the contact's road — the contact of its free-form side, a face closed across its own seam, cut//! where its burial in the tool changes, and its end rims' fans carried over the roll as sheets,//! given their meetings and the end poses, trimmed by membership in the sweep, and the result cut//! from the rod.use cad_kernel::build::{disc, prism, Profile, ProfileEdge};
use cad_kernel::geom::tolerance;
use cad_kernel::nurbs::BSpline;
use cad_kernel::swept::closed::cut_from;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
use std::sync::Arc;
constROD_RADIUS: f64 = 5.;
constROD_LENGTH: f64 = 20.;
/// The section's control points, in (x, z), in order round the loop.constCONTROL: [[f64; 2]; 7] =
[[3.5, 0.], [4.5, -1.5], [8., -1.5], [12., -1.], [12., 1.], [8., 1.5], [4.5, 1.5]];
constDEGREE: usize = 3;
constHALF_LENGTH: f64 = 8.;
constLEAD: f64 = 6.;
constROLL: [f64; 2] = [-90f64.to_radians(), 1350f64.to_radians()];
/// How closely the bar is meshed for the sweep's membership reads.constBAR: f64 = 0.01;
pubfnbuild() -> Result<Brep, String> {
let up = [0., 0., 1.];
let rod = prism(&disc([0., 0., 0.], up, ROD_RADIUS), 0., ROD_LENGTH)?;
// the periodic curve written the way cad-kernel holds a B-spline: its poles with the first// three repeated after the last, on uniform knots, so its domain [3, 10] runs once roundlet poles: Vec<_> = (0..CONTROL.len() + DEGREE)
.map(|k| { let [x, z] = CONTROL[k % CONTROL.len()]; [x, 0., z] })
.collect();
let knots = (0..poles.len() + DEGREE + 1).map(|k| k as f64).collect();
let curve = BSpline::new(DEGREE, knots, poles)?;
let section = Profile { origin: [0., 0., 0.], normal: [0., 1., 0.],
loops: vec![vec![ProfileEdge::Spline(Arc::new(curve))]],
names: Vec::new() };
let bar = prism(§ion, -HALF_LENGTH, HALF_LENGTH)?;
// the screw about z: a radian a radian of the roll, rising the lead a turnlet path = Trajectory::Twist(Screw {
origin: [0., 0., 0.], axis: up, ratio: 1., advance: LEAD,
});
let size = rod.size().max(bar.size());
cut_from(&rod, &bar, &path, ROLL, BAR, tolerance(size))
.map_err(|why| format!("the bar's sweep not built: {why:?}"))
}
occt left no solid to show.
Time
622 ms; CPU time 621 ms; peak memory 356.7 MB
Notes
refused occt has no sweep of a solid: it carries faces along a screw, and the spline bar's side touches what it sweeps along a curve with no closed form, which occt has no operation to find
"""A rod threaded by a bar whose section is a spline. A rod, the cylinder of radius 5 about the z
axis from z = 0 to z = 20, threaded by a bar whose section is a closed B-spline curve, carried
along a screw.
The bar's section lies in the plane y = 0: it is the closed, uniform, periodic cubic B-spline curve
(non-rational, knots evenly spaced, each span the cubic blend of four consecutive control points)
whose seven control points, in (x, z) and in order round the loop, are (3.5, 0), (4.5, −1.5), (8,
−1.5), (12, −1), (12, 1), (8, 1.5) and (4.5, 1.5). Its point nearest the rod's axis is (23/6, 0,
0), about 1.17 inside the rod. The bar is everything within that curve carried from y = −8 to y =
8: a prism, its sides one surface of extrusion of the spline.
The screw is about the z axis: the tool turns right-handed about it (from +x toward +y) and rises 6
for every whole turn, rigidly. It runs from a turn of −90° (lowered 1.5, the tool wholly below the
rod) to a turn of 1350° (raised 22.5, wholly above it). Cut from the rod everything the bar passes
through.
Its contact under the screw has no closed form on a spline: it must be found on the surface
numerically, at each ruling."""from bench importRefuseddefbuild():
# The bar is a prism of the spline, which OCCT makes exactly. But its side, a surface of# extrusion of the spline, touches what the screw sweeps along a curve with no closed form,# found only numerically at each ruling. OCCT sweeps no solid, and a face it carries along# the screw sweeps to a solid only once split along its contact: finding that curve would# be computing the envelope outside the kernel.raiseRefused("occt has no sweep of a solid: it carries faces along a screw, and the spline ""bar's side touches what it sweeps along a curve with no closed form, which ""occt has no operation to find")
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.
kentron left no solid to show.
Time
37 ms; CPU time 37 ms; peak memory 10.1 MB
Notes
refused operation failed: a sweep folding over itself (3 folds where the motion turns past a sharp edge or characteristic curve of the tool): its sheets meet tangent along the fold, and are not parted
//! A rod, the cylinder of radius 5 about the z axis from z = 0 to z = 20, threaded by a bar whose//! section is a spline, carried along a screw: the closed uniform periodic cubic B-spline in the//! plane y = 0 through the control points (x, z) (3.5, 0), (4.5, −1.5), (8, −1.5), (12, −1),//! (12, 1), (8, 1.5), (4.5, 1.5), carried from y = −8 to y = 8, screwed about the z axis,//! right-handed, rising 6 a turn, from a turn of −90° to +1350°. Everything the bar passes//! through, cut.//!//! The bar is the spline's face extruded; its sweep is kentron's sweep of a solid//! (`sweep::solid`, one screw), cut from the rod.usecrate::bench::p;
use kentron::geometry::curve::{BSplineCurve, Curve};
use kentron::make;
use kentron::math::{Axis, Direction, Vector};
use kentron::primitives::Cylinder;
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
use std::f64::consts::FRAC_PI_2;
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let rod = Cylinder::new(5.0, 20.0).build(m)?;
let xz = [(3.5, 0.0), (4.5, -1.5), (8.0, -1.5), (12.0, -1.0), (12.0, 1.0), (8.0, 1.5), (4.5, 1.5)];
let poles = xz.iter().map(|&(x, z)| p(x, -8.0, z)).collect();
let knots = (0..=xz.len()).map(|k| k as f64).collect();
let section = BSplineCurve::try_new_periodic(poles, knots, vec![1; xz.len() + 1], 3)?;
let edge = make::edge_from_curve(m, Curve::BSpline(section))?;
let wire = make::wire(m, &[edge])?;
let face = make::planar_face(m, wire)?;
let bar = sweep::extrude(m, face, Vector::new(0.0, 16.0, 0.0))?.shape;
let screw = RigidMotion::Screw { axis: Axis::new(p(0.0, 0.0, 0.0), Direction::Z), lead: 6.0, from: -FRAC_PI_2, to: 1350f64.to_radians() };
let swept = sweep::solid(m, bar, &screw)?;
kentron::boolean::difference(m, rod, 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.
solidcraft left no solid to show.
Time
1.4 ms; CPU time 1.2 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 spline bar's side meets the screw square-on along a curve found only numerically on its rulings, in no plane, so no planar section screwed by any layer's screw sweep (the kernel's `sweep_helix`, ops's `screw_sweep`) makes the groove's walls
//! Refused. The bar's side is the spline's surface of extrusion along y, and it meets the screw's//! motion square-on at a point of each of its rulings found only numerically, on a curve in no//! plane; the groove's walls are what that curve sweeps. So no section of the bar screwed by the//! kernel's helical sweep (`sweep_helix`) carries it. solidcraft-kernel has no sweep of a solid and//! no envelope, and that curve fitted 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 spline bar's side meets \
the screw square-on along a curve found only numerically on its rulings, in no plane, \
so no planar section screwed by any layer's screw sweep (the kernel's `sweep_helix`, ops's `screw_sweep`) makes the groove's walls"
.into())
}
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
3.2 ms; CPU time 3.1 ms; peak memory 11.6 MB
Notes
refused popkern has no sweep of a solid, and this sweep's wall is an envelope its other operations do not make
// A rod threaded by a bar whose section is a spline.//// Refused: popkern has no sweep of a solid (its sweeps carry a profile along a path), and this// one's boundary is an envelope of the moving solid that its other operations do not make.throw"popkern has no sweep of a solid, and this sweep's wall is an envelope its other operations do not make";
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
351 ms; CPU time 351 ms; peak memory 17.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
1335.319593
1335.319592
4.5e-10
area
810.5682319
810.5682318
1.1e-10
agrees with
cad-kernel, cadrs, springrep, geomsolver
mesh
317256 triangles, closed
centre of gravity
(-0.0246825, -0.0427513, 10) its STEP's solid
inertia
about it, of unit density: Ixx 51875.6; Iyy 51899.2; Izz 14753.5; Ixy 20.4777; Iyz -158.815; Izx 275.076
//! A rod threaded by a bar whose section is a closed periodic cubic B-spline, carried along a//! screw.//!//! Through the kernel's sweep of a solid (`sweep_solid_within`), asked for the bar (the kernel's//! periodic B-spline, `make_periodic_bspline`, on the seven control points in the plane y = 0,//! from y = −8 to 8) along the screw about the z axis that rises 6 a turn, from −90° to +1350°,//! within 5.2 of the z axis from z = −0.05 to 20.05 (which holds the rod and which neither end//! position reaches: at the start the bar's top is at z = −0.08 or lower); cut from the rod.usecrate::solids::p;
usecrate::Refusal;
use brep_kernel::{
boolean_operation_nary, make_cylinder_brep, make_periodic_bspline, sweep_clip_less, sweep_solid_within, BooleanOperation, BrepSolid, ScrewStep,
SolidMotion, SweepClip, SweptTool,
};
use std::f64::consts::TAU;
pubfnbuild() -> Result<BrepSolid, Refusal> {
let rod = make_cylinder_brep(p(0.0, 0.0, 0.0), p(0.0, 0.0, 1.0), 5.0, 20.0)?;
let poles = [(3.5, 0.0), (4.5, -1.5), (8.0, -1.5), (12.0, -1.0), (12.0, 1.0), (8.0, 1.5), (4.5, 1.5)].map(|(x, z)| p(x, 0.0, z));
let bar = SweptTool::Bar {
origin: p(0.0, 0.0, 0.0),
normal: p(0.0, 1.0, 0.0),
section: vec![make_periodic_bspline(3, &poles)?],
from: -8.0,
to: 8.0,
draft: 0.0,
};
let screw = 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: 6.0 / TAU }],
from: (-90.0f64).to_radians(),
to: 1350.0f64.to_radians(),
};
let clip = 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: [0.0, 5.2],
axial: [-0.05, 20.05],
angle: None,
};
letmut operands = vec![rod];
// The rod less the sweep, built directly where the kernel can (its clip// the rod itself); else the sweep within the larger clip, subtracted.let rod_clip = SweepClip { radius: [0.0, 5.0], axial: [0.0, 20.0], ..clip.clone() };
ifletSome(mut bodies) = sweep_clip_less(&bar, &screw, &rod_clip)? {
if bodies.len() == 1 {
returnOk(bodies.remove(0));
}
}
operands.extend(sweep_solid_within(&bar, &screw, &clip)?);
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
443 ms; CPU time 1.09 s; peak memory 32.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
1335.319591
1335.319592
1.1e-09
area
810.5682314
810.5682318
4.7e-10
agrees with
cad-kernel, next.BREP, springrep, geomsolver
mesh
71218 triangles, closed
centre of gravity
(-0.0246825, -0.0427513, 10) its STEP's solid
inertia
about it, of unit density: Ixx 51875.6; Iyy 51899.2; Izz 14753.5; Ixy 20.4777; Iyz -158.815; Izx 275.076
//! A rod (the cylinder of radius 5 about the z axis from z = 0 to z = 20) threaded by a bar whose//! section (in the plane y = 0) is the closed uniform cubic B-spline on (3.5, 0), (4.5, −1.5),//! (8, −1.5), (12, −1), (12, 1), (8, 1.5), (4.5, 1.5) in (x, z), carried from y = −8 to 8, screwed//! about the z axis, rising 6 a turn, from a turn of −90° to 1350°.//!//! The bar is the periodic spline extruded (cadrs's Extrude); what it passes through (a turn and a//! slide along its axis at once: a screw) is cut from the rod by cadrs's cut by a swept solid//! (exactly half a turn at a time where it can be, else meshed); of the//! bar, its part within 5.5 of the axis (the screw maps the cylinder about its axis onto itself, so//! only that part reaches the rod).usecrate::bench::{extrude, p3, v3};
usecrate::shared::geometry::Section;
usecrate::shared::swept::{cut_swept, near_axis, rod, screw, z_axis};
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel, Plane};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
// The plane y = 8, sketch x along +x and sketch y along +z (normal −y, the extrusion's way).let on = Plane::new(p3(0.0, 8.0, 0.0), v3(1.0, 0.0, 0.0), v3(0.0, -1.0, 0.0));
// (The same loop started from (12, −1): its seam, where the periodic spline's first span// starts, then lies at its far end, out of the part near the axis.)let poles = [(12.0, -1.0), (12.0, 1.0), (8.0, 1.5), (4.5, 1.5), (3.5, 0.0), (4.5, -1.5), (8.0, -1.5)];
let section = Section::on(on).periodic(3, &poles);
let bar = extrude(k, §ion.sketch(), 16.0)?;
let bar = near_axis(k, bar, 5.5)?;
let r = rod(k)?;
cut_swept(k, r, bar, &screw(z_axis(), 6.0, -90.0, 1350.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
2.97 s; CPU time 2.97 s; peak memory 126.8 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 rod'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
1335.319593
1335.319592
4.6e-10
area
810.5682319
810.5682318
7.0e-11
agrees with
cad-kernel, next.BREP, cadrs, geomsolver
mesh
84066 triangles, closed
centre of gravity
(-0.0246825, -0.0427513, 10) its STEP's solid
inertia
about it, of unit density: Ixx 51875.6; Iyy 51899.2; Izz 14753.5; Ixy 20.4777; Iyz -158.815; Izx 275.076
//! The rod of radius 5 about the z axis from z = 0 to 20 less everything a prism of closed//! B-spline section in the plane y = 0 passes through as it is screwed about the z axis, rising//! 6 a turn.use springrep::boolean::difference;
use springrep::geom::BSpline;
use springrep::math::{Frame, Vec3};
use springrep::profile::{NamedSegment, Profile, Segment};
use springrep::sweep::{extrude, solid};
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{deg, rod, screwing, v3, within};
pubfnbuild() -> Result<Brep, String> {
let points = [
(3.5, 0.0),
(4.5, -1.5),
(8.0, -1.5),
(12.0, -1.0),
(12.0, 1.0),
(8.0, 1.5),
(4.5, 1.5),
];
// drawn in (x, z) on the plane y = −8, carried along +ylet ctrl = (0..points.len() + 3)
.map(|i| points[i % points.len()])
.map(|(x, z)| v3(x, z, 0.0))
.collect();
let knots = (-3..=10).map(f64::from).collect();
let curve = BSpline::periodic_cubic(knots, ctrl).map_err(e)?;
let side = Segment::Spline {
curve,
reversed: false,
};
let section = Profile::outline(vec![NamedSegment::new(side, "side")]);
let sketch = Frame::new(v3(0.0, -8.0, 0.0), -Vec3::Y, Vec3::X).map_err(e)?;
let bar = extrude(§ion, &sketch, -16.0, "bar").map_err(e)?;
// No sweep of the whole tool: a screw keeps each point's distance from the z axis, so only the// tool within 5.5 of it reaches the rod, and only that part is swept.let tip = within(&bar, 5.5)?;
let swept = solid(&tip, &screwing(6.0, deg(-90.0), deg(1350.0)), "screw").map_err(e)?;
difference(&rod()?, &swept).map_err(e)
}
Time
51.6 s; CPU time 142.8 s; peak memory 103.6 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no periodic B-spline: the section written as its Bézier spans
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
1335.319586
1335.319592
5.1e-09
area
810.5682271
810.5682318
5.8e-09
agrees with
cad-kernel, next.BREP, cadrs, springrep
mesh
43596 triangles, closed
centre of gravity
(-0.0246825, -0.0427513, 10) its STEP's solid
inertia
about it, of unit density: Ixx 51875.6; Iyy 51899.2; Izz 14753.5; Ixy 20.4777; Iyz -158.815; Izx 275.076
// A rod threaded by a bar whose section is a closed spline, carried along a screw. The rod is the// cylinder of radius 5 about z from z = 0 to 20. The bar's section, in the front plane (x, z), is// the closed uniform cubic B-spline over the seven given control points; Solvent's splines are// clamped, so the closed curve is written as its seven spans, each the cubic Bezier whose ends are// the blend (k[i-1] + 4 k[i] + k[i+1]) / 6 and whose inner control points lie a third and two// thirds along the leg k[i] k[i+1] - the same curve, span for span. The bar is that section// carried from y = -8 to 8. The screw is about z, right-handed, rising 6 a turn; the kernel's// sweep of the bar from a turn of -90 to 1350 degrees is cut from the rod.unit mm
use std
use std.solids (cut)
use std.motion (screws)
// where a uniform cubic B-spline's span starts, (a + 4 b + c) / 6: a third of the way from `b`// to the middle of `a` and `c`componentJoint(a: point, b: point, c: point) {
construction chord := line(a, c)
private mid := point hint(((a.x + c.x) / 2, (a.y + c.y) / 2))
mid coincident(t == 0.5) chord
construction lean := line(b, mid)
p := point hint(((a.x + 4 * b.x + c.x) / 6, (a.y + 4 * b.y + c.y) / 6))
p coincident(t == 1 / 3) lean
}
// a span's inner control point: a third of the way from `a` to `b`componentThird(a: point, b: point) {
construction leg := line(a, b)
p := point hint((a.x + (b.x - a.x) / 3, a.y + (b.y - a.y) / 3))
p coincident(t == 1 / 3) leg
}
in std.top {
private o := point
fix((0, 0)) o
private rim := circle(center: o) hint(r: 5)
radius(5mm) rim
}
part := solid(std.solids.Prism(face(rim), from: 0mm, to: 20mm))
in std.front {
private k0 := point
private k1 := point
private k2 := point
private k3 := point
private k4 := point
private k5 := point
private k6 := point
fix((3.5, 0)) k0
fix((4.5, -1.5)) k1
fix((8, -1.5)) k2
fix((12, -1)) k3
fix((12, 1)) k4
fix((8, 1.5)) k5
fix((4.5, 1.5)) k6
// each span's ends, where the blend of three consecutive control points puts themprivate j0 := Joint(k6, k0, k1)
private j1 := Joint(k0, k1, k2)
private j2 := Joint(k1, k2, k3)
private j3 := Joint(k2, k3, k4)
private j4 := Joint(k3, k4, k5)
private j5 := Joint(k4, k5, k6)
private j6 := Joint(k5, k6, k0)
// and its inner control points, a third and two thirds of the way along the leg k[i]-k[i+1]private m0 := Third(k0, k1)
private q0 := Third(k1, k0)
private m1 := Third(k1, k2)
private q1 := Third(k2, k1)
private m2 := Third(k2, k3)
private q2 := Third(k3, k2)
private m3 := Third(k3, k4)
private q3 := Third(k4, k3)
private m4 := Third(k4, k5)
private q4 := Third(k5, k4)
private m5 := Third(k5, k6)
private q5 := Third(k6, k5)
private m6 := Third(k6, k0)
private q6 := Third(k0, k6)
private s0 := spline(j0.p, m0.p, q0.p, j1.p)
private s1 := spline(j1.p, m1.p, q1.p, j2.p)
private s2 := spline(j2.p, m2.p, q2.p, j3.p)
private s3 := spline(j3.p, m3.p, q3.p, j4.p)
private s4 := spline(j4.p, m4.p, q4.p, j5.p)
private s5 := spline(j5.p, m5.p, q5.p, j6.p)
private s6 := spline(j6.p, m6.p, q6.p, j0.p)
}
construction bar := solid(std.solids.Prism(face(s0, s1, s2, s3, s4, s5, s6), from: -8mm, to: 8mm))
feed := frame
feed screws(6mm) std.z
construction thread := solid({ p | some t in (-90deg, 1350deg): p in bar at(under: feed) t })
thread cut part
anvilcad left no solid to show.
Time
1.3 ms; CPU time 1.1 ms; peak memory 3.5 MB
Notes
refused anvil-brep has no sweep of a solid and no helical curve: a body screwed along an axis sweeps envelopes of its surfaces under the screw, which it cannot make from its profile sweeps
//! A rod threaded by a bar whose section is a spline.use anvil_brep::Solid;
pubfnbuild() -> Result<Solid, String> {
Err("anvil-brep has no sweep of a solid and no helical curve: a body screwed along an axis sweeps envelopes of its surfaces under the screw, which it cannot make from its profile sweeps".into())
}