diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2024-03-05 08:00:04 +0100 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2024-03-05 08:00:04 +0100 |
commit | ffa27860292b7337174cccd96554e3c8e1bf7d7c (patch) | |
tree | 279ebdd01569e68041216a07ad9e0b06f3e37fc6 /source | |
parent | 28bc9e93f2c165388ffbe530b35be41f803531a3 (diff) |
Add generating script for flat thimbles
Diffstat (limited to 'source')
-rw-r--r-- | source/accessories/tools/leather_thimbles/sashiko_thimble.svg | 70 | ||||
-rwxr-xr-x | source/accessories/tools/leather_thimbles/thimbles.py | 54 |
2 files changed, 124 insertions, 0 deletions
diff --git a/source/accessories/tools/leather_thimbles/sashiko_thimble.svg b/source/accessories/tools/leather_thimbles/sashiko_thimble.svg new file mode 100644 index 0000000..e91b878 --- /dev/null +++ b/source/accessories/tools/leather_thimbles/sashiko_thimble.svg @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + width="80.793747mm" + height="50.793751mm" + viewBox="0 0 305.3622 191.97638" + version="1.1" + id="svg5" + inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" + sodipodi:docname="sashiko_thimble.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <sodipodi:namedview + id="namedview7" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + inkscape:document-units="mm" + showgrid="true" + inkscape:zoom="3.32" + inkscape:cx="211.59639" + inkscape:cy="162.8012" + inkscape:window-width="1280" + inkscape:window-height="982" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="layer1"> + <inkscape:grid + type="xygrid" + id="grid182" + units="mm" + spacingx="3.7795276" + spacingy="3.7795276" + originx="1.5000001" + originy="1.5" /> + </sodipodi:namedview> + <defs + id="defs2" /> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(1.5,1.5)"> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 18.897638,170.07874 H 283.46457 v -37.79528 l -56.69291,1e-5 c -56.69291,0 0,-113.385832 -75.59056,-113.385832 -75.590556,0 -18.89764,113.385832 -75.590548,113.385832 l -56.692914,-1e-5 z" + id="path247" + sodipodi:nodetypes="cccszscc" /> + <circle + style="fill:none;stroke:#000000;stroke-width:1.00000003;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;fill-opacity:1;stroke-opacity:1" + id="path579" + cx="37.795277" + cy="151.18111" + r="3.7795274" /> + <circle + style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1" + id="path579-3" + cx="264.56693" + cy="151.18111" + r="3.7795274" /> + </g> +</svg> diff --git a/source/accessories/tools/leather_thimbles/thimbles.py b/source/accessories/tools/leather_thimbles/thimbles.py index ef3bfdc..37586ca 100755 --- a/source/accessories/tools/leather_thimbles/thimbles.py +++ b/source/accessories/tools/leather_thimbles/thimbles.py @@ -167,6 +167,60 @@ class Flat(hazwaz.Command): """ Draw the pattern for flat thimbles """ + def draw_pattern(self, dest): + grp = dest.g() + + sa = 2 + r_min = 7 + r_max = 13 + h = 20 + + y = 20 + + for i, r in enumerate(range(r_min, r_max)): + + size = dest.g() + + # half the circumference plus 2 mm sewing allowance + w = r * math.pi + 4 + h = 35 + + top_x = 20 + top_y = (35 + 10) * i + 20 + + thimble = dest.path( + ( + "M", top_x * mm, top_y * mm, + "c", 0, h / 2 * mm, 0, h * mm, w / 2 * mm, h * mm, + "c", w / 2 * mm, 0, + w / 2 * mm, - h / 2 * mm, + w / 2 * mm, - h * mm, + "L", top_x * mm, top_y * mm, + ), + ** LINE_STYLE, + ) + + size.add(thimble) + + size.add(dest.text( + text="size: " + str(r * 2), + insert=((top_x + w / 2) * mm, (top_y + 1) * mm + 8), + text_anchor="middle", + ** TEXT_STYLE, + )) + + grp.add(size) + + dest.add(grp) + + def main(self): + dest = svgwrite.Drawing( + filename="flat_thimbles.svg", + size=("210mm", "297mm"), + profile="full", + ) + self.draw_pattern(dest) + dest.save() class Thimble(hazwaz.MainCommand): |