pymel.core.rendering.viewSet

viewSet(*args, **kwargs)

This command positions the camera to one of the pre-defined positions. If the fit flag is set in conjunction with persp, top, side, or front, the view is fitbased on the list of selected objects (if there are any) or on all the objects if nothing is selected. Notice that the fit flag cannot be set in conjunction with view along axis commands like viewX. If a camera is not specified, the camera in the active view will be used. If no flag is specified, the camera is set to the home position. In query mode, return type is based on queried flag.

Flags:

Long Name / Short Name Argument Types Properties
animate / an bool ../../../_images/create.gif
  Specifies that the transition between camera positions should be animated.
back / b bool ../../../_images/create.gif
  Moves the camera to the back position.
bottom / bo bool ../../../_images/create.gif
  Moves the camera to the bottom position.
fit / fit bool ../../../_images/create.gif ../../../_images/query.gif
  Apply a viewFit after positioning camera to persp, top, side, or front.
fitFactor / ff float ../../../_images/create.gif
  Specifies how much of the view should be filled with the fitteditems
front / f bool ../../../_images/create.gif
  Moves the camera to the front position.
home / h bool ../../../_images/create.gif
  Executes the camera’s home attribute command. Before the string is executed, all occurances of %camerawill be replaced by the camera’s name. Use the camera command to set a camera’s home command.
keepRenderSettings / krs bool ../../../_images/create.gif ../../../_images/query.gif
  Retain the ‘renderable’ flag vaue on the view. Especially important if it switches from perspective to orthographic and then back again.
leftSide / ls bool ../../../_images/create.gif
  Moves the camera to the left side position.
namespace / ns unicode ../../../_images/create.gif
  Specifies a namespace that should be excluded. All objects in the specified namespace will be excluded from the fit process.
nextView / nv bool ../../../_images/create.gif ../../../_images/query.gif
  Moves the camera to the next position.
persp / p bool ../../../_images/create.gif
  Moves the camera to the persp position.
previousView / pv bool ../../../_images/create.gif ../../../_images/query.gif
  Moves the camera to the previous position.
rightSide / rs bool ../../../_images/create.gif
  Moves the camera to the right side position.
side / s bool ../../../_images/create.gif
  Moves the camera to the (right) side position (deprecated).
t / t bool  
   
top / t bool ../../../_images/create.gif
  Moves the camera to the top position.
viewNegativeX / vnx bool ../../../_images/create.gif
  Moves the camera to view along negative X axis.
viewNegativeY / vny bool ../../../_images/create.gif
  Moves the camera to view along negative Y axis.
viewNegativeZ / vnz bool ../../../_images/create.gif
  Moves the camera to view along negative Z axis.
viewX / vx bool ../../../_images/create.gif
  Moves the camera to view along X axis.
viewY / vy bool ../../../_images/create.gif
  Moves the camera to view along Y axis.
viewZ / vz bool ../../../_images/create.gif
  Moves the camera to view along Z axis. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.viewSet

Example:

import pymel.core as pm

# Create a new camera
cam = pm.camera();
camShape = cam[1];

# Set cameraShape1 to the persp position
pm.viewSet( camShape, p=True )

# Set the camera in the active view to the top position
pm.viewSet( t=True )