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
airTerminal
ElementThe air terminal element.
duct
ElementThe 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
ductPlaceholder
ElementA 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
ductType
ElementThe Element of the new duct type.
level
ElementThe level for the new duct.
startConnector
ConnectorThe first connector where the new duct starts.
endPoint
PointThe 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
ductType
ElementThe Element of the new duct type.
level
ElementThe level for the new duct.
startConnector
ConnectorThe first connector where the new duct starts.
endPoint
PointThe second point of the new duct.
width
doublenew value width of duct
height
doublenew 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
systemType
ElementThe element of the HVAC system type.
ductType
ElementThe element of the duct type.
level
ElementThe level for the duct.
line
Linethe 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
systemType
ElementThe element of the HVAC system type.
ductType
ElementThe element of the duct type.
level
ElementThe level for the duct.
line
Linethe line to draw new duct
width
doublenew value width of duct
height
doublenew 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
ductType
ElementThe Element of the new duct type.
level
ElementThe level Element for the new duct.
startConnector
ConnectorThe first connector where the new duct starts.
endConnector
ConnectorThe 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
ductType
ElementThe Element of the new duct type.
level
ElementThe level Element for the new duct.
startConnector
ConnectorThe first connector where the new duct starts.
endConnector
ConnectorThe second point of the new duct.
width
doublenew value width of duct
height
doublenew 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
systemType
ElementThe element of the HVAC system type.
ductType
ElementThe element of the duct type.
level
ElementThe level for the duct.
startPoint
PointThe start point of the duct.
endPoint
PointThe 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
systemType
ElementThe element of the HVAC system type.
ductType
ElementThe element of the duct type.
level
ElementThe level for the duct.
startPoint
PointThe start point of the duct.
endPoint
PointThe end point of the duct.
width
doublenew value width of duct
height
doublenew 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
systemType
ElementThe element of the HVAC system type.
ductType
ElementThe element of the duct type.
level
ElementThe element level for the duct.
line
Linethe 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
systemType
ElementThe element of the HVAC system type.
ductType
ElementThe element of the duct type.
level
ElementThe element level for the duct.
line
Linethe line to draw duct from start point to end point
width
doublenew value width of duct
height
doublenew 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
systemType
ElementThe element of the HVAC system type.
ductType
ElementThe element of the duct type.
level
ElementThe element level for the duct.
startPoint
PointThe first point of the placeholder line.
endPoint
PointThe 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
systemType
ElementThe element of the HVAC system type.
ductType
ElementThe element of the duct type.
level
ElementThe element level for the duct.
startPoint
PointThe first point of the placeholder line.
endPoint
PointThe second point of the placeholder line.
width
doublenew value width of duct
height
doublenew 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
duct
Elementthe 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
systemType
Elementthe 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
systemType
Elementthe 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
duct
Elementthe duct to set diameter
diameter
doublenew 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
duct
Elementthe duct to set diameter
width
doublenew value width of duct
height
doublenew 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
duct
ElementThe Element of the duct
systemType
ElementThe 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
duct
Elementthe duct
Returns
- dynamic
shape type of duct