diff options
author | jaseg <git@jaseg.de> | 2021-12-29 19:58:20 +0100 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2021-12-29 19:58:20 +0100 |
commit | 3fb26e6940b5ae752308d8a33f2608d266795153 (patch) | |
tree | a563b0cf512e5661b2a450ebf73eafe655ac18b2 /gerbonara/gerber/aperture_macros/primitive.py | |
parent | 30dabef9ee83021067957854187b9bbf245c14cf (diff) | |
download | gerbonara-3fb26e6940b5ae752308d8a33f2608d266795153.tar.gz gerbonara-3fb26e6940b5ae752308d8a33f2608d266795153.tar.bz2 gerbonara-3fb26e6940b5ae752308d8a33f2608d266795153.zip |
Basic round-trip works
Diffstat (limited to 'gerbonara/gerber/aperture_macros/primitive.py')
-rw-r--r-- | gerbonara/gerber/aperture_macros/primitive.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gerbonara/gerber/aperture_macros/primitive.py b/gerbonara/gerber/aperture_macros/primitive.py index aeb38c4..4d3e597 100644 --- a/gerbonara/gerber/aperture_macros/primitive.py +++ b/gerbonara/gerber/aperture_macros/primitive.py @@ -7,9 +7,9 @@ import contextlib import math -from expression import Expression, UnitExpression, ConstantExpression, expr +from .expression import Expression, UnitExpression, ConstantExpression, expr -from .. import graphic_primitivese as gp +from .. import graphic_primitives as gp def point_distance(a, b): @@ -41,7 +41,7 @@ class Primitive: raise ValueError(f'Too few arguments ({len(args)}) for aperture macro primitive {self.code} ({type(self)})') def to_gerber(self, unit=None): - return self.code + ',' + ','.join( + return f'{self.code},' + ','.join( getattr(self, name).to_gerber(unit) for name in type(self).__annotations__) + '*' def __str__(self): @@ -149,6 +149,7 @@ class Polygon(Primitive): class Thermal(Primitive): code = 7 + exposure : Expression # center x/y x : UnitExpression y : UnitExpression @@ -216,6 +217,8 @@ class Outline(Primitive): class Comment: + code = 0 + def __init__(self, comment): self.comment = comment @@ -233,6 +236,6 @@ PRIMITIVE_CLASSES = { Thermal, ]}, # alternative codes - 2: VectorLinePrimitive, + 2: VectorLine, } |