Skip to content

metric option for zip sack #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 43 additions & 10 deletions assets/js/zipsack.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,51 @@
Calculate fabric pattern sizes for rectangular zip sack
*/

function patternSize(l,w,h) {
var zsA = 0.5; // zipper seam allowance
var sA = 0.375; // general seam allowance
function roundToEigthInch (number) {
var number = (Math.round(number * 8) / 8);
return number;
}

// function patternSize(l,w,h) {
// var zsA = 0.5; // zipper seam allowance
// var sA = 0.375; // general seam allowance
// if (l,w,h > 0) {
// var fabricW = 2*w + 2*h + (2*zsA);
// var fabricH = 1*l + 1*h + (2*sA);
// return [fabricW, fabricH];
// }
// }

function patternSize(units,l,w,h) {
if (units==1) { // metric
var zsA = 1.3; // channel seam allowance
var sA = 1.0; // general seam allowance
}
else { // imperial
var zsA = 0.5; // channel seam allowance
var sA = 0.375; // general seam allowance
}
if (l,w,h > 0) {
var fabricW = 2*w + 2*h + (2*zsA);
var fabricH = 1*l + 1*h + (2*sA);
return [fabricW, fabricH];

if (units==1) {
var fabricW = fabricW.toFixed(1); //trimming to closest mm
var fabricH = fabricH.toFixed(1);
}
else {
var fabricW = roundToEigthInch(fabricW); //rounding to nearest 1/8" increment
var fabricH = roundToEigthInch(fabricH);
}

return [fabricW, fabricH]; // returns radius
}
}



$('document').ready(function () {

var version = "v0.2";
var version = "v0.3";
$('.version').html(version);

$('.dimension').change(function () { //when any .dimension changes (input loses focus), function runs
Expand All @@ -31,22 +61,25 @@ $('document').ready(function () {
}
});

var units = $( "input[type=radio][name=units]:checked" ).val(); // inches (val=0) or cm (val=1)

var length = $('#length').val();
var width = $('#width').val();
var height = $('#height').val();

if (length, width, height != "") {
var scrap = patternSize(length,width,height);
var scrap = patternSize(units, length,width,height);
var fabricW = scrap[0];
var fabricH = scrap[1];

if (units == 1) { var unitText = " cm" }
else { var unitText = " in" }
var volLiters = (vol * 0.0163871).toFixed(1); //convert cubic inches to liters

//html id returns
$('#volumeCuIn').html(vol);
$('#volumeLiters').html(volLiters);
$('.patternHeight').html(fabricH + '"');
$('.patternWidth').html(fabricW + '"');
$('.patternHeight').html(fabricH + unitText);
$('.patternWidth').html(fabricW + unitText);

}
});
Expand Down
33 changes: 26 additions & 7 deletions zpinstructions.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<!-- Banner -->
<section class="banner style2 orient-left content-align-left image-position-right onload-content-fade-right">
<div class="content">
<h1> <a href="index.html">MYOG Patterns</a> </h1>
<h1> <a href="index.html">Learn MYOG</a> </h1>
<p class="major">A collection of sewing patterns and generators for outdoor enthusiasts who prefer to Make Your Own Gear (MYOG)</p>
<p></p>
</div>
Expand All @@ -56,6 +56,23 @@ <h3>Pattern Generator</h3>

<form method="post" action="#">
<div class="fields">

<!-- Set Units -->
<div class="field third">
<label>Pattern Units</label>
</div>

<div class="field third">
<input type="radio" name="units" class="dimension" id="imperial" value="0" checked>
<label for="imperial">Inches (in)</label>
</div>

<div class="field third">
<input type="radio" name="units" class="dimension" id="metric" value="1">
<label for="metric">Centimeters (cm)</label>
</div>

<!-- Set Dimensions -->
<div class="field third">
<label for="length">Length</label>
<input type="number" name="length" class="dimension" id="length" value="" />
Expand All @@ -70,14 +87,16 @@ <h3>Pattern Generator</h3>
</div>
</div>

<!-- Button used for tab and force change -->
<div class="actions small">
<button class="button small" type="button">Generate</button>
</div>
</form>

<span class="image right"><img src="images\zipPouchPattern.png" alt="zip pouch pattern" /></span>

<ul class="alt">

<li>Seam Allowances: 3/8" typical with 1/2" Zipper Allowance</li></br>
<li>Seam Allowances: 3/8" (1 cm) typical with 1/2" (1.3 cm) Zipper Allowance</li></br>
<li><strong>Fabric Width: <span class="patternWidth"></span></strong></li>
<li><strong>Fabric Height: <span class="patternHeight"></span></strong></li>
</ul>
Expand Down Expand Up @@ -137,8 +156,8 @@ <h3>Measure and Cut Fabric</h3>
<ol>
<li>Using the generated <strong>Fabric Width <span class="patternWidth"></span></strong> and <strong>Fabric Height <span class="patternHeight"></span></strong>, measure and draw the dimensions on a fabric panel.</li>
<li>Cut the fabric panel along the outer perimeter.</li>
<li>Mark the 1/2 inch zipper allowance along the Fabric Height edges.</li>
<li>Mark the 3/8 inch seam allowance along the Fabric Width edges.</li>
<li>Mark the 1/2 inch (1.3 cm) zipper allowance along the Fabric Height edges.</li>
<li>Mark the 3/8 inch (1 cm) seam allowance along the Fabric Width edges.</li>
</ol>
</div>
</section>
Expand Down Expand Up @@ -172,8 +191,8 @@ <h3>Close Zip Pouch Ends</h3>

<ol>
<li>With wrong sides out, close zipper and lay flat. Ensure zipper is parallel with edges. Zipper should be evenly spaced in the middle.</li>
<li>Lining up the bottom edge, sew one end closed with the 3/8 inch seam allowance. Being careful not to break your needle, sew over the zipper.</li>
<li>Flip around, smooth out and ensure zipper is still parallel and evenly spaced. Sew opposite end with 3/8" seam allowance.</li>
<li>Lining up the bottom edge, sew one end closed with the 3/8 inch (1 cm) seam allowance. Being careful not to break your needle, sew over the zipper.</li>
<li>Flip around, smooth out and ensure zipper is still parallel and evenly spaced. Sew opposite end with 3/8" (1 cm) seam allseam allseam allowance.</li>
<li>If you have long zipper tape, don't make the rookie move and sew your zipper pull on the outside of the bag!</li>
<li>Trim excess zipper tape off both ends.</li>
<li>For bonus points, consider adding pull loops to the zipper ends. Grosgrain ribbon or excess zipper tape work great. Make sure your loops are sewn INSIDE the pouch!</li>
Expand Down