add rotation fuction

This commit is contained in:
opiopan 2019-03-23 21:59:13 +09:00
parent 9febca7da6
commit 690df56bb7
17 changed files with 12374 additions and 19 deletions

2792
test/data/fill.dxf Normal file

File diff suppressed because it is too large Load diff

51
test/data/merge.py Executable file
View file

@ -0,0 +1,51 @@
#!/usr/bin/env python
import os
import gerberex
from gerberex.dxf import DxfFile
exts = ['GTL', 'GTO', 'GTP', 'GTS', 'GBL', 'GBO', 'GBP', 'GBS', 'TXT']
boards=[
('../../sonopi-digi/pcb/CAMOutputs/sonopi-digi.', 0, 0),
('../../sonopi-digi/pcb/CAMOutputs/sonopi-digi.', 0, 22.5),
('../../rcstick-f/pcb/small/CAMOutputs/rcstick-f-small.', 0, 60),
('../../rcstick-f/pcb/small/CAMOutputs/rcstick-f-small.', 20, 60),
('../../rcstick-f/pcb/small/CAMOutputs/rcstick-f-small.', 40, 60),
('../../rcstick-f/pcb/large/CAMOutputs/rcstick-f.', 72.4, 0),
('../../rcstick-f/pcb/jig/CAMOutputs/rcstick-jig.', 0, 44),
('../../stm32breakout/pcb/CAMOutputs/stm32breakout.', 78.0, 59.36),
('../../stm32breakout/pcb/CAMOutputs/stm32breakout.', 100.0, 59.36),
]
outline = 'outline.dxf'
fill = 'fill.dxf'
outputs = 'outputs/elecrow-panelized'
os.chdir(os.path.dirname(__file__))
for ext in exts:
print('merging %s: ' % ext ,end='', flush=True)
if ext == 'TXT':
ctx = gerberex.DrillComposition()
else:
ctx = gerberex.GerberComposition()
for board in boards:
file = gerberex.read(board[0] + ext)
file.to_metric()
file.offset(board[1], board[2])
ctx.merge(file)
print('.', end='', flush=True)
if ext != 'TXT':
file = gerberex.read(outline)
ctx.merge(file)
ctx.dump(outputs + '.' + ext)
print(' end', flush=True)
print('generating GML: ', end='', flush=True)
file = gerberex.read(outline)
file.write(outputs + '.GML')
print('.', end='', flush=True)
file = gerberex.read(fill)
file.to_metric()
file.draw_mode = DxfFile.DM_FILL
file.write(outputs + '-fill.GML')
print('. end', flush=True)

2602
test/data/outline.dxf Normal file

File diff suppressed because it is too large Load diff

6518
test/data/test.GTL Normal file

File diff suppressed because it is too large Load diff

45
test/data/test.TXT Normal file
View file

@ -0,0 +1,45 @@
M48
;GenerationSoftware,Autodesk,EAGLE,9.3.0*%
;CreationDate,2019-03-17T14:26:03Z*%
FMAT,2
ICI,OFF
METRIC,TZ,000.000
T5C0.350
T4C0.508
T3C0.800
T2C0.930
T1C1.200
%
G90
M71
T1
X5450Y2685
X9950Y2685
T2
X11200Y4785
X8700Y4785
X6700Y4785
X4200Y4785
T3
X5588Y25527
T4
X2062Y6253
X2062Y7503
X2062Y8753
X2062Y10003
T5
X4191Y15113
X11557Y15494
X7747Y17018
X7747Y9017
X4064Y27178
X7112Y27178
X8890Y26035
X1651Y24892
X6096Y22479
X12700Y18796
X13335Y18161
X7747Y22225
X7112Y23907
X14450Y34250
M30