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!
R23D
Posts: 65
Joined: Sat Jan 25, 2020 5:23 am

Exporting Multiple Meshes to one STL...

Postby R23D » Thu Nov 19, 2020 3:42 pm

Whenever I export multiple meshes to a single STL file they combine into a single mesh body which is unacceptable for my purposes in general and doubly so since they are touching. :? Is this a limitation of the STL file format or a limitation of Freecad? Is there a way to do this such that the result is an STL file containing multiple independent mesh objects?

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22846 (Git)
Build type: Release
Branch: master
Hash: 1f46b72491a0008384a6db4f2615a656249f6f08
Python version: 3.8.6
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/Australia (en_AU)
zardozer
Posts: 24
Joined: Sat Nov 07, 2020 2:35 am

Re: Exporting Multiple Meshes to one STL...

Postby zardozer » Thu Nov 19, 2020 5:18 pm

You can create the meshes before exporting. It's usually better to do this anyway, since you can check the analyze the mesh for problems and fix them before exporting.

Go to the mesh design workbench. Make sure your bodies are positioned where you want them, select them and click on 'tessallate shape'. Make sure those settings are where you want them. After the meshes are created, you can analyze them (Meshes->Analyze->evaluate and repair) or select both of the meshes and export to one stl. Your stl should have them positioned where you left them.
R23D
Posts: 65
Joined: Sat Jan 25, 2020 5:23 am

Re: Exporting Multiple Meshes to one STL...

Postby R23D » Thu Nov 19, 2020 5:56 pm

Yes, I already do this. :D However, when you select multiple meshes you have created this way and export them to a single file they magically combine into one single mesh in that file regardless of the fact that they were separate meshes beforehand.
chrisb
Posts: 30663
Joined: Tue Mar 17, 2015 9:14 am

Re: Exporting Multiple Meshes to one STL...

Postby chrisb » Thu Nov 19, 2020 11:13 pm

The binary STL format used by FreeCAD is just a set of triangles. 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 the file format doesn't support separate solids, there is nothing FreeCAD can do about it.
You need at least FreeCAD 0.19.23300 to edit my current sketches.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Roy_043
Posts: 2359
Joined: Thu Dec 27, 2018 12:28 pm

Re: Exporting Multiple Meshes to one STL...

Postby Roy_043 » Fri Nov 20, 2020 7:29 am

chrisb wrote:
Thu Nov 19, 2020 11:13 pm
separate objects
In FreeCAD you can use Mesh_RemoveCompByHand (after creating copies of the original mesh first) or Arch_SplitMesh.
chrisb
Posts: 30663
Joined: Tue Mar 17, 2015 9:14 am

Re: Exporting Multiple Meshes to one STL...

Postby chrisb » Fri Nov 20, 2020 7:49 am

Roy_043 wrote:
Fri Nov 20, 2020 7:29 am
In FreeCAD you can use Mesh_RemoveCompByHand (after creating copies of the original mesh first) or Arch_SplitMesh.
So with my previous post we can derive that FreeCAD is a clever program :D
You need at least FreeCAD 0.19.23300 to edit my current sketches.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
jeno
Posts: 868
Joined: Sun Jun 29, 2014 10:41 am

Re: Exporting Multiple Meshes to one STL...

Postby jeno » Fri Nov 20, 2020 8:18 am

chrisb wrote:
Thu Nov 19, 2020 11:13 pm
...
As the file format doesn't support separate solids, there is nothing FreeCAD can do about it.
This is only partially true. STL-Ascii can describe multiple solids, STL-Binary not. But most programms ignore this. It works like this

Code: Select all

solid A
Description of vertices and facets
endsolid A
solid B
Description of vertices and facets
endsolid B
Kind regards
chrisb
Posts: 30663
Joined: Tue Mar 17, 2015 9:14 am

Re: Exporting Multiple Meshes to one STL...

Postby chrisb » Fri Nov 20, 2020 9:43 am

jeno wrote:
Fri Nov 20, 2020 8:18 am
chrisb wrote:
Thu Nov 19, 2020 11:13 pm
...
As the file format doesn't support separate solids, there is nothing FreeCAD can do about it.
This is only partially true.
You quoted only partially. As mentioned in my post, FreeCAD uses the binary format; so ASCII-stl would be a new export format.
You need at least FreeCAD 0.19.23300 to edit my current sketches.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
R23D
Posts: 65
Joined: Sat Jan 25, 2020 5:23 am

Re: Exporting Multiple Meshes to one STL...

Postby R23D » Fri Nov 20, 2020 10:36 am

Ok. I've never used multiple meshes in a single file before (this is my first attempt to do so) so, I wasn't aware that it could only be done with an ASCII STL file. All I knew was that a bunch of online posts were saying STLs could contain multiple separate models and that I couldn't seem to achieve it. The program I wish to open them in is reads ASCII STL files just fine (so, I'm told). So, the new question becomes then, 'Can Freecad export multiple meshes in ASCII STL format?' Or in some other not too rare format that allows this? It would be VERY useful to me and simplify my life greatly to be able to put multiple meshes into one ASCII STL... :D
User avatar
Roy_043
Posts: 2359
Joined: Thu Dec 27, 2018 12:28 pm

Re: Exporting Multiple Meshes to one STL...

Postby Roy_043 » Fri Nov 20, 2020 10:54 am

chrisb wrote:
Fri Nov 20, 2020 9:43 am
FreeCAD uses the binary format; so ASCII-stl would be a new export format.
This is not correct. It the depends on the extension the user provides. If the extension is AST the file will be an ASCII STL.