Skip to content

Commit

Permalink
Make no_designators and a translated origin the default.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Mets committed Jul 6, 2024
1 parent e5e3007 commit 33fd4f0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 17 deletions.
5 changes: 0 additions & 5 deletions examples/arc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@ def arc_test(cols, rows, spacing):
# Create a new Circuit Painter
painter = CircuitPainter()

# Start drawing at position 50, 50 on the circuit board canvas, so that it
# fits in the sheet nicely.
painter.translate(50,50)

# Draw a board outline
painter.layer("Edge_Cuts")
painter.rect(-spacing,-spacing,(cols)*spacing,(rows)*spacing)


painter.layer("F_Cu")
painter.rect_zone(-spacing,-spacing,(cols)*spacing,(rows)*spacing,"vbat")
painter.layer("B_Cu")
Expand Down
3 changes: 1 addition & 2 deletions examples/asterix.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

def asterix(arms,leds_per_arm):
painter = CircuitPainter()
painter.no_designators()

# Start drawing at a nicer location
painter.translate(100,100)
Expand Down Expand Up @@ -101,7 +100,7 @@ def asterix(arms,leds_per_arm):
if __name__ == "__main__":
parser = ArgumentParser(description="Asterix")
parser.add_argument('--arms',type=int,default=25, help="Number of arms")
parser.add_argument('--leds',type=int,default=12, help="Number of LEDs per arm")
parser.add_argument('--leds',type=int,default=8, help="Number of LEDs per arm")
parser.add_argument('--save',action="store_true",help="Save the design to a KiCad file")
args = parser.parse_args()

Expand Down
1 change: 0 additions & 1 deletion examples/hello_painter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from circuitpainter import CircuitPainter
painter = CircuitPainter()

painter.no_designators() # Don't show reference designator names on the board silkscreen
painter.layer('F_Cu')
painter.width(.2)

Expand Down
4 changes: 0 additions & 4 deletions examples/learn_to_solder_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
# Create a new circuit board
painter = CircuitPainter()

# Start drawing at position 50, 50 on the circuit board canvas, so that it
# fits in the sheet nicely.
painter.translate(50,50)

# Draw a board outline for a 50x20mm PCB
painter.layer("Edge_Cuts")
painter.rect(0,0,50,20)
Expand Down
3 changes: 0 additions & 3 deletions examples/lotus_leds.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ def lerp(a,b,percent):
def lotus_leds(radius, leds,led_radius_percent):
painter = CircuitPainter()

# Don't show reference designator names on the board silkscreen
painter.no_designators()

anglular_step = math.ceil(360/leds)

# Compute the radial positions that the component arcs start and stop at
Expand Down
13 changes: 11 additions & 2 deletions src/circuitpainter/circuitpainter.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,16 @@ class CircuitPainter:
def __init__(
self,
filename=None,
library_path=None):
library_path=None,
preserve_origin=False):
""" Create a Circuit Builder context
:param filename: (optional) If specified, load the given PCB. If not
specified, start with a blank PCB
:param library_path: (optional) Path to the footprint libraries
:param preserve_origin: By default, Circuit Painter translates the
board origin to (40,40), so that the board will be inside of the
title block. Set this to false to keep the origin at (0,0).
"""

if library_path==None:
Expand All @@ -155,7 +159,7 @@ def __init__(
self.draw_width = 0.1
self.draw_layer = "F_Cu"
self.draw_fill = False
self.show_reference_designators = True
self.show_reference_designators = False

# Put all generated items into a group, to make them easier to
# identify.
Expand All @@ -173,6 +177,11 @@ def __init__(
# once before the _fill_zones command is called.
self.is_drc_run = False

# Start drawing at position 50, 50 on the circuit board canvas, so that it
# fits in the sheet nicely.
if not preserve_origin:
self.translate(50,50)

def width(self, width):
""" Set the width to use for drawing commands
Expand Down

0 comments on commit 33fd4f0

Please sign in to comment.