Skip to content

kraftwerk15/RevitAPISnippets

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RevitAPISnippets

Revit API snippets for Visual Studio and JetBrains Rider.

Visual Studio 2019 JetBrains Rider 2022 Release Stars Forks Issues Issues Contributors License MIT

Installation For Visual Studio

  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.

Installation For JetBrains Rider

Download the Settings File (.zip) for Rider and Import to your project. You can leave this file zipped as when we import these settings, we will need a zip file.

After download, open Rider. Click on File > Manage IDE Settings > Import Settings...

Navigate to the zip file downloaded and click "Select Folder".

You should see a new dialog display that asks if you desire to import the Live Templates

Finally, Restart Rider.

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

Below is a hyperlink to each individual .snippet for Visual Studio. JetBrains Rider code is the exact same, but the settings cannot be visualized the same way on GitHub.

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!

About

Revit API snippets for Visual Studio.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Snippet 100.0%