summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2023-08-20 19:54:31 +0200
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2023-08-20 19:54:31 +0200
commit28bc9e93f2c165388ffbe530b35be41f803531a3 (patch)
tree5d3ce451c73328a98c62d5861475b3e067a5ceab
parent1b8c001da8a9507e8190186b0e948002b98f376e (diff)
Start of articlethimbles
-rw-r--r--source/accessories/index.rst1
-rw-r--r--source/accessories/tools/index.rst9
-rw-r--r--source/accessories/tools/leather_thimbles/index.rst33
-rwxr-xr-xsource/accessories/tools/leather_thimbles/thimbles.py183
4 files changed, 226 insertions, 0 deletions
diff --git a/source/accessories/index.rst b/source/accessories/index.rst
index 659a363..56d2774 100644
--- a/source/accessories/index.rst
+++ b/source/accessories/index.rst
@@ -8,3 +8,4 @@
bags/index
cases/index
+ tools/index
diff --git a/source/accessories/tools/index.rst b/source/accessories/tools/index.rst
new file mode 100644
index 0000000..d7d1b78
--- /dev/null
+++ b/source/accessories/tools/index.rst
@@ -0,0 +1,9 @@
+*******
+ Tools
+*******
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Contents:
+
+ leather_thimbles/index
diff --git a/source/accessories/tools/leather_thimbles/index.rst b/source/accessories/tools/leather_thimbles/index.rst
new file mode 100644
index 0000000..14b0808
--- /dev/null
+++ b/source/accessories/tools/leather_thimbles/index.rst
@@ -0,0 +1,33 @@
+Leather Thimbles
+================
+
+.. only:: html
+
+ .. contents::
+
+.. figure::
+ :align: center
+
+
+Materials
+---------
+
+Fabric
+^^^^^^
+
+
+Notions
+^^^^^^^
+
+
+Pattern
+-------
+
+
+Instructions
+------------
+
+
+Gallery
+-------
+
diff --git a/source/accessories/tools/leather_thimbles/thimbles.py b/source/accessories/tools/leather_thimbles/thimbles.py
new file mode 100755
index 0000000..ef3bfdc
--- /dev/null
+++ b/source/accessories/tools/leather_thimbles/thimbles.py
@@ -0,0 +1,183 @@
+#!/usr/bin/env python3
+
+import math
+
+import hazwaz
+import svgwrite
+
+
+# 1 mm in px
+mm = 3.7795276
+
+LINE_STYLE = {
+ 'stroke': svgwrite.utils.rgb(0, 0, 0),
+ 'stroke_width': 0.5,
+ 'fill': 'none'
+ }
+
+LINE_STYLE_LIGHT = {
+ 'stroke': svgwrite.utils.rgb(127, 127, 127),
+ 'stroke_width': 0.5,
+ 'fill': 'none'
+ }
+
+TEXT_STYLE = {
+ 'stroke': "none",
+ 'stroke_width': 0.5,
+ 'fill': svgwrite.utils.rgb(0, 0, 0),
+ "font_family": "Free Mono",
+ "font_weight": "bold",
+ "font_size": 12,
+ }
+
+
+class Cylindrical(hazwaz.Command):
+ """
+ Draw the pattern for cylindrical thimbles
+ """
+
+ def draw_pattern(self, dest):
+ grp = dest.g()
+
+ r_min = 6
+ r_max = 14
+ h = 20
+
+ y = 20
+
+ for r in range(r_min, r_max):
+
+ size = dest.g()
+
+ c_x = (r + 20)
+ c_y = (y + r)
+
+ size.add(dest.circle(
+ center=(c_x * mm, c_y * mm),
+ r=r * mm,
+ ** LINE_STYLE,
+ ))
+
+ size.add(dest.circle(
+ center=(c_x * mm, c_y * mm),
+ r=(r - 2) * mm,
+ ** LINE_STYLE_LIGHT,
+ ))
+
+ for i in range(12):
+ size.add(dest.line(
+ start=(
+ (c_x + (r - 3) * math.cos(math.pi / 6 * i)) * mm,
+ (c_y + (r - 3) * math.sin(math.pi / 6 * i)) * mm,
+ ),
+ end=(
+ (c_x + (r - 1) * math.cos(math.pi / 6 * i)) * mm,
+ (c_y + (r - 1) * math.sin(math.pi / 6 * i)) * mm,
+ ),
+ ** LINE_STYLE_LIGHT,
+ ))
+
+ size.add(dest.text(
+ text=str(r),
+ insert=(c_x * mm, c_y * mm + 5),
+ text_anchor="middle",
+ ** TEXT_STYLE,
+ ))
+
+ d = r * math.pi * 2 / 12
+
+ size.add(dest.rect(
+ insert=((r_max * 2 + 20 + 10) * mm, y * mm),
+ size=((d * 15) * mm, h * mm),
+ ** LINE_STYLE,
+ ))
+
+ for i in range(1, 15):
+ size.add(dest.line(
+ start=(
+ (r_max * 2 + 20 + 10 + d * i) * mm,
+ (y + 1) * mm,
+ ),
+ end=(
+ (r_max * 2 + 20 + 10 + d * i) * mm,
+ (y + 3) * mm,
+ ),
+ ** LINE_STYLE_LIGHT,
+ ))
+ size.add(dest.line(
+ start=(
+ (r_max * 2 + 20 + 10 + d * i - 1) * mm,
+ (y + 2) * mm,
+ ),
+ end=(
+ (r_max * 2 + 20 + 10 + d * i + 1) * mm,
+ (y + 2) * mm,
+ ),
+ ** LINE_STYLE_LIGHT,
+ ))
+
+ for i in range(3):
+ size.add(dest.line(
+ start=(
+ (r_max * 2 + 20 + 10 + d * 15 - 2) * mm,
+ (y + 5 + 5 * i - 1) * mm,
+ ),
+ end=(
+ (r_max * 2 + 20 + 10 + d * 15 - 2) * mm,
+ (y + 5 + 5 * i + 1) * mm,
+ ),
+ ** LINE_STYLE_LIGHT,
+ ))
+ size.add(dest.line(
+ start=(
+ (r_max * 2 + 20 + 10 + d * 15 - 3) * mm,
+ (y + 5 + 5 * i) * mm,
+ ),
+ end=(
+ (r_max * 2 + 20 + 10 + d * 15 - 1) * mm,
+ (y + 5 + 5 * i) * mm,
+ ),
+ ** LINE_STYLE_LIGHT,
+ ))
+
+ size.add(dest.text(
+ text="size: " + str(r),
+ insert=((r_max * 2 + 20 + 10 + 2) * mm, (y + 6) * mm + 8),
+ text_anchor="start",
+ ** TEXT_STYLE,
+ ))
+
+ y += (max(r * 2, h) + 10)
+
+ grp.add(size)
+
+ dest.add(grp)
+
+ def main(self):
+ dest = svgwrite.Drawing(
+ filename="cylindrical_thimbles.svg",
+ size=("210mm", "297mm"),
+ profile="full",
+ )
+ self.draw_pattern(dest)
+ dest.save()
+
+
+class Flat(hazwaz.Command):
+ """
+ Draw the pattern for flat thimbles
+ """
+
+
+class Thimble(hazwaz.MainCommand):
+ """
+ Draw the pattern for leather thimbles
+ """
+ commands = (
+ Cylindrical(),
+ Flat(),
+ )
+
+
+if __name__ == "__main__":
+ Thimble().run()