Exporting Multiple Meshes to one STL...

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
zardozer
Posts: 49
Joined: Sat Nov 07, 2020 2:35 am

Re: Exporting Multiple Meshes to one STL...

Post by zardozer »

TedM wrote: Sat Nov 21, 2020 12:55 am This is odd. I have no problems exporting multiple objects in a single STL file and Cura opens it and shows the objects spaced as I had them in FreeCAD. I've actually been doing this for quite a while. I simply select the objects and then do File->Export as an STL file.
I think OP wanted to have them recognized as separate meshes if they were to be imported into another program. As far as Cura (or any slicer for that matter) is concerned, if you have two meshes that are separate in space but from one stl, it still considers them one "object." As to WHY the OP really needs this, I have no idea. Maybe he wants two objects to be exactly X spaced apart when when imported into the slicer, but he still needs them to be recognized as two separate objects? I don't know.
jeno
Veteran
Posts: 1849
Joined: Sun Jun 29, 2014 10:41 am

Re: Exporting Multiple Meshes to one STL...

Post by jeno »

zardozer wrote: Sat Nov 21, 2020 1:25 am
TedM wrote: Sat Nov 21, 2020 12:55 am This is odd. I have no problems exporting multiple objects in a single STL file and Cura opens it and shows the objects spaced as I had them in FreeCAD. I've actually been doing this for quite a while. I simply select the objects and then do File->Export as an STL file.
I think OP wanted to have them recognized as separate meshes if they were to be imported into another program. As far as Cura (or any slicer for that matter) is concerned, if you have two meshes that are separate in space but from one stl, it still considers them one "object." As to WHY the OP really needs this, I have no idea. Maybe he wants two objects to be exactly X spaced apart when when imported into the slicer, but he still needs them to be recognized as two separate objects? I don't know.
Maybe he wants to assign different materials or colors to the meshes.
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Exporting Multiple Meshes to one STL...

Post by wmayer »

Is this a limitation of the STL file format or a limitation of Freecad?
It's a limitation of the file format.
A clever program could import such triangles and separate objects by finding all triangles that are in something I would call the "connectivity hull".
As long as the combined triangles don't form non-manifold surfaces FreeCAD is able to split the single mesh into its components. When you import an STL with several objects and go in the context-menu to "Display components" you can graphically see the different objects. At the moment there is only a way via Python to split a mesh into several components but a GUI command is missing.
This is only partially true. STL-Ascii can describe multiple solids, STL-Binary not. But most programms ignore this. It works like this
I don't know if this is officially supported. At least the article on WP does not mention it that an ASCII STL can have several objects: https://en.wikipedia.org/wiki/STL_(file_format)

The only format I know that intentionally supports several objects is OBJ.
I've just tried exporting as an AST and as a Wavefront Obj file and in both instances, Freecad combined all the meshes into one homogeneous blob...
There are two OBJ exporters. One is from the Mesh module (Alias Mesh) and the other from the Arch module (Wavefront OBJ). You must use the former.
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Exporting Multiple Meshes to one STL...

Post by wmayer »

jeno
Veteran
Posts: 1849
Joined: Sun Jun 29, 2014 10:41 am

Re: Exporting Multiple Meshes to one STL...

Post by jeno »

wmayer wrote: Sat Nov 21, 2020 10:07 am ...
This is only partially true. STL-Ascii can describe multiple solids, STL-Binary not. But most programms ignore this. It works like this
I don't know if this is officially supported. At least the article on WP does not mention it that an ASCII STL can have several objects: https://en.wikipedia.org/wiki/STL_(file_format)
...
I also did not found a really proof for this. But at least three.js and numpy-stl supports it. Also here a thread in Rhino forum. Solid Edge also seems to deal with it. See note in first paragraph.
Seems not very common but you can find examples here and there. And I have no idea what else could be the reason for these

Code: Select all

solid some_name
...
endsolid
tags in the file

Regards
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Exporting Multiple Meshes to one STL...

Post by wmayer »

Well, it's always a bit problematic to extend the capabilities of a format that isn't (or doesn't seem to be) part of the specification. You can do nice things as long as you only use SW that supports it but as soon as you use other SW that strictly implements the official specification the problems start.

It's very similar to the unofficial extensions of the binary STL where e.g. the 80 bytes long header or the two-byte pad after each triangle is used to save some additional information like colors.
R23D
Posts: 135
Joined: Sat Jan 25, 2020 5:23 am

Re: Exporting Multiple Meshes to one STL...

Post by R23D »

Maybe he wants to assign different materials or colors to the meshes.
YES! That's exactly what I want to do! Sorry for the long absence from this post.

There is a technique whereby you can use a single nozzled 3D printer to create multi coloured prints. Many people are doing it. It's brilliant and works well and I fully understand how to do it but it relies on being able to align several meshes created in a 3d CAD program in your slicer of choice. The only part of the technique that I DO NOT UNDERSTAND is how people are doing that alignment. The obvious but perhaps naïve answer seems to be to export multiple meshes in one single file which maintains their relative spacing, something I thought was going to be easy. Although this seems to be possible with Freecad (allegedly), Cura (my slicer of choice), opens these meshes fused. I do not know if that is because Freecad is fusing them on export or because Cura is fusing them on opening. I do know that it is possible to use Cura for this technique, however, as I have seen it done. So, there must be a way!

My question then becomes: What technique could I use to get multiple parts out of Freecad into Cura, maintaining the physical alignments to each other they had in Freecad?
bennn
Posts: 23
Joined: Thu Jul 21, 2016 7:15 am

Re: Exporting Multiple Meshes to one STL...

Post by bennn »

I'm 18 months late, but here's a hack : export each mesh in different files, and cat it in a terminal. That's mandatory for CFD and works perfectly for me
Post Reply