Skip to content

Instantly share code, notes, and snippets.

@yschimke
Created August 25, 2024 06:31
Show Gist options
  • Save yschimke/4fd82d5394be9652f411b1409aca559a to your computer and use it in GitHub Desktop.
Save yschimke/4fd82d5394be9652f411b1409aca559a to your computer and use it in GitHub Desktop.
from cqgridfinity import *
import cadquery as cq
from ocp_vscode import show_object
FRONT_SURFACE_TAG = "front_surface"
# make a simple box
box = GridfinityBox(3, 4, 21, solid=True, solid_ratio=1.0, holes=True, unsupported_holes=True)
posca_box: cq.Workplane = box.cq_obj
posca_box.faces("<X[1]").workplane().tag(FRONT_SURFACE_TAG)
d = 20
l = 125
for y in range(0, 6):
for x in range(-3, 4):
posca_box = (
posca_box.workplaneFromTagged(FRONT_SURFACE_TAG)
.transformed(offset=cq.Vector(x * (d + 2), 27 + (y * (d + 2)), -5))
.rect(d, d)
.cutBlind(l)
)
show_object(posca_box)
cq.exporters.export(posca_box, 'posca_box.stl')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment