LearnRevitAPI
![](https://framerusercontent.com/images/zMFB840Y52OLteloUT4BRuogE.png)
![](https://framerusercontent.com/images/U9zjOvD4k3m6cIJd5bOiu960DeI.png)
Jul 19, 2023
Get Default Element Type
![](https://framerusercontent.com/images/Sd5FTaxiqzG7oeH1ykV6yypUzXo.png?scale-down-to=512)
There are times during development when we need to get random Types to test a snippet. I used to use FilteredElementCollector but there is an easier method available to get Default Type.
💡 Let's learn how to get Default Element Types!
👀 Available Methods
Whenever you create elements in Revit UI, you always have a default type for each category, usually it's the last used.
And there are 2 methods in Revit API that can give us default types:
![](https://framerusercontent.com/images/ovHEfmv977Cr13a3iA3mj7u5mk.png)
![](https://framerusercontent.com/images/HyX8yoG4e4LqUJAH5qHWUD6UD4k.png)
These 2 methods do similar thing - They give you an ElementId of Default Type.
But one is used on native Revit Elements like Walls,Floors... and the other is used for Loaded Families like Windows,Doors...
👀 So let's have a look at examples on how to use both of them!
1️⃣ .GetDefaultElementTypeId()
![](https://framerusercontent.com/images/ovHEfmv977Cr13a3iA3mj7u5mk.png)
This method is very straight-forward. It takes a single argument - ElementTypeGroup, which is an enumeration.
Enumeration is a data type in programming that allows you to define a set of named values.
It provides a way to group related values together under a single type, making your code more organized and readable.
![](https://framerusercontent.com/images/0T1ie1ayH84FppINEvu6oMakpA.png)
So you just have to choose the right option like ElementTypeGroup.WallType for example, and you will get Element Id of your Default Wall Type.
![](https://framerusercontent.com/images/9jZdmqDYB30eUpHf4dEiiWnL12E.png)
2️⃣ .GetDefaultFamilyTypeId()
![](https://framerusercontent.com/images/HyX8yoG4e4LqUJAH5qHWUD6UD4k.png)
Unlike .GetDefaultElementTypeId this method takes familyCategoryId as an argument. It simply means that we need ElementId of a category which type we are trying to get for example: ElementId(BuiltInCategory.OST_Windows)
So it's quite simple once you see an example of how to use it.
👇 Have a look below.
![](https://framerusercontent.com/images/z7nvDaqCgZNcGhIWzmwk8gxe38M.png)
I hope this has made it clear for you on how to get default types with Revit API and you are going to use it in your scripts.
Join Newsletter
📩 You will be added to Revit API Newsletter
Join Us!
which is already read by 6700+ people!
![](https://framerusercontent.com/images/svHzzMLtnnRCxtCUwbgAm6CUeB8.jpg)
![](https://framerusercontent.com/images/Y44kwhY0i7q37LzXUjrlxeGUo.jpg)
![](https://framerusercontent.com/images/lqKYmh8rqwZwgY2C9MSQER6iBCI.jpg)
![](https://framerusercontent.com/images/SyGCvJ3dbHsJEyklWWBhweY.jpg)
![](https://framerusercontent.com/images/DwiaUdmQHs3FVdDH2PXwAr0Y.jpg)