diff --git a/docs/assets/examples/toy_truck.png b/docs/assets/examples/toy_truck.png new file mode 100644 index 0000000..bc70175 Binary files /dev/null and b/docs/assets/examples/toy_truck.png differ diff --git a/docs/assets/examples/toy_truck_picture.jpg b/docs/assets/examples/toy_truck_picture.jpg new file mode 100644 index 0000000..ee075fd Binary files /dev/null and b/docs/assets/examples/toy_truck_picture.jpg differ diff --git a/docs/examples_1.rst b/docs/examples_1.rst index 4cb0f89..987a870 100644 --- a/docs/examples_1.rst +++ b/docs/examples_1.rst @@ -94,6 +94,11 @@ Most of the examples show the builder and algebra modes. :link: tea_cup :link-type: ref + .. grid-item-card:: Toy Truck |Builder| + :img-top: assets/examples/toy_truck.png + :link: toy_truck + :link-type: ref + .. grid-item-card:: Vase |Builder| |Algebra| :img-top: assets/examples/vase.png :link: vase @@ -515,6 +520,30 @@ The tea cup model involves several CAD techniques, such as: round the edges for aesthetic improvement and to mimic real-world objects more closely. + +.. _toy_truck: + +Toy Truck +--------- +.. image:: assets/examples/toy_truck.png + :align: center + +.. image:: assets/examples/toy_truck_picture.jpg + :align: center + +.. dropdown:: |Builder| Reference Implementation (Builder Mode) + + .. literalinclude:: ../examples/toy_truck.py + :start-after: [Code] + :end-before: [End] + +This example demonstrates how to design a toy truck using BuildPart and +BuildSketch in Builder mode. The model includes a detailed body, cab, grill, +and bumper, showcasing techniques like sketch reuse, symmetry, tapered +extrusions, selective filleting, and the use of joints for part assembly. +Ideal for learning complex part construction and hierarchical modeling in +build123d. + .. _vase: Vase diff --git a/src/build123d/jupyter_tools.py b/src/build123d/jupyter_tools.py index ce05a73..9e3600b 100644 --- a/src/build123d/jupyter_tools.py +++ b/src/build123d/jupyter_tools.py @@ -66,8 +66,10 @@ def shape_to_html(shape: Any) -> HTML: ) # A new div with a unique id, plus the JS code templated with the id - div_id = 'shape-' + uuid.uuid4().hex[:8] - code = Template(TEMPLATE_JS).substitute(data=dumps(payload), div_id=div_id, ratio=0.5) + div_id = "shape-" + uuid.uuid4().hex[:8] + code = Template(TEMPLATE_JS).substitute( + data=dumps(payload), div_id=div_id, ratio=0.5 + ) html = HTML(f"
") return html diff --git a/src/build123d/topology/__init__.py b/src/build123d/topology/__init__.py index 2bf01d3..11d00d9 100644 --- a/src/build123d/topology/__init__.py +++ b/src/build123d/topology/__init__.py @@ -5,7 +5,7 @@ name: __init__.py by: Gumyr date: January 07, 2025 -desc: +desc: This package contains modules for representing and manipulating 3D geometric shapes, including operations on vertices, edges, faces, solids, and composites. The package provides foundational classes to work with 3D objects, and methods to