- Gerber Editor - working in conversion to the new data format
This commit is contained in:
parent
820f75e20c
commit
784865518f
36
camlib.py
36
camlib.py
|
@ -2680,6 +2680,9 @@ class Gerber (Geometry):
|
|||
elif current_operation_code == 2:
|
||||
# finish current path
|
||||
if len(path) > 1:
|
||||
geo_s = None
|
||||
geo_f = None
|
||||
|
||||
if last_path_aperture is None:
|
||||
if '0' not in self.apertures:
|
||||
self.apertures['0'] = {}
|
||||
|
@ -2691,40 +2694,32 @@ class Gerber (Geometry):
|
|||
else:
|
||||
width = self.apertures[last_path_aperture]["size"]
|
||||
|
||||
if self.apertures[last_path_aperture]["type"] != 'R':
|
||||
geo_f = LineString(path)
|
||||
follow_buffer.append(geo_f)
|
||||
|
||||
if making_region:
|
||||
try:
|
||||
geo_s = Polygon(path)
|
||||
poly_buffer.append(geo_s)
|
||||
except ValueError:
|
||||
log.warning(
|
||||
"Not enough points in path to create a Polygon %s %s" % (gline, line_num))
|
||||
try:
|
||||
geo_f = LineString(path)
|
||||
except ValueError:
|
||||
log.warning(
|
||||
"Not enough points in path to create a LineString %s %s" % (gline, line_num))
|
||||
else:
|
||||
geo_s = LineString(path).buffer(width / 1.999, int(self.steps_per_circle / 4))
|
||||
poly_buffer.append(geo_s)
|
||||
geo_f = LineString(path)
|
||||
|
||||
if self.apertures[last_path_aperture]["type"] != 'R':
|
||||
poly_buffer.append(deepcopy(geo_s))
|
||||
follow_buffer.append(deepcopy(geo_f))
|
||||
|
||||
if making_region:
|
||||
geo_dict = dict()
|
||||
geo_dict['follow'] = geo_f
|
||||
if geo_s:
|
||||
if self.is_lpc:
|
||||
geo_dict['clear'] = geo_s
|
||||
geo_dict['clear'] = deepcopy(geo_s)
|
||||
else:
|
||||
geo_dict['solid'] = geo_s
|
||||
|
||||
self.apertures['0']['geometry'].append(geo_dict)
|
||||
|
||||
else:
|
||||
geo_dict = dict()
|
||||
geo_dict['follow'] = geo_f
|
||||
if geo_s:
|
||||
if self.is_lpc:
|
||||
geo_dict['clear'] = geo_s
|
||||
else:
|
||||
geo_dict['solid'] = geo_s
|
||||
geo_dict['solid'] = deepcopy(geo_s)
|
||||
try:
|
||||
self.apertures[last_path_aperture]['geometry'].append(geo_dict)
|
||||
except KeyError:
|
||||
|
@ -2765,7 +2760,6 @@ class Gerber (Geometry):
|
|||
# Reset path starting point
|
||||
path = [[linear_x, linear_y]]
|
||||
|
||||
|
||||
# Draw the flash
|
||||
geo_f = Point(linear_x, linear_y)
|
||||
geo_s = Gerber.create_flash_geometry(
|
||||
|
|
Loading…
Reference in New Issue