Application: AutoJoin
Revit Platform: All
Revit Version: 2011.0
First Released For: 2010.0
Programming Language: C#
Skill Level: Medium
Category: Geometry
Type: ExternalCommand

Subject: Automatically join geometry of combinable elements.
Summary: 
This sample demonstrates how to automatically join geometry between multiple generic forms for use in family modeling and massing. 

Classes: 
Autodesk.Revit.UI.IExternalCommand
Autodesk.Revit.DB.Document
Autodesk.Revit.DB.CombinableElement

Project Files: 
Command.cs
      Implement this method as an external command for Revit.
AutoJoin.cs
      Join all the overlapping generic forms in this document.
Intersection.cs
      Tell if two geometry objects are overlapping or not.

Description: 
This sample utilizes the method Document::CombineElements to join geometry between overlapping generic forms for use in family modeling and massing.

This sample provide a utility method to tell if two geometry objects are overlapping or not, based on the API method Face::Intersect(Curve).

Instructions: 
This external command can be run on Revit family document.

1.	Open a Revit family that includes generic forms (Sweep, Blend, Extrusion and Revolution).
2.	Run this external command and all overlapping generic forms are joined.

Optional:
1.	Open a Revit family that includes generic forms (Sweep, Blend, Extrusion and Revolution).
2.	Select multiple generic forms.
3.	Run this external command and the selected generic forms are joined, whether or not they overlap.