Tuesday, April 21, 2015

RevitLookup for Revit 2016

With Revit 2016 officially out, I am working on updating my addins for 2016. One of the most invaluable addins has already been updated. Per Jeremy Tammik on his website, http://thebuildingcoder.typepad.com/blog/2015/04/revit-2016-api-news-and-devdays-online-recording.html, RevitLookup has been updated for Revit 2016.

















You can get the source code here: https://github.com/jeremytammik/RevitLookup/releases/tag/2016.0.0.6 and build it yourself.

Or you can download a zip with a version that I have already built here: https://app.box.com/s/5hxbjrtgk77a80uwvycvfxinjvo9tzvt

Just extract the contents of the zip file into your Revit 2016 addins folder ( C:\ProgramData\Autodesk\Revit\Addins\2016\ )

Thursday, April 02, 2015

Convert View Names on Sheets to UPPERCASE

Here is a quick little Revit Macro that will change all the View names on Sheets to UPPERCASE. This helps when browsing through the Project Browser to identify which views are placed on Sheets. It is one directional at the moment, so if a view that is already UPPERCASE is not on a sheet anymore it won't change it back to lowercase. If I add this in the future I will post an update then.


public void SheetViewNamesToUppercase()
{
    Document doc =  this.ActiveUIDocument.Document;
   
    using(Transaction t = new Transaction(doc, "Sheet View Names to Uppercase"))
    {
        t.Start();
       
        foreach(ViewSheet vs in new FilteredElementCollector(doc).OfClass(typeof(ViewSheet)))
        {
            foreach(ElementId eid in vs.GetAllPlacedViews())
            {
                try
                {
                    View v = doc.GetElement(eid) as View;
                    v.Name = v.Name.ToUpper();
                }
                catch
                {                           
                }
               
            }
        }
       
        foreach (ViewSchedule vsc in new FilteredElementCollector(doc).OfClass(typeof(ViewSchedule)))
        {
            foreach (ScheduleSheetInstance ssi in new FilteredElementCollector(doc).OfClass(typeof(ScheduleSheetInstance)))
            {
                if (vsc.Name == ssi.Name)
                {
                    try
                    {
                        vsc.Name = vsc.Name.ToUpper();
                    }
                    catch
                    {                               
                    }
                   
                }
            }
        }

        t.Commit();
    }
}