| 414 | } |
| 415 | |
| 416 | function STL() { |
| 417 | let src = []; |
| 418 | src.push(`solid heightmap`); |
| 419 | for (let index of cells) { |
| 420 | src.push(`facet normal 0 0 0`); |
| 421 | src.push(` outer loop`); |
| 422 | for (let i of index) { |
| 423 | let [x, y, z] = positions[i]; |
| 424 | src.push(` vertex ${z * scale.z} ${x * scale.x} ${y * scale.y}`); |
| 425 | } |
| 426 | src.push(` endloop`); |
| 427 | src.push(`endfacet`); |
| 428 | } |
| 429 | src.push(`endsolid heightmap`); |
| 430 | return src.join('\n'); |
| 431 | } |
| 432 | |
| 433 | app.createDialog('Error').addLabel(path ? `Exported ${path}` : `Could not save ${fileName}`); |
| 434 | |