Creating sublayers from a macro

Is it possible to create sublayers from a macro?

Sure, just use the double-colon syntax.

-layer new “Parent Layer::Child Layer::GrandchildLayer”

Double quotes are required if your layers have spaces in their names, otherwise they aren’t required.

That’s it - thanks!
Is this a documented feature? I couldn’t find it anywhere.

Hi John - that is an excellent question - it may not be, I don’t see it yet… I’ll see if I can figure out where best to add it if it is not in there someplace, probably under both the Layer command and under the bit that covers macros.

https://mcneel.myjetbrains.com/youtrack/issue/RH-37374

thanks,
-Pascal

1 Like

So I can figure this out, where/how did you look for this information?

1 Like

Pascal, how did you know this? Do you remember?

Hey Margaret,

Not Pascal here… This layer/sublayer syntax is known by people who write scripts, as it’s needed for a lot of layer related functions. However, I’m not sure I’ve seen it in a help file anywhere, it might just be something that has been passed along in forum posts among scripters/developers…

–Mitch

And perhaps worth noting is that when you round-trip e.g. a STEP file, the layer hierarchy is flattened and the resulting layers get the parent::child long name.