Use Dynamo to create and manipulate Autocad / Civil 3D layers

Would anybody know how to create a layer in Autocad / Civil 3D, and set name and color, using Python in Dynamo?


In Dynamo for Civil 3D 2020 you can feed any string value into the “Layer” input of most nodes and it will make a new layer with that name. I have not seen anyone set layer colors though. Object color is doable via OOTB nodes though.

I know that. But setting layer color is essential in my case. I did not find any OOTB nodes to do that, so i am eager to try some AutoCAD dotNET API stuff through Dynamo and Python. But cant find a good reference for this :slight_smile:

Hi try this Link to get an idea of what is the code to create a Layer.
Attached an implementation with Python in Dynamo for Civil 3D.CreateLayerByNameColor.dyn (8.7 KB)


Thanks for helping out, @Paolo_Emilio_Serra1. Will check this out.


Hi @Paolo_Emilio_Serra1 thanks for posting the CreateLayerByNameColor script - this is super helpful! I am trying to do the same thing but instead set the color by ACI. I was reading that “ColorMethod.ByAci” can be used for this task but am getting an error in my python code when I write it this way. Do you have any suggestions?