You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.8 KiB
57 lines
1.8 KiB
import cadquery as cq
|
|
from cq_warehouse.fastener import SocketHeadCapScrew
|
|
from cq_warehouse.bearing import SingleRowDeepGrooveBallBearing
|
|
import cq_warehouse.extensions
|
|
from cqmore import Workplane
|
|
from cqmore.curve import archimedeanSpiral, circle
|
|
from cqmore.polygon import regularPolygon, star
|
|
from random import randint, choice
|
|
import functools as fnc
|
|
import itertools as it
|
|
|
|
|
|
def makeTriangle(self, width, height, x_offset=0, y_offset=0):
|
|
return (self.move(x_offset, y_offset).makePolygon(
|
|
[
|
|
(height/2, width*20, -width), (0, width, 0), (width, height, 0)
|
|
]
|
|
))
|
|
|
|
def add_triangle(plane, width, height, offset):
|
|
return plane.triangle(width, height, y_offset=offset)
|
|
|
|
Workplane.triangle = makeTriangle
|
|
|
|
# must be 17 mm wide
|
|
# gap must be at least 4 mm
|
|
|
|
holder_dim = (18, 30, 30)
|
|
holder_slot_dim = (holder_dim[0] + holder_dim[0]*0.65,
|
|
holder_dim[1]-holder_dim[1]*0.2,
|
|
holder_dim[1]-holder_dim[1]*0.865) # should be around 4mm
|
|
|
|
pole_dim = (18, 10)
|
|
lip_dim = (pole_dim[0], 15)
|
|
pole_length = 230
|
|
|
|
print(holder_slot_dim)
|
|
|
|
result = Workplane().box(*holder_dim)
|
|
result = result.workplane().moveTo(0, -5).box(*holder_slot_dim, True, "cut")
|
|
result = (result.faces(">Z").workplane()
|
|
.moveTo(0, (holder_dim[0]) - 8)
|
|
.rect(*pole_dim).extrude(pole_length))
|
|
|
|
support_width = 10
|
|
|
|
result = result.faces(">Y[1]").workplane().triangle(support_width,
|
|
support_width,
|
|
-support_width/2,
|
|
-holder_dim[0]).extrude(15)
|
|
|
|
result = (result.faces(">Z[3]").center(0, pole_length-lip_dim[0]/4).workplane()
|
|
.moveTo(0, lip_dim[1])
|
|
.rect(*lip_dim).extrude(pole_dim[0]/4))
|
|
|
|
cq.exporters.export(result, "/home/deck/cad_files/tape_holder.step")
|
|
|
|
|