# Babylon to .STL file for 3D printing

**URL:** <https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534>\
**Category:** Questions\
**Created:** [February 21, 2019, 4:31pm UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534 "2019-02-21T16:31:45Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![gamedev44](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@gamedev44](https://forum.babylonjs.com/u/gamedev44)\
**Post date:** [February 21, 2019, 4:31pm UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534/1 "2019-02-21T16:31:45Z")

</div>

Hello,  
Is there a way to export a scene from Babylon to .stl?

AstroPrint has an API to print directly from javascript, so it would be nice to connect the dots and allow user to print their creations from babylon:  
[https://astroprint.github.io/3d-print-api-sample/](https://astroprint.github.io/3d-print-api-sample/)

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [February 21, 2019, 4:41pm UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534/2 "2019-02-21T16:41:56Z")

</div>

We do not yet but that is something I would love to get if someone wants to try  
We do have OBJ and glTF exporters already

---

<div class="post-metadata">

**Author:** ![gamedev44](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@gamedev44](https://forum.babylonjs.com/u/gamedev44)\
**Post date:** [February 21, 2019, 4:53pm UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534/3 "2019-02-21T16:53:36Z")

</div>

Hopefully someone will, thanks

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [February 21, 2019, 6:27pm UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534/4 "2019-02-21T18:27:03Z")

</div>

I wrote up an ASCII STL exporter… one second.

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [February 21, 2019, 6:30pm UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534/5 "2019-02-21T18:30:13Z")

</div>

cause I \<3 you:

[https://playground.babylonjs.com/#L97Q67#2](https://playground.babylonjs.com/#L97Q67#2)

this has been tested with 3d prints as well, and worked flawlessly. Let me know if you run into any issues.

---

<div class="post-metadata">

**Author:** ![gamedev44](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@gamedev44](https://forum.babylonjs.com/u/gamedev44)\
**Post date:** [February 21, 2019, 6:57pm UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534/6 "2019-02-21T18:57:50Z")

</div>

Great!

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [February 21, 2019, 7:10pm UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534/7 "2019-02-21T19:10:51Z")

</div>

@Deltakosh

Should we add this to the exporters?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [February 21, 2019, 7:15pm UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534/8 "2019-02-21T19:15:40Z")

</div>

man! yes!

> **[BabylonJS/Babylon.js](https://github.com/BabylonJS/Babylon.js/tree/master/serializers/src)**
>
> Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework. - BabylonJS/Babylon.js

(and a good exercice for your TS practicing 😉 )

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [February 21, 2019, 7:19pm UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534/9 "2019-02-21T19:19:19Z")

</div>

haha ok 🙂 actually great point! I just installed TS on my rig last night globally and was thinking about doing my first script, this might actually be a good opportunity you are right.

Ill start on it after I get done with work today.

---

<div class="post-metadata">

**Author:** ![gamedev44](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@gamedev44](https://forum.babylonjs.com/u/gamedev44)\
**Post date:** [February 21, 2019, 7:25pm UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534/10 "2019-02-21T19:25:24Z")

</div>

Also wondering if there is a way that the file exported file could live in cache so that it could be a one step process to print through the astroprint api, rather than download a file and then navigating to it…or needing to manage file write on a server.

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [February 21, 2019, 7:27pm UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534/11 "2019-02-21T19:27:03Z")

</div>

Just pass it as a buffer?

var blob = new Blob([content], {‘type’:contentType});

that should be all the binaryBuffer data your print process should need. I would have to look at the astroprint api though.

---

<div class="post-metadata">

**Author:** ![gamedev44](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@gamedev44](https://forum.babylonjs.com/u/gamedev44)\
**Post date:** [February 21, 2019, 7:27pm UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534/12 "2019-02-21T19:27:17Z")

</div>

Sounds good

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [February 26, 2019, 5:47am UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534/13 "2019-02-26T05:47:20Z")

</div>

I just added binary support and put a PR up tonight.

I tested it out and it worked well, figured it will get merged tomorrow!

@gamedev44 Thought that might interest you as well, if you are trying to pass it as a binary buffer to your printer.

Ill write up some docs on its usage tomorrow. If you need arguments like scaling or world up vector let me know.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [February 26, 2019, 3:21pm UTC](https://forum.babylonjs.com/t/babylon-to-stl-file-for-3d-printing/1534/14 "2019-02-26T15:21:39Z")

</div>

I just have one concern regarding indentation and then I merge and publish 🙂
