Skip to content

Commit a4ac0ea

Browse files
authored
Create 3d-rechner
1 parent b188e49 commit a4ac0ea

File tree

1 file changed

+223
-0
lines changed

1 file changed

+223
-0
lines changed

3d-rechner

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
---
2+
layout: default
3+
title: 3D-Druck-Preisrechner
4+
permalink: /3d-preisrechner/
5+
---
6+
<!--
7+
SPDX-FileCopyrightText: 2023 Johann Galle
8+
SPDX-License-Identifier: Unlicense
9+
-->
10+
<!DOCTYPE html>
11+
<html>
12+
<head>
13+
<meta charset="utf-8">
14+
<title>3D-Druck Preisrechner fablab Cottbus e.V.</title>
15+
<style>
16+
body {
17+
text-align: center;
18+
max-width: 80em;
19+
margin: auto;
20+
font-family: sans-serif;
21+
font-size: 1.2em;
22+
font-variant-numeric: tabular-nums;
23+
}
24+
noscript {
25+
color: red;
26+
}
27+
table {
28+
margin: auto;
29+
border-collapse: collapse;
30+
border: 1px solid grey;
31+
vertical-align: top;
32+
}
33+
td, th {
34+
text-align: right;
35+
padding: .5em .1em .5em .7em;
36+
}
37+
td:last-child, th:last-child {
38+
padding-right: .7em;
39+
}
40+
th {
41+
text-align: center;
42+
border-bottom: 2px solid black;
43+
}
44+
tr:nth-child(2n) {
45+
background: lightgrey;
46+
}
47+
tr > .unit {
48+
text-align: left;
49+
padding-left: .1em;
50+
}
51+
.grandtotal {
52+
border-bottom: 3px double black;
53+
vertical-align: top;
54+
}
55+
</style>
56+
</head>
57+
<body>
58+
<noscript>
59+
Zum Ausführen der Berechnungen wird JavaScript verwendet.
60+
Wenn JavaScript nicht verfügbar oder nicht aktiviert ist, kann dieser Rechner leider nicht verwendet werden.
61+
</noscript>
62+
<h1>3D-Druck Preisrechner</h1>
63+
<h2>fablab Cottbus e.V.</h2>
64+
<table>
65+
<thead>
66+
<tr>
67+
<th>Beschreibung</th>
68+
<th colspan="2">Grundpreis</th>
69+
<th colspan="2">Multiplikator</th>
70+
<th>Summe</th>
71+
</tr>
72+
</thead>
73+
<tbody>
74+
<tr>
75+
<td><label for="vorbereiten-in">3D-Druck bewerten und für den Druck vorbereiten</label></td>
76+
<td>15.00</td>
77+
<td class="unit" aria-label="Euro">€</td>
78+
<td><input type="number" id="vorbereiten-in" value="0" min="0" max="1" step="1"/></td>
79+
<td class="unit"></td>
80+
<td><output id="vorbereiten-out">?</output> €</td>
81+
</tr>
82+
<tr>
83+
<td><label for="konvertieren-in">Aus anderem Dateiformat konvertieren</label></td>
84+
<td>5.00</td>
85+
<td class="unit" aria-label="Euro">€</td>
86+
<td><input type="number" id="konvertieren-in" value="0" min="0" max="1" step="1"/></td>
87+
<td class="unit"></td>
88+
<td><output id="konvertieren-out">?</output> €</td>
89+
</tr>
90+
<tr>
91+
<td><label for="anpassen-in">Druck für Druckbarkeit anpassen (modifizieren, zerschneiden etc.)</label></td>
92+
<td>20.00</td>
93+
<td class="unit" aria-label="Euro pro Stunde">€/h</td>
94+
<td><input type="number" id="anpassen-in" value="0.0" min="0" step="0.1"/></td>
95+
<td class="unit" aria-label="Stunden">h</td>
96+
<td><output id="anpassen-out">?</output> €</td>
97+
</tr>
98+
<tr>
99+
<td><label for="tests-in">Testdrucke zur Machbarkeit bzw. Maßgenauigkeit</label></td>
100+
<td>20.00</td>
101+
<td class="unit" aria-label="Euro pro Stunde">€/h</td>
102+
<td><input type="number" id="tests-in" value="0.0" min="0" step="0.1"/></td>
103+
<td class="unit" aria-label="Stunden">h</td>
104+
<td><output id="tests-out">?</output> €</td>
105+
</tr>
106+
<tr>
107+
<td><label for="abschreibung-in">Abschreibung Drucker</label></td>
108+
<td><output id="abschreibung-preis">1.50</output></td>
109+
<td class="unit" aria-label="Euro pro Meter Filament">€/m</td>
110+
<td colspan="2" rowspan="2">siehe Materialkosten</td>
111+
<td><output id="abschreibung-out">?</output> €</td>
112+
</tr>
113+
<tr>
114+
<td>Anteilige Wartungskosten (Düsen reinigen, Reperaturen, Ersatzteile)</td>
115+
<td><output id="wartung-preis">2.00</output></td>
116+
<td class="unit" aria-label="Euro pro Meter Filament">€/m</td>
117+
<td><output id="wartung-out">?</output> €</td>
118+
</tr>
119+
<tr>
120+
<td><label for="rabatt-in">Rabatt</label></td>
121+
<td colspan="4">
122+
<select id="rabatt-in">
123+
<option selected value="0">keiner (kommerziell)</option>
124+
<option value="0.25">Privatpersonen (-25 %)</option>
125+
<option value="0.5">Sozialrabatt (-50 %)</option>
126+
<option value="0.75">eigenständig arbeitende Mitglieder (-75 %)</option>
127+
</select>
128+
</td>
129+
<td><output id="rabatt-out">?</output> €</td>
130+
</tr>
131+
<tr>
132+
<td colspan="5">Zwischensumme ohne Material</td>
133+
<td class="total"><output id="zws-ohne-mat">?</output> €</td>
134+
</tr>
135+
<tr>
136+
<td>
137+
<label for="material-factor">Material</label>
138+
<select id="material-factor">
139+
<option value="6.3794">2.85er Filament</option>
140+
<option value="2.4053">1.75er Filament</option>
141+
</select>
142+
</td>
143+
<td><output id="material-preis"></output></td>
144+
<td class="unit" aria-label="Euro pro Meter">€/m</td>
145+
<td><input type="number" id="material-in" value="1.0" min="0.1" step="0.1"/></td>
146+
<td class="unit" aria-label="Meter">m</td>
147+
<td><output id="material-out">?</output> €</td>
148+
</tr>
149+
<tr>
150+
<td><label for="risiko-in">Risikozuschlag</label></td>
151+
<td colspan="2"></td>
152+
<td><input type="number" id="risiko-in" value="0" min="0" step="1"/></td>
153+
<td class="unit">%</td>
154+
<td><output id="risiko-out">?</output> €</td>
155+
</tr>
156+
<tr>
157+
<td colspan="5">Preis</td>
158+
<td><div class="grandtotal"><output id="total-out">?</output> €</div></td>
159+
</tr>
160+
</tbody>
161+
</table>
162+
<script>
163+
function setOutput(outputId, value) {
164+
const output = document.getElementById(outputId);
165+
166+
if (isNaN(value)) {
167+
output.innerText = "?";
168+
return value;
169+
} else {
170+
output.innerText = value.toFixed(2);
171+
return value;
172+
}
173+
}
174+
175+
function calculate(inputId, factor, outputId) {
176+
const inputValue = parseFloat(document.getElementById(inputId).value);
177+
return setOutput(
178+
outputId,
179+
Math.round(inputValue * factor * 100) / 100);
180+
}
181+
182+
/// Computes and updates all reactive fields.
183+
function updateTotals() {
184+
const baseCrosssection = 6.3794;
185+
const filamentCrosssection = parseFloat(document.getElementById("material-factor").value);
186+
187+
const abschreibung = 1.5/baseCrosssection * filamentCrosssection;
188+
setOutput("abschreibung-preis", abschreibung);
189+
const wartung = 2/baseCrosssection * filamentCrosssection;
190+
setOutput("wartung-preis", wartung);
191+
192+
let total = (
193+
calculate("vorbereiten-in", 15, "vorbereiten-out")
194+
+ calculate("konvertieren-in", 5, "konvertieren-out")
195+
+ calculate("anpassen-in", 20, "anpassen-out")
196+
+ calculate("tests-in", 20, "tests-out")
197+
+ calculate("material-in", abschreibung, "abschreibung-out")
198+
+ calculate("material-in", wartung, "wartung-out")
199+
);
200+
201+
const rabatt = Math.round(total * parseFloat(document.getElementById("rabatt-in").value) * 100) / 100;
202+
setOutput("rabatt-out", -rabatt);
203+
total -= rabatt;
204+
setOutput("zws-ohne-mat", total);
205+
206+
const materialFactor = filamentCrosssection * 0.4/baseCrosssection;
207+
setOutput("material-preis", materialFactor);
208+
total += calculate("material-in", materialFactor, "material-out");
209+
210+
const risiko = Math.round(total * parseFloat(document.getElementById("risiko-in").value)) / 100;
211+
setOutput("risiko-out", risiko);
212+
total += risiko;
213+
214+
setOutput("total-out", total);
215+
}
216+
217+
// Initialize reactivity.
218+
document.querySelectorAll("input, select").forEach(elem => elem.addEventListener("input", updateTotals));
219+
// Initialize totals from currently selected/inputted values.
220+
updateTotals();
221+
</script>
222+
</body>
223+
</html>

0 commit comments

Comments
 (0)