Go to: Synopsis. Return value. Related. Flags. MEL examples.

Synopsis

viewFit [-allObjects] [-animate boolean] [-center] [-fitFactor float] [-namespace string] [-noChildren] [camera...]

viewFit is undoable, NOT queryable, and NOT editable.

The viewFit command positions the specified camera so its point-of-view contains all selected objects other than itself. If no objects are selected, everything is fit to the view (excepting cameras, lights, and sketching plannes). The fit-factor, if specified, determines how much of the view should be filled. If a camera is not specified, the camera in the active view will be used. After the camera is moved, its center of interest is set to the center of the bounding box of the objects.

Additionally, a list of objects can be passed as arguments. If a camera is specified it must be the first argument. Objects passed as arguments to the command will be used instead of the selected objects.

Return value

None

Related

camera, cameraView, dolly, listCameras, lookThru, orbit, roll, track, tumble, viewCamera, viewClipPlane, viewHeadOn, viewLookAt, viewPlace, viewSet

Flags

allObjects, animate, center, fitFactor, namespace, noChildren
Long name (short name) Argument types Properties
-allObjects(-all) create
Specifies that all objects are to be fit regardless of the active list.
-animate(-an) boolean create
Specifies that the transition between camera positions should be animated.
-center(-c) create
Specifies that the camera moves to the center of the selected object, but does not move the camera closer.
-fitFactor(-f) float create
Specifies how much of the view should be filled with the "fitted" items.
-namespace(-ns) string create
Specifies a namespace that should be excluded. All objects in the specified namespace will be excluded from the fit process.
-noChildren(-noc) create
Specifies that the children of fitted objects should be ignored when determining the fit.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command.

MEL examples

// Position the active camera to view the active objects
viewFit;

// Position cameraShape-1 to view all objects
viewFit -all cameraShape1;

// Fill 50 percent of the active view with active objects
viewFit -f 0.5;

viewFit -all;