RevitAPISnippets
RevitAPISnippets copied to clipboard
Revit API snippets for Visual Studio.
RevitAPISnippets
Revit API snippets for Visual Studio.
Installation
- Download or clone this repo;
- On Visual Studio, go to
Tools > Code Snippets Manager...or press Ctrl + K and Ctrl + B; - Click on
Addbutton. - Navigate to the folder where you saved this repo;
- Open the repo
Folder > Snippetsand Select the RevitAPI folder according to your Revit version (E.g.:RevitAPI2020); - Click on
OK.
How to use
- After installation, type the command (as in the Snippets List)
commandand 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.
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. |
Contributors
If you have any snippets that you think might be interesting to share, follow the steps below to contribute to this project:
Instructions
- Fork this repo;
- Use the
templateinsideSnippets > Templates > Csharp.snippet; - Use the prefix
rvtto 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);
CommitandPushyour changes to your forked repo;- Send a
Pull Requestto Develop branch.
More Information
For more information, feel free to contact me via email [email protected] or LinkedIn.
License
This project is licensed under the MIT Licence.
Do you like this solution? Please star this project on GitHub!