- fixed bug in parsing Gerber regions (a point was added unnecessary)
This commit is contained in:
parent
d7031bc89a
commit
fee24505ae
|
@ -12,6 +12,7 @@ CAD program, and create G-Code for Isolation routing.
|
||||||
4.05.2019
|
4.05.2019
|
||||||
|
|
||||||
- fixed bug in camlib.parse_lines() in the clear_geometry processing section for self.apertures
|
- fixed bug in camlib.parse_lines() in the clear_geometry processing section for self.apertures
|
||||||
|
- fixed bug in parsing Gerber regions (a point was added unnecessary)
|
||||||
|
|
||||||
01.05.2019
|
01.05.2019
|
||||||
|
|
||||||
|
|
25
camlib.py
25
camlib.py
|
@ -2446,6 +2446,14 @@ class Gerber (Geometry):
|
||||||
self.apertures[current_aperture]['clear_geometry'] = []
|
self.apertures[current_aperture]['clear_geometry'] = []
|
||||||
self.apertures[current_aperture]['clear_geometry'].append(flash)
|
self.apertures[current_aperture]['clear_geometry'].append(flash)
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
|
self.apertures[current_aperture]['follow_geometry'].append(Point(
|
||||||
|
current_x, current_y))
|
||||||
|
except KeyError:
|
||||||
|
self.apertures[current_aperture]['follow_geometry'] = []
|
||||||
|
self.apertures[current_aperture]['follow_geometry'].append(Point(
|
||||||
|
current_x, current_y))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.apertures[current_aperture]['solid_geometry'].append(flash)
|
self.apertures[current_aperture]['solid_geometry'].append(flash)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -2692,11 +2700,10 @@ class Gerber (Geometry):
|
||||||
# Pen down: add segment
|
# Pen down: add segment
|
||||||
if current_operation_code == 1:
|
if current_operation_code == 1:
|
||||||
# if linear_x or linear_y are None, ignore those
|
# if linear_x or linear_y are None, ignore those
|
||||||
if linear_x is not None and linear_y is not None:
|
if current_x is not None and current_y is not None:
|
||||||
# only add the point if it's a new one otherwise skip it (harder to process)
|
# only add the point if it's a new one otherwise skip it (harder to process)
|
||||||
if path[-1] != [linear_x, linear_y]:
|
if path[-1] != [current_x, current_y]:
|
||||||
path.append([linear_x, linear_y])
|
path.append([current_x, current_y])
|
||||||
|
|
||||||
if making_region is False:
|
if making_region is False:
|
||||||
# if the aperture is rectangle then add a rectangular shape having as parameters the
|
# if the aperture is rectangle then add a rectangular shape having as parameters the
|
||||||
# coordinates of the start and end point and also the width and height
|
# coordinates of the start and end point and also the width and height
|
||||||
|
@ -2791,9 +2798,9 @@ class Gerber (Geometry):
|
||||||
self.apertures['0']['size'] = 0.0
|
self.apertures['0']['size'] = 0.0
|
||||||
self.apertures['0']['solid_geometry'] = []
|
self.apertures['0']['solid_geometry'] = []
|
||||||
last_path_aperture = '0'
|
last_path_aperture = '0'
|
||||||
elem = [linear_x, linear_y]
|
# elem = [current_x, current_y]
|
||||||
if elem != path[-1]:
|
# if elem != path[-1]:
|
||||||
path.append([linear_x, linear_y])
|
# path.append([current_x, current_y])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
geo = Polygon(path)
|
geo = Polygon(path)
|
||||||
|
@ -3200,7 +3207,7 @@ class Gerber (Geometry):
|
||||||
|
|
||||||
conversion_factor = 25.4 if file_units == 'IN' else (1/25.4) if file_units != app_units else 1
|
conversion_factor = 25.4 if file_units == 'IN' else (1/25.4) if file_units != app_units else 1
|
||||||
|
|
||||||
# --- the following section is usefull for Gerber editor only --- #
|
# --- the following section is useful for Gerber editor only --- #
|
||||||
# list of clear geos that are to be applied to the entire file
|
# list of clear geos that are to be applied to the entire file
|
||||||
global_clear_geo = []
|
global_clear_geo = []
|
||||||
|
|
||||||
|
@ -3246,7 +3253,7 @@ class Gerber (Geometry):
|
||||||
|
|
||||||
if len(poly_buffer) == 0:
|
if len(poly_buffer) == 0:
|
||||||
log.error("Object is not Gerber file or empty. Aborting Object creation.")
|
log.error("Object is not Gerber file or empty. Aborting Object creation.")
|
||||||
return
|
return 'fail'
|
||||||
|
|
||||||
if self.use_buffer_for_union:
|
if self.use_buffer_for_union:
|
||||||
log.debug("Union by buffer...")
|
log.debug("Union by buffer...")
|
||||||
|
|
Loading…
Reference in New Issue