This morning, I ran into an interesting bug in Revit 2016. I opened up my Macro Manager per the norm, but when attempting to create a new module Revit wouldn’t save the new module. It successfully opened the dialog box to let me choose a name, language, and description, however once I clicked “OK” nothing happened. Sharp Develop did not open nor did the new module appear in the Macro Manager window.
I found the suggested fix on Revitforum.org, however it did not work for me. Perhaps because this post was for an earlier version of Revit.
Here’s actually what ended up working for me:
- Close all Revit instances.
- Navigate to your Macros folder on your C drive:
- You may see multiple years in this folder, one per Revit version installed on your computer (e.g., 2014, 2015, 2016, 2017). Move the year of Revit that you are working in to a temporary folder like your desktop.
- Restart Revit.
- Go to your Macro Manager and create a new module.
By creating a new module, Revit recreates this directory and is able to successfully create a new module for your use.
I just stumbled on this script library for Revit users who wish to use Python with the Revit API. In it’s simplest form, it’s a folder of IronPython
.py scripts for Autodesk Revit.
There is plenty of example code written in Python that you can refer to when learning to create macros or add-ins for Revit.
To use Python with Revit, you will need to install a few things:
I don’t want to get into too much detail on how to use Python with Revit in this post, but if you need help getting started, there is a very helpful guide on Productspec.
- Iron Python: http://ironpython.net/download/
- RevitPythonShell: https://code.google.com/p/revitpythonshell/
- Revit Software Development Kit: http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2484975
The good folks over at Boost Your BIM have posted a macro for copying a legend to multiple sheets. It works really well, but I wonder if anyone would like to take on the challenge of doing something similar in Dynamo.
public void legendOnSheets()
Document doc = this.ActiveUIDocument.Document;
// create list of element ids for the sheets that will get the legends
List<ElementId> sheetIds = new List<ElementId>();
// use SheetNumber to find the desired sheets
// add each sheet to the list of sheet ids
.FirstOrDefault(q => q.SheetNumber == "A101").Id);
.FirstOrDefault(q => q.SheetNumber == "A102").Id);
.FirstOrDefault(q => q.SheetNumber == "A103").Id);
// find the legend to put on the sheets
// use ViewType.Legend and the view name to find the legend view
Element legend = new FilteredElementCollector(doc)
.FirstOrDefault(q => q.ViewType == ViewType.Legend && q.Name == "Legend 1");
// create a transaction so that the document can be modified
using (Transaction t = new Transaction(doc, "Legends on Sheets"))
// start the transaction
// loop through the list of sheet ids
foreach (ElementId sheetid in sheetIds)
// create a new viewport for the legend on each sheet
// place the legend view at the 0,0,0 location on each sheet
// user will need to move the legend to the desired location
Viewport.Create(doc, sheetid, legend.Id, new XYZ(0,0,0));
// commit the changes