spakin / SimpInkScr

Simple Inkscape Scripting
https://inkscape.org/~pakin/%E2%98%85simple-inkscape-scripting
GNU General Public License v3.0
320 stars 31 forks source link

Remove does not work #58

Closed DavidGauntt closed 1 year ago

DavidGauntt commented 1 year ago

According to the documentation, invoking remove() on a shape will remove it from the displayed shapes. However, the following script does not delete any shapes:

for c in all_shapes(): c.remove

From another post in this forum, I found a script that does work:

for c in svg_root.iter(): if isinstance(c, inkex.ShapeElement) and not isinstance(c, inkex.Layer): c.delete()

Why does the first script not work?

spakin commented 1 year ago

It looks like remove removes only shapes that were created using one of the Simple Inkscape Scripting shape commands. I'll update the code shortly to make remove work on any object returned by all_shapes.