Skip to content

Commit

Permalink
Merge pull request #34 from gumyr/dev
Browse files Browse the repository at this point in the history
Release 0.6.0 content
  • Loading branch information
gumyr committed Apr 7, 2022
2 parents 87e3f5f + 1b41c76 commit bc08c5d
Show file tree
Hide file tree
Showing 23 changed files with 1,252 additions and 105 deletions.
Binary file added dist/cq_warehouse-0.6.0-py3-none-any.whl
Binary file not shown.
Binary file added dist/cq_warehouse-0.6.0.tar.gz
Binary file not shown.
124 changes: 124 additions & 0 deletions docs/bearing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#############################
bearing - parametric bearings
#############################
Many mechanical designs will contain bearings of some kind. The
bearing sub-package provides a set of classes that
create many different types of parametric bearings.

Bearings are created as CadQuery Assemblies and with accurate
external dimensions but simplified internal structure to avoid
excess creation time.

Holes for the bearings can be created with a :meth:`~extensions_doc.Workplane.pressFitHole`
method which can automatically place the bearing into an Assembly and bore a hole
for an axle if the part is thicker than the bearing.
See :ref:`Press Fit Holes <press fit holes>` for details.

Here is a list of the classes (and bearing types) provided:

* :ref:`Bearing <bearing>` - the base bearing class
* ``SingleRowDeepGrooveBallBearing``: SKT
* ``SingleRowCappedDeepGrooveBallBearing``: SKT
* ``SingleRowAngularContactBallBearing``: SKT
* ``SingleRowCylindricalRollerBearing``: SKT
* ``SingleRowTaperedRollerBearing``: SKT

See :ref:`Extending the fastener sub-package <extending>` (these instructions apply
to bearings as well) for guidance on how to easily
add new sizes or entirely new types of bearings.

The following example creates a variety of different sized bearings:

.. code-block:: python
import cadquery as cq
from cq_warehouse.bearing import SingleRowDeepGrooveBallBearing, SingleRowTaperedRollerBearing
skate_board_bearing = SingleRowDeepGrooveBallBearing(size="M8-22-7", bearing_type="SKT")
motocycle_head_bearing = SingleRowTaperedRollerBearing(size="M20-42-15", bearing_type="SKT")
Both metric and imperial sized standard bearings are directly supported by the bearing sub-package
although the majority of the bearings currently implemented are metric.

All of the fastener classes provide a ``cq_object`` instance variable which contains the cadquery
object.

The following sections describe each of the provided classes.

.. _bearing:

*******
Bearing
*******
As the base class of all other bearing classes, all of the bearing classes share the same
interface as follows:

.. autoclass:: bearing.Bearing


Bearing Selection
=================
As there are many classes and types of bearings to select from, the Bearing class provides some methods
that can help find the correct bearing for your application. As a reminder, to find the subclasses of
the Bearing class, use ``__subclasses__()``:

.. py:module:: bearing
.. doctest::

>>> Bearing.__subclasses__()
[<class 'cq_warehouse.bearing.SingleRowDeepGrooveBallBearing'>, <class 'cq_warehouse.bearing.SingleRowCappedDeepGrooveBallBearing'>, <class 'cq_warehouse.bearing.SingleRowAngularContactBallBearing'>, <class 'cq_warehouse.bearing.SingleRowCylindricalRollerBearing'>, <class 'cq_warehouse.bearing.SingleRowTaperedRollerBearing'>]

Here is a summary of the class methods:

.. automethod:: Bearing.types

.. doctest::

>>> SingleRowDeepGrooveBallBearing.types()
{'SKT'}

.. automethod:: Bearing.sizes

.. doctest::

>>> SingleRowDeepGrooveBallBearing.sizes("SKT")
['M3-10-4', 'M4-9-2.5', 'M4-11-4', 'M4-12-4', 'M4-13-5', 'M4-16-5', 'M5-11-3', 'M5-13-4', 'M5-16-5', 'M5-19-6', 'M6-13-3.5', 'M6-15-5', 'M6-19-6', 'M7-14-3.5', 'M7-17-5', 'M7-19-6', 'M7-22-7', 'M8-16-4', 'M8-19-6', 'M8-22-7', 'M8-24-8', 'M9-17-4', 'M9-20-6', 'M9-24-7', 'M9-26-8', 'M10-19-5', 'M10-22-6', 'M10-26-8', 'M10-28-8', 'M10-30-9', 'M10-35-11']

.. automethod:: Bearing.select_by_size

.. doctest::

>>> Bearing.select_by_size("M8-22-7")
{<class 'cq_warehouse.bearing.SingleRowDeepGrooveBallBearing'>: ['SKT'], <class 'cq_warehouse.bearing.SingleRowCappedDeepGrooveBallBearing'>: ['SKT']}

Derived Bearing Classes
=======================
The following is a list of the current bearing classes derived from the base Bearing class. Also listed is
the type for each of these derived classes where the type refers to a standard that defines the bearing
parameters. All derived bearings inherit the same API as the base Bearing class.

