Read Revit Key Parameter value + set new Key parameter value

Hello,

In Revit I made a key schedule for my Spaces with the key parameter “CN_V_IDA Class”. It contains 4 rows with values (see screenshot 1, Revit).

When I try to read my Space parameters with the Element.GetParameterValueByName node, I can read every normal Space parameter I want except the key parameter value. It gives me not the real value, but “(none)” when no key value was set for this Space or “Element” when a key value is set. Somehow, I cannot reach the value for the key parameter (see screenshot 2, Dynamo). When I ask for all the parameters from my spaces at once (Element.Parameters node), I can see the key parameter value for each Space (for example: third Space => parameter 44), but the problem is that this huge list of parameters is in a different sequence for each Space. The node List.Sort could not help me here (don’t know what the “built-in natural ordening” means though) (see screenshot 3, Dynamo).

My second problem with these key parameter, is that I cannot set a new value for it. Dynamo gives me the warning that the parameter’s storage type is not a string (screenshot 4, Dynamo). I thought that key parameter values were strings, but they must be something different…

I use Revit 2016 and Dynamo 0.9.0.3067. Thanks in advance!
1 Revit Key schedule

3 get key parameter value - alternative 4 Set Key parameter

Hi Mathias,

For your Second problem i believe you need to feed “Element (IDA4)” not a string.

for your first problem - Are you looking to get parameter value filtering “Elements” which is not equal to (none)?

Thank for your answer KULKUL, I’m one step closer to my goal! For my second problem, I need indeed to feed an element, as I found out that key schedules exist of rows of elements. Now, when I can’t enter simple strings, I will need to get the elements of my key schedule “Key_V_IDA Class” for each row before I can feed them. I can find my key schedule, but how on earth can I access its elements (say its rows)? I can’t see any elements from this view(schedule) that is a key schedule. At the moment I can only get these key row elements by checking this key parameter via the existing Spaces, but this does not gives me all rows of my key schedule.

For my first problem, I found out that the simple “Element.name” node gives me what I need: the translation of the element to the key parameter value. One problem remains here: when the key parameter element from my first Space is not entered (“none”), it stops ‘translating’ the rest of the list. See screenshots below. Maybe I can use a dummy element to replace each empty key parameter value, but if I can avoid it, I would be happy.

 

1

The easiest fix is to use “Element.Name” together with “List.Map”:

 

1 Like

Thanks Dimitar, looks like a very good solution! Any idea how I can acces the key values from my key schedule (the elements), so I can use this to set the parameter value for my Spaces as I want?

Yes, feed the schedule view into spring nodes’ “Collector.ElementsInView” like so:

2016-03-18_11-51-04

Hey Dimitar, I’m discovering your awesome Spring nodes. I have a question about the node “NullSetParameter” that should do the same as the ootb node “Element.SetParameterByName”, but with the ability to handle null values. I wanted to use it for setting a list a parameters values from different parameters for different Space instances. Your node inputs suggest that it should be possible to feed lists, but I don’t manage it to work: I don’t see changes in my Revit project, but the node does not displays any errors.

Hi Mathias,

Not sure why it’s not working for you with lists. Maybe it’s got something to do with your list structure? It works as expected on my end:

My problem is that I want to set a whole bunch of parameters for a list of Spaces. I have around 30 parameters so I made a list to keep it manageable. Then I also have a list with values for each Space (sublist per Space). I was hoping that your node would be able to do this, as its inputs “parameter” and “value” both are from the data type var[]…[]. The ootb node inputs are from data type var I believe

As the saying goes, a picture’s worth a thousand words. It’s impossible for me to give you the correct feedback without detailed information on your graph’s structure. The only recommendation I can give you is to search the forum for list combination nodes, CBN replication guides or imperative functions and study the result.

Here’s a brief example that demonstrates how you can set multiple parameters for multiple elements with the “List.Combine” node:

This might or might not work for your case, as I said above I can only guess…

I should have added a picture indeed. But anyway, your solution with List.Combine did the job for me :smiley:

Thanks!