Edge/corner masking

Cut rounded edge/corner/face profiles into a cuboid (BOSL2 masks2d/masks3d).

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

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

Parameters:
radius : float | None

Rounding radius.

inset : float | tuple[float, 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 : int | None

Arc smoothness overrides.

fa : float | None

Arc smoothness overrides.

fs : float | None

Arc smoothness overrides.

Returns:

A Path2D of the 2-D cutter cross-section.

Return type:

Path2D

pybosl2.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]

Return a standalone 3-D edge-rounding cutter of length length, for manual positioning.

Parameters:
length : float | None

Length of the cutter along its axis (default 1).

height : float | None

Length of the cutter along its axis (default 1).

radius : float | None

Rounding radius (both ends).

radius1 : float | None

Rounding radius at the first end, for a tapered cutter.

radius2 : float | None

Rounding radius at the second end, for a tapered cutter.

diameter : float | None

Rounding diameter (both ends).

diameter1 : float | None

Rounding diameter at the first end.

diameter2 : float | None

Rounding diameter at the second end.

excess : float

Amount the flat sides extend past the origin (default 0.1).

fn : int | None

Arc smoothness overrides.

fa : float | None

Arc smoothness overrides.

fs : float | None

Arc smoothness overrides.

Returns:

A Bosl2Solid cutter.

Return type:

Bosl2Solid

pybosl2.masking.chamfer_edge_mask(length=1.0, chamfer=1.0, excess=0.1)[source]

Return a standalone 3-D edge-chamfer cutter of length length.

A diamond bar (square prism rotated 45°) centered on its own Z axis.

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).

Returns:

A Bosl2Solid cutter.

Return type:

Bosl2Solid

pybosl2.masking.edge_mask(body, edges=Anchor.ALL, except_edges=None, children=None, size=None, anchor=Anchor.CENTER, center=None, return_cutter=False)[source]

Cut a 3-D edge cutter along each selected edge of the box-shaped body.

Parameters:
body : Bosl2Solid

The box solid to cut.

edges : EdgeAtom | list[EdgeAtom]

Edges to mask — an EdgePlane, a string, a vector, or a list thereof (default "ALL").

except_edges : list[EdgeAtom] | None

Edges to explicitly not mask.

children : Bosl2Solid | None

The pre-built 3-D edge cutter.

size : tuple[float, float, float] | None

The box’s (x, y, z) size.

anchor : Anchor | Point

The anchor body was built with (default CENTER).

center : Point | None

The box center in body’s current frame.

return_cutter : bool

If True, returns the generated cutter shape instead of cutting it.

Return type:

Bosl2Solid | None

pybosl2.masking.edge_profile(body, edges=Anchor.ALL, except_edges=None, children=None, size=None, convexity=10, anchor=Anchor.CENTER, center=None, return_cutter=False)[source]

Cut a 2-D mask profile extruded along each selected edge of the box-shaped body.

Parameters:
body : Bosl2Solid

The box solid to cut.

edges : EdgeAtom | list[EdgeAtom]

Edges to mask (default "ALL").

except_edges : list[EdgeAtom] | None

Edges to explicitly not mask.

children : Path2D | None

The 2-D mask cross-section Path2D.

size : tuple[float, float, float] | None

The box’s (x, y, z) size.

convexity : int

Accepted for signature compatibility; unused.

anchor : Anchor | Point

The anchor body was built with (default CENTER).

center : Point | None

The box center in body’s current frame.

return_cutter : bool

If True, returns the generated cutter shape instead of cutting it.

Return type:

Bosl2Solid | None

pybosl2.masking.corner_profile(body, corners=Anchor.ALL, except_corners=None, radius=None, diameter=None, size=None, children=None, convexity=10, anchor=Anchor.CENTER, center=None, fn=None, fa=None, fs=None, return_cutter=False)[source]

Round each selected corner of the box-shaped body to radius radius.

Parameters:
body : Bosl2Solid

The box solid to cut.

corners : Anchor

Corners to mask — "ALL"/"NONE", a face vector, or a corner vector.

except_corners : list[Anchor] | None

Corners to explicitly not mask.

radius : float | None

Rounding radius.

diameter : float | None

Rounding diameter (alternative to radius).

size : tuple[float, float, float] | None

The box’s (x, y, z) size.

children : Path2D | None

Accepted for call-site compatibility; unused.

convexity : int

Accepted for signature compatibility; unused.

anchor : Anchor | Point

The anchor body was built with (default CENTER).

center : Point | None

The box center in body’s current frame.

fn : int | None

Arc smoothness overrides.

fa : float | None

Arc smoothness overrides.

fs : float | None

Arc smoothness overrides.

return_cutter : bool

If True, returns the generated cutter shape instead of cutting it.

Return type:

Bosl2Solid | None

