Ultimaker Community of 3D Printing Experts

# sending an STL or GCODE directly to printer by command line

## Recommended Posts

Thanks for the previous answers, but unfortunate not very helpful. I wasn't clear enough about my objective being to send a file to printer directly by command line. It is true that curaEngine can be run from the command line, however it only creates a gcode file from an stl file. Another drawback of curaEngine is that every single setting must be set on the command line. There is no ini or config file option for loading these settings. The config file in Cura is not related to these settings.

If I go back to running Cura.exe form command line, it launches the GUI. There is no documentation on how to use as a command line option, if it is even possible.

The goal is as follows:

(1) pass an stl file + config settings (ideally a file) to curaEngine to create a gcode file

(2) send the gcode to the printer.

If this can be managed through Cura.exe by suppressing the GUI it would be easier.

I don't think this should require coding my own solution. If it does I would need to find the firmware interface documentation. Perhaps I'm the only odd-ball who is trying send prints from another external program..?

##### Share on other sites
Another drawback of curaEngine is that every single setting must be set on the command line. There is no ini or config file option for loading these settings.

Not true. You can send it .ini files

If I go back to running Cura.exe form command line, it launches the GUI. There is no documentation on how to use as a command line option, if it is even possible.

That's because it's a GUI application, not a command line one

Streaming g-code to the printer isn't that hard of a task. I'm pretty sure you can pipe the results from the engine into a serial connection (So a single bash script should do the trick).

##### Share on other sites

Another drawback of curaEngine is that every single setting must be set on the command line. There is no ini or config file option for loading these settings.

Not true. You can send it .ini files

Nallath, can you elaborate how to pass .ini files to the cura engine command line slicer? When looking at the help page (CuraEngine help), I don't see any option to pass a ini file.

If this is not possible to add the ini file, I wonder if it is possible to add the ini variables to the json file provided in the Cura/resources/machines/ directory.

##### Share on other sites

The .ini files are for a older version of the engine (the one used by 15.04).

If you want to use the latest and greatest, you only have to provide the command line option with all settings that you want to change, or adjust the json files so that the defaults match the values that you need.

##### Share on other sites

I am trying to better automate the build of various parts using CuraEngine directly. At the moment I do this by using cura:

cura \-i part1.ini \-o part1.gcode \-s part1.stl

I want to switch to using CuraEngine directly for automated builds since the needed command line options seem to be missing on the new Cura rewrite (Cura-2.1.2).

The .ini files are for a older version of the engine (the one used by 15.04).

So how exactly can I use the shipped version of CuraEngine with the ini files?

I can't seem to get it to work (cura 15.04.06; ubuntu 16.04).

/usr/share/cura/CuraEngine -c part1.ini -o part1.gcode part1.stl

gives the following error:

 Default config 'default.cfg' not usedConfig(part1.ini): Line 1: No key value pair foundFailed to read config 'part1.ini'Failed to open part1.gcode for output.

##### Share on other sites

The errors are pretty clear. The contents of the .ini file isn't correct. It's also unable to open / create the .gcode file (probably due to rights)

##### Share on other sites

The errors are pretty clear. The contents of the .ini file isn't correct. It's also unable to open / create the .gcode file (probably due to rights)

Yeah I got that. The gcode file is created fine if I don't try to load an ini file.

Maybe I misunderstood you. From the post before:

The .ini files are for a older version of the engine (the one used by 15.04).

If you want to use the latest and greatest, you only have to provide the command line option with all settings that you want to change, or adjust the json files so that the defaults match the values that you need.

I took that to mean that the shipped version of CuraEngine is able to parse ini files directly.

If I misunderstood you:

- Is there a way to do translate the ini files to CuraEngine config files easily?

- Or are there plans to re-implement the missing command line functionality in Cura >2.1.2?

---------------------------------

BTW: My use case is that I first use and iterate in cura with the gui. But once I lock down the printer settings for a certain part I use a small script to render it in the future (even if there are slight changes in the stl), as I have various parts I print again and again, but many with somewhat different printer settings.

No Idea how common this scenario is, but it works great with version control.

Using Ultimaker 2; recently upgraded to 2+

Edited by Guest

##### Share on other sites

As far as I know is that the guy that works on the engine just gives all the commands in commandline (without the .ini file). I don't think he has plans to make any changes to it.

It shouldn't be that hard to write a little script that generates that though.

##### Share on other sites

Hi,

Can we run the curaengine by command prompt in windows?

Can we run it using cigwin or CMD prompt?

Please let me know the exact command to run in cigwin and CMD prompt in windows.

Thanks & Regards,

Debakanta

##### Share on other sites

Can we run the curaengine by command prompt  in windows?

Yep

Can we run it using cigwin or CMD prompt?

Both are possible

Please let me know the exact command to run in cigwin and CMD prompt in windows.

##### Share on other sites

Hi,

We are using Cura-15.04.3. I need the command to convert a STL file to GCode file and send the request to the printer to print it.

