Accessing Key Schedule Information

I’m trying to access one of the values from a Key Schedule(uaing Areas), unfortunately it doesn’t seem to work.

I’m using Element.GetParameterValuesByName to access the Key Schedule parameter.

 

Any help is much appreciated once again :slight_smile:

Mhmmmm…Daniel, this is not going to work like that. In a Key Schedule - if I am not mistaken - each “row of data” is an element which means that you need to get hold of those somehow and only from there you can get values of individual parameters that they hold (columns).

The way, that I usually do it, is to first make a very broad sweep for all elements in a model: allKeys = FilteredElementCollector(doc).WhereElementIsNotElementType()

Now if you know that your Keys were not changed and are still just numbers 1,2,3,4… and so on you can go about it like this:

for key in allKeys:

try:

if key.get_Paramter(BuiltInParameter.REF_TABLE_ELEM_NAME).AsString() in keyNames and key.OwnerViewId == keySchedule.Id:

indexValue = keyNames.index(key.get_Parameter(BuiltInParameter.REF_TABLE_ELEM_NAME).AsString())

<span class=“pl-k” style=“color: #a71d5d;”>for</span> i <span class=“pl-k” style=“color: #a71d5d;”>in</span> <span class=“pl-c1” style=“color: #0086b3;”>range</span>(<span class=“pl-c1” style=“color: #0086b3;”>0</span>, <span class=“pl-c1” style=“color: #0086b3;”>len</span>(inputParams),<span class=“pl-c1” style=“color: #0086b3;”>1</span>):

params[indexValue].append(key.get_Parameter(<span class=“pl-c1” style=“color: #0086b3;”>str</span>(inputParams[i])))

except:

pass

 

This is just a fraction of the code but you get the idea. You have to match the Key Name and ScheduleView.Id to one of the ALL elements in the model so that you know you got your “row” element and then you can ask the element for all its parameters to start either getting their values or setting them.

Capture

and yes, I did forget about how much this place sucks for posting answers. I am sorry about this mess of a formatting. I realize its impossible to read.

I wouldn’t worry Konrad, this is over my limited knowledge ahahahah

But i sure appreciate the headsup

It’s actually quite straightforward:

Example of getting parameters from Key Schedule where Views = the name of the schedule.

1 Like