Icône du fichier
 
 

3125

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

Taille
86,8 Kio
Créé le
Révisions
14
Type
application/zip
General Public License v3 (GPLv3)

Lien

inklinea a écrit le  :

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 a écrit le  :

@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_ a écrit le  :

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 a écrit le  :

@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.

Connectez-vous pour ajouter un commentaire !