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

**URL:** https://discourse.paraview.org/t/helping-script-ways-to-set-a-view-in-a-non-axis-aligned-direction/5007
**Category:** ParaView Support
**Created:** [July 31, 2020, 7:25pm UTC](https://discourse.paraview.org/t/helping-script-ways-to-set-a-view-in-a-non-axis-aligned-direction/5007 "2020-07-31T19:25:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [July 31, 2020, 7:25pm UTC](https://discourse.paraview.org/t/helping-script-ways-to-set-a-view-in-a-non-axis-aligned-direction/5007/1 "2020-07-31T19:25:17Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [August 3, 2020, 2:14pm UTC](https://discourse.paraview.org/t/helping-script-ways-to-set-a-view-in-a-non-axis-aligned-direction/5007/2 "2020-08-03T14:14:41Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [August 3, 2020, 2:45pm UTC](https://discourse.paraview.org/t/helping-script-ways-to-set-a-view-in-a-non-axis-aligned-direction/5007/3 "2020-08-03T14:45:27Z")

</div>

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](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.
