Commit b061b0d9 authored by Jayant Khatkar's avatar Jayant Khatkar
Browse files

color visualised voxels by stress magnitude

parent 6cd53771
......@@ -106,7 +106,9 @@ def check_data(mesh_file_name, csv_fname, from_inches=False):
def visualise_voxels(fname):
data = pd.read_csv(fname)
locs = data.iloc[:,1:4].to_numpy()
stresses = np.sum(data.iloc[:,4:].to_numpy()**2, axis=1)**0.5
locs_pv = pv.PolyData(locs)
locs_pv['stress_mag'] = stresses
locs_pv.plot()
......@@ -115,13 +117,13 @@ def contour2dict(c):
if __name__ == '__main__':
obj = 'models/M8'
obj = 'models/M9'
#check_data(obj + '.stl', obj + '_raw.csv', from_inches=True)
#out = voxelised_csv(obj + '.stl', obj + '_raw.csv', voxels=obj+'_vox_centers.csv', from_inches=True)
#out.to_csv(obj + '_voxels.csv')
#visualise_voxels(obj + '_voxels.csv')
visualise_voxels(obj + '_voxels.csv')
contours = gc.decode_gcode(obj + '.gcode')
outfile = open(obj + 'contours.json','w')
json.dump([contour2dict(c) for c in contours], outfile)
#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