From a8ede94e2ca377ee027b9b3f26f1dcd766f3657e Mon Sep 17 00:00:00 2001 From: Ivan Mironov Date: Wed, 31 Oct 2018 01:55:22 +0500 Subject: [PATCH] c14n_stl: Also convert "-0" to "0" --- c14n_stl.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/c14n_stl.py b/c14n_stl.py index 853309d..5ad7c1b 100644 --- a/c14n_stl.py +++ b/c14n_stl.py @@ -11,6 +11,11 @@ from __future__ import print_function import sys +def _cmz(x): + ''' Convert "-0" to "0". ''' + return '0' if x == '-0' else x + + class Vertex: def __init__(self, x, y, z): self.x, self.y, self.z = x, y, z @@ -44,7 +49,7 @@ class STL: self.facets = [] f = open(fname) - words = [s.strip() for s in f.read().split()] + words = [_cmz(s.strip()) for s in f.read().split()] f.close() if words[0] == 'solid' and words[1] == 'OpenSCAD_Model':