-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaccess_a_specific_gr.py
More file actions
33 lines (30 loc) · 937 Bytes
/
access_a_specific_gr.py
File metadata and controls
33 lines (30 loc) · 937 Bytes
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
root = QgsProject.instance().layerTreeRoot()
#print(root.children())
#child0 = root.children()
#group_names = []
#for ch in child0:
# #grs = ch.findGroups()
# if isinstance(ch, QgsLayerTreeGroup):
# print (type(ch))
# group_names.append(ch.name())
# else:
# print('no')
sel_gr = 'Piano degli Interventi'
subgr_name = []
lyr_names = []
for c in root.children():
#print(c)
if isinstance(c, QgsLayerTreeGroup):
if c.name() == sel_gr:
for subc in c.children():
if isinstance(c, QgsLayerTreeGroup):
subgr_name.append(subc.name())
lyrs = subc.findLayers()
# print(lyrs)
for lyr in lyrs:
# print(lyr.name())
# print(lyr.layerId())
lyr_names.append(lyr.name())
print(group_names)
print(subgr_name)
print(lyr_names)