Welcome! Log In Create A New Profile

Advanced

Is there a way to break STL in individual parts' files?

Posted by realthor 
Is there a way to break STL in individual parts' files?
May 11, 2016 04:27AM
Hi guys, I am exporting from CAD a bunch of parts in a single STL. I can open that STL and ungroup/split etc but I can't seem to be able to divide the job among several files if I only want a part at a time for printing.
I'm thinking about some sort of export that has an option to "Export each object to a STL".

Does something like that exist? Slic3r or otherwise.

Thanks.


RepRap Lander concept on Concept Forge
RepRap Lander concept on RepRap Forums
My Things, mostly experimental stuff
Re: Is there a way to break STL in individual parts' files?
May 11, 2016 07:25AM
You can always import the STL into OpenScad or similar CAD software, and export STL's after you have modified by deleting the areas outside the part you are exporting each time (just perform an intersection between the imported STL and a cube positioned to encompass each of the parts in turn).

Dave
Re: Is there a way to break STL in individual parts' files?
May 11, 2016 07:29AM
That is very much work for a STL with 40-50 individual parts that are easily recognized by slicers. It's a pity such an option is not there...


RepRap Lander concept on Concept Forge
RepRap Lander concept on RepRap Forums
My Things, mostly experimental stuff
Re: Is there a way to break STL in individual parts' files?
May 11, 2016 09:33AM
Quote
realthor
...am exporting from CAD a bunch of parts in a single STL...

And why don't you export from your CAD program each part in a seperate STL file?
What CAD program are you using?


Bob Morrison
Wörth am Rhein, Germany
"Luke, use the source!"
BLOG - PHOTOS - Thingiverse
Re: Is there a way to break STL in individual parts' files?
May 11, 2016 10:13AM
I am using DesignSpark Mechanical and I have exported all parts to STLs but it is tedious task and if I work on the design and modify a few parts then I have to export them right away otherwise I forget which ones I have slightly altered. If I could just export all to a single STL and break that STL apart then I'd always have the latest individual versions in STL format.

Actually DSM has a break STL from the Save As menu but it is not well suited for my job as I have nested components and only want to save as STL the hop hierarchical ones, whereas DSM exports them all to its own STL.

I have each part made of several other sub-parts that I modify so I have to export all as a single STL then clean that up in a STL cleaner service then I'd like to have that file broken apart in individual objects. That's why a slicer is a best program to do that.

Edited 1 time(s). Last edit at 05/11/2016 10:18AM by realthor.


RepRap Lander concept on Concept Forge
RepRap Lander concept on RepRap Forums
My Things, mostly experimental stuff
Re: Is there a way to break STL in individual parts' files?
May 11, 2016 12:24PM
If they are nested, how can the slicer know which parts you want to be separated?

So long as the position of the parts does not change by much when you modify a part, you would only need to write a suitable OpenScad script once.

Dave
Re: Is there a way to break STL in individual parts' files?
May 11, 2016 01:11PM
Quote
dmould
If they are nested, how can the slicer know which parts you want to be separated?

So long as the position of the parts does not change by much when you modify a part, you would only need to write a suitable OpenScad script once.

Dave

They are nested in CAD not STL. STL is clean and parts are separate.
Probably an OpenSCAD script can do that. It would be awesome.... but I don't know openscad unfortunately.

Maybe someone knowledgeable in coding can help...


RepRap Lander concept on Concept Forge
RepRap Lander concept on RepRap Forums
My Things, mostly experimental stuff
Re: Is there a way to break STL in individual parts' files?
May 11, 2016 01:53PM
I have used Meshmixer to take parts out of a multi-part STL file, with no problems.

It is also free...
Re: Is there a way to break STL in individual parts' files?
May 11, 2016 02:08PM
It would be the same as saving each to STL from CAD. I need an automated method of doing it. DesignSpark Mechanical can do it but it looks down any nested CAD components and exports each single bit into its own STL, whereas I only need the top parents to be exported as STL. In this regard a script that reads an STL, and saves as STL each object at least 1mm apart from another mesh and saves those parts with incremental names would be awesome.


RepRap Lander concept on Concept Forge
RepRap Lander concept on RepRap Forums
My Things, mostly experimental stuff
Re: Is there a way to break STL in individual parts' files?
May 12, 2016 08:36AM
Quote
realthor
It would be the same as saving each to STL from CAD. I need an automated method of doing it. DesignSpark Mechanical can do it but it looks down any nested CAD components and exports each single bit into its own STL, whereas I only need the top parents to be exported as STL. In this regard a script that reads an STL, and saves as STL each object at least 1mm apart from another mesh and saves those parts with incremental names would be awesome.

In that case, instead of separating the parts from a single STL, you could output the design as lots of separate STLs, then combine the child STLs of each top parent.

In OpenScad that is trivial and I'll explain exactly how to do it:

Install and run OpenScad (it's free). Then navigate to the folder that contains your STLs in your file explorer, highlight all the STL files of the group you want to combine, and drag and drop those files as a group into the editor (left hand) window of the latest OpenScad. You will see that OpenScad then automatically generates the correct "import" line statements for each file. Then hit "F6" and wait for it to be compiled to a fully rendered model (may take a while but there's a progress bar). Check that the model looks OK (you may need to zoom out to see the model - you can move it and zoom in and out with the mouse when the cursor is clicked in the top right-hand pane), then simply use the dropdown "File">"Export">"Export as STL" to save the combined part. Wait for OpenScad to report that the STL has been exported (messages are in the right lower pane of OpenScad). You then save that OpenScad script to a suitably named SCAD file ("File">"Save as")

