Edge/corner masking

bosl2.masking.mask2d_roundover(radius=None, inset=0, excess=0.01, diameter=None, fn=None, fa=None, fs=None)[source]

The 2-D L-shaped cutter cross-section for rounding a 90-degree edge/corner to radius radius.

The origin is the sharp corner to be rounded; the shape extends along +X and +Y (with a small excess skirt past 0 on each) into the material being cut, with a quarter-circle bite of radius radius taken out of the far corner.

Parameters:
  • radius (float | None) – rounding radius

  • inset (float | list[float]) – scalar or [x,y] inset of the rounding center from the corner (default 0)

  • excess (float) – amount the flat sides extend past the origin, for a clean boolean cut (default 0.01)

  • diameter (float | None) – rounding diameter (alternative to radius)

  • fn/fa/fs – arc smoothness overrides

  • fn (int | None)

  • fa (float | None)

  • fs (float | None)

Return type:

list[list[float]]

bosl2.masking.rounding_edge_mask(length=None, radius=None, radius1=None, radius2=None, diameter=None, diameter1=None, diameter2=None, height=None, excess=0.1, fn=None, fa=None, fs=None)[source]

A standalone 3-D edge-rounding cutter of length length, for manual positioning (matching this project’s existing .rotate(…).translate(…) usage rather than going through edge_mask()). Uses the same local-frame convention as mask2d_roundover(): origin at the sharp edge, +X/+Y extending into the material, centered along its own Z axis over length length.

Parameters:
  • length/height – length of the cutter along its axis (default 1)

  • radius (float | None) – rounding radius (both ends)

  • radius1/radius2 – rounding radius at each end, for a tapered cutter

  • diameter/diameter1/diameter2 – rounding diameter (both ends) / each end

  • excess (float) – amount the flat sides extend past the origin (default 0.1)

  • fn/fa/fs – arc smoothness overrides

  • length (float | None)

  • radius1 (float | None)

  • radius2 (float | None)

  • diameter (float | None)

  • diameter1 (float | None)

  • diameter2 (float | None)

  • height (float | None)

  • fn (int | None)

  • fa (float | None)

  • fs (float | None)

Return type:

PyOpenSCAD

bosl2.masking.chamfer_edge_mask(length=1, chamfer=1, excess=0.1)[source]

A standalone 3-D edge-chamfer cutter of length length (BOSL2 chamfer_edge_mask()).

A diamond bar (a square prism rotated 45 degrees, with its vertices chamfer out along each axis – i.e. cylinder(radius=chamfer, $fn=4)), centered on its own Z axis. Position it along a sharp edge and subtract it to bevel the edge by chamfer.

Parameters:
  • length (float) – length of the cutter along its axis (default 1)

  • chamfer (float) – chamfer size – the diamond’s half-diagonal along each axis (default 1)

  • excess (float) – extra length past length so the cut clears the surface (default 0.1)

Return type:

PyOpenSCAD

bosl2.masking.edge_mask(body, edges='ALL', except_edges=None, children=None, size=None, anchor=[0, 0, 0], center=None)[source]

Cut an already-built 3-D edge cutter (e.g. from rounding_edge_mask()) along each selected edge of the box-shaped body.

Parameters:
  • body (PyOpenSCAD) – the box solid to cut

  • edges (str | list) – edges to mask (default “ALL”)

  • except_edges (list | None) – edges to explicitly not mask (BOSL2’s except= synonym)

  • children (PyOpenSCAD | None) – the pre-built 3-D edge cutter (BOSL2’s _children=)

  • size (Sequence[float] | None) – the box’s [x,y,z] size (BOSL2 gets this from $parent_geom)

  • anchor (Sequence[float]) – the anchor body was built with (default CENTER); used only to locate the box center when center isn’t given

  • center (Sequence[float] | None) – the box center in body’s current frame; when given (e.g. from a native bbox query) it’s used directly and anchor is ignored

Return type:

PyOpenSCAD

bosl2.masking.edge_profile(body, edges='ALL', except_edges=None, children=None, size=None, convexity=10, anchor=[0, 0, 0], center=None)[source]

Cut a 2-D mask profile (e.g. from mask2d_roundover()), extruded along the edge’s own length, along each selected edge of the box-shaped body.

