File Icon
 
 

3120

Simple Inkscape Scripting

Simple Inkscape Scripting makes it easy to automate repetitive drawing tasks. It defines a simple set of Python functions such as "rect" to draw a rectangle and "line" to draw a line. For example, the one-line program "for r in range(7, 0, -1): circle((100, 100), 10*r, fill=['white','red'][r%2])" is all it takes to draw a bullseye.

Invoking the extension (Extensions → Render → Simple Inkscape Scripting…) brings up a dialog box that lets you load a Python script from a file or enter Python code directly in a text box. Shapes produced by the script appear directly on the canvas and can be edited just like any other shape.

See https://github.com/spakin/SimpInkScr for details and examples.

Inkscape Extensions

Size
86.8 KB
Created
Revisions
14
타입
application/zip
General Public License v3 (GPLv3)

Link

inklinea wrote :

Posted by a user on the forum yesterday :

I was not aware of this extension. It looks like that's indeed what I was looking for.

You've made my day, thanks !

Scott Pakin wrote :

@inklinea: Thanks for pointing out that post (https://inkscape.org/forums/beyond/parametric-drawings/), and thanks for recommending Simple Inkscape Scripting as a solution to @ragloo's problem. I hope the extension proves useful to a lot of users.

Vera_ wrote :

Could I use this to call inkscape's functionality to convert path nodes to curves? Idk probably not but asking just in case, thanks!

Scott Pakin wrote :

@imv2: Not exactly. You could either manually construct curves from the control points, or you could apply the BSpline path effect to a path. See https://github.com/spakin/SimpInkScr/blob/master/examples/path_effects.py for an example the latter.

Please log in to leave a comment!