0749/2078
Add-In Wizard for Revit 2013
Originally Published inI have been using an updated version of my Visual Studio Revit C# add-in wizard for Revit 2013 for a while now and thought you might find it useful as well.
It now generates a bit more boiler-plate code up front which can be simply deleted if not needed:
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Application app = uiapp.Application;
Document doc = uidoc.Document;
// Access current selection
Selection sel = uidoc.Selection;
// Retrieve elements from database
FilteredElementCollector col
= new FilteredElementCollector( doc )
.WhereElementIsNotElementType()
.OfCategory( BuiltInCategory.INVALID )
.OfClass( typeof( Wall ) );
// Filtered element collector is iterable
foreach( Element e in col )
{
Debug.Print( e.Name );
}
// Modify document within a transaction
Transaction tx = new Transaction( doc );
tx.Start();
tx.Commit();
return Result.Succeeded;
For the full description of the wizards, please refer to these previous posts:
- Original introduction, benefits, and usage example for C# and VB.
- Personalised minimal C# version for Revit 2011.
- A short additional usage note.
- 64 bit versions for C# and VB.
- Support for the Revit 2012 API for C# and VB.
- Updated C# and VB versions placing assembly DLL alongside add-in manifest and including other changes.
To install, simply copy the zip file to the Visual Studio C# project template folder in your local file system:
- RevitAddinWizardQuasarRP.zip – copy to
[My Documents]\Visual Studio 2010\Templates\ProjectTemplates\Visual C#
Any volunteers to create and test the VB version?