diff options
author | jaseg <git@jaseg.de> | 2023-04-20 00:46:30 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2023-04-20 00:46:30 +0200 |
commit | 5ce88e4d1b06dcc846c94ec614fb00f64e85c125 (patch) | |
tree | 30cacf1ffb500c1deebc6b30e8c98d7ec474559a /gerbonara/aperture_macros | |
parent | 240e5569aa7521aed321b2607f78d198c36ed8b8 (diff) | |
download | gerbonara-5ce88e4d1b06dcc846c94ec614fb00f64e85c125.tar.gz gerbonara-5ce88e4d1b06dcc846c94ec614fb00f64e85c125.tar.bz2 gerbonara-5ce88e4d1b06dcc846c94ec614fb00f64e85c125.zip |
Fix a bunch of bugs on the way to electroniceel's protoboard layout
Diffstat (limited to 'gerbonara/aperture_macros')
-rw-r--r-- | gerbonara/aperture_macros/expression.py | 5 | ||||
-rw-r--r-- | gerbonara/aperture_macros/primitive.py | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/gerbonara/aperture_macros/expression.py b/gerbonara/aperture_macros/expression.py index f545aac..0b2168f 100644 --- a/gerbonara/aperture_macros/expression.py +++ b/gerbonara/aperture_macros/expression.py @@ -65,7 +65,10 @@ class Expression: class UnitExpression(Expression): def __init__(self, expr, unit): - self._expr = expr + if isinstance(expr, Expression): + self._expr = expr + else: + self._expr = ConstantExpression(expr) self.unit = unit def to_gerber(self, unit=None): diff --git a/gerbonara/aperture_macros/primitive.py b/gerbonara/aperture_macros/primitive.py index 5b93971..4a991f1 100644 --- a/gerbonara/aperture_macros/primitive.py +++ b/gerbonara/aperture_macros/primitive.py @@ -113,7 +113,7 @@ class VectorLine(Primitive): start_y : UnitExpression end_x : UnitExpression end_y : UnitExpression - rotation : Expression + rotation : Expression = None def to_graphic_primitives(self, offset, rotation, variable_binding={}, unit=None, polarity_dark=True): with self.Calculator(self, variable_binding, unit) as calc: @@ -243,7 +243,7 @@ class Outline(Primitive): if len(args) > 5004: raise ValueError(f'Invalid aperture macro outline primitive, too many points ({len(args)//2-2}).') - self.exposure = args.pop(0) + self.exposure = expr(args.pop(0)) # length arg must not contain variables (that would not make sense) length_arg = (args.pop(0) * ConstantExpression(1)).calculate() @@ -252,7 +252,7 @@ class Outline(Primitive): raise ValueError(f'Invalid aperture macro outline primitive, given size {length_arg} does not match length of coordinate list({len(args)//2-1}).') if len(args) % 2 == 1: - self.rotation = args.pop() + self.rotation = expr(args.pop()) else: self.rotation = ConstantExpression(0.0) |