Monday, July 21, 2014

BIMConsortium Revit Addin Update + New Tools + 2015 Compatible












A new update is available located here: BIMCon_Addin_1.2.zip


Updated
  • Addin now supports both Revit 2014 and 2015
  • Delete Views - Added option to delete all views NOT on a Sheet
















New

3D Room Tags
This tool will place a generic family with 3D text into the center of every room at the specified height above the room's level. Load the included family Room Tag 3D BIMCon.rfa. This family can be modified to what you want it to look like as long as it keeps the same name. I will add an option in the future to pick a family of your own.


















Room to 3D Views
This tool will create four (4) 3D Camera Views for every room in the model. The views are placed at lower-left and upper-right at floor and above ceiling. The heights are adjustable.

* Note: Because of how the API determines a room boundary as a rectangular box, the cameras may be located outside the actual rooms.























Merge Text
This tool is actually two (2) tools, Merge 2 Text and Merge Multiple Text.
















The first one will take two (2) pieces of text and merge them together with several options available.





















The second tool will merge several text elements into the first one selected. Notice that you need to hit ESC to end the selection of elements.

















NOTE:
If you receive an error in Revit about not being able to load the addin, go to the folder where you saved the dll file, right-click the file and go to properties. In the properties dialog click the button to Unblock the file.


Tuesday, June 24, 2014

Revit Lookup 2015 Addin

During my class (BIM Managers Guide to Automating Revit Using Macros) at RTC in Schaumburg (Chicago) last week, I mentioned the Revit Lookup addin. Afterwards several people asked where they could download a compiled version. I compiled the most recent source from https://github.com/jeremytammik/RevitLookup/ and uploaded it to my blog so you can download it (below).

Download
Revit Lookup 2015

Install Instructions
Extract the 2 files to C:\ProgramData\Autodesk\Revit\Addins\2015\


If you are interested in 2013 and 2014 versions you can find them in a blog post from last year: http://revitcoaster.blogspot.com/2013/09/creating-macros-larug-sept-2013.html 

Thursday, June 05, 2014

View Schedule with Detail Numbers Macro for Revit

A question was posted on http://revitforum.org about showing a view's detail number in a view list schedule. Revit has a parameter for the Detail Number (see first image) but it isn't accessible to add in a view list schedule.

Original post: http://www.revitforum.org/architecture-general-revit-questions/20119-detail-number-view-list-schedule.html




















Solution

Step 1
Create a View List schedule (or edit an existing one) and add a new text Parameter named "Detail_Number" (notice the _ in the name)






















Step 2
Create a new macro with the following routine and run it

public void DetailNumber()
{
    UIDocument uidoc = this.ActiveUIDocument;
    Document doc = uidoc.Document;
  
    string strDetailNumber = "Detail_Number";         
  
    FilteredElementCollector collector = new FilteredElementCollector(doc);
    ICollection<Element> collection = collector.OfClass(typeof(View)).ToElements();
  
    using (Transaction t = new Transaction(doc, "Detail Number"))
    {
        t.Start();
      
        foreach(Element e in collection)
        {
            View v = e as View;
          
            try
            {
                Parameter bpDetailNumber = v.get_Parameter(BuiltInParameter.VIEWPORT_DETAIL_NUMBER);
                v.get_Parameter(strDetailNumber).Set(bpDetailNumber.AsString());
            }
            catch
            {
              
            }
          
        }
      
        t.Commit();
    }
}


Results
All the views that are on sheets now have the Detail Number copied into the Detail_Number parameter.



















