-
Notifications
You must be signed in to change notification settings - Fork 1
/
generateelements.py
42 lines (33 loc) · 992 Bytes
/
generateelements.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import inkex
from inkex import Line
class NewElement(inkex.GenerateExtension):
container_label = 'lines'
container_layer = True
def generate(self):
self.style = {'fill' : 'none', 'stroke' : '#000000',
'stroke-width' : '0.264583'}
lines = self.add_lines()
for l in lines:
yield l
def add_lines(self):
el1 = Line()
el1.set('x1', '10')
el1.set('y1', '10')
el1.set('x2', '40')
el1.set('y2', '40')
el1.set('style', self.style)
el2 = Line.new(start=(40, 10), end=(10, 40))
el2.style = self.style
el3 = Line()
el3.update(**{
'x1': '50',
'y1': '10',
'x2': '80',
'y2': '40',
'style': self.style
})
el4 = Line(x1='50', y1='40', x2='80', y2='10')
el4.style = self.style
return el1, el2, el3, el4
if __name__ == '__main__':
NewElement().run()