mmalecki / cq-queryabolt

A quick way to create nutcatches, screw holes and countersinks in CadQuery, according to fastener standards.
MIT License
4 stars 0 forks source link
cadquery fasteners

cq-queryabolt

A quick way to create nutcatches, screw holes and countersinks in CadQuery, according to fastener standards.

Nutcatches, screw holes and countersinks.

Requirements and installation

poetry add cq-queryabolt

Usage

To create a simple box with a bolt hole and a nutcatch:

import queryabolt
import cadquery as cq

class Workplane(queryabolt.WorkplaneMixin, cq.Workplane):
    pass

box = Workplane().box(25, 10, 10)

# A nutcatch on the bottom:
result = box.faces("<Z").workplane().tag("center").nutcatchParallel("M3")

# And a bolt hole through:
result = result.faces(">Z").workplane().boltHole("M3")

show_object(result, name="simple")

Or check out the example showcasing all the features, or using a cadquery.Assembly.

API

queryabolt.WorkplaneMixin

boltHole(bolt: string, depth: Optional[float] = None)

Make a bolt hole (cadquery.Workplane.hole for named fasteners)

Args:

cboreBoltHole(bolt: str, depth: Optional[float] = None, headDiameterClearance: Optional[float] = 0.1)

Make a counterbored hole (cadquery.Workplane.cboreHole for named fasteners)

Args:

cskBoltHole(bolt: string, depth: Optional[float] = None)

Make a countersunk hole (cadquery.Workplane.cskHole for named fasteners)

Args:

nutcatchParallel(options: string, kind: Optional[string] = "hexagon", heightClearance: Optional[float] = 0)

Make a parallel (surface) nutcatch

Args:

nutcatchSidecut(options: string, kind: Optional[string] = "hexagon", heightClearance: Optional[float] = 0, depth: Optional[float] = None)

Make a side-cut nutcatch

Args:

Acknowledgements

Prior work

The following turned out too verbose for the simpler end of the spectrum of my projects:

Similar library for OpenSCAD, by yours truly: