Viewport.saveAsImageFile Method

Parent Object: Viewport
Defined in namespace "adsk::core" and the header file is <Core/Application/Viewport.h>

Description

Saves the current view to the specified image file. The view is re-rendered to the specified size and not just scaled from the existing view. This allows you to generate higher resolution images than you could do with just a screen capture.

Syntax

"viewport_var" is a variable referencing a Viewport object.

returnValue = viewport_var.saveAsImageFile(filename, width, height)
"viewport_var" is a variable referencing a Viewport object.

#include <Core/Application/Viewport.h>

returnValue = viewport_var->saveAsImageFile(filename, width, height);
"viewport_var" is a variable referencing a Viewport object.

returnValue = viewport_var.saveAsImageFile(filename, width, height);

Return Value

Type Description
boolean Returns true if the operation was successful.

Parameters

Name Type Description
filename string The full filename, including the path, of the image file. The type of image file to be created is inferred from the extension of the filename.
width integer The width in pixels of the output image. A value of zero indicates that the current width of the viewport is to be used.
height integer The height in pixels of the output image. A value of zero indicates that the current height of the viewport is to be used.

Samples

Name Description
Create Animation API Sample

Creates a series of images while a design parameter changes. You can assemble the images into an animation in other software.

Before running: Open a part that contains a user or model parameter named Length, modifiable from 10 to 15 centimeters. When prompted, choose or create an output folder; the script saves one image per parameter value.

Version

Introduced in version August 2014