Commit 6cd53771 authored by Jayant Khatkar's avatar Jayant Khatkar
Browse files

support x,y,z in inches but not automatically

parent 842b9f7d
......@@ -18,7 +18,8 @@ def voxelised_csv(mesh_file_name,
voxels='',
skip_lines=4,
voxel_dim=3,
layer_height=1
layer_height=1,
from_inches=False
):
"""
takes in input from solidworks csv and voxelises.
......@@ -61,6 +62,8 @@ def voxelised_csv(mesh_file_name,
data = pd.read_csv(csv_fname, header=skip_lines)
locs = data.iloc[:,1:4].to_numpy()
if from_inches:
locs = locs*25.4
locs_pv = pv.PolyData(locs)
if 'M3' in mesh_file_name:
locs_pv.rotate_x(-90)
......@@ -80,13 +83,15 @@ def voxelised_csv(mesh_file_name,
return out
def check_data(mesh_file_name, csv_fname):
def check_data(mesh_file_name, csv_fname, from_inches=False):
mesh = pv.read(mesh_file_name)
bed_centre = [110, 110, 0]
tu.transform_to_bed_centre(mesh, bed_centre)
tu.transform_to_z0(mesh)
data = pd.read_csv(csv_fname, header=4)
locs = data.iloc[:,1:4].to_numpy()
if from_inches:
locs = locs*25.4
locs_pv = pv.PolyData(locs)
#locs_pv.rotate_x(-90) # M3
#locs_pv.rotate_x(90) # M5
......@@ -110,9 +115,9 @@ def contour2dict(c):
if __name__ == '__main__':
obj = 'models/M5'
#check_data(obj + '.stl', obj + '_raw.csv')
#out = voxelised_csv(obj + '.stl', obj + '_raw.csv', voxels=obj+'_vox_centers.csv')
obj = 'models/M8'
#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')
......
Supports Markdown
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