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.

98 lines
2.7 KiB

from cadquery import exporters
from cq_warehouse.extensions import Workplane
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 svg_path import addSvgPath
from svgpathtools import svg2paths
import cadquery as cq
import cqmore
from math import ceil, floor
Workplane = cqmore.extend(Workplane)
bearing_od = 22.0
bearing_or = bearing_od / 2.0
bearing_diameter = 8.0
bearing_diameter_rest = 8.8
bearing_radius = bearing_diameter / 2.0
bearing_radius_rest = bearing_diameter_rest / 2.0
bearing_thickness = 6.93
x_offset = 37.5
y_offset = 18.9
spinner_base = (
Workplane()
.cylinder(10, 20)
.workplane(offset=-bearing_thickness + 2)
.cylinder(1.5, bearing_radius_rest)
.workplane(offset=-bearing_thickness)
.cylinder(10, bearing_radius + 0.08)
.workplane(offset=3.224)
.rect(35, 35, forConstruction=True)
.vertices()
.cylinder(4, 10)
)
spinner = (
Workplane()
.workplane(offset=0)
.move(-x_offset, 19)
.cylinder(5, 15)
.workplane(offset=-2)
.move(x_offset, y_offset)
.cylinder(10, bearing_radius)
)
tree = cq.importers.importStep("/home/deck/Downloads/xmas_tree.step")
spinner = tree.union(spinner)
spinner_split_top = (
tree.workplane(5)
.split(keepTop=True)
.workplane(offset=-10)
.move(-x_offset + 0.1, y_offset)
.cylinder(10, bearing_radius + 0.025)
.workplane(offset=-2.9)
.move(-x_offset + 0.1, y_offset)
.cylinder(10, bearing_radius + 3)
)
spinner_split_bottom = (
tree.workplane(5)
.split(keepBottom=True)
.workplane(offset=7.8)
.move(-x_offset, y_offset)
.cylinder(bearing_thickness, bearing_or, combine="cut")
.workplane(offset=6.8)
.move(-x_offset, y_offset)
.cylinder(20, bearing_radius, combine="cut")
.workplane(offset=-3.0)
.move(-x_offset, y_offset)
.cylinder(13.3, 15)
.workplane(offset=-7.12)
.move(-x_offset, y_offset)
.cylinder(bearing_thickness + 3.3, bearing_or, combine="cut")
.workplane(offset=-7.12)
.move(-x_offset, y_offset)
.cylinder(15, bearing_radius, combine="cut")
)
cq.exporters.export(spinner, "/home/deck/model_files/xmas_spinner.stl")
cq.exporters.export(spinner_split_top, "/home/deck/model_files/xmas_spinner_top.stl")
cq.exporters.export(
spinner_split_bottom, "/home/deck/model_files/xmas_spinner_bottom.stl"
)
cq.exporters.export(spinner_base, "/home/deck/model_files/xmas_spinner_base.stl")
try:
show_object(spinner_base)
# show_object(spinner_split_top)
# show_object(spinner_split_bottom)
except NameError:
pass