Application: AutoRoute
Revit Platform: All
Revit Version: 2011.0
First Released For: 2010.0
Programming Language: C#
Skill Level: Beginning
Category: MEP
Type: ExternalCommand

Subject: Route ducts and fittings.
Summary: 
This sample demonstrates how to route a set of ducts and fittings between a base air supply equipment and 2 terminals.

Classes: 
Autodesk.Revit.DB.Mechanical.MechanicalSystem
Autodesk.Revit.DB.Mechanical.Duct
Autodesk.Revit.DB.FamilyInstance
Autodesk.Revit.DB.Connector
Autodesk.Revit.DB.Document

Project Files: 
Command.cs
This file contains the class Command which inherits from IExternalCommand. The function of it is to route a set of ducts and fittings between a base air supply equipment and 2 terminals.

Description: 
-	To create a mechanical system, use Document.Create.NewMechanicalSystem.
-	To define the route, first find the bounding box that bounds all the three elements and then try the middle line, quarter lines on the X and Y axis as the trunk with a series of ducts that will be connected to the elements with fittings and ducts.
-	To create duct, use Document.Create.NewDuct.
-	To create fittings, use Document.Create.NewElbowFitting and Document.Create.NewTeeFitting.
-	To make a connection between connectors, use Connector.ConnectTo

Instructions: 
1.	Run the command. (Before that, you can move the positions of terminals and equipment)
2.	A mechanical system and its duct work will be created automatically.