Get and set parameters with python
What to do when you need to set and get a parameter
Once you have access to a element and want to change one of it’s parameter,using the usual print(dir(myLayer)) method or use Oil.docMe() to get a view of the possibilities.
Here are a few properties of interest:
For example we can set the label of the element:
myLayer = script.parentElement.layers[0]
myLayer.label = "myLayer"
This code above will rename the first layer in the element Tree.
myLayer = script.parentElement.layers[0]
myLayer.activation.set(False)
This code above will deactivate the layer.
Now the first layer named “myLayer” could also be retrieved with:
myLayer = script.rootElement.layers["myLayer"]