Application: CreateAirHandler
Revit Platform: MEP
Revit Version: 2011.0
First Released For: 2010.0
Programming Language: C#
Skill Level: Medium
Category: Families
Type: ExternalCommand

Subject: Create one air handler and add connectors.
Summary: 
This sample creates one air handler and adds connectors (piping, duct).

Classes: 
Autodesk.Revit.UI.IExternalCommand
Autodesk.Revit.UI.UIDocument
Autodesk.Revit.Creation.FamilyItemFactory
Autodesk.Revit.DB.Extrusion
Autodesk.Revit.DB.Mechanical.DuctConnector
Autodesk.Revit.DB.Plumbing.PipeConnector
Autodesk.Revit.DB.CombinableElement

Project Files: 
Command.cs
      This file contains the class Command that inherits from IExternalCommand and implements the Execute method to create some extrusions and add connectors on them.

Description: 
This sample first utilizes the OwnerFamily.FamilyCategory property to check the template.

And then this sample utilizes the NewExtrusion, NewPipeConnector, NewDuctConnector in Autodesk.Revit.Creation.FamilyItemFactory class to create handler and connectors, and utilizes xxxDuct properties to set proper parameters of connectors.

Finally, this sample utilizes the method Document::CombineElements to join the extrusions in one air handler.

Instructions: 
This external command can be run on Revit family.
1.	Update your Revit.ini by following lines: 
[ExternalCommands]
ECCount        = 1
ECName1        = Create Air Handler
ECClassName1   = Revit.SDK.Samples.CreateAirHandler.CS.Command
ECAssembly1    = <your path>\CreateAirHandler.dll
ECDescription1 = Create one air handler and add connectors.
2.	Create a Revit family with “Mechanical Equipment” template file.
3.	Run this external command and the air handler is created.