Creates a new stairs path for the specified stairs with the specified stairs path type only in the plan view.
Namespace: Autodesk.Revit.DB.ArchitectureAssembly: RevitAPI (in RevitAPI.dll) Version: 27.0.4.0 (27.0.4.0)
Syntaxpublic static StairsPath Create(
Document document,
LinkElementId stairsId,
ElementId typeId,
ElementId planViewId
)
Public Shared Function Create (
document As Document,
stairsId As LinkElementId,
typeId As ElementId,
planViewId As ElementId
) As StairsPath
public:
static StairsPath^ Create(
Document^ document,
LinkElementId^ stairsId,
ElementId^ typeId,
ElementId^ planViewId
)
static member Create :
document : Document *
stairsId : LinkElementId *
typeId : ElementId *
planViewId : ElementId -> StairsPath Parameters
- document Document
-
The document.
- stairsId LinkElementId
-
The id of the stairs element either in the host document or in a linked document.
- typeId ElementId
-
The type of stairs path.
- planViewId ElementId
-
The plan view in which the stairs path will be shown.
Return Value
StairsPath
The new stairs path.
Exceptions| Exception | Condition |
|---|
| ArgumentException |
The stairsId is not a valid stairs.
-or-
The typeId is not a valid stairs path type.
-or-
The planViewId is not a valid plan view.
-or-
The stairsId already has a stairs path.
-or-
The stairsId is not visible in planViewId.
|
| ArgumentNullException |
A non-optional argument was null
|
Exampleprivate void CreateStairsPath(Document document, Stairs stairs)
{
Transaction transNewPath = new Transaction(document, "New Stairs Path");
transNewPath.Start();
FilteredElementCollector collector = new FilteredElementCollector(document);
ICollection<ElementId> stairsPathIds = collector.OfClass(typeof(StairsPathType)).ToElementIds();
ElementId planViewId = ElementId.InvalidElementId;
FilteredElementCollector viewCollector = new FilteredElementCollector(document);
ICollection<ElementId> viewIds = viewCollector.OfClass(typeof(View)).ToElementIds();
foreach (ElementId viewId in viewIds)
{
View view = document.GetElement(viewId) as View;
if (view.ViewType == ViewType.FloorPlan)
{
planViewId = view.Id;
break;
}
}
LinkElementId stairsLinkId = new LinkElementId(stairs.Id);
StairsPath.Create(stairs.Document, stairsLinkId, stairsPathIds.First(), planViewId);
transNewPath.Commit();
}
See Also