diff options
Diffstat (limited to 'source/accessories/tools/leather_thimbles/thimbles.py')
-rwxr-xr-x | source/accessories/tools/leather_thimbles/thimbles.py | 54 |
1 files changed, 54 insertions, 0 deletions
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): |