Get a nested parameter value

Anyone know if it’s possible to get the value of a stairs “Actual Run Width”? It’s nested in the run of a component stair. Thanks

I believe you’ll have to use Python and the GetStairsRuns() method to pull the stair run element from your stair, and get the parameter value from that

Lol. Thanks for the relpy! I’m fairly new to Dynamo. Not sure I’m ready for Python.

Here is a script for it:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

stairs = IN[0]
if not isinstance(stairs,list):
	stairs = [stairs]

def getRuns(stair):
	runs = []
	stair = UnwrapElement(stair)
	runids = stair.GetStairsRuns()
	for run in runids:
		runs.append(doc.GetElement(run))
	return runs

OUT = map(getRuns, stairs)

Paste this into a Python script node and connect your stair (or list of stairs) to it and it will give you its respective stair runs, which you can query for the run width with GetParameterValueByName.

Let me know if this works for you :slight_smile:

6 Likes

Wow! Thanks! I’ll try it on Monday.

Worked perfectly. Thank you!

1 Like

Hi, Is it possible to edit the Python script to get the x,y,z of the run? I can do the research (you’ve done enough), I just want to know if it’s possible before I spend the time. I’m having problems inserting a tag since the stairs themselves don’t have an insertion point. Thanks Again!

@BBDCW Hmm you mean the location? The OOTB node Tag.ByElement should work without a location

Hi Amy and thanks.

When I was working on the door version I was getting errors using the Tag.ByElementAndOffset as well as the Tag.ByElement. No one could figure it out so I went with Create Annotation Tag and that worked. However when I tweaked it for the stairs it wouldn’t work.

Here’s the original error I was getting on the door version:

PS I was trying to get a point to place the tag after it calculated some other values and set the parameters of the element being tagged. Element.GetLocation worked for the door version but not the stairs.

The image shows the stair version that uses the Create Annotation Tag.

Stairs

Ah yeah I wouldn’t have expected GetLocation to return a point because the stair runs don’t have an insertion point, they’re more line/sketch based. One possible idea would be to get the solid geometry with Element.Geometry and use Solid.Centroid to get a point and remove the z value

PS your code block that reads "True" and "False" needs to be true and false to be proper booleans and not strings

As usual nothing but excellent advice from you. Solid.Centroid looks promising. Working on losing the Z now. Thanks for the boolean advice.

1 Like

Got it working. Element.Geometry, Soild.Centroid and changing Z to 0 worked. Thanks!

1 Like

Hi Amy

I’m trying to get a stair’s railing path. I have a Python script which works for a single stair but it doesn’t work for a list of stairs. Any ideas on how I need to modify it? Sorry I’m a Python noobie…

/////

import clr
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument
curves = []
railing = UnwrapElement(IN[0])
rpath = railing.GetPath()

for i in rpath:
curves.append(i.ToProtoType())

OUT = curves

Hi @Paul_Wintour please start a new topic for getting a stair’s railing path, and when sharing code paste it as preformatted text (the </> symbol in the formatting options) image