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();
            }
        }


Tuesday, November 19, 2013

Setting an Image's Visibility to Off in a Family

I am revamping several of our engineer's stamps for Revit 2014 and didn't want to go through the old process of converting their signature from an image to CAD and then importing to Revit. So I decided to just use the images and went to set the Visibility to a parameter and found it wasn't available (I already knew this from way back, but forgot about it).

Image in Family with no Parameter for Visibility

















Looking over the small list of parameters, it hit me. Why not make the Width and Height equal to 0 when I don't want to see the signature, thus setting it to not visible.

So I setup 3 parameters called Show Signature, Sig_W, and Sig_H. I then linked the Image's Width to Sig_W and Height to Sig_H. Lastly I created a formula for Sig_W and Sig_H to adjust the image size off of the parameter Show Signature's value.

New Parameters and Formulas


















Linking the Width and Height to the New Parameters

Monday, November 18, 2013

Quick Macro that creates 5 Dependent Views for the Current View

I had a user that needed to create 5 dependent views for 5 areas in a building across several views and disciplines. To save him time, I created this quick macro that will create 5 dependent views for the active view. This will save a lot of right-clicking on each view.

Code:


        public void CreateDependentViews()
        {
            UIDocument uidoc = this.ActiveUIDocument;
            Document doc = uidoc.Document;

            using(Transaction t = new Transaction(doc, "Duplicate View 5x"))
            {
                t.Start();
              
                int i = 0;
              
                while (i < 5)
                {
                    uidoc.ActiveView.Duplicate(ViewDuplicateOption.AsDependent);
                    i++;
                }               
                t.Commit();                   
            }           
        }


I expanded it a bit more and did some renaming based on Areas just to enhance it a bit.

Code:

        public void CreateDependentViews()
        {
            UIDocument uidoc = this.ActiveUIDocument;
            Document doc = uidoc.Document;

            using(Transaction t = new Transaction(doc, "Duplicate View 5x"))
            {
                t.Start();
               
                int i = 0;
               
                while (i < 5)
                {
                    ElementId dupViewId = uidoc.ActiveView.Duplicate(ViewDuplicateOption.AsDependent);
                    View dupView = doc.GetElement(dupViewId) as View;
                    char c = (char) (i + 65);
                    dupView.Name = uidoc.ActiveView.Name + " - AREA " + c.ToString();
                   
                    i++;
                }
               
                t.Commit();                   
            }           
        }