Create Method


Creates a new ViewPlan.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 16.0.0.0 (16.0.0.0)
Since: 2013

Syntax

C#
public static ViewPlan Create(
	Document document,
	ElementId viewFamilyTypeId,
	ElementId levelId
)
Visual Basic
Public Shared Function Create ( _
	document As Document, _
	viewFamilyTypeId As ElementId, _
	levelId As ElementId _
) As ViewPlan
Visual C++
public:
static ViewPlan^ Create(
	Document^ document, 
	ElementId^ viewFamilyTypeId, 
	ElementId^ levelId
)

Parameters

document
Type: Autodesk.Revit.DB Document
The document to which the ViewPlan will be added.
viewFamilyTypeId
Type: Autodesk.Revit.DB ElementId
The id of the ViewFamilyType which will be used by the new ViewPlan. The type needs to be a FloorPlan, CeilingPlan, AreaPlan, or StructuralPlan ViewType.
levelId
Type: Autodesk.Revit.DB ElementId
The id of the Level to associate with the new plan view.

Return Value

The new ViewPlan.

Examples

Copy C#
// Create a Level and a Floor Plan based on it
double elevation = 10.0;
Level level1 = Level.Create(document, elevation);
ViewPlan floorView = ViewPlan.Create(document, floorPlanId, level1.Id);

// Create another Level and a Ceiling Plan based on it
elevation += 10.0;
Level level2 = Level.Create(document, elevation);
ViewPlan ceilingView = ViewPlan.Create(document, ceilingPlanId, level2.Id);
Copy VB.NET
   ' Create a Level and a Floor Plan based on it
   Dim elevation As Double = 10.0
Dim level1 As Level = Level.Create(document, elevation)
   Dim floorView As ViewPlan = ViewPlan.Create(document, floorPlanId, level1.Id)

   ' Create another Level and a Ceiling Plan based on it
   elevation += 10.0
Dim level2 As Level = Level.Create(document, elevation)
   Dim ceilingView As ViewPlan = ViewPlan.Create(document, ceilingPlanId, level2.Id)

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException This view family type is not a plan view type. -or- The ElementId levelId does not correspond to a Level. -or- StructuralPlans can only be created when the structural discipline is enabled whereas FloorPlans and CeilingPlans can only be created when architecture or MEP disciplines are enabled. -or- Plan view creation is not allowed in this family.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
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.

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 →