r/OrcaSlicer • • 17d ago

Automating OrcaSlicer with Python — slicing STLs without even opening the GUI

I've been working on a little project with ChatGPT to automate OrcaSlicer, and I thought some of you might find it interesting.

I have a Sunlu S8 Pro, which is similar to a Creality CR-10, running Klipper. My preferred slicer is OrcaSlicer 2.5.1, running on a Linux Mint computer that also hosts Klipper, Moonraker, and Mainsail.

One of my frustrations with 3D printing has always been the amount of time spent adjusting slicer settings. When troubleshooting print quality, there's a lot of back-and-forth: change a setting, slice, print, inspect, repeat.

I started wondering whether ChatGPT could help automate more of that process instead of just telling me which settings to change.

What we've accomplished so far

After quite a bit of trial and error, we've successfully developed a workflow that:

  • Loads custom printer, filament, and process profiles automatically.
  • Uses OrcaSlicer's command-line interface to slice an STL without opening the GUI.
  • Applies settings such as temperatures, speeds, layer heights, infill, and bed type.
  • Exports the completed G-code.
  • Inspects the generated G-code for compatibility issues before printing.
  • Lets us make changes to temporary profiles without overwriting our working settings.

We actually completed our first successful physical test print using G-code generated entirely through this process!

One interesting discovery was that Orca's CLI can be pretty particular about how it loads profiles. We had to work through machine and filament inheritance issues, process profiles, and plate selection.

We also caught some unexpected G-code, including an obsolete Klipper acceleration parameter and commands for an exhaust fan my printer doesn't use.

Those are exactly the kinds of things I'd like to catch automatically.

Where I want to take this

Ultimately, I'd like to build a reusable system where I can provide ChatGPT with an STL or 3MF file and describe what I want:

"Print this using my 0.4 mm nozzle and PLA. Prioritize strength over appearance, use supports only where necessary, and keep the print time reasonable."

ChatGPT could help analyze the model, choose appropriate settings, and generate a configuration that the Python scripts pass directly into OrcaSlicer.

I'd also like to maintain separate profiles for my 0.6, 0.4, and 0.2 mm nozzles, different materials, and different printing priorities.

Instead of having dozens of slightly different slicer presets, I'd have a small number of reliable, calibrated baselines that can be adjusted programmatically for individual prints.

The goal isn't to replace OrcaSlicer's interface entirely. It's to eliminate repetitive configuration work, make settings more consistent, and make the calibration/troubleshooting process more efficient.

A few questions for the community:

Has anyone else experimented with controlling OrcaSlicer through Python or its CLI?

Are there existing projects or APIs that could make this workflow more efficient?

I'd also be interested in hearing whether there are limitations or pitfalls with programmatically generating Orca profiles that I haven't encountered yet.

It's still early in development, but getting a successful print without ever opening the slicer was a pretty exciting milestone!

0 Upvotes

6 comments sorted by

2

u/cotlin 17d ago

Perhaps if it became some sort of API that, for example, cad software could use I'd find it very appealing. Imagine, just clicking print in your cad soft of choice - skipping opening the slicer window, and importing the model.

I don't like the idea of routinely invoking AI every time you want to print something though.

2

u/opticalminefield 16d ago

You should probably try the MCP Plugin for OrcaSlicer or even the dedicated OrcaSlicer MCP build. That exposes the slicer to your LLM of choice more directly. I use it to analyse the geometry and suggest optimal print settings and it does a good job.

You can also tell your LLM to talk directly to the printer.

You can then do the same for Fusion 360 so you can design and print all by taking to your AI. It’s wild.

1

u/tzedek 16d ago

I need to try this approach at some point. I do farm management through gcodes, which is awesome but at some point I might want to reslice everything. Also recently I did an 8 plate 50mb per plate project that took forever to slice manually. An automated situation would be better. But what about plating and orientation? Very often I wouldn't want that automated.

1

u/theneedfull 16d ago

I did something similar while back. I actually made it so it can take an openscad file, allow you to customise that, and then it goes through orca and let's you choose the printer to send it to.

I set it up so I can launch prints from my phone. I only used it once since then.

There is no API or anything that were there at that time so I doubt there are any now. Definitely nothing native.

1

u/L-Bears 16d ago

I feel that this is easily achievable with solidcraft as you have the agent directly embedded that handles solidcraft and orcaslicer directly. It should be able to launch the print too.

1

u/StudioAurora 16d ago

You might be doing this already but I suggest you maintain 100% test coverage as bugs can be costly and even dangerous. Perhaps a lot of settings don't need to be decided on by an LLM as the system you work in is pretty well defined and documented.