Glare Analysis Honeybee(How to use GH to set an automatic perspective in rhinos)

Hi, everyone
I made a component for glare analysis. Can you give me some Suggestions?Thank you.

The component seems to work fine and you get the output for dgp and dgi. I’m not sure what the question is here? Is it that the image viewer doesn’t show the image?

Thank you for your reply.
Before this, I did not get the value of DGI, but I found the reason, I did not set -rhino views name-. Now the problem is how to automatically control the view in a rhino in GH.I now manually adjust the view Angle, which is very inconvenient.
This is a component of my automated view, but it doesn’t seem to work properly.

This is my python code
‘’
import scriptcontext as sc
import Rhino as rc

def setCamera():
** target = rc.Geometry.Point3d.Add(cameraLocation, distance * cameraDirection)**
** sc.doc.Views.ActiveView.ActiveViewport.SetCameraLocation(cameraLocation, False)**
** sc.doc.Views.ActiveView.ActiveViewport.SetCameraDirection(cameraDirection, False)**
** sc.doc.Views.ActiveView.ActiveViewport.SetCameraTarget(target, False)**
** sc.doc.Views.ActiveView.Redraw()**

if cameraLocation and cameraDirection and distance: setCamera()
‘’