-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuntionDrawPlace.py
47 lines (39 loc) · 1.35 KB
/
funtionDrawPlace.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
43
44
45
46
47
import xml.etree.ElementTree as ET
def draw_Place(net, P_name, P_position_X, P_position_Y):
# Place
# Son 1.2
place = ET.SubElement(net, 'place')
place.set('id', P_name)
# Son 1.2.1
element1 = ET.SubElement(place, 'graphics')
# Son 1.2.1.1
sub_element1 = ET.SubElement(element1, 'position')
sub_element1.set('x', P_position_X)
sub_element1.set('y', P_position_Y)
# Son 1.2.2
element2 = ET.SubElement(place, 'name')
# Son 1.2.2.1
sub_element2 = ET.SubElement(element2, 'value')
sub_element2.text = P_name
# Son 1.2.2.2
sub_element2 = ET.SubElement(element2, 'graphics')
# Son 1.2.2.2.1
sub_sub_element2 = ET.SubElement(sub_element2, 'offset')
sub_sub_element2.set('x', '0.0')
sub_sub_element2.set('y', '0.0')
# Son 1.2.3
element3 = ET.SubElement(place, 'initialMarking')
# Son 1.2.3.1
sub_element3 = ET.SubElement(element3, 'value')
sub_element3.text = 'Default,' + '0'
# Son 1.2.3.2
sub_element3 = ET.SubElement(element3, 'graphics')
# Son 1.2.3.2.1
sub_sub_element3 = ET.SubElement(sub_element3, 'offset')
sub_sub_element3.set('x', '0.0')
sub_sub_element3.set('y', '0.0')
# Son 1.2.4
element4 = ET.SubElement(place, 'capacity')
# Son 1.2.4.1
sub_element4 = ET.SubElement(element4, 'value')
sub_element4.text = '0'