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.

76 lines
1.7 KiB

from cqmore import Workplane
from cqmore.curve import archimedeanSpiral, circle
from cqmore.polygon import regularPolygon, star
import cadquery as cq
coaster_radius = 75
xmas_tree_offset = -35
xmas_tree_height = 12
xmas_tree_width = 12
def makeTriangle(self, width, height, x_offset=0, y_offset=0):
return (
self.moveTo(x_offset - (width), y_offset)
.makePolygon(
[
(0, 0, 0),
(width, height, 0),
(width * 2, 0, 0),
]
)
.cutBlind(30)
.clean()
)
def makeXmasTree(self):
return (
self.center(0, 0)
.triangle(xmas_tree_width, xmas_tree_height, y_offset=-(xmas_tree_offset))
.triangle(
xmas_tree_width + 3, xmas_tree_height + 3, y_offset=-(xmas_tree_offset + 8)
)
.triangle(
xmas_tree_width + 1,
xmas_tree_height + 13,
y_offset=-(xmas_tree_offset + 15),
)
.triangle(
xmas_tree_width - 2,
xmas_tree_height + 16,
y_offset=-(xmas_tree_offset + 20),
)
.moveTo(0, -(xmas_tree_offset + 22))
.rect(5, 8)
.cutBlind(30)
)
Workplane.triangle = makeTriangle
Workplane.xmasTree = makeXmasTree
polygon = (
Workplane()
.makePolygon(
regularPolygon(nSides=16, radius=coaster_radius, thetaStart=0, thetaEnd=360)
)
.extrude(10)
.xmasTree()
.workplane()
)
text_solid = Workplane().text(
"David Kerfoot",
25,
25,
clean=False,
combine=False,
fontPath="/home/wes/fonts/StackyardPersonalUse-16Dj.ttf",
)
result = polygon.cut(text_solid)
cq.exporters.export(result, "/home/wes/model_files/coaster.step")