Skip to content

mayconrfreitas/RevitAPISnippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RevitAPISnippets

Revit API snippets for Visual Studio.

Visual Studio 2019 Release Stars Forks Issues Issues Contributors License MIT

Installation

  1. Download or clone this repo;
  2. On Visual Studio, go to Tools > Code Snippets Manager... or press Ctrl + K and Ctrl + B;
  3. Click on Add button.
  4. Navigate to the folder where you saved this repo;
  5. Open the repo Folder > Snippets and Select the RevitAPI folder according to your Revit version (E.g.: RevitAPI2020);
  6. Click on OK.

How to use

  1. After installation, type the command (as in the Snippets List) command and press tab 2x;

Revit API Snippets - Example of snippet

  1. Use tab to navigate through fields and edit them as you wish;

Revit API Snippets - Example of snippet

  1. Press enter to complete the command.

Youtube logo 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

  1. Fork this repo;
  2. Use the template inside Snippets > Templates > Csharp.snippet;
  3. Use the prefix rvt to name your shortcut (E.g.: rvt + getsel (abbreviation to Get Selection) = rvtgetsel);
  4. Be sure that your shortcut doesn't exist in the Snippets List;
  5. Write your snippets in individual files grouped inside folders of their respective subject (E.g.: rvtselfilt is inside Selection folder);
  6. Commit and Push your changes to your forked repo;
  7. Send a Pull Request to Develop branch.

More Information

For more information, feel free to contact me via email mayconrfreitas@gmail.com or LinkedIn.


License

This project is licensed under the MIT Licence.


Do you like this solution? Please star this project on GitHub!