diff options
Diffstat (limited to 'gerbonara/gerber/aperture_macros/parse.py')
-rw-r--r-- | gerbonara/gerber/aperture_macros/parse.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gerbonara/gerber/aperture_macros/parse.py b/gerbonara/gerber/aperture_macros/parse.py index 86f2882..00227c6 100644 --- a/gerbonara/gerber/aperture_macros/parse.py +++ b/gerbonara/gerber/aperture_macros/parse.py @@ -98,6 +98,20 @@ class ApertureMacro: def __hash__(self): return hash(self.to_gerber()) + def dilated(self, offset, unit='mm'): + dup = copy.deepcopy(self) + new_primitives = [] + for primitive in dup.primitives: + try: + if primitive.exposure.calculate(): + primitive.dilate(offset, unit) + new_primitives.append(primitive) + except IndexError: + warnings.warn('Cannot dilate aperture macro primitive with exposure value computed from macro variable.') + pass + dup.primitives = new_primitives + return dup + def to_gerber(self, unit=None): comments = [ c.to_gerber() for c in self.comments ] variable_defs = [ f'${var.to_gerber(unit)}={expr}' for var, expr in self.variables.items() ] |