Spaces:
Running
Running
Add 3 files
Browse files- README.md +7 -5
- index.html +209 -18
- prompts.txt +1 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: test1
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: yellow
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,210 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Laser Cut Box Designer</title>
|
| 7 |
+
<style>
|
| 8 |
+
body { font-family: sans-serif; margin: 20px; }
|
| 9 |
+
.controls { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; max-width: 600px; margin-bottom: 20px; }
|
| 10 |
+
.controls label { display: block; margin-bottom: 5px; }
|
| 11 |
+
.controls input { width: 100%; padding: 8px; box-sizing: border-box; }
|
| 12 |
+
#preview-container { border: 1px solid #ccc; width: 100%; max-width: 800px; height: 500px; margin-top: 20px; overflow: auto; }
|
| 13 |
+
#preview-svg { width: 100%; height: 100%; }
|
| 14 |
+
button { padding: 10px 15px; margin-right: 10px; cursor: pointer; }
|
| 15 |
+
</style>
|
| 16 |
+
</head>
|
| 17 |
+
<body>
|
| 18 |
+
<h1>Laser Cut Box Designer</h1>
|
| 19 |
+
|
| 20 |
+
<div class="controls">
|
| 21 |
+
<div>
|
| 22 |
+
<label for="width">Width (in):</label>
|
| 23 |
+
<input type="number" id="width" value="4" step="0.1">
|
| 24 |
+
</div>
|
| 25 |
+
<div>
|
| 26 |
+
<label for="depth">Depth (in):</label>
|
| 27 |
+
<input type="number" id="depth" value="3" step="0.1">
|
| 28 |
+
</div>
|
| 29 |
+
<div>
|
| 30 |
+
<label for="height">Height (in):</label>
|
| 31 |
+
<input type="number" id="height" value="2" step="0.1">
|
| 32 |
+
</div>
|
| 33 |
+
<div>
|
| 34 |
+
<label for="materialThickness">Material Thickness (in):</label>
|
| 35 |
+
<input type="number" id="materialThickness" value="0.125" step="0.001">
|
| 36 |
+
</div>
|
| 37 |
+
<div>
|
| 38 |
+
<label for="kerf">Kerf (in, optional):</label>
|
| 39 |
+
<input type="number" id="kerf" value="0.005" step="0.001">
|
| 40 |
+
</div>
|
| 41 |
+
<div>
|
| 42 |
+
<label for="boxType">Box Type:</label>
|
| 43 |
+
<input type="radio" id="closedBox" name="boxType" value="closed" checked> <label for="closedBox">Closed Box</label><br>
|
| 44 |
+
<input type="radio" id="openBox" name="boxType" value="open"> <label for="openBox">Open Box</label>
|
| 45 |
+
</div>
|
| 46 |
+
<h3>Face Spacing (0 for standard wall, >0 for gap/offset)</h3>
|
| 47 |
+
<div>
|
| 48 |
+
<label for="spacingTop">Top Face Spacing (in):</label>
|
| 49 |
+
<input type="number" id="spacingTop" value="0" step="0.1">
|
| 50 |
+
</div>
|
| 51 |
+
<div>
|
| 52 |
+
<label for="spacingBottom">Bottom Face Spacing (in):</label>
|
| 53 |
+
<input type="number" id="spacingBottom" value="0" step="0.1">
|
| 54 |
+
</div>
|
| 55 |
+
<div>
|
| 56 |
+
<label for="spacingFront">Front Face Spacing (in):</label>
|
| 57 |
+
<input type="number" id="spacingFront" value="0" step="0.1">
|
| 58 |
+
</div>
|
| 59 |
+
<div>
|
| 60 |
+
<label for="spacingBack">Back Face Spacing (in):</label>
|
| 61 |
+
<input type="number" id="spacingBack" value="0" step="0.1">
|
| 62 |
+
</div>
|
| 63 |
+
<div>
|
| 64 |
+
<label for="spacingLeft">Left Face Spacing (in):</label>
|
| 65 |
+
<input type="number" id="spacingLeft" value="0" step="0.1">
|
| 66 |
+
</div>
|
| 67 |
+
<div>
|
| 68 |
+
<label for="spacingRight">Right Face Spacing (in):</label>
|
| 69 |
+
<input type="number" id="spacingRight" value="0" step="0.1">
|
| 70 |
+
</div>
|
| 71 |
+
</div>
|
| 72 |
+
|
| 73 |
+
<button id="calculateBtn">Calculate & Preview Design</button>
|
| 74 |
+
<button id="exportSvgBtn">Export as SVG</button>
|
| 75 |
+
<button id="exportPdfBtn">Export as PDF</button>
|
| 76 |
+
|
| 77 |
+
<h2>Design Preview:</h2>
|
| 78 |
+
<div id="preview-container">
|
| 79 |
+
<svg id="preview-svg" viewBox="0 0 800 500"></svg>
|
| 80 |
+
</div>
|
| 81 |
+
|
| 82 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
| 83 |
+
<script>
|
| 84 |
+
// Placeholder for box generation logic (this is the complex part)
|
| 85 |
+
function generateBoxSVG(width, depth, height, materialThickness, kerf, boxType, spacing) {
|
| 86 |
+
let svgContent = '';
|
| 87 |
+
const fingerLength = materialThickness * 2; // Example finger length
|
| 88 |
+
const numFingers = 5; // Example number of fingers (you'd calculate this dynamically)
|
| 89 |
+
|
| 90 |
+
// For simplicity, let's just draw rectangles representing the faces
|
| 91 |
+
// In a real application, you'd calculate precise finger joint paths
|
| 92 |
+
|
| 93 |
+
// Front face (example)
|
| 94 |
+
svgContent += `<rect x="0" y="0" width="${width}" height="${height}" fill="lightblue" stroke="black" stroke-width="0.01"/>`;
|
| 95 |
+
// Add finger joints here based on calculations
|
| 96 |
+
|
| 97 |
+
// Top face (example - adjusted for spacing if applicable)
|
| 98 |
+
let topY = height + 1; // Some spacing for layout
|
| 99 |
+
if (boxType === 'closed' || spacing.top === 0) {
|
| 100 |
+
// For a closed box, draw the top. If spacingTop is 0, draw it.
|
| 101 |
+
svgContent += `<rect x="0" y="${topY}" width="${width}" height="${depth}" fill="lightgreen" stroke="black" stroke-width="0.01"/>`;
|
| 102 |
+
} else if (spacing.top > 0) {
|
| 103 |
+
// If there's spacing, you might draw a visual indicator or just omit the piece
|
| 104 |
+
// For this example, we'll just omit it if spacing is greater than 0 for "open"
|
| 105 |
+
// In a real design, spacing might affect how joints are cut or if a face is present.
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
// ... repeat for other faces (back, left, right, bottom)
|
| 110 |
+
// The "spacing" input would modify *how* each face is drawn or if it's drawn at all.
|
| 111 |
+
// For example, if spacingTop is > 0 and it's an "open" box, you might completely omit the top face.
|
| 112 |
+
// If it's a closed box and spacingTop is > 0, it means there's a gap between the top and the walls.
|
| 113 |
+
// This is the most complex part of the user's request and requires careful geometric calculation for each joint.
|
| 114 |
+
|
| 115 |
+
return svgContent;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
function calculateAndPreview() {
|
| 119 |
+
const width = parseFloat(document.getElementById('width').value);
|
| 120 |
+
const depth = parseFloat(document.getElementById('depth').value);
|
| 121 |
+
const height = parseFloat(document.getElementById('height').value);
|
| 122 |
+
const materialThickness = parseFloat(document.getElementById('materialThickness').value);
|
| 123 |
+
const kerf = parseFloat(document.getElementById('kerf').value);
|
| 124 |
+
const boxType = document.querySelector('input[name="boxType"]:checked').value;
|
| 125 |
+
const spacing = {
|
| 126 |
+
top: parseFloat(document.getElementById('spacingTop').value),
|
| 127 |
+
bottom: parseFloat(document.getElementById('spacingBottom').value),
|
| 128 |
+
front: parseFloat(document.getElementById('spacingFront').value),
|
| 129 |
+
back: parseFloat(document.getElementById('spacingBack').value),
|
| 130 |
+
left: parseFloat(document.getElementById('spacingLeft').value),
|
| 131 |
+
right: parseFloat(document.getElementById('spacingRight').value),
|
| 132 |
+
};
|
| 133 |
+
|
| 134 |
+
if (isNaN(width) || isNaN(depth) || isNaN(height) || isNaN(materialThickness) || isNaN(kerf)) {
|
| 135 |
+
alert("Please enter valid numeric dimensions.");
|
| 136 |
+
return;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
const svgElement = document.getElementById('preview-svg');
|
| 140 |
+
// Clear previous design
|
| 141 |
+
svgElement.innerHTML = '';
|
| 142 |
+
|
| 143 |
+
const generatedSVG = generateBoxSVG(width, depth, height, materialThickness, kerf, boxType, spacing);
|
| 144 |
+
svgElement.innerHTML = generatedSVG; // This is a simplified example
|
| 145 |
+
|
| 146 |
+
// For a real application, you'd use a dedicated SVG library
|
| 147 |
+
// For example, with Maker.js:
|
| 148 |
+
/*
|
| 149 |
+
const makerjs = require('makerjs'); // if using Node.js or a bundler
|
| 150 |
+
// Or if directly in browser: makerjs.models.something...
|
| 151 |
+
const boxModel = new makerjs.models.Bolt(width, depth, height, materialThickness); // (example)
|
| 152 |
+
const svgOutput = makerjs.exporter.toSVG(boxModel);
|
| 153 |
+
svgElement.innerHTML = svgOutput;
|
| 154 |
+
*/
|
| 155 |
+
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
function exportSVG() {
|
| 159 |
+
const svgElement = document.getElementById('preview-svg');
|
| 160 |
+
const svgData = new XMLSerializer().serializeToString(svgElement);
|
| 161 |
+
const blob = new Blob([svgData], { type: 'image/svg+xml' });
|
| 162 |
+
const url = URL.createObjectURL(blob);
|
| 163 |
+
const a = document.createElement('a');
|
| 164 |
+
a.href = url;
|
| 165 |
+
a.download = 'laser_cut_box.svg';
|
| 166 |
+
document.body.appendChild(a);
|
| 167 |
+
a.click();
|
| 168 |
+
document.body.removeChild(a);
|
| 169 |
+
URL.revokeObjectURL(url);
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
function exportPDF() {
|
| 173 |
+
const width = parseFloat(document.getElementById('width').value);
|
| 174 |
+
const depth = parseFloat(document.getElementById('depth').value);
|
| 175 |
+
const height = parseFloat(document.getElementById('height').value);
|
| 176 |
+
|
| 177 |
+
const { jsPDF } = window.jspdf;
|
| 178 |
+
const doc = new jsPDF();
|
| 179 |
+
|
| 180 |
+
// Example: Add text and a simple rectangle to the PDF
|
| 181 |
+
doc.text("Laser Cut Box Design", 10, 10);
|
| 182 |
+
doc.text(`Dimensions: ${width}x${depth}x${height} inches`, 10, 20);
|
| 183 |
+
|
| 184 |
+
// You would draw the actual box panels on the PDF here,
|
| 185 |
+
// translating your SVG drawing logic to jsPDF commands.
|
| 186 |
+
// This is more involved than just converting the SVG element directly
|
| 187 |
+
// unless you use a library like html2pdf.js to capture the whole HTML.
|
| 188 |
+
|
| 189 |
+
// A more robust solution might involve:
|
| 190 |
+
// 1. Get the bounding box of your generated SVG content to scale it appropriately.
|
| 191 |
+
// 2. Iterate through your calculated panel shapes and draw them using jsPDF's drawing primitives (rect, line, etc.).
|
| 192 |
+
// Alternatively, if html2pdf.js is used:
|
| 193 |
+
/*
|
| 194 |
+
const element = document.getElementById('preview-container'); // Or the SVG element itself
|
| 195 |
+
html2pdf().from(element).save('laser_cut_box.pdf');
|
| 196 |
+
*/
|
| 197 |
+
|
| 198 |
+
// For this simple example, we'll just save a blank PDF with some text.
|
| 199 |
+
doc.save('laser_cut_box.pdf');
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
document.getElementById('calculateBtn').addEventListener('click', calculateAndPreview);
|
| 203 |
+
document.getElementById('exportSvgBtn').addEventListener('click', exportSVG);
|
| 204 |
+
document.getElementById('exportPdfBtn').addEventListener('click', exportPDF);
|
| 205 |
+
|
| 206 |
+
// Initial preview on load
|
| 207 |
+
calculateAndPreview();
|
| 208 |
+
</script>
|
| 209 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=MarkTheArtist/test1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 210 |
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Create a website for designing laser cut boxes. Have an option for how far each of the 6 faces are spaced apart. Do this in inches have option for open box and close box. After entering in the dimensions, have a button to calculate and then preview the design. Heavy button to export as SVG and PDF formats. Research libraries for this task.
|