Jump to content
navarro_lautaro

PYTHON OR BASH CURA INTERFACE

Recommended Posts

Posted · PYTHON OR BASH CURA INTERFACE

Is there any python or bash interface for use Cura?
I would like to generate gcode from a .stl file through python (prefered) or bash. Also, calculate the price for the print given a certain configuration

Share this post


Link to post
Share on other sites
Posted · PYTHON OR BASH CURA INTERFACE

It sounds like you may want to skip the Cura frontend and slice directly using the CuraEngine slicer. This is what Cura does in the background.

 

CuraEngine does have a command-line interface, and it is possible to specify a model and all the settings. As an aside, Cura does not use the command line to communicate with the CuraEngine, but it uses a socket to send models and settings to the engine (using a protocol named "Arcus", see https://github.com/Ultimaker/libArcus).

 

The CuraEngine command-line interface has the following options for slicing:

CuraEngine slice [-v] [-p] [-j <settings.json>] [-s <settingkey>=<value>] [-g] [-e<extruder_nr>] [-o <output.gcode>] [-l <model.stl>] [--next]
  -v
        Increase the verbose level (show log messages).
  -m<thread_count>
        Set the desired number of threads.
  -p
        Log progress information.
  -j
        Load settings.def.json file to register all settings and their defaults.
  -s <setting>=<value>
        Set a setting to a value for the last supplied object,
        extruder train, or general settings.
  -l <model_file>
        Load an STL model.
  -g
        Switch setting focus to the current mesh group only.
        Used for one-at-a-time printing.
  -e<extruder_nr>
        Switch setting focus to the extruder train with the given number.
  --next
        Generate gcode for the previously supplied mesh group and append that to
        the gcode of further models for one-at-a-time printing.
  -o <output_file>
        Specify a file to which to write the generated gcode.

The resulting gcode contains a comment with how much material is used (in meters). You can calculate the weight from the filament diameter and the density of the material.

  • Like 1

Share this post


Link to post
Share on other sites
Posted · PYTHON OR BASH CURA INTERFACE

For example settings.def.json files you should look around in the folders that Cura creates.  For example on windows I think maybe it's in %appdata%/cura.   On linux I think it's in ~/cura/share/cura/resources/

 

Just search for files on your computer *.def.json.

 

 

Share this post


Link to post
Share on other sites
Posted · PYTHON OR BASH CURA INTERFACE
3 hours ago, gr5 said:

For example settings.def.json files you should look around in the folders that Cura creates

 

Except those folders will rarely contain any .def.json files. Files ending with .def.json are mostly "machine definitions", and they are located in the resources folder of the application bundle.

https://github.com/Ultimaker/Cura/tree/master/resources/definitions

One thing to note is that CuraEngine only ever uses "default_value" and completely ignores "value".

Share this post


Link to post
Share on other sites
Posted · PYTHON OR BASH CURA INTERFACE

Well I have 154 of those files and for me they are all in the ~/cura/share/cura/resources/ folder.  I really don't know where they are on windows.

Share this post


Link to post
Share on other sites
Posted · PYTHON OR BASH CURA INTERFACE
On 12/18/2019 at 1:21 PM, gr5 said:

For example settings.def.json files you should look around in the folders that Cura creates.  For example on windows I think maybe it's in %appdata%/cura.   On linux I think it's in ~/cura/share/cura/resources/

 

Just search for files on your computer *.def.json.

 

 

Can you provide me a json example? I was not able to find it on my linux computer!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!