Run the macro whenever you want to update the values in the new parameter to reflect the current state of the project (aka is doesn't auto update and needs to be run manually).

Wednesday, February 12, 2014

BIM Consortium Addin Updated With New Tool








A new update has been uploaded of the BIM Consortium Revit Addin. The new release adds some polish to the existing tools and  also adds a new tool. Hope you enjoy them as much as I had making them.

Download: https://drive.google.com/file/d/0B16E2YBKmeUtbmZsNDFIUmJHMm8/edit



Dependent Views from Scope Boxes (New)
This new tool will allow you to create dependent views for any number of floor or ceiling plans and apply a Scope Box to them. This tool was created for setting up projects that have multiple work areas divided up using scope boxes.



























Dependent Views (Updated)
The tool now has an interface that allows you to pick how many dependent views you want to duplicate of the current view.















Delete Views (Updated)
Added a logo to the dialog box.























3D Grid Creator (Updated)
Added a logo to the dialog box.


Wednesday, January 29, 2014

BIM Consortium Revit Add-in First Release

I have been working with the Los Angeles Revit Users Group leadership group (known as the BIM Consortium) to start creating a set of Revit add-ins based on meeting discussions. I'm happy to announce the first release of the add-in.

Download: https://drive.google.com/file/d/0B16E2YBKmeUtbmZsNDFIUmJHMm8/edit

Instructions for installation are inside the zip file.


This initial release comes with 3 tools...




3D Grid Generator
This tool is based on the 3D Grid family created by Jay Zallan. Jay demoed the family during a meeting that I happened to also be discussing macros. I challenged myself to take Jay's family and create a macro that would automatically place a 3D Grid family on every grid line in the model. After several iterations, I converted the macro to an add-in and here it is.

The tool is very simple. First load the 3D Grids family included with the add-in into your Revit model. Then start the tool and choose the levels that you would like to have 3D grids on. Then you can use Jay's original guide on how to use the 3D grids. Quick video demo can be found here: https://www.youtube.com/watch?v=-wSnc9-j2O8



** The first release does have a limitation that I am working on fixing and will release in a future update. It currently won't recognize that a 3D grid already exists when creating them. So if you run the tool twice on the same level you will end up with two families in the same place and Revit will let you know. If you want to place new copies if your grid changes, for now you will need to delete the existing 3D grids before you create new ones.


Create Dependent Views
This tool is very simple and came as a request. It will simply duplicate as dependent the active view 5 times. Saves you 5 right-clicks.

** I have already received a request to add a dialog that allows you to pick your own number. It will be in a future update.


Delete Views
This tool was the original reason I wanted to learn how to create macros in Revit. As an MEP firm I work with a lot of models from other companies. In order to keep the numerous linked models manageable, I clean the models by deleting views, legends, schedules, and sheets. I used to do this by hand by deleting them from the project browser. Now I can run this tool and get it done quickly.

Word of caution, this will DELETE views and sheets from your currently active model. Be careful using the tool (I take no responsibility for your usage :-) ).

To use the tool, start from a view you want to keep (Revit requires at least 1 view in a model). Run the tool and choose the option that best suits your model usage.


  • Delete All Non-Plan Views – this option will delete all views except floor and ceiling plans. This is best for consultant models that you will be using linked views.
  • Delete All Views – this option will delete all views in a model except the currently active one.
  • Delete All Except Containing – this option will delete all views except ones containing the word you type in. This is best for prearranged view names for linked models. IE: another company has created views with consultant in the name. Type consultant into the box to delete all but the consultant views.
  • Delete Sheets Too – this option will also delete all the sheets in addition to the options chosen above.

Macro to change all families to the same LEADER ARROWHEAD style

I had a request to write a macro that would change all families' Leader Arrowhead style to the same type in a project.



This is the code I came up with:


public void UpdateLeaders()
        {
            UIDocument uidoc = this.ActiveUIDocument;
            Document doc = uidoc.Document;
            
            // create a collection of all the Arrowhead types
            ElementId id = new ElementId(BuiltInParameter.ALL_MODEL_FAMILY_NAME);
            ParameterValueProvider provider = new ParameterValueProvider(id);
            FilterStringRuleEvaluator evaluator = new FilterStringEquals();
            FilterRule rule = new FilterStringRule(provider, evaluator, "Arrowhead", false);
            ElementParameterFilter filter = new ElementParameterFilter(rule); 
            FilteredElementCollector collector2 = new FilteredElementCollector(doc).OfClass(typeof(ElementType)).WherePasses(filter);
            
            ElementId arrowheadId = null;
              
            // loop through the collection of Arrowhead types and get the Id of a specific one
            foreach(ElementId eid in collector2.ToElementIds())
            {
                if(doc.GetElement(eid).Name == "Arrow Filled 30 Degree") //change the name to the arrowhead type you want to use
                {
                    arrowheadId = eid;
                }
            }
            
            // create a collection of all families
            List<Family> families = new List<Family>(new FilteredElementCollector(doc).OfClass(typeof(Family)).Cast<Family>());
            using(Transaction t = new Transaction(doc, "Update Leaders"))
            {
                t.Start();        
                // loop through all families and get their types       
                foreach(Family f in families)
                {
                    FamilySymbolSet symbols = f.Symbols;
                    List<FamilySymbol> symbols2 = new List<FamilySymbol>(symbols.Cast<FamilySymbol>());
                 
                     // loop through the family types and try switching the parameter Leader Arrowhead to the one chosen above
                     // if the type doesn't have this parameter it will skip to the next family type
                    foreach(FamilySymbol fs in symbols2)
                    {
                        try
                         {
                             fs.get_Parameter(BuiltInParameter.LEADER_ARROWHEAD).Set(arrowheadId);
                         }
                         catch
                         {
                             
                         }
                     }
                }
                t.Commit();
            }
        }