Class Duct
- Namespace
- OpenMEPRevit.Element
- Assembly
- OpenMEPRevit.dll
A duct in the Autodesk Revit MEP product.
public class Duct
- Inheritance
-
Duct
- Inherited Members
Remarks
The duct is only available in the Autodesk Revit MEP product.
Methods
ConnectAirTerminalOnDuct(Element, Element)
Connects an air terminal to a duct directly (without the need for a tee or takeoff).
public static bool ConnectAirTerminalOnDuct(Element airTerminal, Element duct)
Parameters
airTerminalElementThe air terminal element.
ductElementThe duct curve element.
Returns
- bool
True if connection succeeds, false otherwise.
Remarks
The current location of the air terminal will be projected to the duct centerline, and if the point can be successfully projected, the air terminal will be placed on the most suitable face of the duct.
Exceptions
- ArgumentException
The familyinstance is not air terminal. -or- The element is not duct curve. -or- The air terminal already has physical connection. -or- The air terminal connector origin doesn't project within the center line of the duct.
- ArgumentNullException
A non-optional argument was null
ConvertPlaceholdersToDucts(Element)
Converts a collection of duct placeholder elements into duct elements.
public static IEnumerable<Element?> ConvertPlaceholdersToDucts(Element ductPlaceholder)
Parameters
ductPlaceholderElementA collection of element of duct placeholder.
Returns
- IEnumerable<Element>
A collection of element IDs of ducts and fittings.
Remarks
Once conversion succeeds, the duct placeholder elements are deleted. The new duct and fitting elements are created and connections are established.
Exceptions
- ArgumentException
The given element id set is empty. -or- The given element IDs (placeholderIds) are not duct placeholders. -or- The elements belong to different types of system.
- ArgumentNullException
A non-optional argument was null
CreateByConnectorAndPoint(Element, Element, Connector, Point)
Creates a new duct that connects to the connector.
[NodeCategory("Create")]
public static Element? CreateByConnectorAndPoint(Element ductType, Element level, Connector startConnector, Point endPoint)
Parameters
ductTypeElementThe Element of the new duct type.
levelElementThe level for the new duct.
startConnectorConnectorThe first connector where the new duct starts.
endPointPointThe second point of the new duct.
Returns
- Element
The created duct.
Examples

Remarks
The new duct will have the same diameter and system type as the specified connector. The creation will also connect the new duct to the component who owns the specified connector. If necessary, additional fitting(s) are included to make a valid connection. If the new duct can not be connected to the next component (e.g., mismatched direction, no valid fitting, and etc), the new duct will still be created at the specified connector position, and an InvalidOperationException is thrown.
Exceptions
- ArgumentException
The duct type ductTypeId is not valid duct type. -or- The ElementId levelId is not a Level. -or- The connector's domain is not Domain.​DomainHvac. -or- The points of startConnector and endPoint are too close: for MEPCurve, the minimum length is 1/10 inch.
- ArgumentNullException
A non-optional argument was null
- DisabledDisciplineException
None of the following disciplines is enabled: Mechanical Electrical Piping.
- InvalidOperationException
Thrown when the new duct fails to connect with the connector.
CreateByConnectorAndPoint(Element, Element, Connector, Point, double, double)
Creates a new duct that connects to the connector.
[NodeCategory("Create")]
public static Element? CreateByConnectorAndPoint(Element ductType, Element level, Connector startConnector, Point endPoint, double width, double height)
Parameters
ductTypeElementThe Element of the new duct type.
levelElementThe level for the new duct.
startConnectorConnectorThe first connector where the new duct starts.
endPointPointThe second point of the new duct.
widthdoublenew value width of duct
heightdoublenew value height of duct
Returns
- Element
The created duct.
Examples

