Advertisement

Saturday, March 11, 2017

Free pyRevit – IronPython Script Library for Revit

From the pyRevit blog:

pyRevit is an IronPython script library for Revit. However, it is not really written as an example library. It is a working set of tools fully written in IronPython that explores the power of scripting for Revit and also adds some cool functionality.

Download and install it, launch Revit and you will note the new pyRevit tab that hosts buttons to launch all the scripts provided by the package to easily run them without the need to load them in RevitPythonShell or some similar IronPython console.

You can also write your own scripts and add them to pyRevit. There is even a Reload button than dynamically adds the new scripts to the current Revit session without the need to restart Revit.

All the scripts are provided in the pyRevit/extensions folder which is downloaded at installation. You can look into them and learn how to use IronPython for Revit.

A Quick Look at some pyRevit Scripts

Let’s take a quick look at some of the more useful scripts in this library:

Selection Memory

A couple of scripts help you select object more efficiently in Revit. They are similar to the M+, M-, buttons on calculators where you can add or deduct values from memory and read the final value using the MR button.

Under the pyRevit tab, you’ll find MAppend, MAppendOverwrite, MRead, MDeduct, and MClear buttons that add, add and overwrite, read, deduct, and clear the contents of the selection memory. Using these tools, you can navigate between multiple views and select objects, add them to the memory and when you’re done, recall the selection. These tools work really well in combination with other selection tools under pyRevit tab. See images here for the tools and tooltips.

Each tooltip shows the button name, the script that the button is associated with and a description of what the script does.


Copy and Convert Legend Views

This set of scripts help you copy Legend Views to all other project open within a Revit session. You can copy the Legends as Legend views or as Drafting views.


Two more scripts duplicate and convert Legend views to Drafting views and vice versa within the same project.

Matching Element Graphic Overrides

This one is pretty obvious. Run the script, select your source object to pick up the style, and then one by one, select the destination objects to apply the graphic overrides. You can also navigate to other views and apply to objects within that view.


pyRevit provides many other powerful scripts, and most of them are really useful in a production environment.

Editor's Note: Here are some individual post about other scripts in pyRevit:


Release Notes

4.1 (current)

Extension system has been finally added to the core and tested. See Adding your own scripts page on how to add or remove extensions.

4.0

pyRevit has been completely redesigned from ground up. The semantic versioning now only applies to the core features. The rest of the changes to the library are tracked by adding the latest commit hash value to the version.

Example: As of writing this text, pyRevit version is: 4.0 : 8C6C5EA

You can see the current full version at the top of the About window. From now on Release information will only be published for the core features.


3.0.0 beta (deprecated)

During the beta development for version 3, I had extensive discussions with Gui Talarico on how the loader and pyRevit core should be setup. These discussion led to the decision to compeltely redesign the core instead of patching the new features.

under version 4.0:x pyRevit core is an IronPython module and is way more faster, powerful, and extensible than before.

2.49.55
  • Memory > Memory_copyViewportPlacement.py: Copies the location of the selected viewport to memory. This can be later applied to other viewports on other sheets.
  • Memory > Memory_pasteViewportPlacement.py: Pastes a Viewport placement from memory.
  • Tooltip now shows the script Author.
  • Misc changes

2.47.51
  • Revisions > Revisions_listAllSheetsNotShowingRevisionCloudsOnViews.py: Sometimes when a revision cloud is placed inside a view (instead of a sheet) and the view is placed on a sheet, the revision schedule on the sheet does not get updated with the revision number of the cloud inside the sheeted view. This script verifies that the sheet revision schedule is actually listing all the revisions shown inside the views of that sheet.
  • Misc changes

2.46.51
  • Analyse > Analyse_calculateAverageArea.py: Find all Rooms//Areas//Spaces with identical names and calcualts the average area of that space type.
  • Misc changes

2.45.51
  • Revised findReferencingSheets to find referencing sheets for schedules as well.
  • Select > selectAllMirroredDoors: Selects all mirrored doors in the model.
  • Views > removeUnderlayFromSelectedViews: Removes Underlay from selected views.
  • Misc changes

2.43.46
  • WorkSharing > listSheetsWithElementsOwnedByMe: Lists all sheets containing elements currently “owned” by the user. “Owned” elements are the elements by the user since the last synchronize and release.
  • WorkSharing > selectLastEditedByMeInCurrentView: Uses the Worksharing tooltip to find out the element “last edited” by the user in the current view. If current view is a sheet, the tools searches all the views placed on this sheet as well. “Last Edited” elements are elements last edited by the user, and are different from borrowed elements.
  • WorkSharing > selectOwnedByMeInCurrentView: Uses the Worksharing tooltip to find out the element “owned” by the user in the current view. If current view is a sheet, the tools searches all the views placed on this sheet as well. “Owned” elements are the elements edited by the user since the last synchronize and release.
  • Added extended tooltip notes to buttons listing class and assembly name.
  • Minor cleanups

2.40.4
  • Settings > What's New: Added a button to list all the tools added from now on.
  • Sheets > setCropRegionToSelectedShape: Draw the desired crop boundary as a polygon on your sheet (using detail lines). Then select the bounday and the destination viewport and run the script. This script will apply the drafted boundary to the view of the selected viewport.
  • Minor cleanups

Earlier versions

pyRevit was my own private tool for almost two years and honestly I never felt the need to write version changes for myself thus none exists :D

Download Installer.

Read the Docs.

View on GitHub.



pyRevit is brought to you by Ehsan Iran-Nejad. It's free.

There's more information available on the pyRevit blog.

Related

1 comment:

Anonymous said...

What a great set of tools! Thanks Ehsan!