Parameters:
  • body (PyOpenSCAD) – the box solid to cut

  • edges (str | list) – edges to mask (default “ALL”)

  • except_edges (list | None) – edges to explicitly not mask

  • children (Sequence[Sequence[float]] | None) – the 2-D mask cross-section path (BOSL2’s _children=)

  • size (Sequence[float] | None) – the box’s [x,y,z] size

  • convexity (int) – accepted for signature compatibility; unused (no rotate_extrude needed here)

  • anchor (Sequence[float]) – the anchor body was built with (default CENTER); used only when center isn’t given

  • center (Sequence[float] | None) – the box center in body’s current frame; when given it’s used directly

Return type:

PyOpenSCAD

bosl2.masking.edge_profile_asym(body, edges='ALL', except_edges=None, children=None, size=None, convexity=10, anchor=[0, 0, 0], center=None)

Cut a 2-D mask profile (e.g. from mask2d_roundover()), extruded along the edge’s own length, along each selected edge of the box-shaped body.

Parameters:
  • body (PyOpenSCAD) – the box solid to cut

  • edges (str | list) – edges to mask (default “ALL”)

  • except_edges (list | None) – edges to explicitly not mask

  • children (Sequence[Sequence[float]] | None) – the 2-D mask cross-section path (BOSL2’s _children=)

  • size (Sequence[float] | None) – the box’s [x,y,z] size

  • convexity (int) – accepted for signature compatibility; unused (no rotate_extrude needed here)

  • anchor (Sequence[float]) – the anchor body was built with (default CENTER); used only when center isn’t given

  • center (Sequence[float] | None) – the box center in body’s current frame; when given it’s used directly

Return type:

PyOpenSCAD

bosl2.masking.corner_profile(body, corners='ALL', except_corners=None, radius=None, diameter=None, size=None, children=None, convexity=10, anchor=[0, 0, 0], center=None, fn=None, fa=None, fs=None)[source]

Round each selected corner of the box-shaped body to radius radius (cube-octant-minus-sphere).

Parameters:
  • body (PyOpenSCAD) – the box solid to cut

  • corners (str | list) – corners to mask – “ALL”/”NONE”, a face vector (all corners on that face), or a corner vector (default “ALL”)

  • except_corners (list | None) – corners to explicitly not mask

  • radius (float | None) – rounding radius

  • diameter (float | None) – rounding diameter (alternative to radius)

  • size (Sequence[float] | None) – the box’s [x,y,z] size

  • children (Sequence[Sequence[float]] | None) – accepted for call-site compatibility with BOSL2’s _children=; unused (this port always uses the cube-minus-sphere construction, which is only exactly equivalent to mask2d_roundover(), the only 2-D mask this project uses)

  • convexity (int) – accepted for signature compatibility; unused

  • anchor (Sequence[float]) – the anchor body was built with (default CENTER); used only when center isn’t given

  • center (Sequence[float] | None) – the box center in body’s current frame; when given it’s used directly

  • fn/fa/fs – arc smoothness overrides

  • fn (int | None)

  • fa (float | None)

  • fs (float | None)

Return type:

PyOpenSCAD

bosl2.masking.face_profile(body, faces='ALL', radius=None, diameter=None, size=None, children=None, convexity=10, anchor=[0, 0, 0], center=None, fn=None, fa=None, fs=None)[source]

Round all edges and corners bounding the given face(s) of the box-shaped body to radius radius.

Equivalent to edge_profile(faces) followed by corner_profile(faces, radius).

Parameters:
  • body (PyOpenSCAD) – the box solid to cut

  • faces (str | list) – face(s) to round the border of, e.g. TOP, or “ALL” (default “ALL”)

  • radius (float | None) – rounding radius

  • diameter (float | None) – rounding diameter (alternative to radius)

  • size (Sequence[float] | None) – the box’s [x,y,z] size

  • children (Sequence[Sequence[float]] | None) – the 2-D mask cross-section path used for the edges (BOSL2’s _children=); defaults to mask2d_roundover(radius) if not given

  • convexity (int) – accepted for signature compatibility; unused

  • anchor (Sequence[float]) – the anchor body was built with (default CENTER); used only when center isn’t given

  • center (Sequence[float] | None) – the box center in body’s current frame; when given it’s used directly

  • fn/fa/fs – arc smoothness overrides

  • fn (int | None)

  • fa (float | None)

  • fs (float | None)

Return type:

PyOpenSCAD