Add Property values based on Layer name

Hello!
Here’s the first script I made.


This will put values on properties from an Excel sheet thorugh the “Select Objects” node. What I want is to be able to put data from the Excel sheet onto everything on a certain layer based on the Layer name.
Does anyone have a solution to the picutre above? What I ultimately want is a script that will read the Excel file and assign a value to the Propertyset based on the Layer name.
Any help with this would be greatly appreciated!

Add
Screenshot_٢٠٢٢_٠٣٠١_٢٢٣٢١٨

This worked, thank you!
Now is there a way for Dynamo to read the Layers in the DWG and match them with information from an Excel sheet? For example Layer Road_001 always get assigned Property value A, Layer Pipe_001 always get assigned Property value B etc?

Hi
sorry my english is not good
Can you explain with pictures?
An example drawing is attached
to thank

I hope this picture can explain it.
I don’t want to manually write in the property value. I would rather have Dynamo search the Excel file for the same Layer name, and automaticly put in the property value into the property set. Do you think that is possible?

Hi
Please look at this,it may help you

Hi @SeGra,

Here’s one approach.

6 Likes

This seem to work the same way as the first script posted. You have to manually change the “FUNCTION - transform data” code block to choose which Excel column and row it should get data from?
Is there any way it can automaticly do this? Read the layer name, and put a value from the Excel sheet based on that layer name?

Assuming the first Excel column contains the layer names and the second column has the desired property values, then it should add the property values automatically based on the layer name like you describe. Did you try it?