From 5bd78430c478511b5b211448bfebe035146d8595 Mon Sep 17 00:00:00 2001 From: Stevan C Date: Sun, 11 Sep 2022 21:42:44 +0200 Subject: [PATCH] The size of the text body now depends of the actual text carwing depth. It was fixed at -4 before. --- opk.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/opk.py b/opk.py index bf295b9..483b8e7 100644 --- a/opk.py +++ b/opk.py @@ -1,12 +1,12 @@ """ ========================== - ██████ ██████ ██ ██ - ██ ██ ██ ██ ██ ██ - ██ ██ ██████ █████ - ██ ██ ██ ██ ██ - ██████ ██ ██ ██ + ██████ ██████ ██ ██ + ██ ██ ██ ██ ██ ██ + ██ ██ ██████ █████ + ██ ██ ██ ██ ██ + ██████ ██ ██ ██ ========================== - Open Programmatic Keycap + Open Programmatic Keycap ========================== OPK is a spherical top keycap profile developed in CadQuery @@ -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 @@ -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 = ( @@ -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) @@ -176,7 +176,7 @@ def keycap( .circle(2.75) .clean() ) - + stem2 = ( cq.Sketch() .push(stem_pts) @@ -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