Repeat the above in new SCAD script files for each combined STL you want to create, saving each script with a different name

"F5" allows a fast render for checking if you don't want to wait for the full "F6" render - but you cannot export to STL and the model may have some serious graphical glitches.

After modifying a part in your DesignSpark CAD, export all the parts to child STLs as you did before, over-writing the previous STLs, and then double-click on the SCAD file that contains the object you want, hit "F6" and export the combined STL.

Apart from the few simple operations detailed above, there will be no need for you to learn OpenScad at all.

If OpenScad gives an error message that the model contains too many elements or is too complex or has run out of cache after you hit "F6", go to the dropdown "Edit">"Preferences">"Advanced" and increase the rendering and cache sizes.
If you get the message "WARNING: Object may not be a valid 2-manifold and may need repair!", then the resulting STL may not slice properly. It indicates that the object contains shapes that are just touching along a 1D edge or 0D point (e.g. two cubes touching edge to edge, or cones just touching point to point, or circles with circumferences that touch at one place such as two 10mm diameter holes spaced exactly 10mm apart), which causes problems when expressed in STL format (you will have the same issue with the STL you exported from DesignSpark, though it may not have been reported). Objects touching face to face (2D surface) or intersecting are OK.

Dave

Edited 1 time(s). Last edit at 05/12/2016 08:38AM by dmould.
Re: Is there a way to break STL in individual parts' files?
May 12, 2016 09:27AM
That sounds great, I have actually tried but it's a lot of work, needs to be done easier.
I'll explain.

I have about 30 unique parts that are either simple nests or double/triple nests. DSM exports eash simple nest as a STL file, so if I have a parent made of 5 nested components I'd get 5 STL for those. They are named 1,2,3... I don't know what they are, unless I open them and save them after I see what is in there. I ended up with about 50 STLs and I managed to import them all in Openscad and it rendered correctly.

But I am at square one.

Hmm...just got an idea ...brb smiling smiley


RepRap Lander concept on Concept Forge
RepRap Lander concept on RepRap Forums
My Things, mostly experimental stuff
Re: Is there a way to break STL in individual parts' files?
May 12, 2016 02:45PM
Umm, my idea didn't work...

I'm with Meshmixer atm, I can separate the big STL in Shells (a single command => 27 shells created), then I have the option to "make solid" one by one but am stuck there... How do I select each solid and export it to STL? ... this is more difficult than it needs to be sad smiley


RepRap Lander concept on Concept Forge
RepRap Lander concept on RepRap Forums
My Things, mostly experimental stuff
Re: Is there a way to break STL in individual parts' files?
May 13, 2016 05:26AM
Wow, I just managed to do it by mistake smiling smiley ...

In Meshmixer:
1) import STL,
2) go to straight to Print (lowest Icon on the Left Ribbon),
3) then select the "Separate Shells" button at about the middle of the left stack.
4) Once Meshmixer splits the whole file in individual meshes Select the first one then Scroll down to the last one and Shift+Click that one to have all meshes selected and Hit "Repair Selected".
5) Once that is finished Hit "Export".
You'll be asked a name for the file (and I was dissapointed that again i'm saving a single file but did it anyway and surpise surprise).

The result of the save is one file named combined.stl and a bunch of files named 0, 1,...

Presto, I am so happy, took screenshots of the process and will upload them on G+. Will edit this post to include the link.smiling bouncing smiley

Edit: Here's the link [plus.google.com]

Edited 1 time(s). Last edit at 05/13/2016 05:56AM by realthor.


RepRap Lander concept on Concept Forge
RepRap Lander concept on RepRap Forums
My Things, mostly experimental stuff
Re: Is there a way to break STL in individual parts' files?
May 14, 2016 02:18PM
Ok, for the OpenSource crowd (me included), here's what I've found by raising a Feature Request to Slic3r smiling smiley
There is a script called split_stl.pl that does what I need ("splits an STL model into multiple STL files, one per piece")

http://manpages.ubuntu.com/manpages/wily/man1/split_stl.1.html

This script is included in slic4r for linux and for windows one has to compile slic3r from sources.

Edit: just got response from Slic3r guys on github:

Quote
github > alexrj


Actually, @bubnikv and @realthor, you can do that thing using the command line interface of Slic3r itself using the --split argument:

./slic3r --split file.stl

I realize that the --split argument is not documented in [manual.slic3r.org] so I'll reopen this one as a reminder. Having a command for saving all parts as individual parts, as the original request says, actually makes sense.

(https://github.com/alexrj/Slic3r/issues/3327#issuecomment-219239007)

Edited 1 time(s). Last edit at 05/14/2016 04:34PM by realthor.


RepRap Lander concept on Concept Forge
RepRap Lander concept on RepRap Forums
My Things, mostly experimental stuff
Re: Is there a way to break STL in individual parts' files?
May 15, 2016 06:36AM
Cura has a function to do that, right-click on an object and select "Split object into parts". Or use Blender, go into edit mode and press "a" to select everything (usually it is selected already) and then press "p" and select "by loose parts".
Re: Is there a way to break STL in individual parts' files?
May 15, 2016 07:01AM
Quote
danilius
Cura has a function to do that, right-click on an object and select "Split object into parts". Or use Blender, go into edit mode and press "a" to select everything (usually it is selected already) and then press "p" and select "by loose parts".

I actually need to save all those parts in their own STL files in one go. Cura doesn't provide that function, when you save the split objects file you still get one file.


RepRap Lander concept on Concept Forge
RepRap Lander concept on RepRap Forums
My Things, mostly experimental stuff
Sorry, only registered users may post in this forum.

Click here to login