Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Gets active Rhino camera.
A: Set to 'True' to activate current camera.
S: Starting location.
T: Target location.
L: Lens length.
U: Up.
ghenv.Component.Name = "Get Camera"
ghenv.Component.NickName = 'GetCam'
# Import libraries.
import Rhino
import Grasshopper as gh
# Warnings.
if not A:
msg = "Input parameter 'A' failed to collect data."
ghenv.Component.AddRuntimeMessage(gh.Kernel.GH_RuntimeMessageLevel.Warning, msg)
if A == True:
S = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.CameraLocation
T = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.CameraDirection
L = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.Camera35mmLensLength
U = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.CameraUp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.