Application: FabricationPartLayout
Revit Platform: MEP
Revit Version: 2016.0
First Released For: 2016.0
Programming Language: C#
Skill Level: Medium
Category: MEP
Type: ExternalCommand

Subject: Fabrication Part
Summary: 
This sample shows how to use the Fabrication Part API to create a sample layout, which includes rectangular and round ductwork, tap placement, rotations and straight optimizations and connections to a generic Revit family instance.

Classes: 
Autodesk.Revit.DB.Connector
Autodesk.Revit.DB.ConnectorSet
Autodesk.Revit.DB.Document
Autodesk.Revit.DB.ElementId
Autodesk.Revit.DB.FabricationConfiguration
Autodesk.Revit.DB.FabricationDimensionDefinition
Autodesk.Revit.DB.FabricationPart
Autodesk.Revit.DB.FabricationService
Autodesk.Revit.DB.FabricationServiceButton
Autodesk.Revit.DB.FamilyInstance
Autodesk.Revit.DB.Level
Autodesk.Revit.DB.MEPConnectorInfo
Autodesk.Revit.DB.Parameter
Autodesk.Revit.UI.IExternalCommand

Project Files: 
FabricationPartLayout.cs
It contains the class FabricationPartLayout which inherits from interface IExternalCommand and implements the Execute method. This class shows the user how to create a sample layout containing fabrication parts.

OptimizeStraights.cs
It contains the class OptimizeStraights which inherits from interface IExternalCommand and implements the Execute method. This class shows the user how to use the Optimize Lengths method based on a user selection.

Description: 
This sample provides the following functionalities.
-	Creates a sample layout from fabrication parts
-	Access fabrication configuration information
-	Connects fabrication taps to fabrication straight parts
-	Rotates fabrication parts about its connected end
-	Modify specification
-	Modify insulation specification
- 	Modify fabrication material
-	Modify fabrication connector
-	Place fabrication taps on fabrication straight parts
-   Place fabrication hangers on fabrication straight parts

-	Optimize the lengths of fabrication straight parts based on user selection
Instructions: 
Open Revit application.
1.	Fabrication Part Layout
a.   Load FabricationPartLayout.rvt
b.   Execute the command.
Expected result: Draws a sample layout containing fabrication parts connected to the existing Revit AHU instance.

2.	Optimize Straights
a.	Load FabricationPartLayout.rvt or add some fabrication part straights.
b.	Make a selection of the fabrication parts, making sure to select some of the longer fabrication part straights.
c.	Execute the command

Expected result: Fabrication part lengths longer than the standard length will be optimized into smaller straight parts.