Camera Object

Derived from: Base Object
Defined in namespace "adsk::core" and the header file is <Core/Application/Camera.h>

Description

The Camera class represents the information that specifies how a model is viewed and displayed. It's analogous to a real camera where it has a position in space, is pointed towards a specific point and is oriented in a particular way.

Methods

Name Description
classType Static function that all classes support that returns the type of the class as a string. The returned string matches the string returned by the objectType property. For example if you have a reference to an object and you want to check if it's a SketchLine you can use myObject.objectType == fusion.SketchLine.classType().
create Creates a new Camera object that is independent of any viewport. This can be used to construct a camera to be used as input to modify a viewport, and create or update a named view.
getExtents Gets the extents of the camera. This is only used for orthographic cameras. The extents of a perspective camera is defined by a combination of the position of the eye point (how close the eye is to the model) and the perspective angle.
setExtents Sets the extents of the camera. This is only used for orthographic cameras. The extents of a perspective camera is defined by a combination of the position of the eye point (how close the eye is to the model) and the perspective angle.

When the camera is assigned to a viewport, typically only the width or the height is used depending on the aspect ratio of the viewport. For example, if the width and height are both 10, but the viewport is twice as wide as it is tall (2:1 aspect ratio). The height extent will be 10 and the width extent will be recomputed to be 20 to match the viewport.

Properties

Name Description
cameraType Gets and sets the current camera type.
eye Gets and sets the position of the eye in world space.
isFitView If this property is true, when this camera is applied to a viewport it will modify the camera such that the entire model is displayed in the viewport. When getting a camera from a viewport this property is always initialized to false.
isSmoothTransition Determines whether Fusion does a smooth transition to this camera position when the camera is assigned to a ViewPort. If this is true it will do a smooth transition from the current camera position to the new camera position. If false, the view will jump to the position defined by the camera with no intermediate steps. This is useful if you're providing a series of cameras to control the camera animation.
isValid Indicates if this object is still valid, i.e. hasn't been deleted or some other action done to invalidate the reference.
objectType This property is supported by all objects in the API and returns a string that contains the full name (namespace::objecttype) describing the type of the object.

It's often useful to use this in combination with the classType method to see if an object is a certain type. For example: if obj.objectType == adsk.core.Point3D.classType():
perspectiveAngle Gets and sets the perspective angle of the camera. This property is only valid when the CameraType property is either Perspective or PerspectiveWithOrthoFaces.
target Gets and sets the camera target point in world space.
upVector Defines the "up" direction for the camera which controls the orientation of the camera around the line defined between the eye and target points.
viewExtents **RETIRED** Defines the area that's visible by the camera. This value is the radius of a sphere centered at the target point. The camera will display everything within that sphere and everything in front of and behind the sphere. Additional geometry outside of the sphere will also be visible depending on the shape of the window. Setting this value can cause the eye and/or perspective angle to be modified when the camera type is perspective.
viewOrientation Sets the camera to a standard orientation. If this is set, it will result in resetting all the camera values except the camera type. The orientation is based on the current orientation defined by the ViewCube. This means, that the view orientations cannot be expected to be consistent from one view to another.

Accessed From

Camera.create, NamedView.camera, Viewport.camera

Samples

Name Description
As-Built Joint Sample Demonstrates creating a new As-Built Joint.
Joint Origin Sample Demonstrates creating a new Joint Origin.
Rigid Group API Sample Demonstrates creating a new Rigid Group.

Version

Introduced in version August 2014