Fixed Gerber parser: Now buffers current path with previous tool on tool change.
This commit is contained in:
parent
bcbab971ca
commit
b873cbfea4
|
@ -45,7 +45,7 @@ class App(QtCore.QObject):
|
|||
log.addHandler(handler)
|
||||
|
||||
## Version
|
||||
version = 7
|
||||
version = 8
|
||||
version_date = "2014/10"
|
||||
|
||||
## URL for update checks and statistics
|
||||
|
@ -55,7 +55,7 @@ class App(QtCore.QObject):
|
|||
app_url = "http://flatcam.org"
|
||||
|
||||
## Manual URL
|
||||
manual_url = "http://flatcam.org/manual/static/index.html"
|
||||
manual_url = "http://flatcam.org/manual/index.html"
|
||||
|
||||
## Signals
|
||||
inform = QtCore.pyqtSignal(str) # Message
|
||||
|
|
23
camlib.py
23
camlib.py
|
@ -32,9 +32,9 @@ import simplejson as json
|
|||
import logging
|
||||
|
||||
log = logging.getLogger('base2')
|
||||
#log.setLevel(logging.DEBUG)
|
||||
log.setLevel(logging.DEBUG)
|
||||
#log.setLevel(logging.WARNING)
|
||||
log.setLevel(logging.INFO)
|
||||
#log.setLevel(logging.INFO)
|
||||
formatter = logging.Formatter('[%(levelname)s] %(message)s')
|
||||
handler = logging.StreamHandler()
|
||||
handler.setFormatter(formatter)
|
||||
|
@ -42,6 +42,10 @@ log.addHandler(handler)
|
|||
|
||||
|
||||
class Geometry(object):
|
||||
"""
|
||||
Base geometry class.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
# Units (in or mm)
|
||||
self.units = 'in'
|
||||
|
@ -1008,7 +1012,7 @@ class Gerber (Geometry):
|
|||
### Aperture Macros
|
||||
# Having this at the beggining will slow things down
|
||||
# but macros can have complicated statements than could
|
||||
# be caught by other ptterns.
|
||||
# be caught by other patterns.
|
||||
if current_macro is None: # No macro started yet
|
||||
match = self.am1_re.search(gline)
|
||||
# Start macro if match, else not an AM, carry on.
|
||||
|
@ -1074,7 +1078,8 @@ class Gerber (Geometry):
|
|||
else:
|
||||
if last_path_aperture is None:
|
||||
log.warning("No aperture defined for curent path. (%d)" % line_num)
|
||||
width = self.apertures[last_path_aperture]["size"]
|
||||
width = self.apertures[last_path_aperture]["size"] # TODO: WARNING this should fail!
|
||||
#log.debug("Line %d: Setting aperture to %s before buffering." % (line_num, last_path_aperture))
|
||||
if follow:
|
||||
geo = LineString(path)
|
||||
else:
|
||||
|
@ -1268,7 +1273,17 @@ class Gerber (Geometry):
|
|||
# Example: D12*
|
||||
match = self.tool_re.search(gline)
|
||||
if match:
|
||||
log.debug("Line %d: Aperture change to (%s)" % (line_num, match.group(1)))
|
||||
current_aperture = match.group(1)
|
||||
|
||||
# Take care of the current path with the previous tool
|
||||
if len(path) > 1:
|
||||
# --- Buffered ----
|
||||
width = self.apertures[last_path_aperture]["size"]
|
||||
geo = LineString(path).buffer(width/2)
|
||||
poly_buffer.append(geo)
|
||||
path = [path[-1]]
|
||||
|
||||
continue
|
||||
|
||||
### Polarity change
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"gerber_noncopperrounded": false, "geometry_paintoverlap": 0.15, "excellon_plot": true, "excellon_feedrate": 3.0, "serial": "x8twd1r93g8on3eqxywf", "stats": {"save_defaults": 4232}, "gerber_plot": true, "geometry_plot": true, "excellon_drillz": -0.1, "geometry_feedrate": 3.0, "units": "IN", "excellon_travelz": 0.1, "gerber_multicolored": false, "gerber_solid": true, "gerber_isopasses": 1, "cncjob_append": "", "gerber_isotooldia": 0.016, "cncjob_tooldia": 0.016, "geometry_travelz": 0.1, "gerber_cutoutmargin": 0.1, "excellon_solid": false, "geometry_paintmargin": 0.0, "geometry_cutz": -0.002, "geometry_cnctooldia": 0.016, "gerber_cutouttooldia": 0.07, "gerber_gaps": "4", "gerber_bboxmargin": 0.0, "cncjob_plot": true, "gerber_cutoutgapsize": 0.15, "gerber_isooverlap": 0.15, "gerber_bboxrounded": false, "gerber_noncoppermargin": 0.0, "geometry_painttooldia": 0.07}
|
||||
{}
|
|
@ -1 +1 @@
|
|||
[{"kind": "excellon", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/FlatCam_Drilling_Test/FlatCam_Drilling_Test.drl"}, {"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/Top2.gbr"}, {"kind": "project", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/easy_eda_test/easy_eda.fc"}]
|
||||
[{"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/Top3.gbr"}, {"kind": "excellon", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/FlatCam_Drilling_Test/FlatCam_Drilling_Test.drl"}, {"kind": "gerber", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/Top2.gbr"}, {"kind": "project", "filename": "C:/Users/jpcaram/Dropbox/CNC/pcbcam/test_files/easy_eda_test/easy_eda.fc"}]
|
Loading…
Reference in New Issue