Remarks
The new duct will have the same diameter and system type as the specified connector. The creation will also connect the new duct to the component who owns the specified connector. If necessary, additional fitting(s) are included to make a valid connection. If the new duct can not be connected to the next component (e.g., mismatched direction, no valid fitting, and etc), the new duct will still be created at the specified connector position, and an InvalidOperationException is thrown.
Exceptions
- ArgumentException
The duct type ductTypeId is not valid duct type. -or- The ElementId levelId is not a Level. -or- The connector's domain is not Domain.​DomainHvac. -or- The points of startConnector and endPoint are too close: for MEPCurve, the minimum length is 1/10 inch.
- ArgumentNullException
A non-optional argument was null
- DisabledDisciplineException
None of the following disciplines is enabled: Mechanical Electrical Piping.
- InvalidOperationException
Thrown when the new duct fails to connect with the connector.
CreateByLine(Element, Element, Element, Line)
Creates a new duct from Line.
[NodeCategory("Create")]
public static Element? CreateByLine(Element systemType, Element ductType, Element level, Line line)
Parameters
systemTypeElementThe element of the HVAC system type.
ductTypeElementThe element of the duct type.
levelElementThe level for the duct.
lineLinethe line to draw new duct
Returns
- Element
The created duct.
Examples

Exceptions
- ArgumentException
The systemType is not valid HVAC system type. -or- The duct type ductType is not valid duct type. -or- The Element level is not a Level. -or- The points of startPoint and endPoint are too close: for MEPCurve, the minimum length is 1/10 inch.
- ArgumentNullException
A non-optional argument was null
- DisabledDisciplineException
None of the following disciplines is enabled: Mechanical Electrical Piping.
CreateByLine(Element, Element, Element, Line, double, double)
Creates a new duct from Line.
[NodeCategory("Create")]
public static Element? CreateByLine(Element systemType, Element ductType, Element level, Line line, double width, double height)
Parameters
systemTypeElementThe element of the HVAC system type.
ductTypeElementThe element of the duct type.
levelElementThe level for the duct.
lineLinethe line to draw new duct
widthdoublenew value width of duct
heightdoublenew value height of duct
Returns
- Element
The created duct.
Examples

Exceptions
- ArgumentException
The systemType is not valid HVAC system type. -or- The duct type ductType is not valid duct type. -or- The Element level is not a Level. -or- The points of startPoint and endPoint are too close: for MEPCurve, the minimum length is 1/10 inch.
- ArgumentNullException
A non-optional argument was null
- DisabledDisciplineException
None of the following disciplines is enabled: Mechanical Electrical Piping.
CreateByTwoConnector(Element, Element, Connector, Connector)
Creates a new duct that connects to two connectors.
[NodeCategory("Create")]
public static Element? CreateByTwoConnector(Element ductType, Element level, Connector startConnector, Connector endConnector)
Parameters
ductTypeElementThe Element of the new duct type.
levelElementThe level Element for the new duct.
startConnectorConnectorThe first connector where the new duct starts.
endConnectorConnectorThe second point of the new duct.
Returns
- Element
The created duct.
Examples

Remarks
The new duct will have the same diameter and system type as the start connector. The creation will also connect the new duct to two component who owns the specified connectors. If necessary, additional fitting(s) are included to make a valid connection. If the new duct can not be connected to the next component (e.g., mismatched direction, no valid fitting, and etc), the new duct will still be created at the specified connector position, and an InvalidOperationException is thrown.
Exceptions
- ArgumentException
The duct type ductTypeId is not valid duct type. -or- The ElementId levelId is not a Level. -or- The connector's domain is not Domain.​DomainHvac. -or- The points of startConnector and endConnector are too close: for MEPCurve, the minimum length is 1/10 inch.
- ArgumentNullException
A non-optional argument was null
- DisabledDisciplineException
None of the following disciplines is enabled: Mechanical Electrical Piping.
- InvalidOperationException
Thrown when the new duct fails to connect with the connector.
CreateByTwoConnector(Element, Element, Connector, Connector, double, double)
Creates a new duct that connects to two connectors.
[NodeCategory("Create")]
public static Element? CreateByTwoConnector(Element ductType, Element level, Connector startConnector, Connector endConnector, double width, double height)
Parameters
ductTypeElementThe Element of the new duct type.
levelElementThe level Element for the new duct.
startConnectorConnectorThe first connector where the new duct starts.
endConnectorConnectorThe second point of the new duct.
widthdoublenew value width of duct
heightdoublenew value height of duct
Returns
- Element
The created duct.
Examples

