CadQuery / CadQuery/cadquery

Turning DLP-SLA printer pixels into 3D step file.

Open
#1,093 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
5.8k
Forks
541
Avg merge
3d 2h
Merged PRs (30d)
5

Description

full3D = cq.Assembly(name='stackup')
for layer_idx, layer in enumerate(data['Layers']):
pts =[] # initialize the points.
for row_idx, row in enumerate(bmpArray): # iterate through rows
for col_idx, column in enumerate(bmpArray[0]): # iterate through columns
if bmpArray[row_idx][col_idx] > 0: # Checks if there is a 'white' pixel.
pts.append((row_idx*pixel_x,col_idx*pixel_y)) # append these points

result = cq.Workplane(cq.Plane((0,0,height))).pushPoints(pts).box(pixel_x, pixel_y, thickness) # convert these points to rectangles centered at those points.
full3D.add(result,name=("layer"+str(layer_idx)),color=cq.Color("orange"))
full3D.save('test.step')

I'm trying to convert bitmaps (arrays of 0,1 denoting presence of 35um x 35um x 20um voxel) into 3D step file to have a representation of what a model looks like after slicing. Is there are recommended method for improving the speed? This can take an hour by the time it gets to the second layer on an 800x800 landscape that has 100 cylinders of 6 pixel radius. I believe if I use a separate algorithm to convert the boundaries of pixel bodies into a polyline, it may speed things up rather than pixel by pixel, but I fear this may not solve the problem. I believe I am doing something inherently wrong with cadquery.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.