mirror of
https://github.com/gumyr/build123d.git
synced 2025-12-05 18:20:46 -08:00
Added Maker Coin example
This commit is contained in:
parent
18aafed8e6
commit
e7838bf4b8
3 changed files with 116 additions and 16 deletions
BIN
docs/assets/examples/maker_coin.png
Normal file
BIN
docs/assets/examples/maker_coin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 152 KiB |
|
|
@ -49,9 +49,9 @@ 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|
|
||||
|
|
@ -59,6 +59,12 @@ Most of the examples show the builder and algebra modes.
|
|||
: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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
68
examples/maker_coin.py
Normal file
68
examples/maker_coin.py
Normal file
|
|
@ -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]
|
||||
Loading…
Add table
Add a link
Reference in a new issue