Screw drives: Phillips, hex, Torx & Robertson recesses¶
⚙️ Spec sheet → — visual schematic and metrics measured from a real rendered STL.
⚙️ Parts catalog → — this module is featured in the visual parts catalog.
Pure-Python port of BOSL2’s screw_drive.scad: masks for the driver recess cut into a screw
head. The pybosl2.parts.screw_drive module provides classes and functions that each return a
shapes3d mask – subtract one from a head to make the recess:
head - PhillipsMask("#2").shape() # a #2 Phillips recess
head - HexDriveMask(5, 4).shape() # a 5mm hex (Allen) recess, 4mm deep
head - TorxMask(30, 4).shape() # a T30 Torx recess
head - RobertsonMask(2).shape() # a #2 Robertson/square recess
Every *Mask is built bottom-on-the-XY-plane (BOSL2’s anchor=BOTTOM); pass center=True
to center it vertically. The spec classes TorxSpec and
PhillipsSpec return the same dimensional data as their BOSL2
counterparts.
The dimension tables (Phillips ISO 4757, the Torx ISO 14583 OD/ID/depth/rounding table, and the
Robertson square-drive inch table) are transcribed verbatim from screw_drive.scad and checked in
tests/test_screw_drive.py.
Examples¶
A #2 Phillips recess cut into a tapered head:
from pybosl2 import shapes3d as s3
from pybosl2.parts.screw_drive import PhillipsMask
(s3.cyl(diameter1=2, diameter2=8, height=4).down(2) - PhillipsMask("#2").shape()).show()
A T30 Torx tip:
from pybosl2.parts.screw_drive import TorxMask
TorxMask(size=30, l=10).shape().show()
API reference¶
-
class pybosl2.parts.screw_drive.PhillipsMask(size=
'#2', center=False, fn=None, fa=None, fs=None, l=None)[source]¶ Bases:
objectPhillips driver-recess mask for a given bit size (BOSL2 phillips_mask()).
The mask is positioned with its opening at the top and its bottom on the XY plane (BOSL2’s
anchor=BOTTOM). Passcenter=Trueto center the mask vertically instead.Examples
A #2 Phillips recess cut into a tapered head:
from pybosl2.parts.screw_drive import PhillipsMask from pybosl2.solid import cyl (cyl(diameter1=2, diameter2=8, height=4).down(2) - PhillipsMask(size="#2").shape()).show()Loading 3-D preview…- Parameters:¶
- property size : str | int¶
Phillips bit size.
- property center : bool¶
Whether the mask is centered vertically.
- property fn : int | None¶
Facet count override.
- property fa : float | None¶
Minimum facet angle.
- property fs : float | None¶
Minimum facet size.
- property l : float | None¶
Overall length of the recess.
- property shaft : float¶
Shaft/outer diameter.
- property length : float¶
Computed height of the recess.
-
class pybosl2.parts.screw_drive.HexDriveMask(size, l, slop=
0.0, center=False)[source]¶ Bases:
objectHex (Allen) driver-recess mask (BOSL2 hex_drive_mask()).
The recess is slightly oversized per the ISO standard; slop enlarges it by a further
2 * slop.Examples
A 2.5 mm hex drive mask, 5 mm deep:
from pybosl2.parts.screw_drive import HexDriveMask HexDriveMask(size=2.5, l=5).show()Loading 3-D preview…- property size : float¶
Across flats dimension.
- property l : float¶
Height of the recess.
- property slop : float¶
Slop enlargement.
- property center : bool¶
Whether the mask is centered vertically.
- property realsize : float¶
Actual across-flats dimension after ISO oversizing.
-
class pybosl2.parts.screw_drive.TorxMask(size, l=
5.0, center=False)[source]¶ Bases:
objectTorx driver-recess mask: the 2-D profile extruded l tall (BOSL2 torx_mask()).
Examples
A T30 Torx tip:
from pybosl2.parts.screw_drive import TorxMask TorxMask(size=30, l=10).show()Loading 3-D preview…- property size : int¶
Torx size number.
- property l : float¶
Height of the recess.
- property center : bool¶
Whether the mask is centered vertically.
- property outer_diameter : float¶
Outer diameter of the Torx profile.
- class pybosl2.parts.screw_drive.TorxMask2d(size)[source]¶
Bases:
object2-D profile of a Torx driver for a given size (BOSL2 torx_mask2d()).
This is a 2-D shape; to generate an STL, extrude it with
linear_extrude()first.Examples
Generate an STL of a T30 Torx 2-D profile extruded 10 mm:
from pybosl2.parts.screw_drive import TorxMask2d TorxMask2d(size=30).shape().linear_extrude(height=10).show()Loading 3-D preview…- property size : int¶
Torx size number.
-
class pybosl2.parts.screw_drive.RobertsonMask(size, l=
None, angle=2.5, slop=0.0)[source]¶ Bases:
objectRobertson/square driver-recess mask for square-drive sizes
0..``4`` (BOSL2 robertson_mask()).Examples
A #2 Robertson recess:
from pybosl2.parts.screw_drive import RobertsonMask RobertsonMask(size=2).show()Loading 3-D preview…- property size : int¶
Robertson size number (0..4).
- property l : float | None¶
Length of drive mask.
- property angle : float¶
Taper angle of each face.
- property slop : float¶
Slop enlargement.
- class pybosl2.parts.screw_drive.TorxSpec(size)[source]¶
Bases:
objectTorx driver dimensions for one size (ISO 14583).
Construct with the size directly:
TorxSpec(30).- outer_diameter : float¶
- inner_diameter : float¶
- depth : float¶
- tip_rounding : float¶
- inner_rounding : float¶
- property diam : float¶
Outer diameter in mm.
-
class pybosl2.parts.screw_drive.PhillipsSpec(size=
'#2')[source]¶ Bases:
objectPhillips recess geometry for one bit size (ISO 4757). See
PhillipsMask.Construct with the size directly:
PhillipsSpec(2)orPhillipsSpec("#2").- shaft : float¶
- b : float¶
- e : float¶
- g : float¶
- alpha : float¶
- beta : float¶
Examples¶
These mirror the examples in BOSL2’s screw_drive.scad, rendered live through PythonSCAD.
Examples that rely on BOSL2’s attachment/anchor system, or on features not in this port, are omitted.
phillips_mask
A #1 Phillips recess:
from pybosl2.parts.screw_drive import PhillipsMask
PhillipsMask(size="#1").shape().show()
A #2 Phillips recess:
from pybosl2.parts.screw_drive import PhillipsMask
PhillipsMask(size="#2").shape().show()
A #3 Phillips recess:
from pybosl2.parts.screw_drive import PhillipsMask
PhillipsMask(size=3).shape().show()
robertson_mask
A #2 Robertson (square) recess:
from pybosl2.parts.screw_drive import RobertsonMask
RobertsonMask(size=2).shape().show()