Fix out-of-date documentation

This commit is contained in:
jaseg 2025-08-22 13:24:02 +02:00
parent da6d8349fa
commit 379cf273cb
4 changed files with 6 additions and 5 deletions

View file

@ -71,7 +71,7 @@ Then, you are ready to read and write gerber files:
from gerbonara import LayerStack from gerbonara import LayerStack
stack = LayerStack.from_directory('output/gerber') stack = LayerStack.open('output/gerber')
w, h = stack.outline.size('mm') w, h = stack.outline.size('mm')
print(f'Board size is {w:.1f} mm x {h:.1f} mm') print(f'Board size is {w:.1f} mm x {h:.1f} mm')

View file

@ -10,7 +10,7 @@ from gerbonara.utils import MM
from gerbonara.utils import rotate_point from gerbonara.utils import rotate_point
def highlight_outline(input_dir, output_dir): def highlight_outline(input_dir, output_dir):
stack = LayerStack.from_directory(input_dir) stack = LayerStack.open(input_dir)
outline = [] outline = []
for obj in stack.outline.objects: for obj in stack.outline.objects:
@ -28,7 +28,6 @@ def highlight_outline(input_dir, output_dir):
marker_nx, marker_ny = math.sin(marker_angle), math.cos(marker_angle) marker_nx, marker_ny = math.sin(marker_angle), math.cos(marker_angle)
ap = CircleAperture(0.1, unit=MM) ap = CircleAperture(0.1, unit=MM)
stack['top silk'].apertures.append(ap)
for line in outline: for line in outline:
cx, cy = (line.x1 + line.x2)/2, (line.y1 + line.y2)/2 cx, cy = (line.x1 + line.x2)/2, (line.y1 + line.y2)/2

View file

@ -7,5 +7,5 @@ if __name__ == '__main__':
args = parser.parse_args() args = parser.parse_args()
import gerbonara import gerbonara
print(gerbonara.LayerStack.from_directory(args.input)) print(gerbonara.LayerStack.open(args.input))

View file

@ -2,6 +2,7 @@
import math import math
from gerbonara.utils import MM
from gerbonara.graphic_objects import Arc from gerbonara.graphic_objects import Arc
from gerbonara.graphic_objects import rotate_point from gerbonara.graphic_objects import rotate_point
@ -22,7 +23,8 @@ def approx_test():
x1, y1 = rotate_point(0, -1, start_angle*eps) x1, y1 = rotate_point(0, -1, start_angle*eps)
x2, y2 = rotate_point(x1, y1, sweep_angle*eps*(-1 if clockwise else 1)) x2, y2 = rotate_point(x1, y1, sweep_angle*eps*(-1 if clockwise else 1))
arc = Arc(x1+cx, y1+cy, x2+cx, y2+cy, -x1, -y1, clockwise=clockwise, aperture=None, polarity_dark=True) arc = Arc(x1+cx, y1+cy, x2+cx, y2+cy, -x1, -y1, clockwise=clockwise, aperture=None,
polarity_dark=True, unit=MM)
lines = arc.approximate(max_error=max_error) lines = arc.approximate(max_error=max_error)
print(f'<path style="fill: {color}; stroke: none;" d="M {cx} {cy} L {lines[0].x1} {lines[0].y1}', end=' ') print(f'<path style="fill: {color}; stroke: none;" d="M {cx} {cy} L {lines[0].x1} {lines[0].y1}', end=' ')