3D Forge | Upload & Sell 3D Models (GLTF/GLB/STL/BLEND)

Premium 3D Assets

List Your 3D Model (Drag & Drop)

Drop image here or click to select

No file chosen

Drop .gltf, .glb, .stl or .blend file here

No file chosen

Files are stored in your browser (IndexedDB). After checkout you will download the original file.

Your Cart

`; return; } container.innerHTML = allProducts.map(product => `
${product.name}
Your listing
${escapeHtml(product.name)}
$${product.price.toFixed(2)}
${escapeHtml(product.description || 'No description provided.')}
`).join(''); document.querySelectorAll('.add-to-cart-btn').forEach(btn => { btn.addEventListener('click', () => { const id = btn.dataset.id; const name = btn.dataset.name; const price = parseFloat(btn.dataset.price); const thumb = btn.dataset.thumb; addToCart(id, name, price, thumb); }); }); document.querySelectorAll('.preview-3d-btn').forEach(btn => { btn.addEventListener('click', async () => { const productId = btn.dataset.id; const product = allProducts.find(p => p.id == productId); if (product) await open3DPreview(product); }); }); document.querySelectorAll('.delete-product-btn').forEach(btn => { btn.addEventListener('click', async () => { const productId = btn.dataset.id; await deleteUserProduct(productId); }); }); } async function deleteUserProduct(productId) { const product = userProducts.find(p => p.id == productId); if (product) { if (product.thumbnailFileId) await deleteFile('thumbnailImages', product.thumbnailFileId); if (product.modelFileId) await deleteFile('modelFiles', product.modelFileId); } userProducts = userProducts.filter(p => p.id != productId); cartItems = cartItems.filter(item => item.id != productId); saveUserProducts(); saveCart(); refreshAllProducts(); showToast("Model removed successfully"); } // ---- CART FUNCTIONS (unchanged logic, plus download of any 3D file format) ---- function addToCart(id, name, price, thumbnail) { const existing = cartItems.find(item => item.id == id); if(existing) { existing.quantity += 1; } else { cartItems.push({ id, name, price, quantity: 1, thumbnail: thumbnail || 'https://picsum.photos/id/26/50/50' }); } saveCart(); showToast(`Added ${name} to cart!`); } function downloadReceipt(cartItems, total) { const date = new Date().toLocaleString(); let receiptContent = `3D Forge - Order Receipt\n`; receiptContent += `Date: ${date}\n`; receiptContent += `-----------------------------------\n`; cartItems.forEach(item => { const itemTotal = item.price * item.quantity; receiptContent += `${item.name} x ${item.quantity} = $${itemTotal.toFixed(2)}\n`; }); receiptContent += `-----------------------------------\n`; receiptContent += `TOTAL: $${total.toFixed(2)}\n`; receiptContent += `Thank you for your purchase!\n`; const blob = new Blob([receiptContent], { type: 'text/plain' }); const link = document.createElement('a'); const url = URL.createObjectURL(blob); link.href = url; link.download = `order_receipt_${Date.now()}.txt`; document.body.appendChild(link); link.click(); document.body.removeChild(link); URL.revokeObjectURL(url); } // Fixed download function that works for any file type async function downloadModelFile(productId, suggestedName) { try { const fileEntry = await getFile('modelFiles', productId); if (!fileEntry || !fileEntry.data) { console.error(`No file data for ID ${productId}`); return false; } // Convert dataURL to blob const blob = dataURLToBlob(fileEntry.data); const link = document.createElement('a'); const url = URL.createObjectURL(blob); link.href = url; // Use original filename if available, otherwise generate from product name const downloadName = fileEntry.name || `${suggestedName.replace(/[^a-z0-9]/gi, '_')}.model`; link.download = downloadName; document.body.appendChild(link); link.click(); document.body.removeChild(link); URL.revokeObjectURL(url); console.log(`Downloaded ${downloadName}`); return true; } catch (err) { console.error("Download error:", err); return false; } } function updateCartUI() { const cartContainer = document.getElementById("cart-container"); if(!cartContainer) return; if(cartItems.length === 0) { cartContainer.innerHTML = `

Your cart is empty. Explore awesome 3D models!

`; return; } let total = 0; const cartHtml = cartItems.map((item, idx) => { const itemTotal = item.price * item.quantity; total += itemTotal; return `
%24%7Bitem

${escapeHtml(item.name)}

$${item.price.toFixed(2)} each
${item.quantity}
$${itemTotal.toFixed(2)}

Save to list

Scroll to Top