Some fixes (hacks) to load certain malformed gerber.
This commit is contained in:
parent
ef30eb5d9c
commit
0974e54d98
21
camlib.py
21
camlib.py
|
@ -834,19 +834,22 @@ class Gerber (Geometry):
|
||||||
if apertureType == "R": # Rectangle, example: %ADD15R,0.05X0.12*%
|
if apertureType == "R": # Rectangle, example: %ADD15R,0.05X0.12*%
|
||||||
self.apertures[apid] = {"type": "R",
|
self.apertures[apid] = {"type": "R",
|
||||||
"width": float(paramList[0]),
|
"width": float(paramList[0]),
|
||||||
"height": float(paramList[1])}
|
"height": float(paramList[1]),
|
||||||
|
"size": sqrt(float(paramList[0])**2 + float(paramList[1])**2)} # Hack
|
||||||
return apid
|
return apid
|
||||||
|
|
||||||
if apertureType == "O": # Obround
|
if apertureType == "O": # Obround
|
||||||
self.apertures[apid] = {"type": "O",
|
self.apertures[apid] = {"type": "O",
|
||||||
"width": float(paramList[0]),
|
"width": float(paramList[0]),
|
||||||
"height": float(paramList[1])}
|
"height": float(paramList[1]),
|
||||||
|
"size": sqrt(float(paramList[0])**2 + float(paramList[1])**2)} # Hack
|
||||||
return apid
|
return apid
|
||||||
|
|
||||||
if apertureType == "P": # Polygon (regular)
|
if apertureType == "P": # Polygon (regular)
|
||||||
self.apertures[apid] = {"type": "P",
|
self.apertures[apid] = {"type": "P",
|
||||||
"diam": float(paramList[0]),
|
"diam": float(paramList[0]),
|
||||||
"nVertices": int(paramList[1])}
|
"nVertices": int(paramList[1]),
|
||||||
|
"size": float(paramList[0])} # Hack
|
||||||
if len(paramList) >= 3:
|
if len(paramList) >= 3:
|
||||||
self.apertures[apid]["rotation"] = float(paramList[2])
|
self.apertures[apid]["rotation"] = float(paramList[2])
|
||||||
return apid
|
return apid
|
||||||
|
@ -1107,15 +1110,20 @@ class Gerber (Geometry):
|
||||||
log.warning("Single quadrant arc are not implemented yet. (%d)" % line_num)
|
log.warning("Single quadrant arc are not implemented yet. (%d)" % line_num)
|
||||||
|
|
||||||
### Operation code alone
|
### Operation code alone
|
||||||
|
# Operation code alone, usually just D03 (Flash)
|
||||||
|
# self.opcode_re = re.compile(r'^D0?([123])\*$')
|
||||||
match = self.opcode_re.search(gline)
|
match = self.opcode_re.search(gline)
|
||||||
if match:
|
if match:
|
||||||
current_operation_code = int(match.group(1))
|
current_operation_code = int(match.group(1))
|
||||||
if current_operation_code == 3:
|
if current_operation_code == 3:
|
||||||
|
|
||||||
## --- Buffered ---
|
## --- Buffered ---
|
||||||
flash = Gerber.create_flash_geometry(Point(path[-1]),
|
try:
|
||||||
self.apertures[current_aperture])
|
flash = Gerber.create_flash_geometry(Point(path[-1]),
|
||||||
poly_buffer.append(flash)
|
self.apertures[current_aperture])
|
||||||
|
poly_buffer.append(flash)
|
||||||
|
except IndexError:
|
||||||
|
log.warning("Line %d: %s -> Nothing there to flash!" % (line_num, gline))
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -1900,6 +1908,7 @@ class CNCjob(Geometry):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if type(geo) == Point:
|
if type(geo) == Point:
|
||||||
|
# TODO: point2gcode does not return anything...
|
||||||
self.gcode += self.point2gcode(geo)
|
self.gcode += self.point2gcode(geo)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
[{"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/cirkuix/tests/CBS-F_Cu.gtl"}, {"kind": "excellon", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/BLDC2003Through.drl"}, {"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/cirkuix/tests/CBS-B_Cu.gbl"}, {"kind": "project", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/gerber_project.fcam"}, {"kind": "project", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/drill_project.fcam"}, {"kind": "excellon", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/TFTadapter.drl"}, {"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/WindMills - Bottom Copper 2.gbr"}, {"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/Example1_copper_bottom.gbr"}, {"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/7V-PSU.zip"}, {"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/Gerbers/AVR_Transistor_Tester_copper_top.GTL"}]
|
[{"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/not_loaded.gtl"}, {"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/diag_1TOP.art"}, {"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/22TOP.art"}, {"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/Top.gbr"}, {"kind": "excellon", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/holes.drl"}, {"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/cirkuix/tests/CBS-F_Cu.gtl"}, {"kind": "excellon", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/BLDC2003Through.drl"}, {"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/cirkuix/tests/CBS-B_Cu.gbl"}, {"kind": "project", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/gerber_project.fcam"}, {"kind": "project", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/drill_project.fcam"}]
|
Loading…
Reference in New Issue