Making a scaled ruler overlay for parallel view in C#

Hi everyone,

I wrote this grasshopper component in VS, it focuses the viewport camera on one point in order to quickly check dimensions (strongly inspired by the ruler from icem surf). To rescale the scale intervals it references the distance from camera to target point, which does work really well in perspective view.

My problem is, that I want to use this in parallel view too, which is not possible in the current state, since parallel view ignores camera distance. It uses some kind of etheral “zoom”, which has no gettable property in rhinocommon.

ScaledRuler.gha (11.5 KB)
the VS repo:
ScaledRuler.7z (64.0 KB)

Update: I solved the problem!
I referenced the scaling to the frustum radius.

Since the parallel view option fixes the camera in an “infinitely” far away position, the zoom is defined by the view radius of the frustum.
I took the idea to use the frustum radius from the RhinoScriptSyntax, that is available online.