pybosl2.masking.face_profile(body, faces=Anchor.ALL, radius=None, diameter=None, size=None, children=None, convexity=10, anchor=Anchor.CENTER, center=None, fn=None, fa=None, fs=None, return_cutter=False)[source]

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

Parameters:
body : Bosl2Solid

The box solid to cut.

faces : Anchor | list[Anchor]

Face(s) to round, e.g. TOP, or "ALL" (default).

radius : float | None

Rounding radius.

diameter : float | None

Rounding diameter (alternative to radius).

size : tuple[float, float, float] | None

The box’s (x, y, z) size.

children : Path2D | None

The 2-D mask cross-section Path2D; defaults to mask2d_roundover(radius).

convexity : int

Accepted for signature compatibility; unused.

anchor : Anchor | Point

The anchor body was built with (default CENTER).

center : Point | None

The box center in body’s current frame.

fn : int | None

Arc smoothness overrides.

fa : float | None

Arc smoothness overrides.

fs : float | None

Arc smoothness overrides.

return_cutter : bool

If True, returns the generated cutter shape instead of cutting it.

Return type:

Bosl2Solid | None

pybosl2.masking.mask2d_chamfer(x, y=None, excess=0.01)[source]

Return the 2-D L-shaped cutter cross-section for chamfering a 90-degree edge.

Parameters:
x : float

Chamfer width (X direction).

y : float | None

Chamfer height (Y direction). Defaults to x.

excess : float

Amount the flat sides extend past the origin, for a clean cut (default 0.01).

Return type:

Path2D

pybosl2.masking.mask2d_cove(radius, excess=0.01, fn=None, fa=None, fs=None)[source]

Return the 2-D L-shaped cutter cross-section for a concave corner fillet (cove).

Parameters:
radius : float

Cove radius.

excess : float

Amount the flat sides extend past the origin, for a clean cut (default 0.01).

fn : int | None

Arc smoothness overrides.

fa : float | None

Arc smoothness overrides.

fs : float | None

Arc smoothness overrides.

Return type:

Path2D

pybosl2.masking.mask2d_tear(r, maxgap=None, fn=None, fa=None, fs=None)[source]

Return the 2-D L-shaped cutter cross-section with a teardrop-shaped profile.

Parameters:
r : float

Radius of the teardrop circle.

maxgap : float | None

Maximum gap height (unused, kept for compatibility).

fn : int | None

Arc smoothness overrides.

fa : float | None

Arc smoothness overrides.

fs : float | None

Arc smoothness overrides.

Return type:

Path2D

pybosl2.masking.mask2d_step(width, height, excess=0.01)[source]

Return the 2-D cutter cross-section for cutting a step profile in a corner.

Parameters:
width : float

Step width.

height : float

Step height.

excess : float

Amount the flat sides extend past the origin, for a clean cut (default 0.01).

Return type:

Path2D

pybosl2.masking.mask2d_groove(width, depth, chamfer=0.0, round_radius=0.0, excess=0.01, fn=None, fa=None, fs=None)[source]

Return the 2-D cutter cross-section for cutting a slot or groove.

Parameters:
width : float

Groove width.

depth : float

Groove depth.

chamfer : float

Groove chamfer offset (unused, kept for compatibility).

round_radius : float

Groove corner rounding radius (unused, kept for compatibility).

excess : float

Amount the flat sides extend past the origin, for a clean cut (default 0.01).

fn : int | None

Arc smoothness overrides.

fa : float | None

Arc smoothness overrides.

fs : float | None

Arc smoothness overrides.

Return type:

Path2D

pybosl2.masking.mask3d_roundover(r, size, corners=Anchor.ALL, fn=None, fa=None, fs=None)[source]

3-D cutter shape for rounding corners and edges of a box of the given size.

Parameters:
r : float

Rounding radius.

size : tuple[float, float, float]

Bounding box size (X, Y, Z).

corners : Anchor

Corners to select.

fn : int | None

Arc smoothness overrides.

fa : float | None

Arc smoothness overrides.

fs : float | None

Arc smoothness overrides.

Return type:

Bosl2Solid

pybosl2.masking.mask3d_chamfer(chamfer, size, corners=Anchor.ALL)[source]

3-D cutter shape for chamfering corners and edges of a box of the given size.

Parameters:
chamfer : float

Chamfer distance.

size : tuple[float, float, float]

Bounding box size (X, Y, Z).

corners : Anchor

Corners to select.

Return type:

Bosl2Solid

pybosl2.masking.mask3d_groove(width, depth, length, chamfer=0.0)[source]

3-D cutter shape representing a slot or groove of the given width, depth, and length.

Parameters:
width : float

Groove width.

depth : float

Groove depth.

length : float

Groove length.

chamfer : float

Groove chamfer offset.

Return type:

Bosl2Solid