Skip to content

Commit

Permalink
Update nav menu, add examples page
Browse files Browse the repository at this point in the history
  • Loading branch information
cibomahto committed Jun 25, 2024
1 parent 01c2acc commit 6c610f3
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 33 deletions.
Binary file added doc/_static/images/examples_asterix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/_static/images/examples_hello_painter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/_static/images/examples_hex_perfboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/_static/images/examples_lotus_leds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions doc/api.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
API
===
Function Reference
==================

.. autosummary::
:toctree: generated
Expand Down
32 changes: 32 additions & 0 deletions doc/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Examples
========

Here is a collection of example boards designed using CircuitPainter.

Click on the photo to see the source code for the board.

.. list-table::

* - .. image:: _static/images/examples_lotus_leds.png
:width: 400
:target: https://github.com/Blinkinlabs/circuitpainter/blob/main/examples/lotus_leds.py

Lotus LEDs

- .. image:: _static/images/examples_hex_perfboard.png
:width: 400
:target: https://github.com/Blinkinlabs/circuitpainter/blob/main/examples/hex_perfboard.py

Hex perfboard

* - .. image:: _static/images/examples_asterix.png
:width: 400
:target: https://github.com/Blinkinlabs/circuitpainter/blob/main/examples/asterix.py

Asterix

- .. image:: _static/images/examples_hello_painter.png
:width: 400
:target: https://github.com/Blinkinlabs/circuitpainter/blob/main/examples/hello_painter.py

Hello Painter
29 changes: 17 additions & 12 deletions doc/getting_started.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Getting Started
===============
Getting Started Tutorial
========================

This tutorial will walk you through some of the basic concepts in Circuit
Painter. If you haven't set up your environment yet, follow the instructions
in the :doc:`installation` section, then type the following commands into a
circuitpainter-enabled Python interpreter.

Start by creating a drawing context:

Expand Down Expand Up @@ -38,7 +43,7 @@ This will save the design to a temporary location, then open it in the
KiCad editor:

.. image:: _static/images/example-two-lines.png
:width: 400
:width: 600

It's good for seeing the project, but be careful! The file
will be deleted (along with any changes you make), as soon as you close
Expand All @@ -57,7 +62,7 @@ To change the width of lines, use the width() command:
painter.line(0,10,10,10) # line with width 2mm
.. image:: _static/images/example-line-widths.png
:width: 400
:width: 600

You can change where and at what angle features are added, by using the
translate() and rotate() features:
Expand All @@ -69,7 +74,7 @@ translate() and rotate() features:
painter.rect(-5,-5,5,5) # Rectangle is drawn at a 30 degreen angle, centered at (10,10).
.. image:: _static/images/example-rotate-rect.png
:width: 400
:width: 600

Calling them multiple times will stack the transformations (they are
calculated as a 2d transformation matrix)
Expand All @@ -84,7 +89,7 @@ calculated as a 2d transformation matrix)
painter.rect(-5,-5,5,5) # Rectangle is drawn centered at (30,30).
.. image:: _static/images/example-translate-rect.png
:width: 400
:width: 600

Saving and restoring the applied tranformation is done using push_matrix()
and pop_matrix(). (Note: This is implemented as a stack, and multiple pushes can be nested):
Expand All @@ -99,7 +104,7 @@ and pop_matrix(). (Note: This is implemented as a stack, and multiple pushes can
painter.pop_matrix() # Restore previous transformation settings
.. image:: _static/images/example-push-pop-rect.png
:width: 400
:width: 600

Besides lines and rectangles, there are other basic shapes such as arc(), cirle(), and polygon().

Expand All @@ -114,7 +119,7 @@ command:
painter.footprint(0,0,"LED_SMD","LED_0805_2012Metric")
.. image:: _static/images/example-add-led.png
:width: 400
:width: 600

This placed the part, but it won't work well as a part- it's not wired up, so it
won't actually function! Let's add some nets, and a resistor because that
Expand All @@ -130,7 +135,7 @@ your circuit is correct:
painter.track(1,0,4,0)
.. image:: _static/images/example-connect-led.png
:width: 400
:width: 600

Note: In this example, we are manually drawing a track that just happens to line up
with the centers of the two pads that we want to connect. To see a more exact way
Expand Down Expand Up @@ -159,7 +164,7 @@ the previous translation operations, to make a ring of LEDs:
painter.pop_matrix()
.. image:: _static/images/example-led-ring.png
:width: 400
:width: 600

Not bad for a few lines of code!

Expand Down Expand Up @@ -202,13 +207,13 @@ To make a complete board, here is the [rest of the owl](https://knowyourmeme.com
painter.preview()
.. image:: _static/images/example-rest-of-owl.png
:width: 400
:width: 600

Note that we've added a battery connector, vias to connect power and ground from each of the LEDs,
and a circular board edge to make it look a little prettier. It's not a bad idea to check DRC:

.. image:: _static/images/example_led_ring_drc.png
:width: 400
:width: 600

One you are satisfied with the design, you can either save it for further editing in KiCad
with the .save() command, or go straight to a gerber with the .export_gerber() command.
Expand Down
34 changes: 15 additions & 19 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,26 @@ Circuit painter works as a front end / wrapper for `KiCad's pcbnew <https://www.

For more backgrond on the project, see `Matt's Hackaday Berlin talk <https://www.youtube.com/watch?v=9XV9PSsmMkk>`_ about Circuit painter.

:doc:`installation`
How to install Circuit Painter.

:doc:`getting_started`
Getting started tutorial

:doc:`advanced_usage`
Tips and tricks for extending the use of Circuit Painter

:doc:`notes`
Additional Notes

:doc:`api`
Function Reference

.. Hidden TOCs
.. toctree::
:maxdepth: 2
:hidden:
:caption: Getting Started

installation
getting_started
examples

.. toctree::
:hidden:
:caption: Advanced topics

advanced_usage
notes
api
genindex

.. toctree::
:hidden:
:caption: External links

Source Code on Github <https://github.com/blinkinlabs/circuitpainter>
PyPi Project <https://pypi.org/project/circuitpainter/>
Blinkinlabs <https://blinkinlabs.com>

0 comments on commit 6c610f3

Please sign in to comment.