Mechanical Settings

Mechanical Settings

Many of the settings available on the Manage tab under MEP Settings - Mechanical Settings are also available through the Revit API.

Pipe Settings



Pipe Settings

The PipeSettings class provides access to the settings shown above, such as Pipe Size Suffix and Pipe Connector Tolerance. There is one PipeSettings object per document and it is accessible through the static method PipeSettings.GetPipeSettings().

Fitting Angles

Fitting angle usage settings for pipes are available from the following property and methods of the PipeSettings class:

  • PipeSettings.FittingAngleUsage
  • PipeSettings.GetSpecificFittingAngles()
  • PipeSettings.GetSpecificFittingAngleStatus()
  • PipeSettings.SetSpecificFittingAngleStatus()


Pipe Fitting Angles

Segments and Sizes

The settings available in the UI under Pipe Settings - Segments and Sizes are available as well.

Segments and Sizes

This information is available through the Segment and MEPSize classes. A Segment represents a length of MEPCurve that contains a material and set of available sizes. The pipe sizes are represented by the MEPSize class. The Segments available can be found using a filter. The following example demonstrates how to get some of the information in the dialog above.

Code Region: Traversing Pipe Sizes in Pipe Settings

FilteredElementCollector collectorPipeType = new FilteredElementCollector(document);
collectorPipeType.OfClass(typeof(Segment));

IEnumerable<Segment> segments = collectorPipeType.ToElements().Cast<Segment>();
foreach (Segment segment in segments)
{
    StringBuilder strPipeInfo = new StringBuilder();
    strPipeInfo.AppendLine("Segment: " + segment.Name);
                    
    strPipeInfo.AppendLine("Roughness: " + segment.Roughness);

    strPipeInfo.AppendLine("Pipe Sizes:");
    double dLengthFac = 304.8;  // used to convert stored units from ft to mm for display
    foreach (MEPSize size in segment.GetSizes())
    {
        strPipeInfo.AppendLine(string.Format("Nominal: {0:F3}, ID: {1:F3}, OD: {2:F3}",
                                    size.NominalDiameter * dLengthFac, size.InnerDiameter * dLengthFac, size.OuterDiameter * dLengthFac));
    }

                    
    TaskDialog.Show("PipeSetting Data", strPipeInfo.ToString());
    break;                  
}

Output of previous example

To add new sizes to the list, use the Segment.AddSize() method. Use Segment.RemoveSize() to remove a size by nominal diameter.

Slopes

The PipeSettings class also provides access to the slope values available in the UI under Pipe Settings - Slopes. Use GetPipeSlopes() to retreive a list of slope values. PipeSettings.SetPipeSlopes() provides the ability to set all the slope values at once, while PipeSettings.AddPipeSlope() adds a single pipe slope. Revit stores the slope value as a percentage (0-100).

Pipe Slope Values

Duct Settings

Duct Settings

The DuctSettings class provides access to the settings shown above, such as Duct Fitting Annotation Size and Air Density. There is one DuctSettings object per document and it is accessible through the static method DuctSettings.GetDuctSettings().

Duct Fitting Angles

Fitting angle usage settings for ducts are available from the following property and methods of the DuctSettings class:

  • DuctSettings.FittingAngleUsage
  • DuctSettings.GetSpecificFittingAngles()
  • DuctSettings.GetSpecificFittingAngleStatus()
  • DuctSettings.SetSpecificFittingAngleStatus()

Duct Fitting Angles