Keep those macro names unique

If you try to create a macro named “Line” the result will be an error like:
‘ThisApplication.Line()’ is a ‘method’, which is not valid in the given context (CS0119)”

The red squiggly line indicating the error is misleading. The problem here is not really on line 38. The problem is that the name of your macro defines a method called Line which does not have a CreateBound method. Then the compiler gets confused when you try to call the CreateBound method on the Autodesk.Revit.DB.Line class.

So keep those macro names unique to avoid this problem. Renaming the macro to Line1, LineTest, or anything like that will solve the problem.

Capture

File Version Check & Reporting Tool enhanced for 2015

The File Version Check tool has been updated and enhanced for Revit 2015. It provides a cancellable dialog before upgrading files from a previous version and produces reports about the

Download the 2015 installer at http://gdurl.com/eWec/download
This trial version works with all files up to 50MB. Contact Boost Your BIM to upgrade.

Finding those constraining dimensions

Steve asks a lot of good questions and it is nice that the API is often able to help answer them. Recently he asked “Where are the Constraining Dimensions?

Here’s how to use the Dimension.IsLocked property to find those constraining dimensions:

Capture

For the entries where a segment of a multi-segment dimension is locked (such as #s 30, 31, 32), every reference of every segment is listed instead of just listing the two references related to the locked segment. This happens because while the Dimension class does has a References property, the DimensionSegement class has no such property. So the output is all references of the “parent” dimension instead of the two references of the relevant segment.

Capture

public void getConstraints()
{
    Document doc = this.ActiveUIDocument.Document;
    string data = "";
    int ctr = 1;
    foreach (Dimension d in new FilteredElementCollector(doc)
             .OfClass(typeof(Dimension))
             .Cast<Dimension>())
    {                
        if (d.NumberOfSegments == 0 && d.IsLocked)
        {
            data += ctr + ": id = " + d.Id.IntegerValue + " " + getReferenceNames(doc, d.References) + Environment.NewLine;
            ctr++;
        }
        else if (d.NumberOfSegments > 1)
        {
            foreach (DimensionSegment ds in d.Segments)
            {
                if (ds.IsLocked)
                {
                    data += ctr + ": id = " + d.Id.IntegerValue + " " + getReferenceNames(doc, d.References) + " - segment" + Environment.NewLine;
                    ctr++;
                }
            }
        }
    }
    if (data == "")
        data = "No locked dimensions";
    
    TaskDialog td = new TaskDialog("Locked Dimensions");
    td.MainContent = data;
    td.Show();
}

private string getReferenceNames(Document doc, ReferenceArray ra)
{
    string ret = "";
    foreach (Reference r in ra)
    {
        Element e = doc.GetElement(r);
        if (e.Category != null)
            ret += "(" + e.Category.Name + ") ";
        ret += e.Name + " & ";
    }
    
    // trim trailing " & "
    ret = ret.Remove(ret.Length - 3);
    
    return ret;
}

Image O Matic for 2015 now available

Image-O-Matic was the first Boost Your BIM app and remains one of the most popular!

Click here to purchase the 2015 version. A URL for the software download will be sent shortly after your purchase is completed.

You can use Image-O-Matic to generate images by varying values related to instance parameters or displacements sets, or create an image for each phase in your Revit model.

This video shows it in action with displacement sets.

And here is an animation created by using to vary instance parameters