Add a scale bar to a viewport

OVITO currently has no built-in function to add a scale to an image, but it is possible to use an OVITO Python script to paint a custom scale bar on top of a viewport or a rendered image.

For this you have to add a Python script overlay to the viewport where you want to display a scale bar. You can then copy/paste this example Python script into the script editor of the viewport overlay.