-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sketch2CSGInputFolder.py
33 lines (24 loc) · 1.44 KB
/
sketch2CSGInputFolder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import sys
import os
import subprocess
root_folder = sys.argv[1]
solution_folder = os.path.join(sys.argv[2])
finalSolutions = sorted(os.listdir(solution_folder))
for i in range(len(finalSolutions)):
file = finalSolutions[i]
csg_cpp_command = os.path.join(root_folder, "csg_cpp_command")
simplifiedSCAD = os.path.join(solution_folder, file, "sketch_final_simplified.scad")
sketchFile = os.path.join(solution_folder, file, "inputFileInCSGSketchFormat.txt")
csgTree = os.path.join(solution_folder, file, "csgTree")
csgTreeSimple = os.path.join(solution_folder, file, "csgTreeSimple")
nodeOccObj = os.path.join(solution_folder, file, "nodeOccObj.js")
#./csg_cpp_command clean-csg -e espilonValue -i filePathOfSCAD -o newFilePathOfSCAD
command1 = [csg_cpp_command, "clean-csg", "-e", "0.0001", "-i", os.path.join(solution_folder, file, "sketch_final.scad"), "-o", simplifiedSCAD]
print(command1)
subprocess.run(command1)
# ./csg_cpp_command legacy-sketch-tree -i filePathOfSCAD -o outputPath.txt
command2 = [csg_cpp_command, "legacy-sketch-tree", "-i", simplifiedSCAD,"-o", sketchFile]
print(command2)
subprocess.run(command2)
# python sketch2CSGExperimental.py inputFileInCSGSketchFormat csgInTreeFormatPath simplifiedSsgInTreeFormatPath geometry.js
subprocess.run(["python3",os.path.join(root_folder,"sketch2CSGExperimental.py"), sketchFile, csgTree, csgTreeSimple, nodeOccObj])