no message
This commit is contained in:
parent
06920fa1c5
commit
07e221652e
14
extensions/fablabchemnitz_cleangroups.inx
Normal file
14
extensions/fablabchemnitz_cleangroups.inx
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<name>Remove Empty Groups</name>
|
||||
<id>fablabchemnitz.de.cleangroups</id>
|
||||
<effect needs-live-preview="false">
|
||||
<object-type>path</object-type>
|
||||
<effects-menu>
|
||||
<submenu name="FabLab Chemnitz Dev"/>
|
||||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
<command reldir="extensions" interpreter="python">fablabchemnitz_cleangroups.py</command>
|
||||
</script>
|
||||
</inkscape-extension>
|
16
extensions/fablabchemnitz_cleangroups.py
Normal file
16
extensions/fablabchemnitz_cleangroups.py
Normal file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import inkex
|
||||
|
||||
class CleanGroups(inkex.Effect):
|
||||
|
||||
def __init__(self):
|
||||
inkex.Effect.__init__(self)
|
||||
|
||||
def effect(self):
|
||||
groups = self.document.xpath('//svg:g',namespaces=inkex.NSS)
|
||||
for group in groups:
|
||||
if len(group.getchildren()) == 0:
|
||||
group.getparent().remove(group)
|
||||
|
||||
CleanGroups().run()
|
Reference in New Issue
Block a user