Dynamo - Adjusting Loadable Family

Hi,

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.

Elektra

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
“verdiepingshoogte”

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

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

Hi Erfajo,

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

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?

Hi David,

I think the below workflow is close to what you have in mind.

SortByLevel_01.dyn (9.7 KB)

Kind regards,
Mark

1 Like

Hi Erfajo,

I’ve uploaded it on wetransfer due to the file size. It’s in the following link:
https://we.tl/Kf8excB6Ut

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 true value. That’s why you’re only getting the first element filtered. You only have one boolean.)

1 Like

Hi @DavidV,

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)

Kind regards,
Mark

1 Like

Thanks MJB!

The script worked as I wanted :slight_smile:

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.

Hi David,

Good to hear that this is working for you.

  1. 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.
  2. The “Flatten” node flattens these sublists, and you get a simple (flat) list of (29) Family Instances.
  3. This is the list you want to sort, so you connect it with the “List.SortByKey” node (top/straight line).
  4. 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.
  5. 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.
  6. 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.
  7. Now you want to chop this (sorted list) into nested lists (or list with 3 sublists), this is what the “List.GroupByKey” node does.
  8. 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
http://dictionary.dynamobim.com/#/Core/List/Action/GroupByKey

Kind regards,
Mark