* ``SingleRowDeepGrooveBallBearing``: SKT
* ``SingleRowCappedDeepGrooveBallBearing``: SKT
* ``SingleRowAngularContactBallBearing``: SKT
* ``SingleRowCylindricalRollerBearing``: SKT
* ``SingleRowTaperedRollerBearing``: SKT

Detailed information about any of the bearing types can be readily found on the internet from manufacture's
websites or from the standard document itself. SKT provides comprehensive information about all types of
rolling bearings in their document:
`Rolling bearings <https://www.skf.com/binaries/pub12/Images/0901d196802809de-Rolling-bearings---17000_1-EN_tcm_12-121486.pdf>`_.

.. _press fit holes:

***************
Press Fit Holes
***************
When designing parts with CadQuery a common operation is to place holes appropriate to a specific bearing
into the part. This operation is optimized with cq_warehouse by the following new Workplane method:

* :meth:`.pressFitHole`

Note that this method can place a hole in the part sized and aligned for the bore of the bearing if
an axle is intended to pass through the part. The ``fit`` parameter determines how much larger this
hole is than the bearing bore.
45 changes: 7 additions & 38 deletions docs/fastener.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ fastener - parametric threaded fasteners
########################################
Many mechanical designs will contain threaded fasteners of some kind, either in a
threaded hole or threaded screws or bolts holding two or more parts together. The
fastener sub-package provides a set of classes with which raw threads can be created
such that they can be integrated into other parts as well as a set of classes that
fastener sub-package provides a set of classes that
create many different types of nuts, screws and washers - as follows:

.. image:: fastener_disc.png
Expand All @@ -16,7 +15,7 @@ class :meth:`~extensions_doc.Workplane.clearanceHole`, the nuts
:meth:`~extensions_doc.Workplane.threadedHole`.
The washers were automatically placed and all components were add to an Assembly in
their correct position and orientations - see
:ref:`Clearance, Tap and Threaded Holes <custom holes>` for details.
:ref:`Custom Holes <custom holes>` for details.

Here is a list of the classes (and fastener types) provided:

Expand Down Expand Up @@ -365,38 +364,7 @@ head of the screw or nut in the provided Assembly.
For example, let's re-build the parametric bearing pillow block found in
the `CadQuery Quickstart <https://cadquery.readthedocs.io/en/latest/quickstart.html>`_:

.. code-block:: python
import cadquery as cq
from cq_warehouse.fastener import SocketHeadCapScrew
height = 60.0
width = 80.0
thickness = 10.0
diameter = 22.0
padding = 12.0
# make the screw
screw = SocketHeadCapScrew(fastener_type="iso4762", size="M2-0.4", length=16, simple=False)
# make the assembly
pillow_block = cq.Assembly(None, name="pillow_block")
# make the base
base = (
cq.Workplane("XY")
.box(height, width, thickness)
.faces(">Z")
.workplane()
.hole(diameter)
.faces(">Z")
.workplane()
.rect(height - padding, width - padding, forConstruction=True)
.vertices()
.clearanceHole(fastener=screw, baseAssembly=pillow_block)
.edges("|Z")
)
pillow_block.add(base)
# Render the assembly
show_object(pillow_block)
.. literalinclude:: ../examples/pillow_block.py

Which results in:

Expand All @@ -405,13 +373,14 @@ Which results in:

The differences between this code and the Read the Docs version are:

* screw dimensions aren't required
* screw and bearing dimensions aren't required
* the bearing is created during instantiation of the ``SingleRowDeepGrooveBallBearing`` class
* the screw is created during instantiation of the ``SocketHeadCapScrew`` class
* an assembly is created and later the base is added to that assembly
* the call to cskHole is replaced with clearanceHole

Not only were the appropriate holes for M2-0.4 screws created but an assembly was created to
store all of the parts in this project all without having to research the dimensions of M2 screws.
Not only were the appropriate holes for the bearing and M2-0.4 screws created but an assembly was created to
store all of the parts in this project all without having to research the dimensions of the parts.

Note: In this example the ``simple=False`` parameter creates accurate threads on each of the
screws which significantly increases the complexity of the model. The default of simple is True
Expand Down
35 changes: 2 additions & 33 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,39 +43,7 @@ variety of CAD, CAM, or analytical systems.

As an example, consider the design of a simple bearing pillow block:

.. code-block:: python
import cadquery as cq
from cq_warehouse.fastener import SocketHeadCapScrew
height = 60.0
width = 80.0
thickness = 10.0
diameter = 22.0
padding = 12.0
# make the screw
screw = SocketHeadCapScrew(fastener_type="iso4762", size="M2-0.4", length=16, simple=False)
# make the assembly
pillow_block = cq.Assembly(None, name="pillow_block")
# make the base
base = (
cq.Workplane("XY")
.box(height, width, thickness)
.faces(">Z")
.workplane()
.hole(diameter)
.faces(">Z")
.workplane()
.rect(height - padding, width - padding, forConstruction=True)
.vertices()
.clearanceHole(fastener=screw, baseAssembly=pillow_block)
.edges("|Z")
.fillet(2.0)
)
pillow_block.add(base)
# Render the assembly
show_object(pillow_block)
.. literalinclude:: ../examples/pillow_block.py

