Skip to content

Commit

Permalink
Added Maker Coin example
Browse files Browse the repository at this point in the history
  • Loading branch information
gumyr committed Feb 27, 2024
1 parent 18aafed commit e7838bf
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 16 deletions.
Binary file added docs/assets/examples/maker_coin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 48 additions & 16 deletions docs/examples_1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,22 @@ Most of the examples show the builder and algebra modes.
:link: examples-circuit_board
:link-type: ref

.. grid-item-card:: Stud Wall |Algebra|
:img-top: assets/examples/stud_wall.png
:link: stud_wall
.. grid-item-card:: Maker Coin |Builder|
:img-top: assets/examples/maker_coin.png
:link: maker_coin
:link-type: ref

.. grid-item-card:: Platonic Solids |Algebra|
:img-top: assets/examples/platonic_solids.png
:link: platonic_solids
:link-type: ref

.. grid-item-card:: Stud Wall |Algebra|
:img-top: assets/examples/stud_wall.png
:link: stud_wall
:link-type: ref


.. NOTE 01: insert new example thumbnails above this line
.. TODO: Copy this block to add the example thumbnails here
Expand Down Expand Up @@ -248,26 +254,31 @@ This example demonstrates placing holes around a part.
.. literalinclude:: ../examples/circuit_board_algebra.py
:start-after: [Code]
:end-before: [End]

.. _stud_wall:

Stud Wall
---------
.. image:: assets/examples/stud_wall.png

.. _maker_coin:

Maker Coin
----------
.. image:: assets/examples/maker_coin.png
:align: center

This example demonstrates creatings custom `Part` objects and putting them into
assemblies. The custom object is a `Stud` used in the building industry while
the assembly is a `StudWall` created from copies of `Stud` objects for efficiency.
Both the `Stud` and `StudWall` objects use `RigidJoints` to define snap points which
are used to position all of objects.
This example creates the maker coin as defined by Angus on the Maker's Muse
YouTube channel. There are two key features:

.. dropdown:: |Algebra| Reference Implementation (Algebra Mode)
#. the use of :class:`~objects_curve.DoubleTangentArc` to create a smooth
transition from the central dish to the outside arc, and

.. literalinclude:: ../examples/stud_wall.py
#. embossing the text into the top of the coin not just as a simple
extrude but from a projection which results in text with even depth.


.. dropdown:: |Builder| Reference Implementation (Builder Mode)

.. literalinclude:: ../examples/maker_coin.py
:start-after: [Code]
:end-before: [End]

.. _platonic_solids:

Platonic Solids
Expand All @@ -293,6 +304,27 @@ embodying ideals of symmetry and balance.
:start-after: [Code]
:end-before: [End]

.. _stud_wall:

Stud Wall
---------
.. image:: assets/examples/stud_wall.png
:align: center

This example demonstrates creatings custom `Part` objects and putting them into
assemblies. The custom object is a `Stud` used in the building industry while
the assembly is a `StudWall` created from copies of `Stud` objects for efficiency.
Both the `Stud` and `StudWall` objects use `RigidJoints` to define snap points which
are used to position all of objects.

.. dropdown:: |Algebra| Reference Implementation (Algebra Mode)

.. literalinclude:: ../examples/stud_wall.py
:start-after: [Code]
:end-before: [End]



.. NOTE 02: insert new example thumbnails above this line
Expand Down
68 changes: 68 additions & 0 deletions examples/maker_coin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
"""
Maker Coin
name: maker_coin.py
by: Gumyr
date: Febrary 27, 2024
desc:
This example creates the maker coin as defined by Angus on the Maker's Muse
YouTube channel. There are two key features:
1) the use of DoubleTangentArc to create a smooth transition from the
central dish to the external arc.
2) embossing the text into the top of the coin not just as a simple
extrude but from a projection which results in text with even depth.
license:
Copyright 2023 Gumyr
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

from build123d import *
from ocp_vscode import *

# [Code]
# Coin Parameters
diameter, thickness = 50 * MM, 10 * MM

with BuildPart() as maker_coin:
# On XZ plane draw the profile of half the coin
with BuildSketch(Plane.XZ) as profile:
with BuildLine() as outline:
l1 = Polyline((0, thickness * 0.6), (0, 0), ((diameter - thickness) / 2, 0))
l2 = JernArc(
start=l1 @ 1, tangent=l1 % 1, radius=thickness / 2, arc_size=300
) # extend the arc beyond the intersection but not closed
l3 = DoubleTangentArc(l1 @ 0, tangent=(1, 0), other=l2)
make_face() # make it a 2D shape
revolve() # revolve 360°

# Pattern the detents around the coin
with BuildSketch() as detents:
with PolarLocations(radius=(diameter + 5) / 2, count=8):
Circle(thickness * 1.4 / 2)
extrude(amount=thickness, mode=Mode.SUBTRACT) # cut away the detents

fillet(maker_coin.edges(Select.NEW), 2) # fillet the cut edges

# Add an embossed label
with BuildSketch(Plane.XY.offset(thickness)) as label: # above coin
Text("OS", font_size=15)
project() # label on top of coin
extrude(amount=-thickness / 5, mode=Mode.SUBTRACT) # emboss label

show(maker_coin)
# [End]

0 comments on commit e7838bf

Please sign in to comment.