Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The size of the text body now depends of the actual text carwing depth. #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions opk.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""
==========================
██████ ██████ ██ ██
██ ██ ██ ██ ██ ██
██ ██ ██████ █████
██ ██ ██ ██ ██
██████ ██ ██ ██
██████ ██████ ██ ██
██ ██ ██ ██ ██ ██
██ ██ ██████ █████
██ ██ ██ ██ ██
██████ ██ ██ ██
==========================
Open Programmatic Keycap
Open Programmatic Keycap
==========================

OPK is a spherical top keycap profile developed in CadQuery
Expand All @@ -16,7 +16,7 @@

!!! The profile is still highly experimental and very alpha stage. ¡¡¡

If you use the code please give credit, if you do modifications consider
If you use the code please give credit, if you do modifications consider
releasing them back to the public under a permissive open source license.

Copyright (c) 2022 Matteo "Matt3o" Spinelli
Expand Down Expand Up @@ -55,7 +55,7 @@ def keycap(
ty = by - top_diff

# if spacebar make the top less round-y
tension = .4 if convex else 1
tension = .4 if convex else 1

# Three-section loft of rounded rectangles. Can't find a better way to do variable fillet
base = (
Expand Down Expand Up @@ -130,7 +130,7 @@ def keycap(

#show_object(tool, options={'alpha': 0.4})
keycap = keycap - tool

# Top edge fillet
keycap = keycap.edges(">Z").fillet(0.6)

Expand Down Expand Up @@ -176,7 +176,7 @@ def keycap(
.circle(2.75)
.clean()
)

stem2 = (
cq.Sketch()
.push(stem_pts)
Expand Down Expand Up @@ -209,7 +209,7 @@ def keycap(

legend = (
cq.Workplane("XY").transformed(offset=cq.Vector(0, 0, height+1), rotate=cq.Vector(angle, 0, 0))
.text(legend, fontsize, -4, font=font, fontPath=fontPath, halign="center", valign="center")
.text(legend, fontsize, legendDepth*4, font=font, fontPath=fontPath, halign="center", valign="center")
)
bb = legend.val().BoundingBox()
# try to center the legend horizontally
Expand Down