Remarks
The new duct will have the same diameter and system type as the start connector. The creation will also connect the new duct to two component who owns the specified connectors. If necessary, additional fitting(s) are included to make a valid connection. If the new duct can not be connected to the next component (e.g., mismatched direction, no valid fitting, and etc), the new duct will still be created at the specified connector position, and an InvalidOperationException is thrown.
Exceptions
- ArgumentException
The duct type ductTypeId is not valid duct type. -or- The ElementId levelId is not a Level. -or- The connector's domain is not Domain.​DomainHvac. -or- The points of startConnector and endConnector are too close: for MEPCurve, the minimum length is 1/10 inch.
- ArgumentNullException
A non-optional argument was null
- DisabledDisciplineException
None of the following disciplines is enabled: Mechanical Electrical Piping.
- InvalidOperationException
Thrown when the new duct fails to connect with the connector.
CreateByTwoPoint(Element, Element, Element, Point, Point)
Creates a new duct from two points.
[NodeCategory("Create")]
public static Element? CreateByTwoPoint(Element systemType, Element ductType, Element level, Point startPoint, Point endPoint)
Parameters
systemTypeElementThe element of the HVAC system type.
ductTypeElementThe element of the duct type.
levelElementThe level for the duct.
startPointPointThe start point of the duct.
endPointPointThe end point of the duct.
Returns
- Element
The created duct.
Examples

Exceptions
- ArgumentException
The systemType is not valid HVAC system type. -or- The duct type ductType is not valid duct type. -or- The Element level is not a Level. -or- The points of startPoint and endPoint are too close: for MEPCurve, the minimum length is 1/10 inch.
- ArgumentNullException
A non-optional argument was null
- DisabledDisciplineException
None of the following disciplines is enabled: Mechanical Electrical Piping.
CreateByTwoPoint(Element, Element, Element, Point, Point, double, double)
Creates a new duct from two points.
[NodeCategory("Create")]
public static Element? CreateByTwoPoint(Element systemType, Element ductType, Element level, Point startPoint, Point endPoint, double width, double height)
Parameters
systemTypeElementThe element of the HVAC system type.
ductTypeElementThe element of the duct type.
levelElementThe level for the duct.
startPointPointThe start point of the duct.
endPointPointThe end point of the duct.
widthdoublenew value width of duct
heightdoublenew value height of duct
Returns
- Element
The created duct.
Examples

Exceptions
- ArgumentException
The systemType is not valid HVAC system type. -or- The duct type ductType is not valid duct type. -or- The Element level is not a Level. -or- The points of startPoint and endPoint are too close: for MEPCurve, the minimum length is 1/10 inch.
- ArgumentNullException
A non-optional argument was null
- DisabledDisciplineException
None of the following disciplines is enabled: Mechanical Electrical Piping.
CreatePlaceholderByLine(Element, Element, Element, Line)
Creates a new placeholder duct.
[NodeCategory("Create")]
public static Element? CreatePlaceholderByLine(Element systemType, Element ductType, Element level, Line line)
Parameters
systemTypeElementThe element of the HVAC system type.
ductTypeElementThe element of the duct type.
levelElementThe element level for the duct.
lineLinethe line to draw duct from start point to end point
Returns
- Element
The created placeholder duct.
Examples

Exceptions
- ArgumentException
The systemType is not valid HVAC system type. -or- The ductType is not valid duct type. -or- The Element level is not a Level. -or- The points of startPoint and endPoint are too close: for MEPCurve, the minimum length is 1/10 inch.
- ArgumentNullException
A non-optional argument was null
- DisabledDisciplineException
None of the following disciplines is enabled: Mechanical Electrical Piping.
CreatePlaceholderByLine(Element, Element, Element, Line, double, double)
Creates a new placeholder duct.
[NodeCategory("Create")]
public static Element? CreatePlaceholderByLine(Element systemType, Element ductType, Element level, Line line, double width, double height)
Parameters
systemTypeElementThe element of the HVAC system type.
ductTypeElementThe element of the duct type.
levelElementThe element level for the duct.
lineLinethe line to draw duct from start point to end point
widthdoublenew value width of duct
heightdoublenew value height of duct
Returns
- Element
The created placeholder duct.
Examples

