Hello, I am trying to adjust the labelling properties of a point layer through python by accessing the CIM in a script tool. When I run the tool, the properties are applied to the layer, however they do not draw. The labelling properties dialogue box reflects my changes, however the labels are not drawing to reflect the changes. Code below
I am attempting to change the rotation of a label by assigning the rotationField to a field in my attribute table called 'Bearing'.
lyr = m.listLayers(out_pointslayer + "_Map")[0]
ldef=lyr.getDefinition('V2')
for eachclass in ldef.labelClasses:
if eachclass.name == 'Class 1':
lblclass = eachclass
lblclass.maplexLabelPlacementProperties.rotationProperties.rotationField = 'Bearing'
lyr.setDefinition(ldef)
lyr.showLabels = True
aprx.save()
After running this code in a script tool, the labelling properties seem to reflect the changes.
However the rotation does not get applied in the rendering of the labels, however it works when I@@ do it manually.
Any Help would be much appreciated!