4
$\begingroup$

I have a collection of STL files, each containing a separate moving part of an object I want to print. (Imagine a set of gears, or similar, that prints as a single object with multiple moving parts.)

My plan was to import them all into Cura, then hit print, then take my fully assembled object off the build plate. However, Cura ignores the coordinate system in the STL files and automatically separates the components from each other on the build plate. This is usually helpful, but it isn't what I want in this case.

So I'm looking for a quick and simple way to combine my multiple STL files into a single STL file. I know that the objects don't overlap, so I don't need to do a CSG union operation - it's enough just to concatenate the objects.

I tried OpenSCAD, which works, but it takes a really long time, because the meshes are fairly complex and it does the full Boolean operation. Is there another quick and simple way to perform this task?

I'd prefer a command line utility, but I'd also be happy if there's a quick and simple way to do it in some free graphical software. (However, I don't want to spend time manually positioning the objects - they're already in the right places in the STL files, so I just want to import them and go.)

Edit I've accepted Trish's answer (use Blender), but I'd still appreciate a command-line option if anyone knows one.

$\endgroup$
  • $\begingroup$ How would you expect the 3D printer to print the parts movable and at their position at the same time? If they are not placed on the build platform there will be a lot of support needed. $\endgroup$ – Klaus D. Oct 13 '19 at 17:45
  • $\begingroup$ @KlausD. they are all in contact with the build platform and none of them have overhangs that would need support. However, they nevertheless interlock with each other in 3D space in such a way that they can't be separated. $\endgroup$ – Nathaniel Oct 13 '19 at 17:46
  • $\begingroup$ (If that sounds impossible, imagine that one object is an hourglass and the other is a torus that surrounds it, with only a small gap between the inner surface of the torus and the neck of the egg timer. Both contact the build plate and no overhang is more than 45 degrees, but the hourglass can't be removed from the torus.) $\endgroup$ – Nathaniel Oct 13 '19 at 17:50
  • $\begingroup$ @Pᴀᴜʟsᴛᴇʀ2 exactly that. But with the important provision that I know the parts don't overlap, so a Boolean union operation isn't needed. $\endgroup$ – Nathaniel Oct 13 '19 at 18:25
  • $\begingroup$ It is funny you ask about this ... Koenigsegg has to 3d print the turbochargers for his ultra-supercars called "One:1". Can it be done, yes. I'd bet it lends back to how it's designed more so than how the print is setup after design. $\endgroup$ – Pᴀᴜʟsᴛᴇʀ2 Oct 13 '19 at 18:30
3
$\begingroup$

What you try to do is called "Print in Place". However, it is not done by importing several STLs one after another as cura does remove the origin and recenters each imported object upon importing. However, an STL file can contain more than one body.

To generate a PiP model, you need to export your whole project as one STL file containing all the parts and then Cura not only doesn't rip the model apart, it can't do so.

Workaround

If you can't export the whole project in one piece from your design software, you could use a workaround by importing it into a software that can export as one item. Among these is blender, so importing all the parts into blender and then exporting the whole project as one STL is a simple fix. Other options would be TinkerCAD or Fusion360.

The Step by step guide for blender is simple and the general idea of this workflow is the same for other options:

  1. Open blender
  2. New project
  3. delete the cube via entf + enter
  4. Get the files into the workspace via either:
    • Drag & Drop
      1. File > Import > Stl (.stl)
      2. select the file + enter
  5. Possibly reposition the object, till it is in the right position
  6. Repeat 4. to 6. till all parts are imported
  7. File > Export > Stl (.stl) + enter
| improve this answer | |
$\endgroup$
  • $\begingroup$ My issue is that the program I'm using to create the objects is not able to export them as a single file, but only as separate ones. They do indeed need to be in one single STL file, but the question is about how to do that, given that the program will always output them in separate files. $\endgroup$ – Nathaniel Oct 13 '19 at 19:16
  • $\begingroup$ Which program? Fusion360 can export a whole project. $\endgroup$ – Trish Oct 13 '19 at 19:17
  • $\begingroup$ I wrote the program myself. The C++ library I used does not have the functionality to put more than one object in an STL file. $\endgroup$ – Nathaniel Oct 13 '19 at 19:18
  • $\begingroup$ @Nathaniel then you might want to combine via blender by just importing all before exporting. $\endgroup$ – Trish Oct 13 '19 at 19:20
  • $\begingroup$ Thanks for the edit. (+1) I'm not a blender user, and it is quite a complicated program - if you have time, step-by-step instructions would be super helpful. $\endgroup$ – Nathaniel Oct 13 '19 at 19:20
5
$\begingroup$

The operation you want is almost just cat'ing the files together. However you need to remove the 80 byte header from all but the first, and add up the 32-bit triangle count from each file immediately after that. Output should be:

  1. Copy of first 80 bytes of file 1
  2. Sum of int32 from offset 80 of each file.
  3. Bytes 84-end from each file.

See https://en.m.wikipedia.org/wiki/STL_(file_format)

| improve this answer | |
$\endgroup$
2
$\begingroup$

Similarly to @R..'s answer, you can easily concatenate the contents of each file if you have ASCII .stls.

  1. Make sure the .stls are in ASCII format: Open them in any text editor (like Notepad++). If it's readable, you're fine, proceed to (3)
  2. If not readable, convert them to ASCII .stl format using a converter tool (like this)
  3. Open each ASCII .stl file
  4. Copy together the contents of the files, except for the "solid" and "endsolid" statements where the files meet
| improve this answer | |
$\endgroup$
  • $\begingroup$ They're binary unfortunately. I'd have written a Python script to concatenate them otherwise. Sorry to be awkward! $\endgroup$ – Nathaniel Oct 14 '19 at 7:39
1
$\begingroup$

Import them to Tinkercad and then output your combined file from there. You can go into Tinkercad and on the top right side you will see "import", click that to import your file (you can repeat the process as desired) and it will put the files on the workspace .. on the screen. When you have your workspace all set the way you want select them all the click "export" and it will export all of them to one file for your use.

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Hi Nate and welcome to 3D Printing.SE! Please expand the answer how one would do that, this is too short for an answer. $\endgroup$ – 0scar Dec 24 '19 at 8:18
  • 1
    $\begingroup$ My response has been edited per your request. $\endgroup$ – Nate E. Jan 14 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.