檔案圖示
 
 

3037

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

大小
84.6 KB
建立時間
修訂
13
類型
application/zip
General Public License v3 (GPLv3)

連結

inklinea 寫於

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 寫於

@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_ 寫於

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 寫於

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

登入以留下評註!