erkannt / svg2solid

Turn SVGs into STLs for multi-colour printing
https://svg2solid.rknt.de/
MIT License
7 stars 3 forks source link

Output STLs so that they lie flat in popular slicers #2

Closed floslo closed 4 days ago

floslo commented 1 month ago

Request: output a single STL file, instead of the current behaviour of outputting a ZIP file with each color layer as a separate STL file.

erkannt commented 1 month ago

I was under the impression that STLs can only contain a single solid. It appears however that some software might support it.

Would 3MF also work for you? That deffo supports mutliple solids and even colours if I'm not mistaken.

floslo commented 1 month ago

My use case is to go from multi color SVG to PrusaSlicer sliced gcode for 3D printing, where each SVG color turns into a different layer height and filament color. Like this sliced_example

svg2solid outputs one STL file per color. When opening them in PrusaSlicer each object gets grounded to the build plate, which breaks relative positioning from the SVG. Meaning manual fiddly work to reposition them. For example the svg2solid.svg exported as separate STL files appears in PrusaSlicer like this separate_stl_example and after rotating 90 on X axis to lay flat separate_stl_example_flat

I experimented with manually merging some svg2solid output STL files: from each STL concatenate lines from first facet normal to last endfacet, then add a single prefix solid exported and suffix endsolid exported. The merged STL opens ok in PrusaSlicer as one single object with features retaining their relative positions from the SVG. PrusaSlicers then detects the object as a logo/sign and helps to autoapply filament color changes (see first screenshot above).

I don't know if such a merge goes against some STL spec or will fail to open in other slicer/3D software though. And my merge approach of course only works well when the goal is to get a unique layer height for each color. So maybe keep current svg2solid default behaviour but add a merge checkbox?

(Side note: For all svg2solid exports, manually merged or not, PrusaSlices wants to autorepair them first. I don't know why but they behave and print ok after that autorepair.)

3MF opens in PrusaSlicer and other slicers and 3D software too so that might be an option, but I don't know anything about the 3MF spec.

A related request (can also post as a separate issue if you prefer): When opening in PrusaSlicer the svg2solid STL files (merged or not) are positioned vertically (see second screenshot above). So I must rotate 90 degrees on the X axis to lay them flat for printing. Not sure if the same happens when opening in other slicers. Could a toggle be added to svg2solid to control the rotation of the output (0, 90, 180, 270 degrees)?

edit: come to think of it, maybe it is the vertical positioning that causes the separate STL objects to loose their relative positioning from the SVG when importing to PrusaSlicer, due to them being bound to the print bed. That is, an option to rotate the svg2solid output STL files 90 on the X axis could perhaps by itself solve my initial issue.

erkannt commented 1 month ago

Thanks for going into more detail of what the issue is.

For this to work in PrusaSlicer you seem to need a MMU profile selected during import. It then will offer to treat the multiple STLs as a single object and won't shift them. This is the default behaviour in BambuStudio hence I never encountered this issue.

Going to close this as using a different slicer setting resolves the issue without me having to figure out how to create 3MF.

floslo commented 1 month ago

Thanks for the workaround suggestion. Here is the workaround in steps, for other PrusaSlicer users with a non-MMU 3D printer who may have the same use case and issue:

  1. Open Configuration Wizard and add a MMU version of your printer (even though you don't have a MMU printer)
  2. Select the MMU printer profile
  3. Import (drag drop) the svg2solid STL files
  4. In the "multiple objects were loaded ..." popup that shows click "yes"
  5. Select your regular printer profile
  6. Rotate the object 90 degrees on the X axis
  7. Slice and prepare for printing as usual
floslo commented 1 month ago

You did not comment on the orientation issue. When you import svg2solid STL to BambuStudio are they automatically in the desired orientation? If not, if you also have to manually rotate 90 degrees there, then consider changing the default orientation of the output if possible.

erkannt commented 1 month ago

Good point. Just checked and it is also rotated. I'll see if I can flip that.

floslo commented 4 days ago

Thanks for updating. Test report using PrusaSlicer 2.8.0.

The new default orientation fits well when the goal is to place the to-be-viewed side of the 3d-print face down on the platen. face_down

But when the goal is to convert different SVG colors to different height layers and print the to-be-viewed side face up the new default results in this. face_up

Which is fixable in PrusaSlicer with the mirror along Y axis action. face_up_mirror_y

But maybe a checkbox could be added to override the new default and make the output fit the face up goal?

floslo commented 3 days ago

Alternatively if the user selects different extrusion depths for different SVG colors then assume the goal is to print the STL files face up and automatically adjust the STL orientation to fit that use case.