Which results in:

Expand All @@ -100,6 +68,7 @@ Table Of Contents
:maxdepth: 2

installation.rst
bearing.rst
chain.rst
drafting.rst
extensions.rst
Expand Down
Binary file modified docs/pillow_block.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions examples/pillow_block.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import cadquery as cq
from cq_warehouse import fastener
from cq_warehouse.fastener import SocketHeadCapScrew
from cq_warehouse.bearing import SingleRowDeepGrooveBallBearing
import cq_warehouse.extensions

height = 60.0
width = 80.0
thickness = 10.0
diameter = 22.0
padding = 12.0

# make the bearing
bearing = SingleRowDeepGrooveBallBearing(size="M8-22-7", bearing_type="SKT")
# make the screw
screw = SocketHeadCapScrew(
fastener_type="iso4762", size="M2-0.4", length=16, simple=False
size="M2-0.4", fastener_type="iso4762", length=16, simple=False
)
# make the assembly
pillow_block = cq.Assembly(None, name="pillow_block")
Expand All @@ -20,7 +22,7 @@
.box(height, width, thickness)
.faces(">Z")
.workplane()
.hole(diameter)
.pressFitHole(bearing=bearing, baseAssembly=pillow_block)
.faces(">Z")
.workplane()
.rect(height - padding, width - padding, forConstruction=True)
Expand All @@ -30,7 +32,7 @@
.fillet(2.0)
)
pillow_block.add(base, name="base", color=cq.Color(162 / 255, 138 / 255, 255 / 255))
print(pillow_block.fastenerQuantities(bom=False))
print(pillow_block.fastenerQuantities())

# Render the assembly
if "show_object" in locals():
Expand Down
1 change: 1 addition & 0 deletions scripts/build_extensions_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def main(argv):
[
"from typing import Union, Tuple, Optional, Literal\n"
"from fastener import Screw, Nut, Washer\n"
"from bearing import Bearing\n"
"class gp_Ax1:\n pass\n",
"class T:\n pass\n",
"class VectorLike:\n pass\n",
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = cq_warehouse
version = 0.5.3
version = 0.6.0
author = Gumyr
author_email = gumyr9@gmail.com
description = A cadquery parametric part collection
Expand All @@ -26,4 +26,4 @@ where = src
exclude = *examples*

[options.package_data]
* = *.csv
* = *.csv
2 changes: 1 addition & 1 deletion src/cq_warehouse.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: cq-warehouse
Version: 0.5.3
Version: 0.6.0
Summary: A cadquery parametric part collection
Home-page: https://github.com/gumyr/cq_warehouse
Author: Gumyr
Expand Down
8 changes: 6 additions & 2 deletions src/cq_warehouse.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pyproject.toml
setup.cfg
src/cq_warehouse/__init__.py
src/cq_warehouse/assembly_extended.py
src/cq_warehouse/bearing.py
src/cq_warehouse/brad_tee_nut_parameters.csv
src/cq_warehouse/button_head_parameters.csv
src/cq_warehouse/button_head_with_collar_parameters.csv
Expand All @@ -21,9 +22,7 @@ src/cq_warehouse/extensions.py
src/cq_warehouse/extensions_doc.py
src/cq_warehouse/fastener.py
src/cq_warehouse/geom_extended.py
src/cq_warehouse/heatset.py
src/cq_warehouse/heatset_nut_parameters.csv
src/cq_warehouse/heatset_parameters.csv
src/cq_warehouse/hex_head_parameters.csv
src/cq_warehouse/hex_head_with_flange_parameters.csv
src/cq_warehouse/hex_nut_parameters.csv
Expand All @@ -39,6 +38,11 @@ src/cq_warehouse/raised_cheese_head_parameters.csv
src/cq_warehouse/raised_countersunk_oval_head_parameters.csv
src/cq_warehouse/setscrew_parameters.csv
src/cq_warehouse/shapes_extended.py
src/cq_warehouse/single_row_angular_contact_ball_bearing_parameters.csv
src/cq_warehouse/single_row_capped_deep_groove_ball_bearing_parameters.csv
src/cq_warehouse/single_row_cylindrical_roller_bearing_parameters.csv
src/cq_warehouse/single_row_deep_groove_ball_bearing_parameters.csv
src/cq_warehouse/single_row_tapered_roller_bearing_parameters.csv
src/cq_warehouse/socket_head_cap_parameters.csv
src/cq_warehouse/sprocket.py
src/cq_warehouse/square_nut_parameters.csv
Expand Down
Loading

0 comments on commit bc08c5d

Please sign in to comment.