binary stl precompile

Mon, 03 Apr 2017 20:04:15 +0200

author
mdd
date
Mon, 03 Apr 2017 20:04:15 +0200
changeset 10
d26669bf424e
parent 9
a01a3fd32073
child 11
098335a1d510

binary stl precompile

data.py file | annotate | diff | comparison | revisions
stl.py file | annotate | diff | comparison | revisions
--- a/data.py	Mon Apr 03 19:40:06 2017 +0200
+++ b/data.py	Mon Apr 03 20:04:15 2017 +0200
@@ -8,6 +8,9 @@
 	"12S"	: [204, 550, 12, 15.4],
 	"12L"	: [171, 690, 12, 14.5],
 	"15"	: [204, 640, 15, 18.1],
+	"16"	: [204, 670, 16, 19.5],
+	"18"	: [204, 710, 18, 20.5],
+	"20"	: [204, 810, 20, 22.0],
 }
 
 # Standard Rohrdurchmesser (Mr. Baumarkt)
--- a/stl.py	Mon Apr 03 19:40:06 2017 +0200
+++ b/stl.py	Mon Apr 03 20:04:15 2017 +0200
@@ -1,4 +1,5 @@
 import data, os, config, subprocess
+import vtk
 
 OPENSCAD_MODULES = """
 module tank(x, r, h) {
@@ -38,6 +39,15 @@
         output,
         config.TMP_SCAD
         ])
+    # convert to binary
+    reader = vtk.vtkSTLReader()
+    reader.SetFileName(output)
+    reader.Update()
+    write = vtk.vtkSTLWriter()
+    write.SetFileTypeToBinary()
+    write.SetInput(reader.GetOutput())
+    write.SetFileName(output)
+    write.Write() 
 
 def precompile_all_stl():
     base = os.path.abspath('stl')

mercurial