Create Method


Create an ImageView containing an image imported from disk.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 22.0.0.0 (22.1.0.0)
Since: 2020

Syntax

C#
public static ImageView Create(
	Document document,
	ImageTypeOptions options
)
Visual Basic
Public Shared Function Create ( _
	document As Document, _
	options As ImageTypeOptions _
) As ImageView
Visual C++
public:
static ImageView^ Create(
	Document^ document, 
	ImageTypeOptions^ options
)

Parameters

document
Type: Autodesk.Revit.DB Document
The document in which to create the view.
options
Type: Autodesk.Revit.DB ImageTypeOptions
Options that specify what image to load.

Return Value

The newly created view.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException document is not a project document. -or- The ImageTypeOptions sourceType is not correct. Only Import value is allowed. -or- The image filename is an empty string. -or- The image file is not a supported image file type. -or- The image file is password protected. -or- The image file does not contain the requested page number. -or- The image file could not be read and may be corrupt. -or- An error occurred while handling the external resource corresponding to the image.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null
Autodesk.Revit.Exceptions FileArgumentNotFoundException The image file does not exist.
Autodesk.Revit.Exceptions ModificationForbiddenException The document is in failure mode: an operation has failed, and Revit requires the user to either cancel the operation or fix the problem (usually by deleting certain elements). -or- The document is being loaded, or is in the midst of another sensitive process.
Autodesk.Revit.Exceptions ModificationOutsideTransactionException The document has no open transaction.
Autodesk.Revit.Exceptions OptionalFunctionalityNotAvailableException The image file is a PDF file, but PDF import is not available in the installed Revit.

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →