kopia lustrzana https://github.com/brendabell/knittingtools
added calibration feature
rodzic
00c9c01093
commit
369389e97a
|
@ -6,6 +6,7 @@ import time
|
|||
import traceback
|
||||
|
||||
from modules.pcgenerator import PCGenerator
|
||||
from modules.pcgenerator import calibrate
|
||||
|
||||
def pcgenerator_get(handler):
|
||||
|
||||
|
@ -45,26 +46,31 @@ def pcgenerator_post(handler):
|
|||
if ctype == 'multipart/form-data':
|
||||
query=cgi.parse_multipart(handler.rfile, pdict)
|
||||
|
||||
upfilecontent = query.get('upfile')
|
||||
if len(upfilecontent[0]) > 4000:
|
||||
handler.send_response(302)
|
||||
handler.send_header('Content-type', 'text/html')
|
||||
handler.end_headers()
|
||||
handler.wfile.write("Sorry. Your file cannot exceed 2500 bytes!")
|
||||
calibrate = query.get('test', [''])[0] == 'test'
|
||||
if calibrate:
|
||||
result = calibrate()
|
||||
filename_template = 'attachment; filename="calibrate-{}.{}"'
|
||||
else:
|
||||
machine_type = query.get('machine')
|
||||
vert_repeat = query.get('vert')
|
||||
convert_to_png = query.get('png', [''])[0] == 'png'
|
||||
upfilecontent = query.get('upfile')
|
||||
if len(upfilecontent[0]) > 4000:
|
||||
handler.send_response(302)
|
||||
handler.send_header('Content-type', 'text/html')
|
||||
handler.end_headers()
|
||||
handler.wfile.write("Sorry. Your file cannot exceed 2500 bytes!")
|
||||
else:
|
||||
machine_type = query.get('machine')
|
||||
vert_repeat = query.get('vert')
|
||||
convert_to_png = query.get('png', [''])[0] == 'png'
|
||||
|
||||
generator = PCGenerator(
|
||||
handler,
|
||||
upfilecontent[0],
|
||||
machine_type[0],
|
||||
int(vert_repeat[0]))
|
||||
result = generator.generate()
|
||||
generator = PCGenerator(
|
||||
handler,
|
||||
upfilecontent[0],
|
||||
machine_type[0],
|
||||
int(vert_repeat[0]))
|
||||
result = generator.generate()
|
||||
filename_template = 'attachment; filename="punchcard-{}.{}"'
|
||||
|
||||
handler.send_response(200)
|
||||
filename_template = 'attachment; filename="punchcard-{}.{}"'
|
||||
|
||||
if convert_to_png:
|
||||
result = cairosvg.svg2png(bytestring=result)
|
||||
|
|
|
@ -8,12 +8,12 @@ specs = {
|
|||
'blank_rows': 2,
|
||||
'row_height': 5.0,
|
||||
'stitch_width': 9.0,
|
||||
'pattern_hole_radius': 3.5,
|
||||
'pattern_hole_diameter': 3.5,
|
||||
'pattern_hole_xoffset': 22.5,
|
||||
'clip_hole_radius': 3.5,
|
||||
'clip_hole_diameter': 3.5,
|
||||
'clip_hole_xoffset': 5.0,
|
||||
'clip_hole_yoffset': 5.0,
|
||||
'tractor_hole_radius': 3.0,
|
||||
'tractor_hole_diameter': 3.0,
|
||||
'tractor_hole_xoffset': 12.5,
|
||||
'tractor_hole_yoffset': 2.5,
|
||||
'stitches': 12,
|
||||
|
@ -24,12 +24,12 @@ specs = {
|
|||
'blank_rows': 2,
|
||||
'row_height': 5.0,
|
||||
'stitch_width': 6.0,
|
||||
'pattern_hole_radius': 3.5,
|
||||
'pattern_hole_diameter': 3.5,
|
||||
'pattern_hole_xoffset': 17.5,
|
||||
'clip_hole_radius': 3.5,
|
||||
'clip_hole_diameter': 3.5,
|
||||
'clip_hole_xoffset': 5.0,
|
||||
'clip_hole_yoffset': 5.0,
|
||||
'tractor_hole_radius': 3.0,
|
||||
'tractor_hole_diameter': 3.0,
|
||||
'tractor_hole_xoffset': 12.5,
|
||||
'tractor_hole_yoffset': 2.5,
|
||||
'stitches': 18,
|
||||
|
@ -40,12 +40,12 @@ specs = {
|
|||
'blank_rows': 2,
|
||||
'row_height': 5.0,
|
||||
'stitch_width': 4.5,
|
||||
'pattern_hole_radius': 3.5,
|
||||
'pattern_hole_diameter': 3.5,
|
||||
'pattern_hole_xoffset': 17.5,
|
||||
'clip_hole_radius': 3.5,
|
||||
'clip_hole_diameter': 3.5,
|
||||
'clip_hole_xoffset': 5.0,
|
||||
'clip_hole_yoffset': 5.0,
|
||||
'tractor_hole_radius': 3.0,
|
||||
'tractor_hole_diameter': 3.0,
|
||||
'tractor_hole_xoffset': 12.0,
|
||||
'tractor_hole_yoffset': 2.5,
|
||||
'stitches': 24,
|
||||
|
@ -56,12 +56,12 @@ specs = {
|
|||
'blank_rows': 3,
|
||||
'row_height': (100.0 / 19.0),
|
||||
'stitch_width': 5.0,
|
||||
'pattern_hole_radius': 4.0,
|
||||
'pattern_hole_xoffset': 22.0,
|
||||
'clip_hole_radius': 3.5,
|
||||
'pattern_hole_diameter': 3.5,
|
||||
'pattern_hole_xoffset': 22.25,
|
||||
'clip_hole_diameter': 3.5,
|
||||
'clip_hole_xoffset': 2.0,
|
||||
'clip_hole_yoffset': 5.5,
|
||||
'tractor_hole_radius': 3.0,
|
||||
'tractor_hole_diameter': 3.0,
|
||||
'tractor_hole_xoffset': 12.5,
|
||||
'tractor_hole_yoffset': 5.5,
|
||||
'stitches': 40,
|
||||
|
@ -70,6 +70,25 @@ specs = {
|
|||
}
|
||||
|
||||
|
||||
def calibrate():
|
||||
|
||||
diagram = svgwrite.Drawing(
|
||||
"calibrate.svg",
|
||||
size=(
|
||||
'100mm',
|
||||
'100mm'),
|
||||
viewBox=(
|
||||
'0 0 100 100'),
|
||||
preserveAspectRatio='none')
|
||||
diagram.add(
|
||||
diagram.polygon(
|
||||
[(10,10), (90,10), (90,90), (10,90), (10,10)],
|
||||
fill='white',
|
||||
stroke='red',
|
||||
stroke_width=.1))
|
||||
return '<?xml version="1.0" encoding="UTF-8" standalone="no"?>{}'.format(diagram.tostring())
|
||||
|
||||
|
||||
class Layout:
|
||||
|
||||
def __init__(self, machine_id, stitches, rows, horz_repeat, vert_repeat):
|
||||
|
@ -86,14 +105,14 @@ class Layout:
|
|||
# width of one stitch on the card in mm
|
||||
self.stitch_width = specs[machine_id]['stitch_width']
|
||||
|
||||
# radius of a pattern hole in mm
|
||||
self.pattern_hole_radius = specs[machine_id]['pattern_hole_radius']
|
||||
# diameter of a pattern hole in mm
|
||||
self.pattern_hole_diameter = specs[machine_id]['pattern_hole_diameter']
|
||||
|
||||
# offset of the first pattern hole from the left edge of the card in mm
|
||||
self.pattern_hole_xoffset = specs[machine_id]['pattern_hole_xoffset']
|
||||
|
||||
# radius of a clip hole in mm
|
||||
self.clip_hole_radius = specs[machine_id]['clip_hole_radius']
|
||||
# diameter of a clip hole in mm
|
||||
self.clip_hole_diameter = specs[machine_id]['clip_hole_diameter']
|
||||
|
||||
# offset of a clip hole from the left/right edge of the card in mm
|
||||
self.clip_hole_xoffset = specs[machine_id]['clip_hole_xoffset']
|
||||
|
@ -101,8 +120,8 @@ class Layout:
|
|||
# offset of a clip hole from the top/bottom edges of the card in mm
|
||||
self.clip_hole_yoffset = specs[machine_id]['clip_hole_yoffset']
|
||||
|
||||
# radius of a tractor hole in mm
|
||||
self.tractor_hole_radius = specs[machine_id]['tractor_hole_radius']
|
||||
# diameter of a tractor hole in mm
|
||||
self.tractor_hole_diameter = specs[machine_id]['tractor_hole_diameter']
|
||||
|
||||
# offset of a tractor hole from the left/right edge of the card in mm
|
||||
self.tractor_hole_xoffset = specs[machine_id]['tractor_hole_xoffset']
|
||||
|
@ -182,14 +201,14 @@ class PCGenerator:
|
|||
yoffset = (self.layout.blank_rows * self.layout.row_height) + (self.layout.row_height / 2)
|
||||
for row_repeat in range(self.layout.vert_repeat):
|
||||
for rows in range(self.layout.card_rows):
|
||||
xoffset = self.layout.pattern_hole_xoffset + (self.layout.pattern_hole_radius / 2)
|
||||
xoffset = self.layout.pattern_hole_xoffset + (self.layout.pattern_hole_diameter / 2)
|
||||
for stitch_repeat in range(self.layout.horz_repeat):
|
||||
for stitches in range(self.layout.card_stitches):
|
||||
if lines[rows][stitches].upper() == 'X':
|
||||
objects.append(diagram.circle(
|
||||
center=(xoffset, yoffset),
|
||||
fill='white',
|
||||
r = (self.layout.pattern_hole_radius / 2),
|
||||
r = (self.layout.pattern_hole_diameter / 2),
|
||||
stroke='black',
|
||||
stroke_width=.1))
|
||||
xoffset += self.layout.stitch_width
|
||||
|
@ -200,13 +219,13 @@ class PCGenerator:
|
|||
# blank rows at top
|
||||
yoffset = self.layout.row_height / 2
|
||||
for rows in range(self.layout.blank_rows):
|
||||
xoffset = self.layout.pattern_hole_xoffset + (self.layout.pattern_hole_radius / 2)
|
||||
xoffset = self.layout.pattern_hole_xoffset + (self.layout.pattern_hole_diameter / 2)
|
||||
for stitch_repeat in range(self.layout.horz_repeat):
|
||||
for stitches in range(self.layout.card_stitches):
|
||||
objects.append(diagram.circle(
|
||||
center=(xoffset, yoffset),
|
||||
fill='white',
|
||||
r = (self.layout.pattern_hole_radius / 2),
|
||||
r = (self.layout.pattern_hole_diameter / 2),
|
||||
stroke='black',
|
||||
stroke_width=.1))
|
||||
xoffset += self.layout.stitch_width
|
||||
|
@ -215,13 +234,13 @@ class PCGenerator:
|
|||
# blank rows at bottom
|
||||
yoffset = (self.layout.card_height - (self.layout.row_height * self.layout.blank_rows)) + (self.layout.row_height / 2)
|
||||
for rows in range(self.layout.blank_rows):
|
||||
xoffset = self.layout.pattern_hole_xoffset + (self.layout.pattern_hole_radius / 2)
|
||||
xoffset = self.layout.pattern_hole_xoffset + (self.layout.pattern_hole_diameter / 2)
|
||||
for stitch_repeat in range(self.layout.horz_repeat):
|
||||
for stitches in range(self.layout.card_stitches):
|
||||
objects.append(diagram.circle(
|
||||
center=(xoffset, yoffset),
|
||||
fill='white',
|
||||
r = (self.layout.pattern_hole_radius / 2),
|
||||
r = (self.layout.pattern_hole_diameter / 2),
|
||||
stroke='black',
|
||||
stroke_width=.1))
|
||||
xoffset += self.layout.stitch_width
|
||||
|
@ -234,7 +253,7 @@ class PCGenerator:
|
|||
objects,
|
||||
self.layout.clip_hole_xoffset,
|
||||
self.layout.clip_hole_yoffset,
|
||||
self.layout.clip_hole_radius)
|
||||
self.layout.clip_hole_diameter)
|
||||
|
||||
def draw_tractor_holes(self, diagram, objects):
|
||||
|
||||
|
@ -243,11 +262,11 @@ class PCGenerator:
|
|||
objects,
|
||||
self.layout.tractor_hole_xoffset,
|
||||
self.layout.tractor_hole_yoffset,
|
||||
self.layout.tractor_hole_radius)
|
||||
self.layout.tractor_hole_diameter)
|
||||
|
||||
def draw_side_holes(self, diagram, objects, xoffset, yoffset, radius):
|
||||
def draw_side_holes(self, diagram, objects, xoffset, yoffset, diameter):
|
||||
|
||||
left_xoffset = xoffset + (radius / 2)
|
||||
left_xoffset = xoffset + (diameter / 2)
|
||||
right_xoffset = self.layout.card_width - left_xoffset
|
||||
|
||||
while yoffset < self.layout.card_height:
|
||||
|
@ -255,21 +274,21 @@ class PCGenerator:
|
|||
objects.append(diagram.circle(
|
||||
center=(left_xoffset, yoffset),
|
||||
fill='white',
|
||||
r = (radius / 2),
|
||||
r = (diameter / 2),
|
||||
stroke='black',
|
||||
stroke_width=.1))
|
||||
# holes on right
|
||||
objects.append(diagram.circle(
|
||||
center=(right_xoffset, yoffset),
|
||||
fill='white',
|
||||
r = (radius / 2),
|
||||
r = (diameter / 2),
|
||||
stroke='black',
|
||||
stroke_width=.1))
|
||||
yoffset += self.layout.row_height
|
||||
|
||||
def get_card_shape(self):
|
||||
|
||||
corner_radius = self.layout.corner_offset + 1
|
||||
corner_diameter = self.layout.corner_offset + 1
|
||||
|
||||
# a------------------b
|
||||
# p c
|
||||
|
@ -283,16 +302,16 @@ class PCGenerator:
|
|||
# k h
|
||||
# j------------------i
|
||||
|
||||
a = (corner_radius, 0)
|
||||
b = (self.layout.card_width - corner_radius, 0)
|
||||
a = (corner_diameter, 0)
|
||||
b = (self.layout.card_width - corner_diameter, 0)
|
||||
c = (self.layout.card_width - self.layout.corner_offset, 1)
|
||||
d = (self.layout.card_width - self.layout.corner_offset, 20)
|
||||
e = (self.layout.card_width, 22)
|
||||
f = (self.layout.card_width, self.layout.card_height - 22)
|
||||
g = (self.layout.card_width - self.layout.corner_offset, self.layout.card_height - 20)
|
||||
h = (self.layout.card_width - self.layout.corner_offset, self.layout.card_height - 1)
|
||||
i = (self.layout.card_width - corner_radius, self.layout.card_height)
|
||||
j = (corner_radius, self.layout.card_height)
|
||||
i = (self.layout.card_width - corner_diameter, self.layout.card_height)
|
||||
j = (corner_diameter, self.layout.card_height)
|
||||
k = ( self.layout.corner_offset, self.layout.card_height - 1)
|
||||
l = ( self.layout.corner_offset, self.layout.card_height - 20)
|
||||
m = (0, self.layout.card_height - 22)
|
||||
|
|
|
@ -1,125 +1,132 @@
|
|||
<!DOCTYPE HTML SYSTEM>
|
||||
<html>
|
||||
<head>
|
||||
<title>PCGenerator</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: arial, sans-serif;
|
||||
margin-top: 40px;
|
||||
margin-left: 10%;
|
||||
width: 80%;
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
td, th {
|
||||
border: None;
|
||||
text-align: left;
|
||||
padding: 8px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Punchcard Generator</h1>
|
||||
<a href="/knittingtools">[Back To Tools Home]</a> <a href="http://www.brendaabell.com">[Back To My Blog]</a>
|
||||
<hr>
|
||||
|
||||
<p>This app will allow you to upload a small text file that contains your pattern represented as a sequence of rows with X's for punched holes and any other character except space for unpunched holes. The program will generate an SVG file that can be imported into the software you use to cut material with your die cutter.
|
||||
<p>IMPORTANT!!! This app is currently considered Beta. As such, there may be bugs. If you see something that doesn't look right, please report the issue using the instructions at the bottom of this page.
|
||||
|
||||
<h2>TL;DR</h2>
|
||||
<ul>
|
||||
<li>Select the file to upload.</li>
|
||||
<li>Select your machine type.</li>
|
||||
<li>Enter the # vertical repeats if you need them. The # horizontal repeats will be automatically calculated based on the machine type.</li>
|
||||
<li>Check "Convert to PNG" if you'd like to download a PNG image instead of SVG.</li>
|
||||
<li>Click the Upload button.</li>
|
||||
</ul>In a few seconds, you should see a dialog prompting you for where you want to save your file. If you need more detailed instructions, keep reading below.
|
||||
|
||||
<p>
|
||||
<form
|
||||
id="main"
|
||||
method="POST"
|
||||
enctype="multipart/form-data"
|
||||
action="/pcgenerator"
|
||||
onfocus="y.value=vert.value"
|
||||
oninput="y.value=vert.value">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td style="text-align:right">Select file to upload:<br> </td>
|
||||
<td colspan="2"><input type="file" name="upfile"><br><small>(maximum file size 4000 characters)<small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:right">Select machine type:<br> </td>
|
||||
<td colspan="2">
|
||||
<select name="machine">
|
||||
<option value="12-stitch-br-sr">12-stitch Brother/Silver Reed/Studio</option>
|
||||
<option value="24-stitch-br-sr">24-stitch Brother/Silver Reed/Studio</option>
|
||||
<option value="40-stitch-deco">40-stitch Passap Deco</option>
|
||||
<option value="18-stitch-mk70">18-stitch Empisal MK70</option>
|
||||
</select>
|
||||
<p><b>NOTICE: Support for Deco and MK70 is currently experimental and has not been fully tested.</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:right"># Vertical repeats (up to 24):</td>
|
||||
<td><input type="range" id="vert" name="vert" min="1" max="24" step="1" value="1">
|
||||
<output id="y" name="y" value="1"></output>
|
||||
<script>y.value=vert.value;</script></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="test-align:right">Convert to PNG image:</td>
|
||||
<td><input type="checkbox" name="png" value="png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan="2"><input type="submit" value="Upload"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<br>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
<h1>Instructions</h1>
|
||||
|
||||
<p>Both upper and lower case X's are supported. The total width in stitches is determined by the number of characters in the first row. For example, the following text file has 4 rows and 12 stitches:
|
||||
|
||||
<pre>
|
||||
x-----x-----
|
||||
-x-----x----
|
||||
--x-----x---
|
||||
---x-----x--
|
||||
</pre>
|
||||
|
||||
<p>The generator will determine the number of horizontal repeats based on the number of characters in your first row and the type of machine. I.e., if row 1 contains 4 characters and you select a 12-stitch machine, the generator will automatically do 3 horizontal repeats: 4 * 3 = 12.
|
||||
|
||||
<p>By default, the generator will do 1 vertical repeat. I.e., if your file contains 36 rows, the generated file will produce a 36 row card. You can increase the length by adjusting the vertical repeat before clicking the upload button.
|
||||
|
||||
<p>What this means is that you can design a simple 4x4 card and use repeats to make the card as wide or as long as it needs to be in order to work properly. For example, the following text file will generate a 24 row x 48 stitch card if you select a 24-stitch machine and specify 12 for the vertical repeat:
|
||||
|
||||
<pre>
|
||||
x-x-
|
||||
-x-x
|
||||
x-x-
|
||||
-x-x
|
||||
</pre>
|
||||
|
||||
<p>The resulting SVG file can be imported into any application that understands SVG. You can also display the SVG in some browsers. Neither the text file or resulting SVG will be saved on this site. Be sure to keep them in a safe location so they don't get lost.
|
||||
|
||||
<p>Silhouette users have reported issues importing SVG files or having to resize the SVG in Inkscape before importing. If you have trouble with the SVG file, try checking the Convert To PNG button to see if that gives you a better result.
|
||||
|
||||
<h2>Bugs & Disclaimers</h2>
|
||||
<p>This program has only been tested using Sure Cuts A Lot on a Pazzles Creative Mighty. YMMV!
|
||||
|
||||
<p>If you have questions or feedback, please contact <a href="http://www.ravelry.com/people/beebell">beebell on Ravelry</a> via private message or log at issue on <a href="https://github.com/brendabell/knittingtools/issues">GitHub</a>.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE HTML SYSTEM>
|
||||
<html>
|
||||
<head>
|
||||
<title>PCGenerator</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: arial, sans-serif;
|
||||
margin-top: 40px;
|
||||
margin-left: 10%;
|
||||
width: 80%;
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
td, th {
|
||||
border: None;
|
||||
text-align: left;
|
||||
padding: 8px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Punchcard Generator</h1>
|
||||
<a href="/knittingtools">[Back To Tools Home]</a> <a href="http://www.brendaabell.com">[Back To My Blog]</a>
|
||||
<hr>
|
||||
|
||||
<p>This app will allow you to upload a small text file that contains your pattern represented as a sequence of rows with X's for punched holes and any other character except space for unpunched holes. The program will generate an SVG file that can be imported into the software you use to cut material with your die cutter.
|
||||
<p>IMPORTANT!!! This app is currently considered Beta. As such, there may be bugs. If you see something that doesn't look right, please report the issue using the instructions at the bottom of this page.
|
||||
|
||||
<h2>TL;DR</h2>
|
||||
<ul>
|
||||
<li>Select the file to upload.</li>
|
||||
<li>Select your machine type.</li>
|
||||
<li>Enter the # vertical repeats if you need them. The # horizontal repeats will be automatically calculated based on the machine type.</li>
|
||||
<li>Check "Convert to PNG" if you'd like to download a PNG image instead of SVG.</li>
|
||||
<li>Click the Upload button.</li>
|
||||
</ul>In a few seconds, you should see a dialog prompting you for where you want to save your file. If you need more detailed instructions, keep reading below.
|
||||
|
||||
<p>
|
||||
<form
|
||||
id="main"
|
||||
method="POST"
|
||||
enctype="multipart/form-data"
|
||||
action="/pcgenerator"
|
||||
onfocus="y.value=vert.value"
|
||||
oninput="y.value=vert.value">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td style="text-align:right">Select file to upload:<br> </td>
|
||||
<td colspan="2"><input type="file" name="upfile"><br><small>(maximum file size 4000 characters)<small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:right">Select machine type:<br> </td>
|
||||
<td colspan="2">
|
||||
<select name="machine">
|
||||
<option value="12-stitch-br-sr">12-stitch Brother/Silver Reed/Studio</option>
|
||||
<option value="24-stitch-br-sr">24-stitch Brother/Silver Reed/Studio</option>
|
||||
<option value="40-stitch-deco">40-stitch Passap Deco</option>
|
||||
<option value="18-stitch-mk70">18-stitch Empisal MK70</option>
|
||||
</select>
|
||||
<p><b>NOTICE: Support for Deco and MK70 is currently experimental and has not been fully tested.</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:right"># Vertical repeats (up to 24):</td>
|
||||
<td><input type="range" id="vert" name="vert" min="1" max="24" step="1" value="1">
|
||||
<output id="y" name="y" value="1"></output>
|
||||
<script>y.value=vert.value;</script></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:right">Convert to PNG image:</td>
|
||||
<td><input type="checkbox" name="png" value="png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align;right">Calibrate Only:</td>
|
||||
<td><input type="checkbox" name="test" value="test"></td>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan="2"><input type="submit" value="Upload"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<br>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
<h1>Instructions</h1>
|
||||
|
||||
<p>Both upper and lower case X's are supported. The total width in stitches is determined by the number of characters in the first row. For example, the following text file has 4 rows and 12 stitches:
|
||||
|
||||
<pre>
|
||||
x-----x-----
|
||||
-x-----x----
|
||||
--x-----x---
|
||||
---x-----x--
|
||||
</pre>
|
||||
|
||||
<p>The generator will determine the number of horizontal repeats based on the number of characters in your first row and the type of machine. I.e., if row 1 contains 4 characters and you select a 12-stitch machine, the generator will automatically do 3 horizontal repeats: 4 * 3 = 12.
|
||||
|
||||
<p>By default, the generator will do 1 vertical repeat. I.e., if your file contains 36 rows, the generated file will produce a 36 row card. You can increase the length by adjusting the vertical repeat before clicking the upload button.
|
||||
|
||||
<p>What this means is that you can design a simple 4x4 card and use repeats to make the card as wide or as long as it needs to be in order to work properly. For example, the following text file will generate a 24 row x 48 stitch card if you select a 24-stitch machine and specify 12 for the vertical repeat:
|
||||
|
||||
<pre>
|
||||
x-x-
|
||||
-x-x
|
||||
x-x-
|
||||
-x-x
|
||||
</pre>
|
||||
|
||||
<p>The resulting SVG file can be imported into any application that understands SVG. You can also display the SVG in some browsers. Neither the text file or resulting SVG will be saved on this site. Be sure to keep them in a safe location so they don't get lost.
|
||||
|
||||
<p>Silhouette users have reported issues importing SVG files or having to resize the SVG in Inkscape before importing. If you have trouble with the SVG file, try checking the Convert To PNG button to see if that gives you a better result.
|
||||
|
||||
<p>Depending on the software you use to view or cut the image, what you see on your screen may or may not be sized properly. If you'd like to calibrate your viewing or cutting software, check the Calibrate Only checkbox and click Upload. That will generate a 100x100mm diagram with a red square. Determine the steps necessary to make your software display or print the square so it's exactly 80x80mm. Then use those same steps to calibrate your software for the generated punchcards.
|
||||
|
||||
<p>If both Convert To PNG and Calibrate Only are checked, the downloaded calibration image will be converted to a PNG image.
|
||||
|
||||
<h2>Bugs & Disclaimers</h2>
|
||||
<p>This program has only been tested using Sure Cuts A Lot on a Pazzles Creative Mighty. YMMV!
|
||||
|
||||
<p>If you have questions or feedback, please contact <a href="http://www.ravelry.com/people/beebell">beebell on Ravelry</a> via private message or log at issue on <a href="https://github.com/brendabell/knittingtools/issues">GitHub</a>.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
||||
-xxx--xx-xx-xx--xxx--xxx--xx-xx-xx--xxx-
|
||||
x---xx--x--x--xx---xx---xx--x--x--xx---x
|
|
@ -17,3 +17,4 @@ text_file.close()
|
|||
png_file = open("{}.png".format(machine), "w")
|
||||
cairosvg.svg2png(bytestring=result,write_to=png_file)
|
||||
png_file.close()
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue