The L-shaped plate whose outline in the xy plane is the polygon through (0, 0), (20, 0), (20, 5), (5, 5), (5, 15) and (0, 15), extruded 8 along +z. Grow it by 1 with its edges kept sharp: move each face 1 outward along its normal, and extend the moved faces until they meet, so that no round is added and every edge stays where its two faces meet.
The grown plate is the outline through (−1, −1), (21, −1), (21, 6), (6, 6), (6, 16) and (−1, 16), extruded from z = −1 to z = 9.
† 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
110 ms; CPU time 152 ms; peak memory 15.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.
//! The L-shaped plate through (0, 0), (20, 0), (20, 5), (5, 5), (5, 15), (0, 15), 8 thick, grown//! by 1, its edges kept sharp: its faces moved out and extended until they meet.usecrate::sketch::l_block;
use cad_kernel::offset::{grown, Join};
use cad_kernel::topo::Brep;
pubfnbuild() -> Result<Brep, String> {
grown(&l_block()?, 1., Join::Sharp)
}
Time
651 ms; CPU time 650 ms; peak memory 368.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.
"""An L-shaped plate grown_sharp. The L-shaped plate whose outline in the xy plane is the polygon through
(0, 0), (20, 0), (20, 5), (5, 5), (5, 15) and (0, 15), extruded 8 along +z."""fromOCP.BRepBuilderAPIimportBRepBuilderAPI_MakeFace, BRepBuilderAPI_MakePolygonfromOCP.BRepPrimAPIimportBRepPrimAPI_MakePrismfromOCP.GeomAbsimportGeomAbs_IntersectionfromOCP.gp import gp_Pnt, gp_Vec
from offset import offset
OUTLINE = [(0, 0), (20, 0), (20, 5), (5, 5), (5, 15), (0, 15)]
THICKNESS = 8DISTANCE = 1defbuild():
polygon = BRepBuilderAPI_MakePolygon()
for x, y inOUTLINE:
polygon.Add(gp_Pnt(x, y, 0))
polygon.Close()
outline = BRepBuilderAPI_MakeFace(polygon.Wire()).Face()
plate = BRepPrimAPI_MakePrism(outline, gp_Vec(0, 0, THICKNESS)).Shape()
returnoffset(plate, DISTANCE, GeomAbs_Intersection)
Time
2.7 ms; CPU time 2.5 ms; peak memory 7.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.
//! The L-shaped plate through (0, 0), (20, 0), (20, 5), (5, 5), (5, 15) and (0, 15), extruded 8//! along +z, grown by 1 with its edges kept sharp: each face moved 1 outward, the faces extended to//! meet.use arris::geom::{Profile, ProfileLoop, ProfileSegment};
use arris::math::{Control, Frame, Point2, Vec3};
use arris::ops::{extrude, offset_faces, OpError};
use arris::topo::{Body, Model};
constOUTLINE: [(f64, f64); 6] =
[(0.0, 0.0), (20.0, 0.0), (20.0, 5.0), (5.0, 5.0), (5.0, 15.0), (0.0, 15.0)];
constTHICKNESS: f64 = 8.0;
constGROWTH: f64 = 1.0;
pubfnbuild(m: &mutModel) -> Result<Body, OpError> {
let corner = |(x, y): (f64, f64)| Point2::new(x, y);
// the outline closed back to its first cornerlet segments = OUTLINE[1..]
.iter()
.chain(&OUTLINE[..1])
.map(|&p| ProfileSegment::LineTo(corner(p)))
.collect();
let sketch = Profile {
plane: Frame::world(),
outer: ProfileLoop::Path { start: corner(OUTLINE[0]), segments },
holes: vec![],
};
let (plate, _) = extrude(m, &sketch, Vec3::z(), THICKNESS, &Control::NONE)?;
// every face moved out along its normal, each edge where the moved faces meetlet faces = m.faces(plate)?;
let (grown, _) = offset_faces(m, plate, &faces, GROWTH, &Control::NONE)?;
Ok(grown)
}
Time
46 ms; CPU time 46 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.
//! The L-shaped plate, the outline through (0, 0), (20, 0), (20, 5), (5, 5), (5, 15) and (0, 15)//! extruded 8 along +z, grown by 1 with its edges kept sharp: each face moved 1 outward and the//! moved faces extended until they meet.usecrate::shared::offset::l_plate;
use kentron::offset::{self, Join};
use kentron::topology::{Model, Shape};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let plate = l_plate(m)?;
offset::shape(m, plate, 1.0, Join::Intersection)
}
vcad left no solid to show.
Time
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
Time
79 ms; CPU time 78 ms; peak memory 48.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.
//! Offset Face (`offset_faces`) moves the faces picked along their outward normals and extends//! them to meet, keeping the body's topology: with every face of the plate picked, that is the//! plate grown with its edges kept sharp.usecrate::solids::*;
/// The L plate: its outline in the xy plane extruded from z = 0 to z = 8.pubfnl_plate() -> R<Body> {
let outline =
polygon(&[(0.0, 0.0), (20.0, 0.0), (20.0, 5.0), (5.0, 5.0), (5.0, 15.0), (0.0, 15.0)]);
extrude(&Plane::XY, outline, 0.0, 8.0)
}
/// A point on each of the plate's eight faces: its bottom and top, then its sides in the/// outline's order.pubfnl_plate_faces() -> [Vec3; 8] {
[
v3(2.0, 2.0, 0.0),
v3(2.0, 2.0, 8.0),
v3(10.0, 0.0, 4.0),
v3(20.0, 2.5, 4.0),
v3(12.0, 5.0, 4.0),
v3(5.0, 10.0, 4.0),
v3(2.5, 15.0, 4.0),
v3(0.0, 7.0, 4.0),
]
}
pubfnbuild() -> R<Body> {
solidcraft_kernel::offset_faces(&l_plate()?, &l_plate_faces(), 1.0)
}
Time
1.5 ms; CPU time 1.3 ms; peak memory 4.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.
//! The L-shaped plate (its outline through (0, 0), (20, 0), (20, 5), (5, 5), (5, 15) and (0, 15),//! extruded 8 along +z) grown by 1 with brepkit's offset, whose default joint extends the moved//! faces until they meet, so every edge stays sharp.use brepkit_operations::offset_v2::offset_solid_v2;
use brepkit_topology::solid::SolidId;
use brepkit_topology::Topology;
usecrate::solids::offset::l_block;
usecrate::Refusal;
pubfnbuild(topo: &mutTopology) -> Result<SolidId, Refusal> {
let plate = l_block(topo)?;
Ok(offset_solid_v2(topo, plate, 1.0)?)
}
Time
7 ms; CPU time 8.1 ms; peak memory 21.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.
// The L-shaped plate: the outline through (0, 0), (20, 0), (20, 5), (5, 5), (5, 15), (0, 15),// extruded 8 up, grown by 1 with its edges kept sharp (faces extended to meet).let m = model();
let l = m.profile(xy())
.polygon([[0.0, 0.0], [20.0, 0.0], [20.0, 5.0], [5.0, 5.0], [5.0, 15.0], [0.0, 15.0]])
.sketch("outline").extrude(blind(8.0));
l = l.offset_solid(1.0, #{ join: "intersection", label: "grown" });
m
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
8.7 ms; CPU time 8.5 ms; peak memory 18.5 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Its volume and area are its STEP file's, as the harness measures them from the file's exact geometry (harness/mass/); its triangles are Open CASCADE's mesh of the file, for the pictures.
//! The L through (0, 0), (20, 0), (20, 5), (5, 5), (5, 15), (0, 15), extruded 8 along +z, grown by//! 1 with its edges kept sharp: every face moved 1 outward and the moved faces extended until they//! meet, the L through (−1, −1), (21, −1), (21, 6), (6, 6), (6, 16), (−1, 16) from z = −1 to 9.usecrate::solids::offset::sharp;
usecrate::solids::{p, polygon};
usecrate::Refusal;
use brep_kernel::{extrude_profile_brep, BrepSolid};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let l = polygon(&[
p(0.0, 0.0, 0.0), p(20.0, 0.0, 0.0), p(20.0, 5.0, 0.0),
p(5.0, 5.0, 0.0), p(5.0, 15.0, 0.0), p(0.0, 15.0, 0.0),
])?;
let block = extrude_profile_brep(&l, p(0.0, 0.0, 1.0), 8.0)?;
Ok(sharp(&block, 1.0)?)
}
Time
62 ms; CPU time 61 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.
//! The L-shaped plate, the polygon (0, 0), (20, 0), (20, 5), (5, 5), (5, 15), (0, 15) extruded//! 8 up, grown by 1 with its edges kept sharp: every face moved 1 outward, the moved faces//! extended until they meet. The plate is extruded from its outline and its eight faces offset//! 1 out of it by geop's face offset, which rebuilds the solid where the moved faces meet; each//! face is picked by a point on it.usecrate::shared::hollow::{offset_faces, prism};
usecrate::{Bench, Refusal};
pubfnbuild(b: &mutBench) -> Result<(), Refusal> {
let outline = [[0.0, 0.0], [20.0, 0.0], [20.0, 5.0], [5.0, 5.0], [5.0, 15.0], [0.0, 15.0]];
prism(b, "plate", &outline, 8.0)?;
let faces = [
[2.0, 2.0, 0.0],
[2.0, 2.0, 8.0],
[10.0, 0.0, 4.0],
[20.0, 2.0, 4.0],
[10.0, 5.0, 4.0],
[5.0, 10.0, 4.0],
[2.0, 15.0, 4.0],
[0.0, 7.0, 4.0],
];
offset_faces(b, "grow", &faces, 1.0)
}
Time
2.3 ms; CPU time 2 ms; peak memory 6.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.
//! The L-shaped plate whose outline is the polygon through (0, 0), (20, 0), (20, 5), (5, 5),//! (5, 15) and (0, 15), extruded 8 along +z, grown by 1 with its edges kept sharp: each face moved//! 1 out along its normal and the moved faces extended until they meet.//!//! The outline extruded, then cadrs's offset with sharp edges.usecrate::bench::extrude;
usecrate::shared::offset::offset;
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel, Loop, Plane, Profile};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let outline =
Loop::polygon(&[[0.0, 0.0], [20.0, 0.0], [20.0, 5.0], [5.0, 5.0], [5.0, 15.0], [0.0, 15.0]]);
let plate = extrude(k, &Profile::of(Plane::xy(0.0), vec![outline]), 8.0)?;
offset(k, plate, 1.0, true)
}
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.1 ms; CPU time 1.6 ms; peak memory 7.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.
//! The L-shaped plate on the outline (0, 0), (20, 0), (20, 5), (5, 5), (5, 15), (0, 15), 8 thick,//! with every face moved 1 outward and the moved faces run on until they meet, no round added://! springrep's face offset, which keeps the solid's topology.use std::collections::HashMap;
use springrep::edit::offset_faces;
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::offset::l_block;
pubfnbuild() -> Result<Brep, String> {
let plate = l_block()?;
let every_face: HashMap<_, _> = plate.face_ids().map(|f| (f, 1.)).collect();
offset_faces(&plate, &every_face).map_err(e)
}
Time
38 ms; CPU time 39 ms; peak memory 24.3 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no offset keeping its edges sharp: the moved outline drawn, each edge 1 from its original
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.
// An L-shaped plate grown by 1 with its edges kept sharp. Solvent's grown body (`std.rounds.Grown`,// the points within 1) rounds every convex edge, and it has no offset that extends the moved faces// until they meet, so the moved outline is drawn instead: in the top plane (x, y), beside the// plate's outline through (0, 0), (20, 0), (20, 5), (5, 5), (5, 15) and (0, 15), each of its edges// moved 1 outward, stated as the edge 1 from the plate's edge it moves (the runs keep their// directions, and meet where the moved lines cross); the prism over it runs from z = −1 to z = 9,// the plate's caps at 0 and 8 each moved 1 out.unit mm
use std
use std.solids
grow := 1mm
thick := 8mmin std.top {
a := point
b := point hint((20, 0))
c := point hint((20, 5))
d := point hint((5, 5))
e := point hint((5, 15))
f := point hint((0, 15))
horizontal (ab := line(a, b)) -> vertical (bc := line(b, c)) -> horizontal (cd := line(c, d)) ->
vertical (de := line(d, e)) -> horizontal (ef := line(e, f)) -> vertical (fa := line(f, a)) -> close
fix((0, 0)) a
a distance(20) b
b distance(5) c
c distance(15) d
f distance(15) a
// the same outline, each edge moved `grow` outward
a1 := point hint((-1, -1))
b1 := point hint((21, -1))
c1 := point hint((21, 6))
d1 := point hint((6, 6))
e1 := point hint((6, 16))
f1 := point hint((-1, 16))
moved := horizontal (ab1 := line(a1, b1)) ->
vertical (bc1 := line(b1, c1)) ->
horizontal (cd1 := line(c1, d1)) -> vertical (de1 := line(d1, e1)) ->
horizontal (ef1 := line(e1, f1)) -> vertical (fa1 := line(f1, a1)) -> close
ab distance(grow) ab1
bc distance(grow) bc1
cd distance(grow) cd1
de distance(grow) de1
ef distance(grow) ef1
fa distance(grow) fa1
}
part := solid(std.solids.Prism(moved, from: -grow, to: thick + grow))
Time
1.5 ms; CPU time 1.3 ms; peak memory 4.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.
//! The L through (0, 0), (20, 0), (20, 5), (5, 5), (5, 15), (0, 15) extruded 8 up z, grown by 1//! with its edges kept sharp: every face moved 1 outward, the moved faces extended until they meet.use anvil_brep::Solid;
usecrate::shared::{offset, prism};
pubfnbuild() -> Result<Solid, String> {
let l = prism(&[(0., 0.), (20., 0.), (20., 5.), (5., 5.), (5., 15.), (0., 15.)], 0., 8.)?;
offset(&l, 1.)
}