summaryrefslogtreecommitdiff
path: root/gerbonara/cam.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-02-06 17:54:57 +0100
committerjaseg <git@jaseg.de>2022-02-06 17:54:57 +0100
commit77f2da8761c45048d58e98eab3cd985e60f32298 (patch)
tree07a7542aa056f449c9224a4d3dee5ee67df8c5ca /gerbonara/cam.py
parentc31aabc227333d79ad6e09e293a5da98a1ccf543 (diff)
downloadgerbonara-77f2da8761c45048d58e98eab3cd985e60f32298.tar.gz
gerbonara-77f2da8761c45048d58e98eab3cd985e60f32298.tar.bz2
gerbonara-77f2da8761c45048d58e98eab3cd985e60f32298.zip
More parsing speedupsv0.9.0
Diffstat (limited to 'gerbonara/cam.py')
-rw-r--r--gerbonara/cam.py13
1 files changed, 2 insertions, 11 deletions
diff --git a/gerbonara/cam.py b/gerbonara/cam.py
index 593ede8..2edf8ed 100644
--- a/gerbonara/cam.py
+++ b/gerbonara/cam.py
@@ -141,22 +141,13 @@ class FileSettings:
integer_digits, decimal_digits = self.number_format
- sign = 1
-
- if value[0] == '-':
- sign = -1
- value = value[1:]
-
- elif value[0] == '+':
- value = value[1:]
-
if self.zeros == 'leading':
value = self._pad + value # pad with zeros to ensure we have enough decimals
- return sign*float(value[:-decimal_digits] + '.' + value[-decimal_digits:])
+ return float(value[:-decimal_digits] + '.' + value[-decimal_digits:])
else: # no or trailing zero suppression
value = value + self._pad
- return sign*float(value[:integer_digits] + '.' + value[integer_digits:])
+ return float(value[:integer_digits] + '.' + value[integer_digits:])
def write_gerber_value(self, value, unit=None):
""" Convert a floating point number to a Gerber-formatted string. """