Dynamo python node code compairing to lists and setting a parameter value in one list.

Dynamo python node code compairing to lists and setting a parameter value in one list.

eakershoek
Participant Participant
1,781 Views
2 Replies
Message 1 of 3

Dynamo python node code compairing to lists and setting a parameter value in one list.

eakershoek
Participant
Participant

Normally i know my way around with Dynamo, but in this case i have a problem that i think can only be fixed using a python node. I do have a python node script that i put together but it doesnt seem to do anything, and i cannot figure out why.

i am a absolut beginner at python programming so i am struggeling with the basics here. 

In line 26 and 27 i have some part of the code that i do not completely understand and i might be that, or something completely different. 

In short. List A has a list of family instances with family parameters 'groepnummer', 'Schema_nr' and 'contactdozen aantal'.  List B has a list of family instances with shared project parameters 'voedende groep' and 'Bouwnummer'

The script needs to find all Family instances in List B where the value of parameter 'voedende groep' is the same value as in parameter 'groepnummer' in Families in List A ,  AND families with the value of parameter 'Bouwnummer' in List B has the same value as families with the value of parameter 'Schema_nr' in families in List A. If this is the case the amount of family instances with these parameter values in List B should be counted and this amount should be SET in parameter 'conatactdozen aantal' in the one family instance in List A that have these parameter values.

I hope this all makes sense and someone can give me a hand in getting this to work.

Supplied is the script that i have so far as text.

Erik.

0 Likes
Accepted solutions (1)
1,782 Views
2 Replies
Replies (2)
Message 2 of 3

L.Maas
Mentor
Mentor
Accepted solution

If I understood you correctly I believe it can be done relative simply with normal nodes

LMaas_1-1693469248817.png

LMaas_2-1693469391459.png

 

One thing to note is that you need to be careful with this script as it is. the comparison node "==" uses cross product. All items in list A have to be checked against all items in list B. So if both your list A and B are substantial then you will get a lot of comparisons. Too much and Dynamo and Revit may crash (so save your project). In that case you might need to finetune the script to limit the comparisons in some way (depending on what you have in your project)

 

Attached the script. You will need to modify it to suit your familyinstances and  parameter names.

Louis

EESignature

Please mention Revit version, especially when uploading Revit files.

0 Likes
Message 3 of 3

eakershoek
Participant
Participant

Thnx,

For some reason i did not see this solution in nodes and started looking for python solutions.

It works as intended.

 

0 Likes