Initial commit of coil splitter 2.0

This commit is contained in:
Taylor Courage 2024-07-03 01:41:02 -04:00
commit ae1f9b901c
4 changed files with 142 additions and 0 deletions

9
README.md Normal file
View File

@ -0,0 +1,9 @@
# Coil Split Calculator
## Introduction
This web app is designed to calculate the counter value(s) required to divide coils into two or more 'splits.'
## How it works
The operator of the machine simply chooses their machine/cast size from the drop-down box, enters the size of the finished product, and the target finished rack weight. Upon clicking the "Calculate" button or pressing the return key on the keyboard, the operator will be shown three possible values that their counter could be using, whether it is feet, inches, or rotations of the bullblock.

71
index.html Normal file
View File

@ -0,0 +1,71 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
<script src="splitter.js"></script>
<link rel="stylesheet" href="splitter.css" />
<title>Split Calculator</title>
</head>
<body>
<div class="content">
<div class="header">
<p id="vanity">Taylor Courage's</p>
<h1>Split Calculator</h1>
<h3>Enter cast and finish size to get counter value</h3>
</div>
<div class="body" id="body">
<label for="block">Block size:</label>
<select name="block" id="block">
<option value="26">26" (11, 14)</option>
<option value="30">30" (26, Koch)</option>
<option value="36">36" (22, 23)</option>
<option value="42">42" (24)</option>
</select>
<br />
<label for="finish">Finished size:</label>
<input autocomplete="off" id="finish" type="text" value="0.000" size="3">
<br />
<label for="rack">Rack weight:</label>
<input autocomplete="off" id="rack" type="text" value="2075" size="3">
<label for="rack">lbs</label>
<br />
<br />
&nbsp;<input type="button" id="submitButton" value="Calculate" onclick="doSplit()" />
<br />
<br />
<br />
<script>
// This script listens for the enter key being pressed
var input = document.getElementById("body");
input.addEventListener("keypress", function (event) {
if (event.key === "Enter") {
event.preventDefault();
document.getElementById("submitButton").click();
}
});
</script>
<table style="width:80%" align="center">
<tr>
<td style="width:33%">Feet</td>
<td>Inches</td>
<td style="width:33%">Rotations</td>
</tr>
<tr>
<td id="feet">0</td>
<td id="inch">0</td>
<td id="revs">0</td>
</tr>
</table>
<script>
</script>
&nbsp;
</div>
</div>
<div class="footer" align="center">
&nbsp;
<p>&copy; 2024 <a href="https://git.taylorcourage.net/Taylor">Taylor Courage</a></p>
</div>
</body>
</html>

36
splitter.css Normal file
View File

@ -0,0 +1,36 @@
.content {
position: relative;
border: 1px solid black;
padding-left: 17px;
padding-right: 17px;
max-width: 400px;
min-height: 400px;
margin: auto;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.footer {
position: relative;
bottom: 15px;
width: 100%;
font-size: 75%;
margin: auto;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
label {
margin: auto;
}
table,td {
border: 1px solid black;
border-collapse: collapse;
text-align: center;
font-weight: bold;
}
#vanity {
font-family: serif;
font-style: oblique;
font-size: 0.8em;
}

26
splitter.js Normal file
View File

@ -0,0 +1,26 @@
function doSplit() {
// Get values from page
var dia = document.getElementById("finish").value;
var block = document.getElementById("block").value;
var rack = document.getElementById("rack").value;
// Format our numbers to prevent maximum user stupidity
if (dia > 100) {
dia = dia / 1000;
}
// These are a few baseline calculations
var lbsPerFoot = (((dia * dia * 0.7854) * 12) * 0.2833);
var ftPerRev = (3.1415 * (block / 12));
// Actual final values
var feet = Math.round(rack / lbsPerFoot);
var inches = feet * 12;
var revs = Math.round(feet / ftPerRev);
// Set values on page
document.getElementById("feet").textContent = feet;
document.getElementById("inch").textContent = inches;
document.getElementById("revs").textContent = revs;
}