Can you please let us know the command to convert a STL file to GCode file.

Kindly let us know the command to print a GCode file from the CMD prompt.

I don't find the .ini file inside my cura folder as well.

Thanks & Regards,

Debakanta

##### Share on other sites

Click the link. It's explained there.

##### Share on other sites

Hi,

I have installed with Cura-15.04.3

I'm giving the command to slice a STL file to GCode file

The command is as below:

CuraEngine -s "C:\path\to\STL File\" -o "C:\path\to\test.gcode"

Though it is producing  a test.gcode file it is not the proper one.

Only heading porting is coming as contents in the .gcode file.

Please correct the command and let me know the proper one.

Thanks,

Debakanta

Edited by Guest

##### Share on other sites

Hi,

While running CuraEngine -s "C:\path\to\STL File\"  I'm getting the below output:-

This program is free software: you can redistribute it and/or modify

the Free Software Foundation, either version 3 of the License, or

(at your option) any later version.

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License

along with this program.  If not, see .

Default config 'default.cfg' not used

M107

G1 F2700 E-4.50000

G0 F9000 X0.00 Y0.00 Z5.00

M104 S0                     ;extruder heater off

M140 S0                     ;heated bed heater off (if you have it)

G91                            ;relative positioning

G1 E-1 F300                    ;retract the filament a bit before lifting the

nozzle, to release some of the pressure

G1 Z+0.5 E-5 X-20 Y-20 F9000   ;move Z up a bit and retract filament even more

G28 X0 Y0                      ;move X/Y to min endstops, so the head is out of

the way

M84                         ;steppers off

G90                         ;absolute positioning

Please let me know how can I get a correct gcode file

Thanks & Regards,

Debakanta

Edited by Guest

##### Share on other sites

Hi,

Have any one tried using cura command to convert the .json file to .gcode. If so please let us know.

Thanks & Regards,

Debakanta

##### Share on other sites

Did you see my reply on one of your other of many duplicate posts you made on this subject?

Keep your question to a single post and it'll easier to keep track of...

##### Share on other sites

Hi,

Usually I'm getting GNU Affero General Public Licence message and default.cfg file not found while running CuraEngine from CMD Command prompt. Kindly let me know how to overcome this issue.

Though the .gcode file is produced its contents are not expected and not similar to the gcode file produced using GUI.

Using the command as below;

CuraEngine -o C:\Path\to\the\file.gcode C:\Path\to\the\file.stl

The Cura Version I'm using is:

Cura-15.04.4

Thanks & Regards,

Debakanta

##### Share on other sites

Use the 2.1 version and the instructions on the github.

##### Share on other sites

Hi,

Using Cura-15.04.3 and not able to see definitions/dual_extrusion_printer.def.json file.

Please let me know how do I set the environment variable in CMD Command prompt in windows. Where to feed the line CURA_ENGINE_SEARCH_PATH=/path/to/Cura/resources/definitions:/user/defined/path if definition folder is missing.

Do I need to buy a paid Cura software if I want to run it from command prompt.

Can I use GNU Affero General Public License additionally. If so then how?

Using CuraEngine -s "C:\path\to\STL File\" -o "C:\path\to\test.gcode" command and getting

Default Config 'default.cfg' not used message.

Thanks,

Debakanta

##### Share on other sites

Cura 15.04.3 doesn't work with the def.json files, those were introduced for 2.2 or higher.

There is no paid Cura software (You could pay us, we don't mind, but you don't have to).

##### Share on other sites

Hi,

Now, I'm able to produce the .gcode file from .stl file but failing for other files like .obj and .amf etc.

Using the command as below;

CuraEngine -c .cura\15.04.3\preferences.ini -o C:\Path\to\the\file.gcode C:\Path\to\the\file.stl

The Cura Version I'm using is:

Cura-15.04.4

Please guide me how to produce .gcode from .obj and .amf files.

Thanks & Regards,

Debakanta

You cant.

Edited by Guest

##### Share on other sites

Hi,

Is it possible to generate gcode files from .obj, .amf files using windows command prompt?

Can we convert .obj and .amf files to .stl by windows command prompt.

Thanks & Regards,

Debakanta

##### Share on other sites

Not with CuraEngine. It could be that there is software that can do it, but i'm not aware of any.

##### Share on other sites

What is the command to print a stl file or its gcode from windows command prompt.

Thanks & Regards,

Debakanta

## Create an account

Register a new account

• ### Our picks

• Ultimaker is hosting a webinar where we explain how you can achieve and maintain a high print success rate using these new reinforced engineering materials. Learn from Ultimaker's Product Manager of Materials and top chemical engineer Bart van As how you can take your 3D printing to that next level.
• 0 replies
• Designing for light-weight parts is becoming more important, and I’m a firm believer in the need to produce lighter weight, less over-engineered parts for the future. This is for sustainability reasons because we need to be using less raw materials and, in things like transportation, it impacts the energy usage of the product during it’s service life.
• 12 replies
×