Automating Inkscape process

Post about using Inkscape with cutters or plotters.
Ram K
Posts: 1
Joined: Thu Nov 28, 2019 7:11 pm

Automating Inkscape process

Postby Ram K » Thu Nov 28, 2019 7:31 pm

Hello all

What I want (Summary):
I want to write a code in python (other suggestions are welcomed too) to automate the process of gcode generation.

what I have done:
I am working with endurance lasers plugin in Inkscape 0.92.3 on Ubuntu 18.04.3 64 bit. I open png file in Inkscape GUI, and I use the following options in that exact order:
object to path
trace bitmap
extensions---Endurance Laser G-code
After this, endurance laser g-code popup window opens in which I input the parameters like laser power, feed speed, location of output gcode file etc. After clicking apply the gcode is generated and the file is dumped in a specified location.

What I want (In Detail):
I need to automate the above process completely. All the png files will be in a folder. The output gcode files can be saved in the same folder or any other location. I am thinking of python code which can be run on bootup and does this job automatically. I am ready to do this in any other programming language too If this can't be achieved using python.
Also if there is any standalone python code that can do this without Inkscape and generate gcodes for compatible with grbl or raster machines, suggest them too.
Any and all the help is appreciated, thanking you in advance.

Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Automating Inkscape process

Postby Moini » Sat Nov 30, 2019 8:10 am

This won't currently work within Inkscape. Dialogs in Inkscape do not take parameters via command line. You would need to automate the clicking in the user interface. I'd recommend you use an external library (e.g. potrace or autotrace) directly to trace. There is a python extension that uses autotrace, you might find some parts of what you need there (but it does centerline tracing): .

If you modify that extension to do the normal kind of tracing, you could also use the command line to achieve what you want.

Btw. I'm not sure what the 'Object to Path' is doing there in the list. If it's a raster graphic, it will do exactly nothing.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Return to “Inkscape & Cutters/Plotters”

Who is online

Users browsing this forum: No registered users and 4 guests