diff options
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) |