diff --git a/docs/assets/examples/example_build123d_logo_01.png b/docs/assets/examples/example_build123d_logo_01.png new file mode 100644 index 0000000..5ded935 Binary files /dev/null and b/docs/assets/examples/example_build123d_logo_01.png differ diff --git a/docs/assets/examples/thumbnail_build123d_logo_01.png b/docs/assets/examples/thumbnail_build123d_logo_01.png new file mode 100644 index 0000000..8aedfb4 Binary files /dev/null and b/docs/assets/examples/thumbnail_build123d_logo_01.png differ diff --git a/docs/examples_1.rst b/docs/examples_1.rst index 50f83fb..867e3b3 100644 --- a/docs/examples_1.rst +++ b/docs/examples_1.rst @@ -34,7 +34,12 @@ Most of the examples show the builder and algebra modes. :link: examples-build123d_customizable_logo :link-type: ref - + .. grid-item-card:: Former build123d Logo |Builder| |Algebra| + :img-top: assets/examples/thumbnail_build123d_logo_01.png + :link: examples-build123d_logo + :link-type: ref + + .. NOTE 01: insert new example thumbnails above this line .. TODO: Copy this block to add the example thumbnails here @@ -125,6 +130,33 @@ It shows how text is created, placed and sizes of text is calulated to define si :start-after: [Code] :end-before: [End] + +.. _examples-build123d_logo: + +Former build123d Logo +-------------------------------- +.. image:: assets/examples/example_build123d_logo_01.png + :align: center + + +This example creates the former build123d logo (new logo was created in the end of 2023). + +Using text and lines to create the first build123d logo. +The builder mode example also generates the SVG file `logo.svg`. + + +.. dropdown:: |Builder| Reference Implementation (Builder Mode) + + .. literalinclude:: ../examples/build123d_logo.py + :start-after: [Code] + :end-before: [End] + +.. dropdown:: |Algebra| Reference Implementation (Algebra Mode) + + .. literalinclude:: ../examples/build123d_logo_algebra.py + :start-after: [Code] + :end-before: [End] + .. NOTE 02: insert new example thumbnails above this line diff --git a/examples/build123d_logo.py b/examples/build123d_logo.py index ec6d253..f5f0373 100644 --- a/examples/build123d_logo.py +++ b/examples/build123d_logo.py @@ -1,33 +1,31 @@ """ +name: "build_123d_logo.py" +title: "Former build123d Logo" +authors: "Gumyr" +license: "http://www.apache.org/licenses/LICENSE-2.0" +created: "2022-08-05" +modified: "2023-07-31" -name: build123d_logo.py -by: Gumyr -date: August 5th 2022 +description: | + This example creates the former build123d logo (new logo was created in the end of 2023). -desc: + Using text and lines to create the first build123d logo. + The builder mode example also generates the SVG file `logo.svg`. - This example creates the build123d logo. - -license: - - Copyright 2022 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. +has_builder_mode: true +has_algebra_mode: true +image_files: + - "example_build123d_logo_01.png" """ +# [Imports] from build123d import * from build123d import Shape from ocp_vscode import * +# [Parameters] +# - none + +# [Code] with BuildSketch() as logo_text: Text("123d", font_size=10, align=(Align.MIN, Align.MIN)) font_height = logo_text.vertices().sort_by(Axis.Y)[-1].Y @@ -120,3 +118,4 @@ show_object(two, name="two") show_object(three_d, name="three_d") show_object(extension_lines, name="extension_lines") show_object(build, name="build") +# [End] \ No newline at end of file diff --git a/examples/build123d_logo_algebra.py b/examples/build123d_logo_algebra.py index 05c8097..9bf291a 100644 --- a/examples/build123d_logo_algebra.py +++ b/examples/build123d_logo_algebra.py @@ -1,6 +1,14 @@ +""" +for details see `build123d_logo.py` +""" +# [Imports] from build123d import * from ocp_vscode import * +# [Parameters] +# - none + +# [Code] logo_text = Text("123d", font_size=10, align=Align.MIN) font_height = logo_text.vertices().sort_by(Axis.Y).last.Y @@ -30,7 +38,7 @@ l2 = Line( ) extension_lines = l1 + l2 extension_lines += Pos(*(l1 @ 0.5)) * arrow_left -extension_lines += (Pos(*(l2 @ 0.5)) * Rot(z=180)) * arrow_left +extension_lines += (Pos(*(l2 @ 0.5)) * Rot(Z=180)) * arrow_left extension_lines += Line(l1 @ 0.5, l1 @ 0.5 + Vector(dim_line_length, 0)) extension_lines += Line(l2 @ 0.5, l2 @ 0.5 - Vector(dim_line_length, 0)) @@ -40,5 +48,6 @@ build = p1 * build_text cmpd = Compound.make_compound([three_d, two, one, build, extension_lines]) -if "show_object" in locals(): - show_object(cmpd, name="compound") +show_object(cmpd, name="compound") + +# [End] \ No newline at end of file