Hi Alexey,
Yes every shape in the group that gets drawn needs to have a label that is the same as the group name. My script below creates the default shape groups.
current_document = Metashape.app.document
current_chunk = current_document.chunk
default_shp_groups = {'QV Maj':[255,0,0], 'QV Min':[255,0,0], 'FAULT':[38,0,255],'AN':[0,170,0], 'CHL':[0,0,0], 'BM':[0,0,0], 'CL':[0,170,255], 'COR':[0,85,0], 'INE':[255,85,0], 'BND':[0,0,0], 'BX':[0,0,0], 'MAS':[0,0,0], 'OX':[255,85,0], 'pd':[0,0,0], 'stk':[255,0,0] }
#loop new groups to add
for new_shp_group_key in default_shp_groups:
#set test if group to be added already exists to False
new_shp_group_key_exists = False
#loop existing groups
for existing_shp_group in current_chunk.shapes.groups:
#test if new group to be added already exists
if new_shp_group_key == existing_shp_group.label:
new_shp_group_key_exists = True
if new_shp_group_key_exists == False:
new_group = current_chunk.shapes.addGroup()
new_group.label = new_shp_group_key
new_group.color = (default_shp_groups[new_shp_group_key][0], default_shp_groups[new_shp_group_key][1], default_shp_groups[new_shp_group_key][2])