Match Room parameter value list with a list of lenghts "Math.sum"

Hi all,
I am trying to change room parameter value with a specific list created from the sum of multiple lengths inside those rooms.
My problem is that I can’t “Match” or “Map” each summary value with its original room.
I am attaching what I could reach so far; hopefully someone could help me out!

PharmaBIO02.dyn (8.4 KB)


Thanks to a Python Script by @Martin_Bijsterbosch; at this topic:
I could create a list of matched rooms/elements.

But now I am still stuck in the point of matching the “Sum” vlaues correctly with the list of the rooms. I always get wrong results mapped with the wrong rooms.

Please find below:

This is what I want:

Hi Ahmad_Saad,

I think i understand your question, it can be fixed with a simple python script that reads the data form the math.sum list and put this in a structure similar to the roomlist, see the image.

below the Python script i made with some comments:

import clr
from Autodesk.DesignScript.Geometry import *
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

sumlist = IN[0]
roomlist = IN[1]

#make an ouput list
output = []

#for each element in sumlist
for idx, i in enumerate(sumlist):

	#get the matching roomlist item
	rooms = roomlist[idx]
	#get amount of rooms in the room item
	numberOfRooms = len(rooms)
	#create a new list 
	#fill the list with the i form the sumlist as many times as there are rooms in the rooms item
	x=0 #make a counter
	while x < numberOfRooms:
		x=x+1#add 1 to the counter
	#append newlist to output
	#delete newlist
	del newlist[:]
#Assign your output to the OUT variable.
OUT = output

I hope this works for you.


@Ahmad_Saad Here is another possible way:

1 Like

Thank you guys for your reply, I am sorry for my late answer, I was in holidays :slight_smile:

I tried your workflows, and it worked perfectly. Thank you.

But the last step; which is actually my main purpose is pushing these data (the SUM values) to the rooms, by using the node “set parameter by name”. This step unfortuantly, didn’t work.

I am sure I am missing something or doing something wrong.

Please find attached:
The problem is that it doesn’t feed the correct values. You can see that in the “Element.GetParameterValueByName”


Please notice that the error message is saying: Warning: Internal error, please report: Dereferencing a non-pointer