Export parameter from volume to families contained within that volume

I’ve created a script that allows me to export a parameter from a volume I’ve created (Mass) to all the MEP-families that are contained within this same volume. Unfortunately, the way this script is created, when there are multiple volumes in my model, I’ve got to change the volume-name manually every time by changing the “Index of Zone”-code block which leads to a “List.GetItemAtIndex”. Not too bad when there are only a few volumes in the project, but when there are a lot, this can turn in to quite a hassle.

I know how to create a list of all the volumes in the model, is there a way I can let this script run over and over again for each separate volume automatically? This shouldn’t be too hard to figure out, but I guess I’m starting to get stuck in my own train of thoughts…

@tim.witvrouwen ,

Sorry i can`t follow you… can you simplify the topic to an example ? :wink:



are you gonna use all the masses/Volume or just certain at specific indexes?
if you are going to use all you might just be able to plug in the mass directly in to your nodes (it might also crash your program).

if you just want some of the masses you need to sort them out somehow and then plug them in and it should run all of them.

Hi Andreas,
The ideas is that I can draw volumes in my model that correspond with zones. I would like to be able to export the name for all the zones that I drew in the model, to the elements that can be found inside those zones. For instance, all the families that can be found in the zone Oncology in a hospital, so I can make schedules to order just that zone if I want to…
Right now my script works on only 1 zone, which I can select by changing the index, but I would like to be albe to run the script over the entire model, over all the zones. Right now, when an element is moved from inside a certain zone to outside, the parameter still contains the zone it was in originally because the script can only check one zone at a time. At first I had some extra nodes to remove all the values of the zones that did not correspond anymore, but that would remove all the values of every element not in a specific zone, which is not ideal…

Hi Stefan,
I’d like to use all the volumes, as said in my reply to Andreas.
If I plug my volumes in directly, it will only check the first volume, and does not continue for the others, but maybe I’m doing something wrong

@tim.witvrouwen ,

you want also to count and name the elements inside ?

# Phython-Standard- und DesignScript-Bibliotheken laden
import sys
import clr
from Autodesk.DesignScript.Geometry import *

# Die Eingaben für diesen Block werden in Form einer Liste in den IN-Variablen gespeichert.
orginals = IN[0]
increment = []

x = 0

for i in orginals:
	x = x + 1
	increment.append("Zone " + str(x))
OUT = increment


Might be a lacing issue check picture and try around with lacing in the node that checks if geometry intersects

1 Like

Hi Andreas, I think you misunderstood. I don’t want to name the zones by increment, the zones will get a name manually, I want to be able to retrieve the name of the zone and push that towards the elements contained within those zones… So all the elements that can be found within Zone A will get a parameter “Zone” where the value will become “Zone A”, for those within Zone B it will become “Zone B” and so on…

Hi Stefan, I’ve adjusted the lacing settings, and now it does seem to work, but not quite correct.
As shown in screenshot, I’ve created multiple boxes, each box has the letter it represents inside in grey. I’ve tagged the ducts to show which results I’m getting, and as you can see, the third duct has a centroid that intersects with Zone I, but gets the value inserted of Zone C…
So instead of taking the parameter value of the zone it actually intersects with, it appears to take the next zone in the list. What am I missing here?

i am not certain but your list that check if it intersects is not the same you have plugged in to your set node one is before the filter of zones the oter after the filter since you insert 2 diffrent list the sorting will be scewed. ne list have 16 elment other has 17

in other words use the node after your filter for both lists

The reason why I did this, is because there are more Generic Models in the model than just the ones I use for zones. I’ve split the list so that only the ones that start with “Zone” remain to be used…

After some more research, it would appear I have another problem: the script I’ve designed works great for finding out which elements are contained within volumes, the problem is that right now my script can’t make the correct connection between the element and the volume it is in. Right now it takes a look at the first element that is contained within a volume, and adds the value of the first volume in the list to that element. It goes on like that for the second element in the list, where it adds the second volume on the list…
Because I’ve tried this script on a relatively easy trial-model, I didn’t notice this. After rearranging the ducts, this became apparent

So, as far as I am able to understand the problem I have right now, I have to find a way to link the correct volumes to the “Element.GetParameterValueByName” node.

the random list in on top would be your elements and the node in bottom your zones after the filter function and cross lacing you the null allindices check which shows the places of index number have the value true (in other world the geometry intersect). the number show elements and the index place in the zone.

juding by my little trial here you should plug in the zones on top of your geometry check and your elements in bottom

hard to do more unless i have the entire script and file to tinker with. sorting is always a pain.

the node pack is Spring Nodes

Hi Stefan,
Attached you can find the script to tinker with if you want. I’d prefer to keep it simple, by not using any extra packs if not specifically needed… A lot of my colleagues aren’t that tech-savvy, and when they have to install extra packs, I can already see the issues starting to rise :smiley:
Zone to Element 2020.dyn (90.4 KB)

Hi Stefan, I’ve found another solution, and now it does what it should do :slight_smile:

Thanks for the help, this is going to save a hell of a lot of time !!!