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.
50 lines
1.2 KiB
50 lines
1.2 KiB
from cqmore import Workplane
|
|
from cqmore.curve import archimedeanSpiral, circle
|
|
from cqmore.polygon import regularPolygon, star
|
|
from random import randint, choice
|
|
import cadquery as cq
|
|
import functools as fnc
|
|
import itertools as it
|
|
from cad_utilities.shapes import makeDice
|
|
from typing import cast
|
|
from cadquery import Face
|
|
from cqmore import Workplane
|
|
from cqmore.polyhedron import tetrahedron, hexahedron, octahedron, dodecahedron, icosahedron
|
|
|
|
radius = 20
|
|
font_name = 'Arial Black'
|
|
font_distance = 2
|
|
detail = 0
|
|
|
|
dice = (Workplane()
|
|
.polyhedron(
|
|
*icosahedron(radius, detail)
|
|
)
|
|
)
|
|
|
|
faces = dice.faces().vals()
|
|
nums = len(faces)
|
|
texts = Workplane()
|
|
for i in range(nums):
|
|
print(i)
|
|
if i == 0:
|
|
text_to_write = "20"
|
|
font_size = 8.5
|
|
else:
|
|
text_to_write = str(nums-i)
|
|
font_size = 8.5
|
|
texts.add(
|
|
Workplane(faces[i])
|
|
.workplane(origin = cast(Face, faces[i]).Center())
|
|
.text(
|
|
text_to_write,
|
|
font_size,
|
|
-font_distance,
|
|
fontPath="/home/deck/cad_files/SEVESBRG.TTF"
|
|
)
|
|
)
|
|
|
|
dice = dice.cut(texts)
|
|
|
|
cq.exporters.export(dice, "/home/deck/cad_files/dice.step")
|
|
|
|
|