Skip to content

HeatSetNut and BradTeeNut

Compare
Choose a tag to compare
@gumyr gumyr released this 10 Mar 14:51
· 159 commits to main since this release
03aec70

This release contains some fixes, new methods as well as the addition to two new types of nuts to the fasteners sub-package: BradTeeNut and HeatSetNut. Much of the functionality is illustrated in this example:

import cadquery as cq
from cq_warehouse.fastener import BradTeeNut, CounterSunkScrew, HeatSetNut
import cq_warehouse.extensions

MM = 1

# Create the fasteners used in this example
bradtee_nut = BradTeeNut(size="M8-1.25", fastener_type="Hilitchi", simple=False)
brad = CounterSunkScrew(
    size=bradtee_nut.nut_data["brad_size"],
    length=20 * MM,
    fastener_type="iso10642",
    simple=False,
)
heatset = HeatSetNut(
    size=bradtee_nut.nut_data["brad_size"] + "-Standard",
    fastener_type="McMaster-Carr",
    simple=True,
)
# Create an empty Assembly to hold all of the fasteners
fastener_assembly = cq.Assembly(None, name="plate")

# Create a simple plate with appropriate holes to house all the fasteners
plate_size = (50 * MM, 50 * MM, 20 * MM)
plate = (
    cq.Workplane("XY")
    .box(*plate_size, centered=(True, True, False))
    .faces(">Z")
    .workplane()
    .clearanceHole(fastener=bradtee_nut, baseAssembly=fastener_assembly)
    .polarArray(
        bradtee_nut.nut_data["bcd"] / 2, 0, 360, bradtee_nut.nut_data["brad_num"]
    )
    .clearanceHole(fastener=brad, baseAssembly=fastener_assembly)
    # Place HeatSetNuts for the brads on the bottom of the plate
    .pushFastenerLocations(
        fastener=brad,
        baseAssembly=fastener_assembly,
        offset=-plate_size[2],
        flip=True,
    )
    .insertHole(fastener=heatset, baseAssembly=fastener_assembly)
)
print(fastener_assembly.fastenerQuantities())
print(HeatSetNut.sizes("McMaster-Carr"))

if "show_object" in locals():
    show_object(plate, name="plate", options={"alpha": 0.8})
    show_object(fastener_assembly, name="fastener_assembly")

which creates:
image
In addition to the two new nuts, note that the pushFastenerLocation() method now supports an offset and flip option which allows one to position a nut on the back side of an object aligned with the bolt on the front side.

There is also a new Shape.transformed() method (the Shape class is a superset of most cadquery object classes) that allows both rotations and a translation to be provided at once just like the Workplane().transformed() method which effectively only applies to a plane.

The new makeHoles() method allows one to put holes into existing faces (including non-planar faces) which can be much more efficient than doing similar operations on 3D objects with cut operations.