Skip to content

Commit

Permalink
Fix handling of complex polygonpours, don't process polygons to zones
Browse files Browse the repository at this point in the history
Only use polygonpours w/ polygonfilldetails for zones, as this geometry reflects isolation, thermals, etc., unlike plain polygons which do not.
Handle non-trivial polygonpours which include multiple shapes as well as polygonholelists (cutouts)
  • Loading branch information
Funkenjaeger authored and qu1ck committed Sep 24, 2023
1 parent 07a3d20 commit 77eb20b
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions InteractiveHtmlBom/ecad/fusion_eagle.py
Expand Up @@ -688,16 +688,27 @@ def _add_zone(self, poly, net):
return

if poly.tag == 'polygonpour':
segs = poly.find('polygonfilldetails').find('polygonshape') \
.find('polygonoutlinesegments')
shapes = poly.find('polygonfilldetails').findall('polygonshape')
if shapes:
zone = {'polygons': [],
'fillrule': 'evenodd'}
for shape in shapes:
segs = shape.find('polygonoutlinesegments')
zone['polygons'].append(self._segments_to_polygon(segs))
holelist = shape.find('polygonholelist')
if holelist:
holes = holelist.findall('polygonholesegments')
for hole in holes:
zone['polygons'].append(self._segments_to_polygon(hole))
if self.config.include_nets:
zone['net'] = net
dest.append(zone)
else:
segs = poly

zone = {'polygons': []}
zone['polygons'].append(self._segments_to_polygon(segs))
if self.config.include_nets:
zone['net'] = net
dest.append(zone)
zone = {'polygons': []}
zone['polygons'].append(self._segments_to_polygon(poly))
if self.config.include_nets:
zone['net'] = net
dest.append(zone)

def _add_parsed_font_data(self):
for (c, wl) in self.font_parser.get_parsed_font().items():
Expand Down Expand Up @@ -781,8 +792,6 @@ def _parse(self, brdfile):
self._add_track(via, signal.attrib['name'])
for poly in signal.iter('polygonpour'):
self._add_zone(poly, signal.attrib['name'])
for poly in signal.iter('polygon'):
self._add_zone(poly, signal.attrib['name'])

# Elements --> components, footprints, silkscreen, edges
for el in elements.iter('element'):
Expand Down

0 comments on commit 77eb20b

Please sign in to comment.