Creating Sub Layers with Python

Creating Sub Layers with Python

Anonymous
Not applicable
1,655 Views
1 Reply
Message 1 of 2

Creating Sub Layers with Python

Anonymous
Not applicable

Hello,

 

I am able to create a layer in python, but have had no luck with a creating a sub layer / nested layer structure. 

 

I want to create layer A, then create layer B as a child of A. 

 

Here is code that hasn't worked:

 

import MaxPlus, pymxs
from pymxs import runtime as rt

parent = MaxPlus.LayerManager.CreateLayer("A") MaxPlus.LayerManager.AddLayer(parent ) MaxPlus.LayerManager.SetCurrentLayer("A") child = MaxPlus.LayerManager.CreateLayer("B") MaxPlus.LayerManager.AddLayer(child)

 

0 Likes
Accepted solutions (1)
1,656 Views
1 Reply
Reply (1)
Message 2 of 2

drew_avis
Autodesk
Autodesk
Accepted solution

It doesn't look like setParent() is implemented in MaxPlus.  Try using pymxs for this:

 

import MaxPlus, pymxs
from pymxs import runtime as rt

parent = rt.LayerManager.NewLayerFromName("C")
child = rt.LayerManager.NewLayerFromName("D")
child.setParent(parent)

Hope that helps,

Drew



Drew Avis
Content Experience Designer