Created
January 17, 2015 06:38
-
-
Save storborg/5b7dafadaeec7e86f66b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pyweaving import Draft | |
| from pyweaving.render import ImageRenderer | |
| # 1-indexed | |
| threading = [ | |
| 4, 3, | |
| 6, 5, | |
| 8, 7, | |
| 1, 2, 3, 4, 5, 6, 7, 8, | |
| 2, 1, | |
| 7, 8, | |
| 5, 6, | |
| 3, 4, | |
| 1, 2, | |
| 8, 7, 6, 5, 4, 3, | |
| 6, 5, | |
| 8, 7, | |
| 1, 2, 3, 4, 5, 6, 7, 8, | |
| 2, 1, | |
| 4, 3, 2, 1, | |
| 7, 8, | |
| 5, 6, | |
| 3, 4, | |
| 1, 2, | |
| 8, 7, 6, 5, | |
| 8, 7, | |
| 1, 2, 3, 4, 5, 6, 7, 8, | |
| 2, 1, | |
| 4, 3, | |
| 6, 5, 4, 3, 2, 1, | |
| 7, 8, | |
| 5, 6, | |
| 3, 4, | |
| 1, 2, | |
| 8, 7, | |
| 1, 2, 3, 4, 5, 6, 7, 8, | |
| 2, 1, | |
| 4, 3, | |
| 6, 5, | |
| 8, 7, 6, 5, 4, 3, 2, 1, | |
| 7, 8, | |
| 5, 6, | |
| 3, 4, | |
| 1, 2, 3, 4, 5, 6, 7, 8, | |
| 2, 1, | |
| 4, 3, | |
| 6, 5, | |
| 8, 7, | |
| 1, 2, | |
| 8, 7, 6, 5, 4, 3, 2, 1, | |
| 7, 8, | |
| 5, 6, | |
| 3, 4, 5, 6, 7, 8, | |
| 2, 1, | |
| 4, 3, | |
| 6, 5, | |
| 8, 7, | |
| 1, 2, 3, 4, | |
| 1, 2, | |
| 8, 7, 6, 5, 4, 3, 2, 1, | |
| 7, 8, | |
| 5, 6, 7, 8, | |
| 2, 1, | |
| 4, 3, | |
| 6, 5, | |
| 8, 7, | |
| 1, 2, 3, 4, 5, 6, | |
| 3, 4, | |
| 1, 2, | |
| 8, 7, 6, 5, 4, 3, 2, 1, | |
| 7, 8, | |
| 2, 1, | |
| 4, 3, | |
| 6, 5, | |
| 8, 7, | |
| 1, 2, 3, 4, 5, 6, 7, 8, | |
| 5, 6, | |
| 3, 4, | |
| 1, 2, | |
| 8, 7, 6, 5, 4, 3, 2, 1, | |
| ] | |
| # list of threads --> treadles, both are 1-indexed | |
| tieup = [ | |
| (1, 5, 7, 8), | |
| (1, 3, 4, 5), | |
| (1, 2, 6, 8), | |
| (2, 4, 5, 6), | |
| (1, 2, 3, 7), | |
| (3, 5, 6, 7), | |
| (2, 3, 4, 8), | |
| (4, 6, 7, 8), | |
| ] | |
| # offset, count | |
| plan = [ | |
| (0, 4), | |
| (0, 5), | |
| (1, 4), | |
| (1, 5), | |
| (2, 4), | |
| (2, 5), | |
| (3, 4), | |
| (3, 5), | |
| (4, 4), | |
| (4, 5), | |
| (5, 4), | |
| (5, 5), | |
| (6, 5), | |
| (7, 4), | |
| (7, 4), | |
| (7, 4), | |
| (7, 3), | |
| (6, 4), | |
| (6, 3), | |
| (5, 4), | |
| (5, 3), | |
| (4, 4), | |
| (4, 3), | |
| (3, 4), | |
| (3, 3), | |
| (2, 4), | |
| (2, 3), | |
| (1, 4), | |
| (1, 4), | |
| (1, 3), | |
| (0, 4), | |
| ] | |
| # 1-indexed | |
| treadling = [] | |
| for __ in range(3): | |
| for offset, run in plan: | |
| for ii in range(run): | |
| treadling.append((offset + ii + 1) % 8) | |
| draft = Draft(num_shafts=8, num_treadles=8) | |
| for ii, shaft_no in enumerate(threading): | |
| if ii % 2 == 0: | |
| # amethyst | |
| color = (75, 0, 188) | |
| else: | |
| # dark teal | |
| # color = (0, 108, 120) | |
| color = (255, 255, 255) | |
| draft.add_warp_thread(color=color, shaft=shaft_no - 1) | |
| for ii, treadle_nos in enumerate(tieup): | |
| shaft = draft.shafts[ii] | |
| for treadle_no in treadle_nos: | |
| draft.treadles[treadle_no - 1].shafts.add(shaft) | |
| for ii, treadle_no in enumerate(treadling): | |
| draft.add_weft_thread(color=(0, 0, 0), treadles=[treadle_no - 1]) | |
| ImageRenderer(draft, | |
| liftplan=True).save('parallel-threading-networked-twill.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment