Skip to content

StairsRun.CreateStraightRun

Public Class

Creates a straight run in the project document.

Namespace: Autodesk.Revit.DB.Architecture

Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)

Syntax

public static StairsRun CreateStraightRun(
Document document,
ElementId stairsId,
Line locationPath,
StairsRunJustification justification
)

Parameters

document Document

The document.

stairsId ElementId

The stairs that the new stairs run will belong to.

locationPath Line

The line for location path of the new stairs run. The line has following restriction:

  • The line should be bound line which is parallel to the XY plane.
  • The Z coordinate of the line is the base elevation for the new run (in model coordinates). It must be greater than or equal to the stairs base elevation.
  • The number of created risers will be calculated by rounding the length of the location path to a multiple of the tread depth.

justification StairsRunJustification

The location path justification of the new stairs run.

Return Value

StairsRun
The new stairs run.

Exceptions

Exception

Condition


ArgumentException

The stairsId is not a valid stairs element. -or- The input locationPath is not a bound line. -or- The input locationPath is not a valid location path line for straight run. -or- The locationPath is not valid line used as stairs path(probably it’s too short).


ArgumentNullException

A non-optional argument was null


ArgumentOutOfRangeException

A value passed for an enumeration argument is not a member of that enumeration


InvalidOperationException

The stairs element represented by stairsId is not in an active StairsEditScope. New components cannot be added to it.


ModificationForbiddenException

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.


ModificationOutsideTransactionException

The document has no open transaction.


RegenerationFailedException

The locationPath doesn’t satisfy restrictions to generate straight run.


Remarks

The new stairs run and the document will be regenerated. This should be run from within an open transaction.