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.
 

141 lines
3.8 KiB

from cq_warehouse.bearing import SingleRowDeepGrooveBallBearing
from cq_warehouse.fastener import *
from cq_warehouse.thread import *
from cqmore.curve import archimedeanSpiral, circle
from cqmore.polygon import regularPolygon, star
from cqmore.polyhedron import polarZonohedra, Polyhedron, superellipsoid
from cq_warehouse.extensions import Workplane
import functools as fnc
import itertools as it
import cadquery as cq
import cqmore
Workplane = cqmore.extend(Workplane)
planter_height = 210
planter_radius = 129
plate_offset = 47
plate_thickness = 3
zonohedra = polarZonohedra(8, 49)
outer_points = [[n * (planter_height / 3.5) for n in vec] for vec in zonohedra.points]
outer_faces = zonohedra.faces
outer_poly = Polyhedron(outer_points, outer_faces)
result = Workplane().polyhedron(*outer_poly)
holder_angle_offset = 20
result = (
result.workplane(offset=-38)
.makePolygon(
regularPolygon(
nSides=4,
radius=planter_radius - 40,
thetaStart=holder_angle_offset,
thetaEnd=360 + holder_angle_offset,
),
forConstruction=True,
)
.vertices()
.cylinder(10, 7, combine="cut")
)
cone = cq.Solid.makeCone(planter_radius, 33, planter_height + 95)
result = result.workplane().cut(cone)
result = result.workplane(offset=-40).cylinder(
planter_height / 1.45, planter_radius * 0.58, combine="cut"
)
result = result.workplane(offset=-16).cylinder(
planter_height / 2.3, planter_radius / 2.5, combine="cut"
)
result = result.workplane(offset=-5).cylinder(
planter_height / 2.3, planter_radius / 1.85, combine="cut"
)
result = (
result.workplane(offset=40)
.makePolygon(
regularPolygon(
nSides=8,
radius=planter_radius / 2.2,
thetaStart=holder_angle_offset,
thetaEnd=360 + holder_angle_offset,
)
)
.extrude(planter_height / 15.5, combine="cut")
)
circle_plate = Workplane().cylinder(
plate_thickness, planter_radius * 0.56
) # enough to fit 0.58
# Split this out into a different part
circle_plate = (
circle_plate.workplane(offset=plate_offset + plate_thickness)
.makePolygon(
star(outerRadius=planter_radius / 3, innerRadius=planter_radius / 4.9, n=8),
forConstruction=True,
)
.vertices()
.cskHole(8, 8, 0.5, depth=None)
)
simple = False
screw = ButtonHeadScrew(
size="M16-2", fastener_type="iso7380_1", length=10 * MM, simple=simple
)
scaled_screw = screw.scale(0.90)
screw_result = Workplane().circle(20).extrude(10).union(scaled_screw)
result = result.workplane(offset=planter_height / 2).cylinder(80, 65, combine="cut")
result = (
result.workplane(offset=(planter_height / 2) - 27)
.makePolygon(
regularPolygon(
nSides=11,
radius=planter_radius / 1.85,
thetaStart=holder_angle_offset,
thetaEnd=360 + holder_angle_offset,
)
)
.extrude(10)
)
result = result.workplane(offset=(planter_height / 2) - 15.6).threadedHole(
screw, 20, simple=simple, fit="Loose"
)
tapered_circle = (
result.workplane(offset=planter_height / 3.0).circle(30).extrude(10, taper=42)
)
tapered_circle_inner = (
result.workplane(offset=planter_height / 3.0).circle(20).extrude(10, taper=42)
)
cut_tapered = Workplane().union(tapered_circle).cut(tapered_circle_inner)
result = result.union(cut_tapered)
assembly = cq.Assembly()
assembly.add(screw_result, loc=cq.Location((0, 0, 0)))
assembly.add(result, loc=cq.Location((100, 100, 100)))
assembly.add(circle_plate, loc=cq.Location((1100, 1100, 1100)))
try:
show_object(result)
except NameError:
pass
cq.exporters.export(screw_result, "/home/deck/cad_files/planter_screw.step")
cq.exporters.export(result, "/home/deck/cad_files/planter.step")
cq.exporters.export(circle_plate, "/home/deck/cad_files/planter_plate.step")