Hi all,
I am trying to update the distances of scalebars via the Python API of Metashape. However, it turned out that my code does not work. Please kindly find my code as follows:
chunk.addScalebar(chunk.markers[0], chunk.markers[1])
chunk.addScalebar(chunk.markers[0], chunk.markers[2])
chunk.addScalebar(chunk.markers[0], chunk.markers[3])
chunk.addScalebar(chunk.markers[1], chunk.markers[2])
chunk.addScalebar(chunk.markers[1], chunk.markers[3])
chunk.addScalebar(chunk.markers[2], chunk.markers[3])
chunk.sortScalebars()
#Input distance of scalebars.
chunk.scalebars[0].Reference.distance = 0.03
chunk.scalebars[1].Reference.distance = 0.04
chunk.scalebars[2].Reference.distance = 0.05
chunk.scalebars[3].Reference.distance = 0.05
chunk.scalebars[4].Reference.distance = 0.04
chunk.scalebars[5].Reference.distance = 0.03
This code does not give me any error or warning. However, the corresponding distances will not change accordingly.
However, I found it is possible for me to rename the scalebars via the code:
chunk.scalebars[0].label = "example_scalebar"
Thus, I was wondering if I might be looking at the wrong functions/objects to change the distance.
Thank you so much for your attention.