forked from kmeisthax/gridfinity-cadquery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pen_pencil_holder.py
43 lines (31 loc) · 981 Bytes
/
pen_pencil_holder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import math
import cadquery as cq
import gridfinity
block_x = 1
block_y = 1
block_height = 6
diameter = 8
taper = 2.5
depth = (block_height - 1) * 7 + 6
taper_pad = depth * math.sin((taper / 180) * math.pi)
spacing = 0.4
clearance= 0.15
block = (
cq.Workplane("XY")
.gridfinity_block(block_x, block_y, block_height))
cutout = (
block.faces(">Z")
.placeSketch(
cq.Sketch().circle(diameter / 2 + clearance + taper_pad))
.extrude(-depth, combine=False, taper=taper))
block = (
block
.rarray(diameter + (clearance + taper_pad) * 2 + spacing, diameter + (clearance + taper_pad) * 2 + spacing, 3, 3)
.eachpoint(lambda loc: cutout.val().moved(loc), combine="cut")
.gridfinity_block_lip(block_x, block_y, screw_depth=3)
.gridfinity_block_stack(block_x, block_y))
#block = block.faces(">Z").chamfer(0.5)
#del block
del cutout
cq.exporters.export(block, "pen_pencil_holder.step")
cq.exporters.export(block, "pen_pencil_holder.stl")