Is there an API for PrusaSlicer?
 
Notifications
Clear all

Is there an API for PrusaSlicer?  

  RSS
YigalB
(@yigalb)
Eminent Member
Is there an API for PrusaSlicer?

Is there an API for PrusaSlicer, so I could call PrusaSlicer from activate it, including changing setup, slice, set color change, etc.?

I would like to control the slicer via C# (VisualStudio)

Posted : 07/03/2023 7:07 pm
Neophyl
(@neophyl)
Illustrious Member
RE: Is there an API for PrusaSlicer?

No.  There's the command line option.  That has a limited subset of switches and can call a 3mf project file with settings in it but I dont think it will do what you want realistically.

I suspect you will have to open a feature request on the PS github.  Good luck.  https://github.com/prusa3d/PrusaSlicer/issues

Posted : 07/03/2023 7:51 pm
YigalB liked
YigalB
(@yigalb)
Eminent Member
Topic starter answered:
RE: Is there an API for PrusaSlicer?

 

Posted by: @neophyl

No.  There's the command line option.  That has a limited subset of switches and can call a 3mf project file with settings in it but I dont think it will do what you want realistically.

I suspect you will have to open a feature request on the PS github.  Good luck.  https://github.com/prusa3d/PrusaSlicer/issues

I opened such a request and got a fast NO: "We are not going to implement such an API any time soon. Contributions are welcome."

Posted : 08/03/2023 5:45 pm
Diem
 Diem
(@diem)
Illustrious Member

Slicer isn't really intended for remote operation so the API route complicates matters.  If you want to control the slicer remotely then either set it up on a machine with a VNC server or similar and control it graphically or, and this is nearest to an API, or write an invocation script (Python, or I would use perl) with it's own API and have that compute a command string and launch slicer from the shell.

Cheerio,

Posted : 08/03/2023 7:53 pm
YigalB
(@yigalb)
Eminent Member
Topic starter answered:
RE:

The target of the API is not to remote control.

It is to control the slicer with pre-made scripts.

This will allow to run the design (OpenSCAD in my case) and the slicing automatically, with parameters changing - all  offline.

This post was modified 2 years ago by YigalB
Posted : 09/03/2023 8:21 am
JimB
 JimB
(@jimb)
Estimable Member
RE: Is there an API for PrusaSlicer?

You might be able to do what you want with the prusa-slicer command line options.

prusa-slicer --help
prusa-slicer --help-fff

I was able to give it an stl file, have it load a config file, slice and save the gcode file which seemed to work.

prusa-slicer --load myconfig.ini --slice test.stl

Although I tried to trigger a color change with the --colorprint-heights option, but I could not get it to do anything.  Don't know if it is broken or I am just not using it right.  You might have to post-process the gcode to inset color changes at the desired places.

Posted : 09/03/2023 1:12 pm
YigalB liked
Diem
 Diem
(@diem)
Illustrious Member

OK, so it's not an API problem in the usual sense.

You can invoke an OpenSCAD script from shell (eg: bash) or script with parameters passed from the run-time call.  You can pipe the output into PrusaSlicer OR save an intermediate file with a predefined name then the same script can invoke PrusaSlicer with variables also calculated at run-time.

I have done this at proof-of-concept level with the vague intention of making a web interface for a customisable product that would run through to emailing an STL to the user - but I haven't completed the project, thank for the reminder, maybe I should return to it.

Cheerio,

Posted : 09/03/2023 3:47 pm
YigalB liked
Share: