Revit API snippets for Visual Studio.
- Download or clone this repo;
- On Visual Studio, go to
Tools > Code Snippets Manager...
or press Ctrl + K and Ctrl + B; - Click on
Add
button. - Navigate to the folder where you saved this repo;
- Open the repo
Folder > Snippets
and Select the RevitAPI folder according to your Revit version (E.g.:RevitAPI2020
); - Click on
OK
.
- After installation, type the command (as in the Snippets List)
command
and press tab 2x;
- Use tab to navigate through fields and edit them as you wish;
- Press enter to complete the command.
Watch this video to see a more detailed use of Revit API snippets.
List of snippets ready to use:
Command | Description |
---|---|
rvtiexcom | Creates a sample of a IExternal Command implemented with the main codes. |
rvtallinstcat | Collects all instances in the project by the builtin category. |
rvtalltypescat | Collects all element types in the project by the builtin category. |
rvtgetparamdoub | Gets a parameter value as a double. |
rvtgetparamelmid | Gets a parameter value as an ElementId. |
rvtgetparamint | Gets a parameter value as an integer. |
rvtgetparamstr | Get Parameter Value As String. |
rvtgetparamvalstr | Get Parameter Value As Value String. |
rvtsetparam | Set Parameter Value. |
rvtsetparamstr | Set Parameter Value String. |
rvtselfilt | Creates a sample of a Selection Filter code implementing ISelectionFilter interface. |
rvtgetsel | Gets the elements in the model. |
rvtpickelms | Creates a selection of elements in the model. |
rvttrans | Creates a sample of a Transaction code. |
If you have any snippets that you think might be interesting to share, follow the steps below to contribute to this project:
- Fork this repo;
- Use the
template
insideSnippets > Templates > Csharp.snippet
; - Use the prefix
rvt
to name your shortcut (E.g.:rvt
+getsel
(abbreviation to Get Selection) =rvtgetsel
); - Be sure that your shortcut doesn't exist in the Snippets List;
- Write your snippets in individual files grouped inside folders of their respective subject (E.g.: rvtselfilt is inside Selection folder);
Commit
andPush
your changes to your forked repo;- Send a
Pull Request
to Develop branch.
For more information, feel free to contact me via email mayconrfreitas@gmail.com
or LinkedIn.
This project is licensed under the MIT Licence.
Do you like this solution? Please star this project on GitHub!