- 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:
|
elif current_operation_code == 2:
|
||||||
# finish current path
|
# finish current path
|
||||||
if len(path) > 1:
|
if len(path) > 1:
|
||||||
|
geo_s = None
|
||||||
|
geo_f = None
|
||||||
|
|
||||||
if last_path_aperture is None:
|
if last_path_aperture is None:
|
||||||
if '0' not in self.apertures:
|
if '0' not in self.apertures:
|
||||||
self.apertures['0'] = {}
|
self.apertures['0'] = {}
|
||||||
|
@ -2691,40 +2694,32 @@ class Gerber (Geometry):
|
||||||
else:
|
else:
|
||||||
width = self.apertures[last_path_aperture]["size"]
|
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:
|
if making_region:
|
||||||
try:
|
try:
|
||||||
geo_s = Polygon(path)
|
geo_s = Polygon(path)
|
||||||
poly_buffer.append(geo_s)
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
log.warning(
|
log.warning(
|
||||||
"Not enough points in path to create a Polygon %s %s" % (gline, line_num))
|
"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:
|
else:
|
||||||
geo_s = LineString(path).buffer(width / 1.999, int(self.steps_per_circle / 4))
|
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 = dict()
|
||||||
geo_dict['follow'] = geo_f
|
geo_dict['follow'] = geo_f
|
||||||
if geo_s:
|
if geo_s:
|
||||||
if self.is_lpc:
|
if self.is_lpc:
|
||||||
geo_dict['clear'] = geo_s
|
geo_dict['clear'] = deepcopy(geo_s)
|
||||||
else:
|
else:
|
||||||
geo_dict['solid'] = geo_s
|
geo_dict['solid'] = deepcopy(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
|
|
||||||
try:
|
try:
|
||||||
self.apertures[last_path_aperture]['geometry'].append(geo_dict)
|
self.apertures[last_path_aperture]['geometry'].append(geo_dict)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -2765,7 +2760,6 @@ class Gerber (Geometry):
|
||||||
# Reset path starting point
|
# Reset path starting point
|
||||||
path = [[linear_x, linear_y]]
|
path = [[linear_x, linear_y]]
|
||||||
|
|
||||||
|
|
||||||
# Draw the flash
|
# Draw the flash
|
||||||
geo_f = Point(linear_x, linear_y)
|
geo_f = Point(linear_x, linear_y)
|
||||||
geo_s = Gerber.create_flash_geometry(
|
geo_s = Gerber.create_flash_geometry(
|
||||||
|
|
Loading…
Reference in New Issue