Commit 52f14e84 authored by Jayant Khatkar's avatar Jayant Khatkar
Browse files

voxels can have height different from xy dim

parent 90a79182
......@@ -11,4 +11,4 @@ def main(fname):
if __name__ == '__main__':
fname = 'torsionbar_hor.stl'
pl = Planner(fname, 1)
pl = Planner(fname, 1, 0.25)
......@@ -14,14 +14,20 @@ class Planner:
def __init__(self,
mesh_file_name, # vtk file as generated by FreeCAD
grid_res=2,
voxel_dim=1,
layer_height=0.2
):
# record params
self.grid_res = grid_res
self.voxel_dim = voxel_dim
self.lheight = layer_height
# read mesh data
self.mesh = pv.read(mesh_file_name)
#voxelize
self.grid = pv.voxelize(self.boundary, density=self.grid_res)
hwratio = voxel_dim/self.lheight
m = self.mesh.copy()
m.points[:,2] *= hwratio
self.grid = pv.voxelize(m, density=self.voxel_dim)
self.grid.points[:,2] *= 1/hwratio
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