Inkscape on the command line


#1

I had no idea this was possible!
Since my copy of Illustrator is ancient, and I don’t want to buy an Adobe sub, I am investigating Inkscape for SVG making. The ability to make extensions, and to script it on the CLI is super useful.

http://tavmjong.free.fr/INKSCAPE/MANUAL/html/CommandLine.html


#2

What scripts are you thinking of making? Anything we would be interested in?


#3

I won’t really know until I learn Inkscape well enough to find it’s flaws (if it has any). :smile:

In the past I have scripted Illustrator to automate repetitive sequences, but I have no idea what I will really end up doing. Even if I never actually use it, knowing it is there is still useful!


#4

First thing that occurs for me is the possibility of doing kerf adjustment (inset/outset) for non-proofgrade. File goes in, script operates on it, other file comes out.


#5

Scripting automation is definitely a win here.


#6

SVG is a pretty readable file-format (it’s just text) and object styles are hierarchical, like CSS (you can in fact embed SVG in CSS and other HTML objects) so like @paulw points out, you ought to be able to programmatically apply a change to an entire line weight. Such a script wouldn’t even need Inkscape to work. That’s like a sed one-liner.


#7

I don’t think changing the line weight makes any difference to the cut. I think it cuts down the middle. To adjust kerf you need to change all the endpoints to make the outline bigger if it is outside and smaller if it is inside.

It could be done with Python and Clipper but certainly not a sed one liner.


#8

You’re right - I was thinking about line weights affecting laser focus rather than the position of the kerf wanting adjustment.


#9

Corel Draw is inexpensive and can do everything Adobe illy can do without a subscription.


#10

True, but inkscape is free and I am a cheapskate (and I work with open source for my day job).


#11

cough fusion360 cough


#12

I like onshape for modeling but still need a vector drawing editor.


#13

from the Corel User Support Group thread:


#14

You’re right. I should rephrase myself - Corel X8 does everything that AI does that matters :stuck_out_tongue_closed_eyes:


#15

I need to go home, I’m getting some wacky deja-vu


#16

Me too :grinning:


#17

Alternatively…

sed 's/.*MyStar.*$/\<g transform="matrix(1 0 0 -1 0 0)"\>&<\/g>/' MyStar.svg > MyStar.svg

(… okay I’m kidding, that’s a really cool link! :blush: I love how Inkscape’s dedication to their “verb”-based architecture enables this kind of thing)


#18

You don’t need inkscape to make SVG’s.


#19

Oh wow! I had a class in H.S. that taught :turtle: programming :grin:


#20

I heart that you actually went ahead and demonstrated a sed one-liner for the task.