Run script for multiple elements (dynamo)

Run script for multiple elements (dynamo)

Joos_T
Enthusiast Enthusiast
3,207 Views
6 Replies
Message 1 of 7

Run script for multiple elements (dynamo)

Joos_T
Enthusiast
Enthusiast

Hello everyone,

 

I'm trying to add article numbers to a system family. I'm doing this with te same pricipal of a lookup table.

The script I wrote works fine but it only works for one element. 

 

Is there a way I can run this script for multiple elements in a certain category?

 

If I use "Select multiple model elements" the script mixes up all the data.

 

 

0 Likes
Accepted solutions (1)
3,208 Views
6 Replies
Replies (6)
Message 2 of 7

L.Maas
Mentor
Mentor

Yes, check the nodes

LMaas_0-1651221630928.png

After that it is a manner of matching your families with the data. This depends on how everything is structured in your project and lookup table

 

Instead of selecting elements you also can do something like

LMaas_0-1651221986313.png

 

Louis

EESignature

Please mention Revit version, especially when uploading Revit files.

Message 3 of 7

Joos_T
Enthusiast
Enthusiast

Thanks for your reply.

That's what tried first. If I use this Node it mixes up all the data of all the elements.

It has to run every element separately.

0 Likes
Message 4 of 7

L.Maas
Mentor
Mentor

Consider uploading your script, your csv and small sample of your project so that we can see how everything is structured.

 

Basically it is that you create two sets of data (elements in revit, elements in your csv). Then you collect those data in two lists. Then you will need to find a way to match those two lists (which Revit element belongs to which entry in the csv). This can only be figured out if we have clear understanding how both are organized and if there is a key to matching both

Louis

EESignature

Please mention Revit version, especially when uploading Revit files.

Message 5 of 7

Joos_T
Enthusiast
Enthusiast

I've made a sample file for you.

Thanks for helping me out.

 

0 Likes
Message 6 of 7

L.Maas
Mentor
Mentor
Accepted solution

Study this script (added). This should bring you a long way

LMaas_0-1651228080998.png

I basically did:

-Made a "dictionary" (searchkey, value) by merging the three search keys (mat, diam, length) into a single element.

-Doing the same with the revit data.

-Doing a lookup of the search key in the dictionary, getting the matching artikelnummer

-Writing the artikelnummer back to Revit

 

You must finetune it for your case.

Also pay attention to "exceptions" (e.g upper/lower characters in CSV or Excel)

Louis

EESignature

Please mention Revit version, especially when uploading Revit files.

Message 7 of 7

Joos_T
Enthusiast
Enthusiast

This is just what I needed. Thanks for your help!

0 Likes