Simplifying Nested Family Instances

José Alberto Torres Jaraute has been working on an add-in tool to protect the intellectual property built into a complex hierarchy of nested family instances by replacing them with a flatter and simpler hierarchy, yet retaining all the relevant non-confidential custom data.

Basically, his tool also enables location of overlapping elements and duplicates elimination.

In the course of this work, Alberto raised a number of questions in the Revit API discussion forum:

These discussions led to a fruitful conclusion, and Alberto now very kindly reports on the successful project completion:

I use the term SET to denote all the FamilyInstance children of a FamilyInstance with multiple sub-instances.

I implemented the following procedure to deal with a SET:

      doc.Create.NewFamilyInstance(
        point, symbol, xvec, sketchPlane,
        StructuralType.NonStructural );

I also implemented an event to cancel the warnings displayed when inserting a new family instance at a point where another one already exists. It is removed again after terminating this process.

Unfortunately, I cannot share the complete code for confidentiality reasons.

Thank you very much for the fruitful discussions!

Many thanks to Alberto for sharing his experience and workflow!

By the way, in case you are interested in flattening and simplifying, you might also want to check out the more radical approach of flattening all elements to DirectShape.

Nested matryoshka dolls