Move featureline to layer defined in featurelinestyle (Object.SetLayer: eInvalidInput)

Hello!

When creating a featureline, Civil3d-settings give you only two options

layeroptions

with “Use the layer setting” being one hardcoded layer in your settings and “Use the current layer” being, well, the current layer.
If you use the first option, all featurelines, regardless of their style, end up on one layer.

I want to create a Dynamoscript that does the following:

  1. Look at all featurelines in the drawing

  2. Get their style

  3. Look inside the style to retrieve the layer that is set in View Direction: Plan

  4. Move the featureline to that layer (e.g. “C-ROAD-CORR”)

I’m almost there but somehow the Object.SetLayer-node doesn’t work although FeatureLine.AutoCADObject seems to convert the featurelines just fine.

Can someone help me out with what’s going on? (Maybe @mzjensen @Anton_Huizinga?)
Any help is much appreciated! :slight_smile:
MoveFeaturelineToStyleLayer_v01.dyn (25.8 KB)

Alright, I’m an idiot - it had nothing to do with the Object but rather with the lacing of DisplayStyle.Layer.
After flattening that list, everything worked as expected.

I’ve got a bonus question though:
Is there a way without stringmanipulation like regex to get the layername from DisplayStyle.Layer? “String from Object” converts the whole thing (e.g. “Layer(Name = MyLayer)” when all I want is the actual name of the layer “MyLayer”.

Hi @pumpaij,

Glad you got it figured out!

I think you should be able to just use the Layer.Name node for this.

I think you should be able to just use the Layer.Name node for this.

I’m not aware of such a node (Civil3d 2024.3, Dynamo v.2.19.4). I ended up using regex, but that would be nice of course.

Here ya go!