- working on a new type of database
This commit is contained in:
@@ -467,7 +467,7 @@ class Gerber(Geometry):
|
||||
# --- Buffered ----
|
||||
width = self.apertures[last_path_aperture]["size"]
|
||||
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
geo_f = LineString(path)
|
||||
if not geo_f.is_empty:
|
||||
follow_buffer.append(geo_f)
|
||||
@@ -486,7 +486,7 @@ class Gerber(Geometry):
|
||||
geo_dict['solid'] = geo_s
|
||||
|
||||
if last_path_aperture not in self.apertures:
|
||||
self.apertures[last_path_aperture] = dict()
|
||||
self.apertures[last_path_aperture] = {}
|
||||
if 'geometry' not in self.apertures[last_path_aperture]:
|
||||
self.apertures[last_path_aperture]['geometry'] = []
|
||||
self.apertures[last_path_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
@@ -677,7 +677,7 @@ class Gerber(Geometry):
|
||||
# --- Buffered ---
|
||||
try:
|
||||
# log.debug("Bare op-code %d." % current_operation_code)
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
flash = self.create_flash_geometry(
|
||||
Point(current_x, current_y), self.apertures[current_aperture],
|
||||
self.steps_per_circle)
|
||||
@@ -695,7 +695,7 @@ class Gerber(Geometry):
|
||||
geo_dict['solid'] = flash
|
||||
|
||||
if current_aperture not in self.apertures:
|
||||
self.apertures[current_aperture] = dict()
|
||||
self.apertures[current_aperture] = {}
|
||||
if 'geometry' not in self.apertures[current_aperture]:
|
||||
self.apertures[current_aperture]['geometry'] = []
|
||||
self.apertures[current_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
@@ -734,7 +734,7 @@ class Gerber(Geometry):
|
||||
# do nothing because 'R' type moving aperture is none at once
|
||||
pass
|
||||
else:
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
geo_f = LineString(path)
|
||||
if not geo_f.is_empty:
|
||||
follow_buffer.append(geo_f)
|
||||
@@ -754,7 +754,7 @@ class Gerber(Geometry):
|
||||
geo_dict['solid'] = geo_s
|
||||
|
||||
if last_path_aperture not in self.apertures:
|
||||
self.apertures[last_path_aperture] = dict()
|
||||
self.apertures[last_path_aperture] = {}
|
||||
if 'geometry' not in self.apertures[last_path_aperture]:
|
||||
self.apertures[last_path_aperture]['geometry'] = []
|
||||
self.apertures[last_path_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
@@ -774,7 +774,7 @@ class Gerber(Geometry):
|
||||
if path_length > 1:
|
||||
# Take care of what is left in the path
|
||||
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
geo_f = LineString(path)
|
||||
if not geo_f.is_empty:
|
||||
follow_buffer.append(geo_f)
|
||||
@@ -794,7 +794,7 @@ class Gerber(Geometry):
|
||||
geo_dict['solid'] = geo_s
|
||||
|
||||
if last_path_aperture not in self.apertures:
|
||||
self.apertures[last_path_aperture] = dict()
|
||||
self.apertures[last_path_aperture] = {}
|
||||
if 'geometry' not in self.apertures[last_path_aperture]:
|
||||
self.apertures[last_path_aperture]['geometry'] = []
|
||||
self.apertures[last_path_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
@@ -814,7 +814,7 @@ class Gerber(Geometry):
|
||||
self.apertures['0'] = {}
|
||||
self.apertures['0']['type'] = 'REG'
|
||||
self.apertures['0']['size'] = 0.0
|
||||
self.apertures['0']['geometry'] = list()
|
||||
self.apertures['0']['geometry'] = []
|
||||
|
||||
# if D02 happened before G37 we now have a path with 1 element only; we have to add the current
|
||||
# geo to the poly_buffer otherwise we loose it
|
||||
@@ -826,7 +826,7 @@ class Gerber(Geometry):
|
||||
|
||||
if path_length == 1:
|
||||
# this means that the geometry was prepared previously and we just need to add it
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
if geo_f:
|
||||
if not geo_f.is_empty:
|
||||
follow_buffer.append(geo_f)
|
||||
@@ -863,7 +863,7 @@ class Gerber(Geometry):
|
||||
# For regions we may ignore an aperture that is None
|
||||
|
||||
# --- Buffered ---
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
if current_aperture in self.apertures:
|
||||
# the following line breaks loading of Circuit Studio Gerber files
|
||||
# buff_value = float(self.apertures[current_aperture]['size']) / 2.0
|
||||
@@ -965,7 +965,7 @@ class Gerber(Geometry):
|
||||
maxy = max(path[0][1], path[1][1]) + height / 2
|
||||
log.debug("Coords: %s - %s - %s - %s" % (minx, miny, maxx, maxy))
|
||||
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
geo_f = Point([current_x, current_y])
|
||||
follow_buffer.append(geo_f)
|
||||
geo_dict['follow'] = geo_f
|
||||
@@ -982,7 +982,7 @@ class Gerber(Geometry):
|
||||
geo_dict['solid'] = geo_s
|
||||
|
||||
if current_aperture not in self.apertures:
|
||||
self.apertures[current_aperture] = dict()
|
||||
self.apertures[current_aperture] = {}
|
||||
if 'geometry' not in self.apertures[current_aperture]:
|
||||
self.apertures[current_aperture]['geometry'] = []
|
||||
self.apertures[current_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
@@ -1012,7 +1012,7 @@ class Gerber(Geometry):
|
||||
if path_length > 1:
|
||||
geo_s = None
|
||||
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
# --- BUFFERED ---
|
||||
# this treats the case when we are storing geometry as paths only
|
||||
if making_region:
|
||||
@@ -1089,7 +1089,7 @@ class Gerber(Geometry):
|
||||
geo_dict['solid'] = geo_s
|
||||
|
||||
if last_path_aperture not in self.apertures:
|
||||
self.apertures[last_path_aperture] = dict()
|
||||
self.apertures[last_path_aperture] = {}
|
||||
if 'geometry' not in self.apertures[last_path_aperture]:
|
||||
self.apertures[last_path_aperture]['geometry'] = []
|
||||
self.apertures[last_path_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
@@ -1115,7 +1115,7 @@ class Gerber(Geometry):
|
||||
|
||||
if path_length > 1:
|
||||
# --- Buffered ----
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
|
||||
# this treats the case when we are storing geometry as paths
|
||||
geo_f = LineString(path)
|
||||
@@ -1156,7 +1156,7 @@ class Gerber(Geometry):
|
||||
geo_dict['solid'] = geo_s
|
||||
|
||||
if last_path_aperture not in self.apertures:
|
||||
self.apertures[last_path_aperture] = dict()
|
||||
self.apertures[last_path_aperture] = {}
|
||||
if 'geometry' not in self.apertures[last_path_aperture]:
|
||||
self.apertures[last_path_aperture]['geometry'] = []
|
||||
self.apertures[last_path_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
@@ -1167,7 +1167,7 @@ class Gerber(Geometry):
|
||||
# --- BUFFERED ---
|
||||
# Draw the flash
|
||||
# this treats the case when we are storing geometry as paths
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
geo_flash = Point([linear_x, linear_y])
|
||||
follow_buffer.append(geo_flash)
|
||||
geo_dict['follow'] = geo_flash
|
||||
@@ -1190,7 +1190,7 @@ class Gerber(Geometry):
|
||||
geo_dict['solid'] = flash
|
||||
|
||||
if current_aperture not in self.apertures:
|
||||
self.apertures[current_aperture] = dict()
|
||||
self.apertures[current_aperture] = {}
|
||||
if 'geometry' not in self.apertures[current_aperture]:
|
||||
self.apertures[current_aperture]['geometry'] = []
|
||||
self.apertures[current_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
@@ -1275,7 +1275,7 @@ class Gerber(Geometry):
|
||||
path_length = 1
|
||||
|
||||
if path_length > 1:
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
|
||||
if last_path_aperture is None:
|
||||
log.warning("No aperture defined for curent path. (%d)" % line_num)
|
||||
@@ -1303,7 +1303,7 @@ class Gerber(Geometry):
|
||||
geo_dict['solid'] = buffered
|
||||
|
||||
if last_path_aperture not in self.apertures:
|
||||
self.apertures[last_path_aperture] = dict()
|
||||
self.apertures[last_path_aperture] = {}
|
||||
if 'geometry' not in self.apertures[last_path_aperture]:
|
||||
self.apertures[last_path_aperture]['geometry'] = []
|
||||
self.apertures[last_path_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
@@ -1432,7 +1432,7 @@ class Gerber(Geometry):
|
||||
# EOF, create shapely LineString if something still in path
|
||||
# ## --- Buffered ---
|
||||
|
||||
geo_dict = dict()
|
||||
geo_dict = {}
|
||||
# this treats the case when we are storing geometry as paths
|
||||
geo_f = LineString(path)
|
||||
if not geo_f.is_empty:
|
||||
@@ -1454,7 +1454,7 @@ class Gerber(Geometry):
|
||||
geo_dict['solid'] = geo_s
|
||||
|
||||
if last_path_aperture not in self.apertures:
|
||||
self.apertures[last_path_aperture] = dict()
|
||||
self.apertures[last_path_aperture] = {}
|
||||
if 'geometry' not in self.apertures[last_path_aperture]:
|
||||
self.apertures[last_path_aperture]['geometry'] = []
|
||||
self.apertures[last_path_aperture]['geometry'].append(deepcopy(geo_dict))
|
||||
@@ -1525,7 +1525,7 @@ class Gerber(Geometry):
|
||||
# it use a filled bounding box polygon to which add clear polygons (negative) to isolate the copper
|
||||
# features
|
||||
if self.app.defaults['gerber_extra_buffering']:
|
||||
candidate_geo = list()
|
||||
candidate_geo = []
|
||||
try:
|
||||
for p in self.solid_geometry:
|
||||
candidate_geo.append(p.buffer(-0.0000001))
|
||||
@@ -1777,7 +1777,7 @@ class Gerber(Geometry):
|
||||
|
||||
# Add to object
|
||||
if self.solid_geometry is None:
|
||||
self.solid_geometry = list()
|
||||
self.solid_geometry = []
|
||||
|
||||
# if type(self.solid_geometry) == list:
|
||||
# if type(geos) == list:
|
||||
@@ -1795,7 +1795,7 @@ class Gerber(Geometry):
|
||||
geos_length = 1
|
||||
|
||||
if geos_length == 1:
|
||||
geo_qrcode = list()
|
||||
geo_qrcode = []
|
||||
geo_qrcode.append(Polygon(geos[0].exterior))
|
||||
for i_el in geos[0].interiors:
|
||||
geo_qrcode.append(Polygon(i_el).buffer(0))
|
||||
@@ -1822,13 +1822,13 @@ class Gerber(Geometry):
|
||||
self.solid_geometry = [self.solid_geometry]
|
||||
|
||||
if '0' not in self.apertures:
|
||||
self.apertures['0'] = dict()
|
||||
self.apertures['0'] = {}
|
||||
self.apertures['0']['type'] = 'REG'
|
||||
self.apertures['0']['size'] = 0.0
|
||||
self.apertures['0']['geometry'] = list()
|
||||
self.apertures['0']['geometry'] = []
|
||||
|
||||
for pol in self.solid_geometry:
|
||||
new_el = dict()
|
||||
new_el = {}
|
||||
new_el['solid'] = pol
|
||||
new_el['follow'] = pol.exterior
|
||||
self.apertures['0']['geometry'].append(deepcopy(new_el))
|
||||
@@ -1917,10 +1917,10 @@ class Gerber(Geometry):
|
||||
# we need to scale the geometry stored in the Gerber apertures, too
|
||||
try:
|
||||
for apid in self.apertures:
|
||||
new_geometry = list()
|
||||
new_geometry = []
|
||||
if 'geometry' in self.apertures[apid]:
|
||||
for geo_el in self.apertures[apid]['geometry']:
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
if 'solid' in geo_el:
|
||||
new_geo_el['solid'] = scale_geom(geo_el['solid'])
|
||||
if 'follow' in geo_el:
|
||||
@@ -2313,10 +2313,10 @@ class Gerber(Geometry):
|
||||
# we need to buffer the geometry stored in the Gerber apertures, too
|
||||
try:
|
||||
for apid in self.apertures:
|
||||
new_geometry = list()
|
||||
new_geometry = []
|
||||
if 'geometry' in self.apertures[apid]:
|
||||
for geo_el in self.apertures[apid]['geometry']:
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
if 'solid' in geo_el:
|
||||
new_geo_el['solid'] = buffer_geom(geo_el['solid'])
|
||||
if 'follow' in geo_el:
|
||||
@@ -2364,10 +2364,10 @@ class Gerber(Geometry):
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
new_geometry = list()
|
||||
new_geometry = []
|
||||
if 'geometry' in self.apertures[apid]:
|
||||
for geo_el in self.apertures[apid]['geometry']:
|
||||
new_geo_el = dict()
|
||||
new_geo_el = {}
|
||||
if 'follow' in geo_el:
|
||||
new_geo_el['follow'] = geo_el['follow']
|
||||
size = float(self.apertures[apid]['size'])
|
||||
@@ -2405,7 +2405,7 @@ class Gerber(Geometry):
|
||||
return 'fail'
|
||||
|
||||
# make the new solid_geometry
|
||||
new_solid_geo = list()
|
||||
new_solid_geo = []
|
||||
for apid in self.apertures:
|
||||
if 'geometry' in self.apertures[apid]:
|
||||
new_solid_geo += [geo_el['solid'] for geo_el in self.apertures[apid]['geometry']]
|
||||
|
||||
Reference in New Issue
Block a user