Exceptions
- ArgumentException
The systemType is not valid HVAC system type. -or- The ductType is not valid duct type. -or- The Element level is not a Level. -or- The points of startPoint and endPoint are too close: for MEPCurve, the minimum length is 1/10 inch.
- ArgumentNullException
A non-optional argument was null
- DisabledDisciplineException
None of the following disciplines is enabled: Mechanical Electrical Piping.
CreatePlaceholderByTwoPoint(Element, Element, Element, Point, Point)
Creates a new placeholder duct.
[NodeCategory("Create")]
public static Element? CreatePlaceholderByTwoPoint(Element systemType, Element ductType, Element level, Point startPoint, Point endPoint)
Parameters
systemTypeElementThe element of the HVAC system type.
ductTypeElementThe element of the duct type.
levelElementThe element level for the duct.
startPointPointThe first point of the placeholder line.
endPointPointThe second point of the placeholder line.
Returns
- Element
The created placeholder duct.
Examples

Exceptions
- ArgumentException
The systemType is not valid HVAC system type. -or- The ductType is not valid duct type. -or- The Element level is not a Level. -or- The points of startPoint and endPoint are too close: for MEPCurve, the minimum length is 1/10 inch.
- ArgumentNullException
A non-optional argument was null
- DisabledDisciplineException
None of the following disciplines is enabled: Mechanical Electrical Piping.
CreatePlaceholderByTwoPoint(Element, Element, Element, Point, Point, double, double)
Creates a new placeholder duct.
[NodeCategory("Create")]
public static Element? CreatePlaceholderByTwoPoint(Element systemType, Element ductType, Element level, Point startPoint, Point endPoint, double width, double height)
Parameters
systemTypeElementThe element of the HVAC system type.
ductTypeElementThe element of the duct type.
levelElementThe element level for the duct.
startPointPointThe first point of the placeholder line.
endPointPointThe second point of the placeholder line.
widthdoublenew value width of duct
heightdoublenew value height of duct
Returns
- Element
The created placeholder duct.
Examples

Exceptions
- ArgumentException
The systemType is not valid HVAC system type. -or- The ductType is not valid duct type. -or- The Element level is not a Level. -or- The points of startPoint and endPoint are too close: for MEPCurve, the minimum length is 1/10 inch.
- ArgumentNullException
A non-optional argument was null
- DisabledDisciplineException
None of the following disciplines is enabled: Mechanical Electrical Piping.
GetDiameter(Element)
return diameter of duct
[MultiReturn(new string[] { "width", "height", "diameter" })]
[NodeCategory("Query")]
public static Dictionary<string, object?> GetDiameter(Element duct)
Parameters
ductElementthe duct
Returns
Examples

IsDuctTypeId(Element)
Check if the element of duct is a valid duct type
[NodeCategory("Query")]
public static bool IsDuctTypeId(Element systemType)
Parameters
systemTypeElementthe system type of duct
Returns
- bool
true if is duct type id
Examples

IsHvacSystemTypeId(Element)
Check if the element of duct is a valid system type
[NodeCategory("Query")]
public static bool IsHvacSystemTypeId(Element systemType)
Parameters
systemTypeElementthe element of system type
Returns
- bool
true if is HvacSystemTypeId
Examples

SetDiameter(Element, double)
Set new diameter for round duct
public static Element? SetDiameter(Element duct, double diameter)
Parameters
ductElementthe duct to set diameter
diameterdoublenew value diameter of duct
Returns
- Element
duct with new parameter diameter
Examples

SetDiameter(Element, double, double)
Set new diameter for rectangular duct
public static Element? SetDiameter(Element duct, double width, double height)
Parameters
ductElementthe duct to set diameter
widthdoublenew value width of duct
heightdoublenew value height of duct
Returns
- Element
duct with new parameter diameter
Examples

SetSystemType(Element, Element)
Updates the associated system type for the duct.
[NodeCategory("Action")]
public static Element SetSystemType(Element duct, Element systemType)
Parameters
ductElementThe Element of the duct
systemTypeElementThe Element of the hvac system type.
Returns
- Element
duct changed systemType
Examples

Remarks
If the duct previously did not have a system associated to it, this will create a new system.
Exceptions
- ArgumentException
The systemTypeId is not valid HVAC system type.
- ArgumentNullException
A non-optional argument was null
- DisabledDisciplineException
None of the following disciplines is enabled: Mechanical Electrical Piping.
Shape(Element)
Get Shape Type of duct
[NodeCategory("Query")]
public static dynamic Shape(Element duct)
Parameters
ductElementthe duct
Returns
- dynamic
shape type of duct
Examples
