A rod, the cylinder of radius 5 about the z axis from z = 0 to z = 20, threaded by a pointed cone that points at the rod's axis, carried along a screw, as an engraving bit chases a thread.
The cone's axis is the x axis and its point is (4, 0, 0), 1 inside the rod. It opens away from the rod at 60° (each side 30° from its axis) to a flat base at x = 12, of radius 8 tan 30°.
The screw is about the z axis: the cone 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, so that all of it within 5 of the z axis is below the rod) to a turn of 1350° (raised 22.5, all of that above it). Cut from the rod everything the cone passes through.
The cone's point lies on its axis, and the groove's root is the helix it runs along: the contact on each side runs down a root to the point and back up the other.
expected
closed form
volume
1513.245603
no closed form: cad-kernel, next.BREP and cadrs agree to 6e-10; the mean of their values
area
878.8830388
no closed form: cad-kernel, next.BREP and cadrs agree to 2e-9; the mean of their values
Drawing
TopIsometricFrontRight
Third-angle projection, the three views at one scale. Drawn from cadrs'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
3.12 s; CPU time 10.2 s; peak memory 24.4 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
1513.245593
1513.245603
6.3e-09
area
878.8830324
878.8830388
7.3e-09
agrees with
kentron, next.BREP, cadrs, springrep
mesh
13670 triangles, closed
centre of gravity
(-0.00711441, -0.0123225, 10) its STEP's solid
inertia
about it, of unit density: Ixx 59616.1; Iyy 59639; Izz 18372.1; Ixy 19.8024; Iyz -51.876; Izx 89.8518
//! A rod, the cylinder of radius 5 about z from z = 0 to 20, threaded by a pointed cone — its axis//! the x axis, its point (4, 0, 0), opening at 60° to a flat base at x = 12 — screwed about z,//! right-handed and rising 6 a turn, from a turn of −90° to 1350°.//!//! The kernel's closed sweep (`swept::closed::cut_from`) takes the cone whole: its closed class//! takes under a screw a cone only about an axis along the screw's, and refuses this one, which//! stands square to it (`Unbuilt::Curved`: its contact screwed is curved past what the candidates//! hold); since 0.10.0 such a tool goes the contact's road — the side's contact, run on to the//! cone's point, and the base's sharp rim's fan 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::{cone, disc, prism};
use cad_kernel::geom::{tolerance, V};
use cad_kernel::swept::closed::cut_from;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
constROD_RADIUS: f64 = 5.;
constROD_LENGTH: f64 = 20.;
constPOINT: V = [4., 0., 0.];
constLENGTH: f64 = 8.;
/// Each side of the cone from its axis, in degrees.constHALF_ANGLE: f64 = 30.;
/// How far the screw rises a whole turn, and its start and stop, in degrees.constRISE: f64 = 6.;
constFROM: f64 = -90.;
constTO: f64 = 1350.;
/// How closely the cone is meshed for the sweep's membership reads.constBAR: f64 = 0.002;
pubfnbuild() -> Result<Brep, String> {
let up = [0., 0., 1.];
let rod = prism(&disc([0.; 3], up, ROD_RADIUS), 0., ROD_LENGTH)?;
let base = LENGTH * HALF_ANGLE.to_radians().tan();
let tool = cone(POINT, [1., 0., 0.], 0., base, LENGTH)?;
// the screw about z: a radian a radian of the roll, rising `RISE` a turnlet path = Trajectory::Twist(Screw { origin: [0.; 3], axis: up, ratio: 1., advance: RISE });
let size = rod.size().max(tool.size());
cut_from(&rod, &tool, &path, [FROM.to_radians(), TO.to_radians()], BAR, tolerance(size))
.map_err(|why| format!("the cone's sweep not built: {why:?}"))
}
occt left no solid to show.
Time
618 ms; CPU time 618 ms; peak memory 356.6 MB
Notes
refused occt has no sweep of a solid: it carries faces along a screw, and the cone touches what it sweeps along a curve crossing its rulings, which the screw's rise makes no plane section of it, and which occt has no operation to find
"""A rod threaded by a cone's point. A rod, the cylinder of radius 5 about the z axis from z = 0 to
z = 20, threaded by a pointed cone that points at the rod's axis, carried along a screw, as an
engraving bit chases a thread.
The cone's axis is the x axis and its point is (4, 0, 0), 1 inside the rod. It opens away from the
rod at 60° (each side 30° from its axis) to a flat base at x = 12, of radius 8 tan 30°.
The screw is about the z axis: the cone 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, so that all of it within 5
of the z axis is below the rod) to a turn of 1350° (raised 22.5, all of that above it). Cut from
the rod everything the cone passes through.
The cone's point lies on its axis, and the groove's root is the helix it runs along: the contact on
each side runs down a root to the point and back up the other."""from bench importRefuseddefbuild():
# The cone's axis meets the screw's, but the screw also rises. At the point of its side at# distance s from the point along its axis and angle t round it, the normal is square to# the velocity ẑ × p + kẑ where tan t = −A(s)/(k cos 30°), A linear in s: a curve that# crosses the cone's rulings, no plane section and none of its circles. OCCT sweeps no# solid, and a face it carries along the screw (BRepOffsetAPI_MakePipeShell) 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 cone ""touches what it sweeps along a curve crossing its rulings, which the screw's ""rise makes no plane section of it, and 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.
Time
63 ms; CPU time 80 ms; peak memory 36.4 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
1513.245603
1513.245603
3.2e-10
area
878.8830394
878.8830388
5.7e-10
agrees with
cad-kernel, next.BREP, cadrs, springrep
centre of gravity
(-0.00711441, -0.0123225, 10) its STEP's solid
inertia
about it, of unit density: Ixx 59616.1; Iyy 59639; Izz 18372.1; Ixy 19.8024; Iyz -51.876; Izx 89.8519
STEP
B-rep advanced faces, each on a surface AUTOMOTIVE_DESIGN
//! A rod, the cylinder of radius 5 about the z axis from z = 0 to z = 20, threaded by a pointed//! cone carried along a screw: the cone about the x axis with its point at (4, 0, 0), opening away//! from the rod at 60° to a flat base at x = 12, screwed about the z axis, right-handed, rising 6//! a turn, from a turn of −90° to +1350°. Everything the cone passes through, cut.//!//! kentron's cut by a motion (`sweep::cut_by_motion`) takes the cone as the solid of revolution//! of its meridian triangle and the screw as one step. It takes a tool wholly beyond the rod's//! ends where the motion starts and ends, and the cone's base, 4.6 across, is not: but every//! point of the cone with x > 5 lies more than 5 from the z axis wherever the screw carries it,//! so never enters the rod. The cone is cut off at x = 6, its base there 2 tan 30° < 1.5 across,//! and the screw's lowering and raising carry that clear.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 rod = Blank::Disc { frame: Frame::WORLD, radius: 5.0, height: 20.0 };
// The meridian in (distance from the x axis, x): the point, the base's rim at x = 6, its// centre.let (point, rim, centre) = (Point2::new(0.0, 4.0), Point2::new(2.0 * (PI / 6.0).tan(), 6.0), Point2::new(0.0, 6.0));
let meridian = vec![
MeridianPiece::Line { from: point, to: rim },
MeridianPiece::Line { from: rim, to: centre },
MeridianPiece::Line { from: centre, to: point },
];
let cone = Tool::Revolved { frame: Frame::new(p(0.0, 0.0, 0.0), Direction::X, Direction::Z), meridian };
// The screw, t its turn in radians: rising 6 a turn.let screw = MotionStep { axis: Axis::new(p(0.0, 0.0, 0.0), Direction::Z), turn: 1.0, advance: 6.0 / TAU };
let motion = Motion { steps: vec![screw], from: (-90f64).to_radians(), to: 1350f64.to_radians() };
sweep::cut_by_motion(m, &rod, &cone, &motion)
}
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.7 ms; CPU time 1.5 ms; peak memory 4.5 MB
Notes
refused no layer (solidcraft-kernel, solidcore-ops, solidcore) has a sweep of a solid or an envelope: the cone's side meets the screw square-on along a space curve, no line of it and in no plane, so no planar section screwed by either layer's screw sweep (`sweep_helix`, `screw_sweep`) makes the groove's walls
//! Refused. The groove's walls are what the cone's side sweeps where it meets the screw's motion//! square-on. On a cone pointing across the screw's axis that contact is a curve on the side, a//! point on each of its lines found from the screw's lead, which is neither a line of the cone nor//! in any plane, so no section of the cone 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 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 cone's side meets the \
screw square-on along a space curve, no line of it and in no plane, so no planar \
section screwed by either layer's screw sweep (`sweep_helix`, `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.5 ms; CPU time 3.3 ms; peak memory 11.2 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 cone's point.//// 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
41 ms; CPU time 41 ms; peak memory 15.3 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Its volume and area are its STEP file's, as the harness measures them from the file's exact geometry (harness/mass/); its triangles are Open CASCADE's mesh of the file, for the pictures.
Data
its STEP's
expected
rel. error
volume
1513.245603
1513.245603
4.1e-13
area
878.8830393
878.8830388
5.1e-10
agrees with
cad-kernel, kentron, cadrs, springrep
centre of gravity
(-0.00711441, -0.0123225, 10) its STEP's solid
inertia
about it, of unit density: Ixx 59616.1; Iyy 59639; Izz 18372.1; Ixy 19.8024; Iyz -51.876; Izx 89.8519
STEP
B-rep advanced faces, each on a surface AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF
//! A rod threaded by a pointed cone carried along a screw about its axis.//!//! The kernel's sweep of a solid (`sweep_solid_within`): the cone is a solid of revolution about//! the x axis, its meridian the triangle from its point (4, 0, 0) out to its base of radius 8 tan//! 30° at x = 12, swept by the screw about the z axis that rises 6 a turn, from −90° to +1350°.//! Asked for within 5.2 of the z axis from z = −0.5 to 20.5, which holds the rod and which neither//! end position reaches (lowered 1.5, the cone within 5.2 of the axis rises at most to z ≈ −0.81);//! cut from the rod.usecrate::solids::p;
usecrate::Refusal;
use brep_kernel::{
boolean_operation_nary, make_cylinder_brep, sweep_clip_less, sweep_solid_within, BooleanOperation, BrepSolid,
OutlinePiece, ScrewStep, SolidMotion, SweepClip, SweptTool,
};
#[allow(unused_imports)]use std::f64::consts::{PI, TAU};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let z = p(0.0, 0.0, 1.0);
let rod = make_cylinder_brep(p(0.0, 0.0, 0.0), z, 5.0, 20.0)?;
let tool = SweptTool::Revolved {
axis_origin: p(4.0, 0.0, 0.0),
axis_direction: p(1.0, 0.0, 0.0),
radial: p(0.0, 0.0, 1.0),
meridian: {
let base = 8.0 * (PI / 6.0).tan();
vec![
OutlinePiece::Line { from: [0.0, 0.0], to: [base, 8.0] },
OutlinePiece::Line { from: [base, 8.0], to: [0.0, 8.0] },
OutlinePiece::Line { from: [0.0, 8.0], to: [0.0, 0.0] },
]
},
};
let screw = SolidMotion {
steps: vec![ScrewStep { axis_origin: p(0.0, 0.0, 0.0), axis_direction: z, turn: 1.0, advance: 6.0 / TAU }],
from: (-90f64).to_radians(),
to: 1350f64.to_radians(),
};
let around_rod = SweepClip {
axis_origin: p(0.0, 0.0, 0.0),
axis_direction: z,
reference: p(1.0, 0.0, 0.0),
radius: [0.0, 5.2],
axial: [-0.5, 20.5],
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], ..around_rod.clone() };
ifletSome(mut bodies) = sweep_clip_less(&tool, &screw, &rod_clip)? {
if bodies.len() == 1 {
returnOk(bodies.remove(0));
}
}
operands.extend(sweep_solid_within(&tool, &screw, &around_rod)?);
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
339 ms; CPU time 920 ms; peak memory 22.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
1513.245602
1513.245603
9.4e-11
area
878.8830393
878.8830388
5.7e-10
agrees with
cad-kernel, kentron, next.BREP, springrep
mesh
15076 triangles, closed
centre of gravity
(-0.00711441, -0.0123225, 10) its STEP's solid
inertia
about it, of unit density: Ixx 59616.1; Iyy 59639; Izz 18372.1; Ixy 19.8024; Iyz -51.876; Izx 89.8519
//! A rod (the cylinder of radius 5 about the z axis from z = 0 to z = 20) threaded by a pointed cone//! (its point at (4, 0, 0), its axis along +x, opening at 60° to a flat base at x = 12) screwed//! about the z axis, rising 6 a turn, from a turn of −90° to 1350°.//!//! The cone is cadrs's cone primitive; 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 cone, 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::{cone, p3, v3};
usecrate::shared::swept::{cut_swept, near_axis, rod, screw, z_axis};
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let r = 8.0 * 30f64.to_radians().tan();
let tool = cone(k, p3(12.0, 0.0, 0.0), v3(-1.0, 0.0, 0.0), r, 0.0, 8.0)?;
let tool = near_axis(k, tool, 5.5)?;
let rd = rod(k)?;
cut_swept(k, rd, tool, &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
675 ms; CPU time 675 ms; peak memory 40.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
1513.245604
1513.245603
6.6e-10
area
878.8830394
878.8830388
6.8e-10
agrees with
cad-kernel, kentron, next.BREP, cadrs
mesh
23732 triangles, closed
centre of gravity
(-0.00711441, -0.0123225, 10) its STEP's solid
inertia
about it, of unit density: Ixx 59616.1; Iyy 59639; Izz 18372.1; Ixy 19.8024; Iyz -51.876; Izx 89.8519
//! The rod of radius 5 about the z axis from z = 0 to 20 less everything a cone pointed at (4,//! 0, 0) along the x axis, opening at 60°, passes through as it is screwed about the z axis,//! rising 6 a turn.use springrep::boolean::difference;
use springrep::math::{Frame, Vec3};
use springrep::primitive::cone;
use springrep::sweep::solid;
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{deg, rod, screwing, v3, within};
pubfnbuild() -> Result<Brep, String> {
let point = Frame::new(v3(4.0, 0.0, 0.0), Vec3::X, Vec3::Y).map_err(e)?;
let bit = cone(&point, 0.0, 8.0 * deg(30.0).tan(), 8.0, "bit").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(&bit, 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
647 ms; CPU time 996 ms; peak memory 47.7 MB
Notes
wrong volume 1513.24033489 against 1513.24560252 (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
1513.240335
1513.245603
3.5e-06
area
878.8831905
878.8830388
1.7e-07
agrees with
no other kernel
mesh
38970 triangles, closed
centre of gravity
(-0.00711503, -0.0123235, 10) its STEP's solid
inertia
about it, of unit density: Ixx 59615.9; Iyy 59638.8; Izz 18372; Ixy 19.804; Iyz -51.8806; Izx 89.8594
// A rod, the cylinder of radius 5 about the z axis from z = 0 to z = 20; a pointed cone about the x// axis, its point (4, 0, 0), opening away from the rod at 60 degrees (each side 30 degrees from its// axis) to a flat base at x = 12, a turn of its half-section in the front plane; carried by a screw// about the z axis that turns right-handed (from +x toward +y) and rises 6 a turn, from a turn of// -90 degrees to one of 1350, and everything it passes through cut from the rod.unit mm
use std
use std.solids
use std.solids (cut)
use std.motion (screws)
in std.top {
centreline := point
fix((0, 0)) centreline
skin := circle(center: centreline) hint(r: 5)
radius(5) skin
}
part := solid(std.solids.Prism(face(skin), from: 0mm, to: 20mm))
in std.front {
tip := point
rim := point hint((12, 4.6))
centre := point hint((12, 0))
fix((4, 0)) tip
tip distance(8) centre
half := (flank := line(tip, rim)) -> vertical line(rim, centre) ->
horizontal (axle := line(centre, tip)) -> close
flank angle(30deg) std.x
}
cone := solid(std.solids.Revolution(half, about: axle))
climb := frame
climb screws(6mm) std.z
groove := solid({ p | some t in (-90deg, 1350deg): p in cone at(under: climb) t })
groove cut part
anvilcad left no solid to show.
Time
1.2 ms; CPU time 970 µs; peak memory 3.4 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 cone's point.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())
}