Create Method


Creates a new instance of cable tray.

Namespace: Autodesk.Revit.DB.Electrical
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)

Syntax

C#
public static CableTray Create(
	Document document,
	ElementId cabletrayType,
	XYZ startPoint,
	XYZ endPoint,
	ElementId levelId
)
Visual Basic
Public Shared Function Create ( _
	document As Document, _
	cabletrayType As ElementId, _
	startPoint As XYZ, _
	endPoint As XYZ, _
	levelId As ElementId _
) As CableTray
Visual C++
public:
static CableTray^ Create(
	Document^ document, 
	ElementId^ cabletrayType, 
	XYZ^ startPoint, 
	XYZ^ endPoint, 
	ElementId^ levelId
)

Parameters

document
Type: Autodesk.Revit.DBDocument
The document.
cabletrayType
Type: Autodesk.Revit.DBElementId
The cable tray type. This must be a cable tray type accepted by isValidCableTrayType(). If the input cable tray type is InvalidElementId, the default cable tray type from the document will be used.
startPoint
Type: Autodesk.Revit.DBXYZ
The start point of the cable tray location line.
endPoint
Type: Autodesk.Revit.DBXYZ
The end point of the cable tray location line.
levelId
Type: Autodesk.Revit.DBElementId
The element id of the level which this cable tray based. If the input level id is invalidElementId = -1, the nearest level will be used.

Return Value

The newly created cable tray.

Remarks

This method will regenerate the document.

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException This cable tray type is invalid. -or- This level id is invalid. -or- The points of startPoint and endPoint are too close: for MEPCurve, the minimum length is 1/10 inch.
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null
Autodesk.Revit.ExceptionsDisabledDisciplineException None of the following disciplines is enabled: Mechanical Electrical Piping.
Autodesk.Revit.ExceptionsInvalidOperationException The document is in failure mode: an operation has failed, and Revit requires the user to either cancel the operation or fix the problem (usually by deleting certain elements).
Autodesk.Revit.ExceptionsModificationForbiddenException The document is in failure mode: an operation has failed, and Revit requires the user to either cancel the operation or fix the problem (usually by deleting certain elements). -or- The document is being loaded, or is in the midst of another sensitive process.
Autodesk.Revit.ExceptionsModificationOutsideTransactionException The document has no open transaction.

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →