It looks like you're new here. If you want to get involved, click one of these buttons!
Hello,
Every time I try to save layer properties by using lv.save_layer_props(), it resets the layer colors. I know that I can first save layer properties from gui then load it via script. However, I directly want to inherit layer properties from the gui via python scripting. Is it possible? Thanks in advance!
app = pya.Application.instance()
mw = app.main_window()
mw.load_layout(layout_path,0) #load the layout to the mainwindow so that you can see it
lv = mw.current_view()
lyp_path = os.path.join(directory,layer_property_file_name + ".lyp")
lv.save_layer_props(lyp_path) #Saves layer properties into the directory defined in lyp_path RESETS THE COLORS :(
Comments
Hi,
"save_layer_props" will not reset the layer properties. But "load_layout" will do so, because it replaces the layout with a fresh one.
You can replace a layout in a view by a new one while maintaining most of the settings, but not without some precaution:
However, there are many details to add here: like how to maintain the cell selection, how to maintain cell visibility, whether to clear rulers or not, whether to select more or less hierarchy levels, error handling etc.
Matthias
Thank you!