mirror of
https://github.com/gumyr/build123d.git
synced 2025-12-15 07:10:25 -08:00
- Unbreak the three broken tutorials (fixes #848) - This involved a rewrite of PPP-01-10 because I already had my own solution to that one and I couldn't easily tell what was going wrong with the previous solution. - Add assertions to all the tutorials so that non-raising means success - Add the TTT examples to `test_examples.py` added recently for #909 - Also added sympy to development dependencies since one of the TTT examples uses it.
54 lines
1.8 KiB
Python
54 lines
1.8 KiB
Python
"""
|
|
Too Tall Toby Party Pack 01-08 Tie Plate
|
|
"""
|
|
|
|
from build123d import *
|
|
from ocp_vscode import *
|
|
|
|
densa = 7800 / 1e6 # carbon steel density g/mm^3
|
|
densb = 2700 / 1e6 # aluminum alloy
|
|
densc = 1020 / 1e6 # ABS
|
|
|
|
with BuildPart() as p:
|
|
with BuildSketch() as s1:
|
|
Rectangle(188 / 2 - 33, 162, align=(Align.MIN, Align.CENTER))
|
|
with Locations((188 / 2 - 33, 0)):
|
|
SlotOverall(190, 33 * 2, rotation=90)
|
|
mirror(about=Plane.YZ)
|
|
with GridLocations(188 - 2 * 33, 190 - 2 * 33, 2, 2):
|
|
Circle(29 / 2, mode=Mode.SUBTRACT)
|
|
Circle(84 / 2, mode=Mode.SUBTRACT)
|
|
extrude(amount=16)
|
|
|
|
with BuildPart() as p2:
|
|
with BuildSketch(Plane.XZ) as s2:
|
|
with BuildLine() as l1:
|
|
l1 = Polyline(
|
|
(222 / 2 + 14 - 40 - 40, 0),
|
|
(222 / 2 + 14 - 40, -35 + 16),
|
|
(222 / 2 + 14, -35 + 16),
|
|
(222 / 2 + 14, -35 + 16 + 30),
|
|
(222 / 2 + 14 - 40 - 40, -35 + 16 + 30),
|
|
close=True,
|
|
)
|
|
make_face()
|
|
with Locations((222 / 2, -35 + 16 + 14)):
|
|
Circle(11 / 2, mode=Mode.SUBTRACT)
|
|
extrude(amount=20 / 2, both=True)
|
|
with BuildSketch() as s3:
|
|
with Locations(l1 @ 0):
|
|
Rectangle(40 + 40, 8, align=(Align.MIN, Align.CENTER))
|
|
with Locations((40, 0)):
|
|
Rectangle(40, 20, align=(Align.MIN, Align.CENTER))
|
|
extrude(amount=30, both=True, mode=Mode.INTERSECT)
|
|
mirror(about=Plane.YZ)
|
|
|
|
show(p)
|
|
|
|
|
|
got_mass = p.part.volume*densa
|
|
want_mass = 3387.06
|
|
tolerance = 1
|
|
delta = abs(got_mass - want_mass)
|
|
print(f"Mass: {got_mass:0.2f} g")
|
|
assert delta < tolerance, f'{got_mass=}, {want_mass=}, {delta=}, {tolerance=}'
|