ElementIntersectsSolidFilter & CreateRevolvedGeometry

There are often multiple good ways to accomplish something with the Revit API. In the case of the “find column closest to a point” challenge, I’ve explained another approach in a new lecture at https://www.udemy.com/revitapi2/?couponCode=49. This one introduces how to use ElementIntersectsSolidFilter & CreateRevolvedGeometry.


Multi-select floor/roof supports

The Revit UI forces supports to be selected individually. You can use the Revit API to allow multi-selection of supports, which is great if you have dozens or hundreds to select.

Learn how at https://www.udemy.com/revitapi2/?couponCode=49

Learn Even More about the Revit API

My Revit API course at Udemy has been a wonderful success! It has been great to have so many people learn about the power and potential of the Revit API through its more than three dozen lectures.

If there are topics of interest to you that are not covered there, or you would like to continue expanding your knowledge of the Revit API, a new course is available at https://www.udemy.com/revitapi2/?couponCode=49.

This new course currently includes lectures on geometry creation and modification, the Revit Error/Warning API, and Site. More courses will be added (up to a total of 5 hours of lectures) based on your requests.

Current introductory pricing is $49 (if you use the coupon link – https://www.udemy.com/revitapi2/?couponCode=49) which includes both the current lectures and those that will be added in the future. The cost of the course will increase as more lectures are added, so enroll now & save!

Creating a mass from Toposurface geometry

Following up this suggestion from Julien, here’s a look at how to create a massing family with geometry built from the mesh of a toposurface.

public void topoToMass()
    Document doc = this.ActiveUIDocument.Document;
    UIDocument uidoc = this.ActiveUIDocument;
    Application app = this.Application;

    TopographySurface topo = doc.GetElement(uidoc.Selection.PickObject(ObjectType.Element)) as TopographySurface;

    Mesh mesh = topo.get_Geometry(new Options()).First(q => q is Mesh) as Mesh;

    Document famDoc = app.NewFamilyDocument(@"C:\ProgramData\Autodesk\RAC 2014\Family Templates\English_I\Conceptual Mass\Mass.rft");

    using (Transaction t = new Transaction(famDoc,"Create massing surfaces"))

        for (int i = 0; i < mesh.NumTriangles; i++)
            MeshTriangle mt = mesh.get_Triangle(i);
            makeForm(famDoc, mt.get_Vertex(0), mt.get_Vertex(1), mt.get_Vertex(2));

            if (i > 0 && i % 100 == 0)
                TaskDialog td = new TaskDialog("Form Counter");
                td.CommonButtons = TaskDialogCommonButtons.Yes|TaskDialogCommonButtons.No;
                td.MainInstruction = i + " out of " + mesh.NumTriangles + " triangles processed. Do you want to continue?";
                if (td.Show() == TaskDialogResult.No)

private Form makeForm(Document doc, XYZ pt1, XYZ pt2, XYZ pt3)
    Form form = null;

    XYZ u = pt2.Subtract(pt1);
    XYZ v = pt3.Subtract(pt1);
    double area = u.CrossProduct(v).GetLength()/2;
    if (area < 10)
        return null;

    ReferenceArray ra = new ReferenceArray();
    ra.Append(MakeCuveByPoints(doc, pt1, pt2).GeometryCurve.Reference);
    ra.Append(MakeCuveByPoints(doc, pt2, pt3).GeometryCurve.Reference);
    ra.Append(MakeCuveByPoints(doc, pt3, pt1).GeometryCurve.Reference);

    form = doc.FamilyCreate.NewFormByCap(true, ra);

    return form;

private CurveByPoints MakeCuveByPoints(Document doc, XYZ ptA, XYZ ptB)
    ReferencePointArray rpa = new ReferencePointArray();
    return doc.FamilyCreate.NewCurveByPoints(rpa);