Upscaling a set.parameter

Dear Dynamo Community.

A little while ago a made a script which purpose is to automatically fill parameters of objects based on classification codes. The figure below shows this concept for one code. It works as expected, but i’m having trouble upscaling (i.e. adding more codes).

Preferrably i’d like to make it a formula, something along the lines of: (in quasi-SQL)

So, for example: If an object contains the parameter ClassificationCode with the value “21.20”, the script should set the parameter values accordingly within Revit.

Anyone got any tips on how i could upscale this script draining all computing power? In total there are more than 500 classification options.

Yours truly,

Ruben van Duijn

Hi Ruben,
So if I understand correctly: you want to set 3 parameters based on their ClassificationCode? If so, do you have the corresponding values in an external file (excel, text, csv) that you could use? In that case a dictionary would be a great option to use.

Hey T_Pover,

Thanks for commenting, i’ve taken your advice and tried SpringNodes.Directory.KeysByValues. I’m really happy with the results, thankd! Though it shows a few errors (figure). Also, for some reason booleans aren’t readable from a text file.

Ruben van Duijn

Good to hear the dictionary was useful. The reasons for the errors can be varied, but null values and empty lists as input to the SetParameter node surely are one of those reasons. As long as the SetParameter node does its work and sets the parameters for the elements that you intented then there’s no problem.
In Excel ‘False’ and ‘True’ are handled as string, so that’s probably why it does not work in Dynamo. If you can find a way to convert from that string to a boolean in Dynamo (another dictionary is an option) then it ought to work.

In addition to @T_Pover i am only adding the comment with the true or false. I think its the same as yes or no (correct me if im wrong) if so then you need to replace it with the numbers 1 or 0 i forgot which is which but you can test. When i used it before i only add an if node to replace incoming false or true with 1 or 0. Hope this helps in a way. Thanks

Both of you, thanks so much! The suggestions you gave me resulted into a dynamo-script which works without any errors (@4bimfercesp using 1’s and 0’s in Excel was the way to go!). I’d like to share it with you, but sadly new users can’t upload file (if one of you’d like, i could send it via WeTransfer). Maybe it can be of use in some way. :slight_smile:

The last change i’d like to make, is doing the same with less code (there is a little bit of repetition). But that can wait.

Anyway, thanks!