Create CAD layers from Excel Spreadsheet


This is my first time using Dynamo and my first experiance of python scipting so forgive the ignorance/silly questions;

I have a spreadsheet that has a load of layer names that I want to import into CAD, which may also help to formulate a CAD standard check using dynamo (if I can get my head around it) but I can’t for the life of me work out how to get the layer names into CAD.

I have looked through the forum and although the answer may be there; it is unfortuantly not in a forma I cam familar with or currently understand. I found a custom node on here that someone has dont that create new layers from a string value in either the string node of code block node; however as I am importing from excel it isn’t just one string value but a list of string values.

I have managed to get the following:

but i can’t work out how to get the list into the end node. I have a feeling it is because the node is written to only accept a singular value/string not a list; unfortunately I don’t know how to change the python script to read the list as a series of strings - can you help me?

Can you post the contents of the python node as formatted text? We can only guess without knowing how the data is actually being processed. Paste the Python code, highlight it, and press this button:


Could you expand what you mean please? I got the python node from here: Use Dynamo to create and manipulate Autocad / Civil 3D layers

I’m not sure what or where I am to paste it.

If you double-click on the Python node, it will show code that actually executes. I don’t have Civil3D 2020 installed, so I can’t test this myself, but try to replace this:

if IN[0] == None or IN[1] == None or IN[2] == None or IN[3] == None:
	OUT = create_layer.__doc__
	OUT = create_layer(IN[0], IN[1], IN[2], IN[3])

with this:

for n, r, g, b in zip(IN[0], IN[1], IN[2], IN[3]):
	create_layer(n, r, g, b)