FoundationPartsPrimitivesHole wizard (screw sizes)

Hole wizard (screw sizes)

Size holes by screw instead of by radius (ISO metric coarse, M1.6–M30):

  • TappedHole(point, thread_size, depth) drills the tap drill for the thread (M6 → Ø5.0, M8 → Ø6.8).
  • ClearanceHole(point, size, depth, fit=HoleFit.NORMAL) drills the ISO 273 clearance hole for the screw: CLOSE, NORMAL or LOOSE (M6 → Ø6.4 / Ø6.6 / Ø7.0).

The tables are available directly as tap_drill_diameter(size) and clearance_diameter(size, fit). Sizes outside the table raise an error that lists the supported ones — use Hole(point, radius, depth) for anything else.

from cadbuildr.foundation import *


class HoleWizardPlate(Part):
    """ISO metric holes by screw size instead of by radius.

    TappedHole(M6) drills the Ø5.0 tap drill; ClearanceHole(M6) drills the
    ISO 273 clearance for the chosen fit: close Ø6.4, normal Ø6.6, loose Ø7.0.
    """

    def __init__(self, thickness=10):
        s = Sketch(self.xy())
        self.add_operation(
            Extrusion(Rectangle.from_center_and_sides(s.origin, 100, 30), thickness)
        )
        self.add_operation(TappedHole(Point(s, -36, 0), 6, thickness))
        self.add_operation(
            ClearanceHole(Point(s, -12, 0), 6, thickness, fit=HoleFit.CLOSE)
        )
        self.add_operation(ClearanceHole(Point(s, 12, 0), 6, thickness))
        self.add_operation(
            ClearanceHole(Point(s, 36, 0), 6, thickness, fit=HoleFit.LOOSE)
        )
        self.paint("light_bluish_gray")


show(HoleWizardPlate())