At this moment I’m working on a dynamo script to adjust multiple (instance) parameters for a loadable ‘electrical equipment’ family in my Revit project.
First of all there are 5 types of this Electrical Equipment family which I need to filter them by levels. After filtering them by levels I need to adjust the instance parameter
For an example:
All the type families on the 1st floor needs to be 2750
All the type families on the 2nd floor needs to be 2620
The script worked until I’ve tried to add the nodes for adjusting the family parameter. Then it shows up the following error:
The familiy instance parameter is a shared parameter. Also tried this with a type parameter but didn’t work
After solving this problem I want to add more nodes to adjust Yes/ No parameters for the five family types but those nodes encouter the same problem as I described in this topic
Someone also got this same problem?
I think you have to change your graph:
“Element.SetParameterByName” needs an element-list
You are passing the level information not the elements. Use a boolean filter or something similar so you can filter the elements, and send the proper elements to change their parameter value.
Thanks for the help but it doesn’t solve the problem. If I do what you’ve mentioned it applies the value parameter (in this case 2750) to all of the family types.
For my case it’s necessary to apply different values to the family types on different floors. The family types on the first floor has to be 2750. The same family types on the 2nd floor has to be 2620 and on the 3rd floor it has to be 2500 for an example
I’ve tried your help but I still get the same problem (see image). I made the script easier to read:
In this case there are 5 family types (2 on the first floor, 2 on 2nd floor and 1 on 3rd floor) The filtering did work but as you see I get the same problem
you still pass the wrong element… dont pass levels, pass your elements
But if I do that, it adjust the parameter for all the family types despite the floor level. So how do I make a family type selection by level if I’m not filtering them by level?
You need to be sure you are changing an instance parameter, not a type parameter.
However, you still need to send the elements to the node where you want to adjust parameter values, you cannot send a Level parameter to the node.
I think it would be better if you uploaded your .dyn graph and a sample file (rvt), then we might be able to help you.
I think the below workflow is close to what you have in mind.
SortByLevel_01.dyn (9.7 KB)
I’ve uploaded it on wetransfer due to the file size. It’s in the following link:
I’ll try to explain it once more
In the image below there is an example which I want to achieve. You can see the electrical equipment family hosted on a wall in 3 different levels. I want to adjust the instance parameter “verdiepingshoogte” from the family to the same value as the level height.
So for all the family types hosted on the “BG peil” (level 1) I want the instance parameter set on 2750
For all the family types hosted on “VD1 Peil” (Level 2) I want the instance parameter set on 2620
And for the family types hosted on “VD2 Peil” (level 3) set on 2500
With the dynamoscript I want to adjust the instance parameter in one run.
@MJB-online has shown the proper way to do this.
You’re still trying to set the parameter for the Level (which doesn’t exist). You need to filter your Elements based on Level so you can set the parameter for the Elements themselves.
(You’re also checking to see if the name of your selected level is the same as the name of your selected level. You’re comparing the same thing and returning a single
value. That’s why you’re only getting the first element filtered. You only have one boolean.)
Just remove the “quotations” from the lower codeblock (notice the difference from my fist answer), then you’re good to go. After downloading your projectfile, i realised that this input should be numbers instead of strings.
SortByLevel_02.dyn (10.2 KB)
The script worked as I wanted
But for my own understanding (I’m just a beginner in Dynamo) what happend actually here? It’s just something I want to understand if I need to edit the script it in the future.
Good to hear that this is working for you.
- First step is the selection of 5 different Family Types, and that’s why you get a nested list (or list with 5 sublists) of Family Instances.
- The “Flatten” node flattens these sublists, and you get a simple (flat) list of (29) Family Instances.
- This is the list you want to sort, so you connect it with the “List.SortByKey” node (top/straight line).
- Now you have create a key by which you want to sort this list, so you ask all 29 elements what is the value of your “Level” parameter, and you receive 29 level objects.
- The next node converts these level objects into simple text strings. This list with 29 strings is now your key for sorting and you also connect it to the “List.SortByKey” node.
- The “List.SortByKey” node now sorts your Family Instances, so first all Family Instances on Level 1, next all Family Instances on Level 2, and so on.
- Now you want to chop this (sorted list) into nested lists (or list with 3 sublists), this is what the “List.GroupByKey” node does.
- The last step is to assign the values to the “verdiepingshoogte” parameter. All elements in the first sublist receive the value 2750, all elements in the second sublist receive the value 2620, and so on.
I hope that makes sense.
If you want know more about certain (OOTB) nodes you can check them at the Dynamo Dictionary.
For example http://dictionary.dynamobim.com/#/Core/List/Action/SortByKey or