Extracting the layer colors from a list of polylines

Hello guys, I am trying to extract the layer colors of a list of polylines in AutoCAD civ 3d. The list of polylines was created using the List.UniqueItems node. I want to apply these colors extracted to a list of solids within the AutoCAD file. Apologies I am quite new to dynamo so would really appreciate some guidance on this.

You have objects, not layers at this point. Check the Object section (under AutoCAD) in the library, and you can pull the object’s color. This isn’t necessarily the same as the layer’s color though, for that you would want to pull the object’s layer (same spot of the library) and then query that layer’s color with the node you’ve found.

Give it a shot and let us know if you’re still stick.

Hello thanks for the reply!

When connecting the object.color node to the list.uniqueitems node, an error message (Warning: Object.Color expects argument type(s) (Autodesk.AutoCAD.DynamoNodes.Object), but was called with (string[]).) appears.

My aim is to pull the colors of all 13 items in that list if possible. Cheers!

Ah! I didn’t understand where you were at as the description (“The list of polylines”) doesn’t match the picture (I believe it’s a list of layer names?).

I’m about to step out for awhile and then have to get to work (two presentations today) so I may not be able to help directly for a bit. if you hit the ‘export canvas as image’ button while zoomed in like this (or even a little bit closer) you can post an image of your entire graph so the larger community can review what you have and the best way to get back to where you want to be.

In the the meantime, searching the library for stuff like “LayerByName” might be worth reviewing as the solution may be in there.

1 Like

Hi @hacharoui ,

Your strings represent your layer-names, not the corresponding layers. This means that you’ll have to import the AutoCAD layers by their name first to be able to get the color of said layer:

2 Likes

Thank you for your reply! The layerbyname was what i needed cheers!

1 Like

Thank you! Your solution helped