from axipy import Workspace, view_manager, CustomLabelProperties, Point, CustomLabelEndType


def getLayerByName(layers,name_layer):
    for i,layer in enumerate(layers):
        if layer.title==name_layer:
            return layer,i
    return None,None
path_wms=r"E:\Support\WorExample\Mws_custom_label\point_axioma_gk.mws"
layer_need_name='point_gk'
Workspace().load_file(path_wms)
map_view=view_manager.views[0]
layers=map_view.map.layers
layer_need,id_layer=getLayerByName(layers,layer_need_name)
axi_custom_label_1=CustomLabelProperties()
axi_custom_label_1.endType=CustomLabelEndType.Line
axi_custom_label_1.position=Point(12452687.6325121,6702149.67434464,map_view.coordsystem)
'''
axi_custom_label_2=CustomLabelProperties()
axi_custom_label_2.position=Point(7619164.4748742199,8863227.5770377256,map_view.coordsystem)
'''
#map_view.map.custom_labels.set(layer_need,1664,axi_custom_label_1)
map_view.map.custom_labels.set(map_view.map.layers[id_layer],0,axi_custom_label_1)

#map_view.map.custom_labels.set(map_view.map.layers[id_layer],1874,axi_custom_label_2)
jkl=0