Helping script ways to set a view in a non-axis aligned direction

Is there a convenient way to script looking in a pre-specified view direction that’s not axis aligned? This is coming up a decent number of times with my users. As an example, a user is clipping some data and wants to look in the normal direction to what they clipped. Typically the script goes something like this:

view = GetActiveView()
whereStuffIsAt = view.CameraFocalPoint
cameraPosition = whereStuffIsAt + 1000*
view.CameraPosition = cameraPosition
ResetCamera()

Having something automated to help with that would be a nice feature. Maybe something like FitToScreen(view, viewDirection, viewUp), but I’m sure someone will think of something better…

Andy,

That sounds like a good idea. The Slice filter has a button to align the camera with the current normal, so it makes sense to have a corresponding function in Python that uses the same math to change the camera. Wanna write it up as a feature request?

Thanks,
Cory

Huh, I think I’ve probably seen that Camera Normal a thousand times but somehow it never really registered in my head. Well, at least I forgot about it. But yeah, essentially a reverse of this operation.

I’ve added a gitlab issue at https://gitlab.kitware.com/paraview/paraview/-/issues/20129. It would be nice if this makes it into PV 5.9 but since we’re awfully close to the release I didn’t mark it as a requirement for v5.9. The description may be kind of terse but hopefully you get the idea and can improve upon the API for it if needed.