alias_api.save_layers

alias_api.save_layers(file_path: str, target_dirname: str, layer_names: collections.abc.Sequence[str] = [], save_invisible: bool = True, picked_only: bool = False, file_type: alias_api.AlFileType = <AlFileType.Wire: 1>, use_sequential: bool = False, overwrite: bool = False, threshold: typing.SupportsInt = 8) int

Retrieve the file and export each of its layers to a new file.

This provides the same functionality as the Save Layers plugin. It is a convenience function to calling the main export by layer functions ( export_by_layer, export_by_layer_sequentially).

The pick list state will be saved before modifying it, and restored at the end of the operation.

Empty layers will be omitted (there will be no wire file created for empty layers).

This function requires Alias >= 2022.2

Parameters
  • file_path (str) – The file to export layers from. This file will first be retrieved.

  • target_dirname (str) – The output directory to save new layer files to.

  • layer_names (list<str>) – The layers in the file to export. If not specified, all layers will be exported.

  • save_invisible (bool) – True will export all non-empty layers, False will only save layers that are visible or that are construction layers.

  • picked_only (bool) – True will export only layers that are picked, False will export both picked and not picked layers.

  • file_type (AlFileType) – The file type that the new layer files will be saved as.

  • use_sequential (bool) – True will force using the sequential export method (ignores the threshold value).

  • overwrite (bool) – True will overwrite any existing files, False will not save a the layer file it if a file already exists with the same name.

  • threshold (int) – Set the upperbound limit on number of layers to switch between export methods. If the number of layers is less than or equal the threshold, then layers are exported sequentially. If the number of layers is greater than the threshold, then layers are exported in an optimized way.

Raises