LearnRevitAPI

⚠️Stop Wasting Time Creating Views Manually (Here's First Step To Automate Views)

Aug 27, 2025
Automate Views

Automating View Generation will bring you the most joy.
Just imagine: you click a button, go get some coffee, and you come back to hundreds of views generated exactly how you needed them.
On top of that, if you show that to your boss they'll see you as a Automation Wizard🧙♂️. At least that's how I felt when my bosses saw me make 465 sales plans faster than my coffee.
And the first step to thesse automations is to know how to create views in Revit APi. So let's break it down.
Ready to automate views?

Then firstly, let's learn how to create views with Revit API.
How to Create Views?
Creating views in Revit API is not complicated, however keep in mind that each view type has its own class(ViewPlan, ViewSection, View3D...), and we might need a little different arguments for each to create them.

But in all cases you'll notice that you need to provide Document and ViewFamilyType, so let's start with those and then go over each code example.
Get ViewFamilyType
Firstly, let's look at how to get ViewFamilyType because we need it to create any kind of view.
In general, there are 2 ways to do that:
Get all ViewFamilyType with a FEC, and filter them. This way you get a list of all available ViewFamilyTypes and you can select the one you need.

2. Or, a much simpler approach is to get the default ViewFamilyType with doc.GetDefaultElementTypeId. It's quick and easy and that's how I like to create my views.

P.S.
You'd only need to keep one line depending on what kind of view you're trying to create. I'm just providing you multiple examples so you can pick and choose what you need.
Next, let's have a look at how to create each ViewType.
1️⃣ Create ViewPlan
To create a ViewPlan we need 3 arguments:
document,
viewFamilyTypeId
levelId
And keep in mind that the ViewPlan class is used for:
FloorPlan
CeilingPlan
StructuralPlan
AreaPlan
So it means that we need to provide the correct viewFamilyTypeId argument to create what we need.
For example:

2️⃣ Create View3D
When working with 3D Views, remember that we can create Isomateric or Perspective view, and there are different methods:
They are similar to use:

3️⃣ Create ViewDrafting
Creating drafting views is one of the easiest examples. Just see it for yourself:

4️⃣ Create Legend View
Now let's get to the tricky stuff and look at Legends.
First of all, there is no methods in Revit API to create Legends... However, you can grab any existing legend and duplicate it, then you'll have a fresh new empty legend view.
But here's something to keep in mind. You might have projects with no Legends. And in this case you just need to make warning and tell users to create at least one blank Legend manually before you can run your automation.
So here is full code sample:

Let's break it down:
Get All Views
Filter out ViewTemplates and Legends
Ensure that you have legend View
If not, notify user and ask to create one
Duplicate any random legend
Now you have a new Legend View
Not so complicated, huh?
Especially when you use my code samples!
P.S.
Keep an eye on your inbox, I'm going to send you even more tips and tricks on Revit API soon.
✌️See Ya.
Join Newsletter
📩 You will be added to Revit API Newsletter
Join Us!
which is already read by 9500+ people!




