diff options
author | jaseg <git@jaseg.de> | 2024-11-06 14:49:50 +0100 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2024-11-06 14:49:50 +0100 |
commit | be8371c7bc21abe12db49f9dd38dac4513a64886 (patch) | |
tree | 2cf9d84d17f60666b2466b162c632ea1e325b25f /gerbonara/rs274x.py | |
parent | 1a854b1812400867117584f6bbde7bd1c75bb118 (diff) | |
download | gerbonara-be8371c7bc21abe12db49f9dd38dac4513a64886.tar.gz gerbonara-be8371c7bc21abe12db49f9dd38dac4513a64886.tar.bz2 gerbonara-be8371c7bc21abe12db49f9dd38dac4513a64886.zip |
Improve allegro/orcad import
Diffstat (limited to 'gerbonara/rs274x.py')
-rw-r--r-- | gerbonara/rs274x.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gerbonara/rs274x.py b/gerbonara/rs274x.py index fd83c5b..108ccd6 100644 --- a/gerbonara/rs274x.py +++ b/gerbonara/rs274x.py @@ -152,7 +152,7 @@ class GerberFile(CamFile): self.map_apertures(lookup) - def to_excellon(self, plated=None, errors='raise'): + def to_excellon(self, plated=None, errors='raise', holes_only=False): """ Convert this excellon file into a :py:class:`~.excellon.ExcellonFile`. This will convert interpolated lines into slots, and circular aperture flashes into holes. Other features such as ``G36`` polygons or flashes with non-circular apertures will result in a :py:obj:`ValueError`. You can, of course, programmatically remove such @@ -160,7 +160,10 @@ class GerberFile(CamFile): new_objs = [] new_tools = {} for obj in self.objects: - if not (isinstance(obj, go.Line) or isinstance(obj, go.Arc) or isinstance(obj, go.Flash)) or \ + if holes_only and not isinstance(obj, go.Flash): + continue + + if not isinstance(obj, (go.Line, go.Arc, go.Flash)) or \ not isinstance(getattr(obj, 'aperture', None), apertures.CircleAperture): if errors == 'raise': raise ValueError(f'Cannot convert {obj} to excellon.') |