cylindertransport.py

changeset 14
ba3d8c56e6f5
parent 11
098335a1d510
--- a/cylindertransport.py	Wed Apr 05 00:39:31 2017 +0200
+++ b/cylindertransport.py	Wed Apr 05 00:59:45 2017 +0200
@@ -58,7 +58,7 @@
         print "// Abort: no suitable pipe found"
         sys.exit(1)
 
-    def _circle(self, posx, radius, data, cylinder = ""):
+    def _circle(self, posx, radius, data, cylinder=""):
         """
         Push the circle definition for later rendering
         """
@@ -92,7 +92,7 @@
             r_2 = CYLINDER[self.cylinders[i+1]][0] / 2
             r_1, r_2, r_3, data = self.calc_min(r_1, r_2)
             # draw cylinder
-            self._circle(posx, r_1,
+            self._circle(posx, r_1, \
                 CYLINDER[self.cylinders[i]], self.cylinders[i])
             self.scad["cylinder"] += "tank(%f, %f, %f);\n" % (
                 posx * SCALE3D, r_1 * SCALE3D,
@@ -108,7 +108,7 @@
             sx2 = posx - r_3
             if i == (len(self.cylinders) - 2):
                 # draw last bottle
-                self._circle(posx, r_3,
+                self._circle(posx, r_3, \
                     CYLINDER[self.cylinders[i + 1]], self.cylinders[i + 1])
                 self.scad["cylinder"] += "tank(%f, %f, %f);\n" % (
                     posx * SCALE3D, r_3 * SCALE3D,
@@ -194,11 +194,12 @@
     img = worker.render_image()
     img.show()
 
-    if (options.scad != ""):
+    if options.scad != "":
         with open(options.scad, "w") as fd:
             fd.write(worker.scad["tmpl"])
+            # center the object
             fd.write("translate([%f,0,0]) {\n" % (
-                ((worker.width - 2 * worker.margin) / -2) * SCALE3D)) # center the object
+                ((worker.width - 2 * worker.margin) / -2) * SCALE3D))
             fd.write(worker.scad["cylinder"])
             fd.write(worker.scad["spacer"])
             fd.write("}\n")

mercurial