Civil 3d: Create layer based on property set information and move objects to that layer

Hi,

First time using Dynamo in 5 years.

I’m trying to use Dynamo to move AutoCAD data that has been imported via the ARCGIS connector to the correct layer based on the object property set data (Civil 3d places it on layer 0 and there is no native way to change this in the connector or settings).

In the screenshots below, I have extracted the Id information field from the property set data to use this as the new layer name, but cannot see a straightforward way to move the objects that contains the property set Id to the new AutoCAD layer.

The drawing will contain hundreds of data with different Id’s.

Any help would be appreciated.

Property set information below:

YOu have a list of your objects WAAAAAY back at the beginning of your graph, and you’ve extracted the associated ID in a way which neither filters nor reorders the values, so the layers from “layer by name” should be in the same order as the objects. So wiring the objects from WAAAAAAAAY back at the beginning directly into the Object.SetLayer should work.

However you may note this node takes a “layer name” (a string) as the second input - you should be able to skip the Layer.ByName node as a result.

1 Like

Thanks @jacob.small that works!

I’ve also tried to set the layer color from the property set data using the layer.setcolor

However, that returns an error as its expecting a variable rather than a string:

I can’t see the variable its looking for on the list. Is there an better way to set the colour from the lists created from the property set data?

Thanks!

This is asking for a layer, not a layer name. Layer by name might do the trick. Check selection and layer sections of the Dynamo library.

If that doesn’t work, try converting the string being used for “color” to an object type which the Layer.SetColor node permits (perhaps an integer).

1 Like

@jacob.small thank you! Layer.byname works!

1 Like