Releases: gumyr/cq_warehouse
Subclass
Introduced sub-classing of CadQuery Shape:
- enhanced the cadquery core to support sub-classes of Shape
- converted Nut, Screw, Washer, Thread, and Sprocket to sub-classes of Solid
- converted Bearing to sub-classes of Compound
- deprecated use of attribute cq_object for sub-classed objects
- updated documentation, examples, and unit tests
- added user documentation for custom sub-classes
Sketch Snap Features, Draft improvement, Assembly Section
This release significantly expands on the capabilities of cadquery Sketch. The extended Sketch methods are: text(), val(), vals(), add(), mirror_x(), mirror_y(), spline(), polyline(), center_arc(), tangent_arc(), three_point_arc(), bounding_box(), push_points(). All of these methods take "snaps" for point or tangent inputs, where snaps are text strings in the form "@" where position can be a float between 0 and 1 or "start", "middle", or "end". Also note that these methods accept sequences directly, like .polyline((-1, 0), (1, 1), (2, 0), (3, 1), (4, 0)) without the need to wrap the points in a list.
The drafting package has a new feature. One can now create horizontal/vertical extension lines for diagonal features as shown on the right (the left side was previous functionality):
Assembly has a new section()
method. It generates a new assembly that is a cross section of the original assembly for the given plane maintaining the object names and colours.
Sketch Methods
Added the following new Sketch methods:
add()
- add a Edge, Wire or FaceboundingBox()
- add the bounding box for the selected item(s)text()
- add linear or text on a pathval()
- export selected itemvals()
- export selected items
The Sketch.text()
and the refactored Workplane.textOnPath()
methods both depend on the new Compound.make2DText()
method
Finger Jointed Boxes
Release 0.7 contain the following new features:
- makeFingerJoints: build finger jointed boxes from a simple solid model (https://cq-warehouse.readthedocs.io/en/latest/finger_jointed_boxes.html)
- clearanceHole can now make holes to capture nuts (https://cq-warehouse.readthedocs.io/en/latest/fastener.html#captive-nuts)
- screws are aligned with the bottom of a hole if a depth is provided (https://cq-warehouse.readthedocs.io/en/latest/fastener.html#screw-and-hole-alignment)
- projection, emboss and text on path examples extracted from extension examples for clarity
This release also fixes the following bugs:
- setscrews can be "simple" now and the thread module is changed to improve performance when making all simple fasteners
Bearings
This release adds a new bearing module which defines the following bearing classes:
- Bearing - the base bearing class
- SingleRowDeepGrooveBallBearing: SKT
- SingleRowCappedDeepGrooveBallBearing: SKT
- SingleRowAngularContactBallBearing: SKT
- SingleRowCylindricalRollerBearing: SKT
- SingleRowTaperedRollerBearing: SKT
A new Workplane.pressFitHole()
method allows bearings to be used as fasteners are used with the Workplane.clearanceHole()
method.
A new Wire.makeRect()
method creates a rectangle in a similar way to the Wire.makeCircle()
method.
HeatSetNut and BradTeeNut
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:
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.
ReadTheDocs
Moved documentation to ReadtheDocs and added a patch building tool that enhances CadQuery with cq_warehouse.extensions. This allows an IDE to see type hints and do code completion as shown here:
Plastic Bottle Thread
Adding the ASTM D2911 Standard Plastic Bottle Thread to the thread sub-package.
thread = PlasticBottleThread(
size="M38SP444", external=False, manufacturingCompensation=0.2 * MM
)
Methods to Emboss, Project and work with non-planar surfaces
Enhancements to the Cadquery extensions sub-package providing many new methods to project or emboss planar edge/wire/face onto a shape and conversion of the resulting non-planar face into a solid.
Here are the cq_warehouse.extensions methods:
- cq.Assembly.translate()
- cq.Assembly.rotate()
- cq.Plane.toLocalCoords()
- cq.Vector.rotateX()
- cq.Vector.rotateY()
- cq.Vector.rotateZ()
- cq.Vector.pointToVector()
- cq.Vector.toVertex()
- cq.Vector.getSignedAngle()
- cq.Vertex.add()
- cq.Vertex.sub()
- cq.Vertex.str()
- cq.Vertex.toVector()
- cq.Workplane.text()
- cq.Workplane.textOnPath()
- cq.Workplane.hexArray()
- cq.Workplane.thicken()
- cq.Face.thicken()
- cq.Face.projectToShape()
- cq.Face.embossToShape()
- cq.Wire.makeNonPlanarFace()
- cq.Wire.projectToShape()
- cq.Wire.embossToShape()
- cq.Edge.projectToShape()
- cq.Edge.embossToShape()
- cq.Shape.findIntersection()
- cq.Shape.projectText()
- cq.Shape.embossText()
Fastener Locations
This minor release adds a couple methods that locating fasteners relative to other parts.
cq.Assembly.fastenerLocations()
returns a list of cq.Location
objects of the given fastener as follows:
for loc in square_tube_assembly.fastenerLocations(cap_screw):
print(loc)
cq.Workplane.pushFastenerLocations()
pushes the location(s) of the given fastener relative to the given assembly. This enables the following:
square_tube = (square_tube
.pushFastenerLocations(cap_screw, square_tube_assembly)
.tapHole(fastener=cap_screw, counterSunk=False, depth=10)
)
which will place tap holes into square_tube
matching the location of all the cap_screw
s in the square_tube_assembly
.