summaryrefslogtreecommitdiff
path: root/gerber/am_statements.py
diff options
context:
space:
mode:
authorPaulo Henrique Silva <ph.silva@gmail.com>2015-03-05 14:43:30 -0300
committerPaulo Henrique Silva <ph.silva@gmail.com>2015-03-05 14:43:30 -0300
commita13b981c1c2ea9ede39e9821d9ba818566f044de (patch)
treed7e1507bd389623e077da0d497b419edcfd9e53f /gerber/am_statements.py
parent670d3fbbd7ebfb69bd223ac30b73ec47b195b380 (diff)
downloadgerbonara-a13b981c1c2ea9ede39e9821d9ba818566f044de.tar.gz
gerbonara-a13b981c1c2ea9ede39e9821d9ba818566f044de.tar.bz2
gerbonara-a13b981c1c2ea9ede39e9821d9ba818566f044de.zip
Fix tests for macros with no variables.
All AM*Primitive classes now handles float for all but the code modifiers. This simplifies the reading/parsing.
Diffstat (limited to 'gerber/am_statements.py')
-rw-r--r--gerber/am_statements.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/gerber/am_statements.py b/gerber/am_statements.py
index c514ad7..38f4d71 100644
--- a/gerber/am_statements.py
+++ b/gerber/am_statements.py
@@ -160,7 +160,7 @@ class AMCirclePrimitive(AMPrimitive):
def from_gerber(cls, primitive):
modifiers = primitive.strip(' *').split(',')
code = int(modifiers[0])
- exposure = 'on' if modifiers[1].strip() == '1' else 'off'
+ exposure = 'on' if float(modifiers[1]) == 1 else 'off'
diameter = float(modifiers[2])
position = (float(modifiers[3]), float(modifiers[4]))
return cls(code, exposure, diameter, position)
@@ -233,7 +233,7 @@ class AMVectorLinePrimitive(AMPrimitive):
def from_gerber(cls, primitive):
modifiers = primitive.strip(' *').split(',')
code = int(modifiers[0])
- exposure = 'on' if modifiers[1].strip() == '1' else 'off'
+ exposure = 'on' if float(modifiers[1]) == 1 else 'off'
width = float(modifiers[2])
start = (float(modifiers[3]), float(modifiers[4]))
end = (float(modifiers[5]), float(modifiers[6]))
@@ -318,8 +318,8 @@ class AMOutlinePrimitive(AMPrimitive):
modifiers = primitive.strip(' *').split(",")
code = int(modifiers[0])
- exposure = "on" if modifiers[1].strip() == "1" else "off"
- n = int(modifiers[2])
+ exposure = "on" if float(modifiers[1]) == 1 else "off"
+ n = int(float(modifiers[2]))
start_point = (float(modifiers[3]), float(modifiers[4]))
points = []
for i in range(n):
@@ -405,7 +405,7 @@ class AMPolygonPrimitive(AMPrimitive):
def from_gerber(cls, primitive):
modifiers = primitive.strip(' *').split(",")
code = int(modifiers[0])
- exposure = "on" if modifiers[1].strip() == "1" else "off"
+ exposure = "on" if float(modifiers[1]) == 1 else "off"
vertices = int(float(modifiers[2]))
position = (float(modifiers[3]), float(modifiers[4]))
try:
@@ -508,7 +508,7 @@ class AMMoirePrimitive(AMPrimitive):
diameter = float(modifiers[3])
ring_thickness = float(modifiers[4])
gap = float(modifiers[5])
- max_rings = int(modifiers[6])
+ max_rings = int(float(modifiers[6]))
crosshair_thickness = float(modifiers[7])
crosshair_length = float(modifiers[8])
rotation = float(modifiers[9])
@@ -690,7 +690,7 @@ class AMCenterLinePrimitive(AMPrimitive):
def from_gerber(cls, primitive):
modifiers = primitive.strip(' *').split(",")
code = int(modifiers[0])
- exposure = 'on' if modifiers[1].strip() == '1' else 'off'
+ exposure = 'on' if float(modifiers[1]) == 1 else 'off'
width = float(modifiers[2])
height = float(modifiers[3])
center= (float(modifiers[4]), float(modifiers[5]))
@@ -772,7 +772,7 @@ class AMLowerLeftLinePrimitive(AMPrimitive):
def from_gerber(cls, primitive):
modifiers = primitive.strip(' *').split(",")
code = int(modifiers[0])
- exposure = 'on' if modifiers[1].strip() == '1' else 'off'
+ exposure = 'on' if float(modifiers[1]) == 1 else 'off'
width = float(modifiers[2])
height = float(modifiers[3])
lower_left = (float(modifiers[4]), float(modifiers[5]))