Commit 2bbe6a66 authored by Jayant Khatkar's avatar Jayant Khatkar
Browse files

import contours into julia via json

parent e0910c8b
*.pyc *.pyc
*.csv *.csv
*.gcode *.gcode
*.json
using DataFrames using DataFrames
using CSV using CSV
using JSON
voxels = DataFrames.DataFrame(CSV.File("tensile-1-1.csv"))
contours = JSON.parse(open("tensilecontours.json"))
df = DataFrames.DataFrame(CSV.File("tensile-1-1.csv"))
...@@ -8,6 +8,7 @@ from math import pi ...@@ -8,6 +8,7 @@ from math import pi
from scipy.spatial import KDTree from scipy.spatial import KDTree
from scipy.interpolate import LinearNDInterpolator from scipy.interpolate import LinearNDInterpolator
import pandas as pd import pandas as pd
import json
class Voxelizer: class Voxelizer:
...@@ -89,8 +90,16 @@ class Voxelizer: ...@@ -89,8 +90,16 @@ class Voxelizer:
return csv_name return csv_name
def contour2dict(c):
return {'pos':c.pos, 'time':c.time}
if __name__ == '__main__': if __name__ == '__main__':
obj = 'tensile' obj = 'tensile'
pl = Voxelizer(obj + '.vtk', 1, 1) #0.25)
contours = gc.decode_gcode(obj + '.gcode') #pl = Voxelizer(obj + '.vtk', 1, 1) #0.25)
#pl.export_voxels('tensile') #pl.export_voxels('tensile')
contours = gc.decode_gcode(obj + '.gcode')
outfile = open(obj + 'contours.json','w')
json.dump([contour2dict(c) for c in contours], outfile)
outfile.close()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment