Disable camera rotation in a custom parallel projection view

Hi all,

I’m using RhinoCommon dll with C#.
I’d like to disable the camera rotation in a view with parallel projection but with a different direction than top or front view.

I created a new view like this :

RhinoView myView = doc.Views.Add("myView", DefinedViewportProjection.Front, new Rectangle(), false);
myView.Maximized = true;
doc.Views.ActiveView = myView;

Then I change some camera settings in order to adapt it to an object :

//Vector3d vector = something calculated from an object;
//BoundingBox bbox = bounding box of an object;
myView.MainViewport.SetCameraDirection(vector, false);
myView.MainViewport.ZoomBoundingBox(bbox);

My view faces my object like I want, but with right-click the user can rotate the camera… And I’d like right-click to only move the camera position in the perpendicular plane to my vector, but I didn’t find any RhinoViewport method which could solve my problem…

Sorry for my poor English :blush: and thank you in advance for your answers !

I don’t believe the SDK provides a way to do this.[quote=“Thav, post:1, topic:7431”]

And I’d like right-click to only move the camera position in the perpendicular plane to my vector
[/quote]

You might need to write your own view manipulation command do to this.

Finally I managed to solve my problem with a different method, but thank you for your help!

What did you do? Others might benefit from your findings…

Actually, I didn’t really solve the problem :
My purpose was to face up a parallel camera to a plane, and only allow zoom and translation in order to keep the orientation.
Instead of that, I apply a transformation on my plane so as to it lines up with the X and Z axis, and I use front view (which has the camera properties that I want). When the users manipulations are done, the inverse transformation is performed.

I had the same problem and found a handy fix :

  • Tools → Options → View → Pan: Always pan parallel views = on
  • Make sure your viewport has parallel projection & no perspective.
  • The easiest way is to modify the top / front / side view, which are already set to parallel.
  • I make a flat small plane that is oriented flat / perpendicular to the direction I want to look.
  • Align the camera with View → Set camera → Orient camera to surface. Pick the plane.

A great workflow is to place small planes on their own ‘c-plane’ layer and then locate them everywhere you need to align the c-plane or camera. Make a keyboard shortcut for both commands and you’ll be able to jam!

command 1: Set CPlane | To Object (for grid & c-plane)
command 2: Set camera | Orient camera to surface (for camera alignment)

EDIT: This seems like a good topic for a video. Thoughts?

1 Like