- fixed the Gerber parser to work for the case of having coordinates with negative values and the trailing zeros are removed and leading zeros are kept
This commit is contained in:
@@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta
|
||||
|
||||
=================================================
|
||||
|
||||
7.05.2021
|
||||
|
||||
- fixed the Gerber parser to work for the case of having coordinates with negative values and the trailing zeros are removed and leading zeros are kept
|
||||
|
||||
3.05.2021
|
||||
|
||||
- changed the save_project() method such that when the project is saved as compressed now the compression is first done in memory and only after that the app will attempt to write it to a file on disk
|
||||
|
||||
@@ -2670,6 +2670,19 @@ def parse_gerber_number(strnumber, int_digits, frac_digits, zeros):
|
||||
|
||||
if zeros == 'T':
|
||||
int_val = int(strnumber)
|
||||
if int_val >= 0:
|
||||
ret_val = (int_val * (10 ** ((int_digits + frac_digits) - len(strnumber)))) * (10 ** (-frac_digits))
|
||||
else:
|
||||
# negative number therefore we have a '-' char in front of the strnumber
|
||||
ret_val = (int_val * (10 ** ((int_digits + frac_digits + 1) - len(strnumber)))) * (10 ** (-frac_digits))
|
||||
|
||||
# if strnumber[0] == '-':
|
||||
# int_val = strnumber[:(int_digits+1)]
|
||||
# frac_val = strnumber[(int_digits+1):]
|
||||
# else:
|
||||
# int_val = strnumber[:int_digits]
|
||||
# frac_val = strnumber[(int_digits):]
|
||||
# ret_val = '%s.%s' % (int_val, frac_val)
|
||||
# ret_val = float(ret_val)
|
||||
|
||||
return ret_val
|
||||
|
||||
Reference in New Issue
Block a user