This repository has been archived on 2023-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
mightyscape-1.1-deprecated/extensions/fablabchemnitz/random_delete/random_delete.py
2021-12-25 21:13:21 +01:00

21 lines
573 B
Python

#! /usr/bin/env python3
import random
import inkex
class RandomDelete(inkex.Effect):
def add_arguments(self, pars):
pars.add_argument("--prob", type=float, default=50, help="Probability of deletion")
def effect(self):
if len(self.svg.selected) > 0:
for element in self.svg.selection.values():
if random.random() < self.options.prob/100:
element.delete()
else:
self.msg('Please select some paths first.')
return
if __name__ == '__main__':
RandomDelete().run()