prusa3d / PrusaSlicer

G-code generator for 3D printers (RepRap, Makerbot, Ultimaker etc.)
https://www.prusa3d.com/prusaslicer/
GNU Affero General Public License v3.0
7.72k stars 1.93k forks source link

Import FreeCAD's FCStd format #7808

Open eduncan911 opened 2 years ago

eduncan911 commented 2 years ago

Version

Version 2.4.0+linux-x64-GTK3

Operating system type + version

Pop_OS 21.10 (Ubuntu 21.10) + Regolith

3D printer brand / version + firmware version (if known)

N/A

Behavior

Cannot Import -> FCStd format

CURA, Simplify3D, etc all support importing an FCStd file. This is a feature request to add the same support here.

FreeCAD and OpenSCAD are the two most dominant CAD packages on Linux, because of the limited-to-no support of the expensive CAD packages.

Not to mention they are both free and open source, just like Prusa's moto is!

https://wiki.freecadweb.org/File_Format_FCStd

Is this a new feature request?

YES

Project File (.3MF) where problem occurs

N/A

n8bot commented 2 years ago

Is FCStd a step-like file? As in, solid data not mesh?

Either way, it sounds like an interesting project to tackle.

eduncan911 commented 2 years ago

@n8bot yes. more like a f3d (Fusion360) file that holds all data related to the model, including parts and assemblies.

But like best practices in other cad software, 1-part-per-file is best.

IOW:

eduncan911 commented 2 years ago

CURA has FreeCAD, SolidWorks, etc integration. It looks like these plugins for CURA all use the "installed software" to convert/model with. Here's a nice workflow shown for SolidWorks, with a single GUI popup:

https://www.youtube.com/watch?v=Ixm2crbtCtg

Basically, it looks to import a single Part only, which makes sense as who knows what part you want to print if you open an entire assembly.

An FCStd file can be used as an Assembly, or individual Parts - just like SW.

So far, it looks like it uses the external program itself to convert the Part to an STL mesh - all via command line binaries. That's pretty simple actually.

...or, we can get more fancy and have a Modal popup asking what Model from the TreeView we should be importing onto the build plate. Oooo.... now, THAT would be awesome! Because that would lead PrusaSlicer to be able to open STEP files, and select what Part/Model to import (though, you would need FreeCAD or another CAD package installed to convert the STEP file).


TL;DR

If you need help on the command line format/options for FreeCAD to open, convert, and save/output an STL, let me know and I'll own that part.

MisterMakerNL commented 2 years ago

Would be awesome if Prusaslicer could save the slicer settings to the Freecad file, this way when we update the model we just have to to check and hit print. No more transfer files like 3fm needed. Being able to select the bodies you want print is cool too, but Prusa slicer already has a nice way in disabling the bodies that you don't want to print.

eduncan911 commented 2 years ago

Being able to select the bodies you want print is cool too, but Prusa slicer already has a nice way in disabling the bodies that you don't want to print.

True, but have you seen some of these 3D printer step files? with over 100 bodies? And that's if they happen to name things properly. lol

bubnikv commented 2 years ago

AFAIK Cura only supports importing CAD models using a commercial CAD kernel, for which you have to pay.

n8bot commented 2 years ago

I doubt there are any non-free licensing requirements for the FreeCad format, tho.

Also, IIRC, there is no license needed to decode STEP files, but I might be wrong about that.

eduncan911 commented 2 years ago

There is no license or commercial software needed. You run the CAD binaries via exec to convert objects.

AFAIK Cura only supports importing CAD models using a commercial CAD kernel, for which you have to pay.

For SolidWorks files, yes as there is no free version. Fusion360 I am not sure if they have a free CLI conversation program.

But again, this issue is for importing FreeCAD FCStd conversions - and there is no commercial engine or license or whatever - as you already accepted the FreeCAD license when you installed the software (which is GNU).

The CURA plugin that does FreeCAD imports points to the installed /bin/FreeCADcmd binary for CLI conversions of Part Bodies to STL. You can even configure the mesh resolution (though not sure if it's through defaults only or also through CLI).

There's even a FreeCAD CLI-only Docker image: https://wiki.freecadweb.org/FreeCAD_Docker_CLI_mode

eduncan911 commented 2 years ago

I know nothing about Slicer/PrusaSlicer/SuperSlicer internals, and mostly likely have no spare time to dig in.

However, I'm more than happy to research and provide all the CLI binary vars and envs needed.

Also, I can test and verify the FreeCAD imports via Linux, macOS, and Windows default installs.


As far as how to set this up... If we want to KISS it:

That last one may need the log output redirected to a log file, because FreeCAD is very verbose in it's Python coding.

The first one, verifying the FCStd, could be skipped - if we have a way to view the error output of FreeCADcmd.

MisterMakerNL commented 2 years ago

Being able to select the bodies you want print is cool too, but Prusa slicer already has a nice way in disabling the bodies that you don't want to print.

True, but have you seen some of these 3D printer step files? with over 100 bodies? And that's if they happen to name things properly. lol

Reverse-select and hide would fix that pretty easy. Although there is no reverse select atm. So having ether a pop-up or reverse select would probably be a solution to this. @eduncan911 Would be best of it's not an Import function but an native support function, so save your settings in the Freecad file. Which would not be that difficult since as far as I think it's all XML layout, Prusaslicer settings / 3fm and fcstd settings. https://wiki.freecadweb.org/File_Format_FCStd https://3mf.io/specification/ afbeelding

eduncan911 commented 2 years ago

@HaasNL2 i don't see a need to "save PrusaSlicer settings in FreeCAD FCStd" to go back to FreeCAD. That's what 3mf is for. Besides, if you do that and you already had FreeCAD open, any Saves would just overwrite the file. That's a bad workflow IMO, as it can easily get overwritten by FreeCAD saves.

Let's take this one step at a time... Importing FCStd first. Then maybe a Reverse Select as you mentioned...

bubnikv commented 2 years ago

There is no license or commercial software needed. You run the CAD binaries via exec to convert objects.

I see, to implement we would "just" need to buy all various commercial CAD systems, integrate, test and maintain. That sounds like a challenge.

CURA has the benefit of 3rd party plugins, where these plugins are contributed and neither tested nor maintained by Ultimaker. We don't have such a plugin framework.

The CURA plugin that does FreeCAD imports points to the installed /bin/FreeCADcmd binary for CLI conversions of Part Bodies to STL. You can even configure the mesh resolution (though not sure if it's through defaults only or also through CLI).

We may consider to implement such a functionality if there is enough demand.

CURA, Simplify3D, etc all support importing an FCStd file.

I would be surprised if S3D imported FCStd file. If so, then by calling the FreeCADcmd binary as you suggested.

luzpaz commented 1 year ago

Any traction on this ?

sslupsky commented 3 weeks ago

I would like to suggest the next major version of PrusaSlicer be released as a workbench for FreeCAD. FreeCAD is cross platform and open source and the mutual benefits to the Prusa and FreeCAD communities would be greater than the sum.

luzpaz commented 1 week ago

Anybody interested in spearheading it ?