LayerService
Canonical path: NemAll_Python_BaseElements.LayerService
Utility for processing the layer definitions.
This class provides method to retrieve data specific for layer definition e.g., the name of the layer based on its ID or the layer ID based on its name. It can also export/import the layer definitions to/from a file.
Methods:
-
GetAllLayerNames–Get all layer names
-
GetCurrentLayerNames–Get the current layer names
-
GetIDByName–Get the layer ID from the layer name
-
GetIDByShortName–Get the layer ID from the layer short name
-
GetLayerFlags–Get the layer flags from the element layer
-
GetLayerFlagsByID–Get the layer flags
-
GetLongNameByID–Get the long name by ID
-
GetNameByID–Get the name 'short (long)' by the ID
-
GetNamesByID–Get the names by the ID
-
GetShortNameByID–Get the short name by the ID
-
LoadFromFavoriteFile–Load the layer data from a favorite file
-
SaveToFavoriteFile–Save the layer data to a favorite file
-
SetLayerFromElement–Set the layer from the element
GetAllLayerNames
staticmethod
GetAllLayerNames(doc: DocumentAdapter) -> VecStringList
Get all layer names
Parameters:
-
doc(DocumentAdapter) –Document
Returns:
-
VecStringList–All layer names
GetCurrentLayerNames
staticmethod
GetCurrentLayerNames(doc: DocumentAdapter) -> VecStringList
Get the current layer names
Parameters:
-
doc(DocumentAdapter) –Document
Returns:
-
VecStringList–Current layer names
GetIDByName
staticmethod
GetIDByName(name: str, doc: DocumentAdapter) -> int
Get the layer ID from the layer name
Parameters:
-
name(str) –Name
-
doc(DocumentAdapter) –Document
Returns:
-
int–Layer ID (-1 if not found)
GetIDByShortName
staticmethod
GetIDByShortName(shortName: str, doc: DocumentAdapter) -> int
Get the layer ID from the layer short name
Parameters:
-
shortName(str) –Short namek
-
doc(DocumentAdapter) –Document
Returns:
-
int–Layer ID
GetLayerFlags
staticmethod
GetLayerFlags(ele: BaseElementAdapter) -> LayerFlagsData
Get the layer flags from the element layer
Parameters:
-
ele(BaseElementAdapter) –Element with the layer
Returns:
-
LayerFlagsData–Layer flag data
GetLayerFlagsByID
staticmethod
GetLayerFlagsByID(layerID: int, documentID: int) -> LayerFlagsData
Get the layer flags
Parameters:
-
layerID(int) –Layer ID
-
documentID(int) –Document ID
Returns:
-
LayerFlagsData–Layer flag data
GetLongNameByID
staticmethod
Get the long name by ID
Parameters:
-
layerID(int) –Layer ID
-
documentID(int) –Document
Returns:
-
str–Long name
GetNameByID
staticmethod
Get the name 'short (long)' by the ID
Parameters:
-
layerID(int) –Layer ID
-
documentID(int) –Document ID
Returns:
-
str–Name by ID
GetNamesByID
staticmethod
GetNamesByID(layerID: int, documentID: int) -> tuple[str, str]
Get the names by the ID
Parameters:
-
layerID(int) –Layer ID
-
documentID(int) –Document ID
Returns:
-
tuple[str, str]–tuple(Short name, Long name)
GetShortNameByID
staticmethod
Get the short name by the ID
Parameters:
-
layerID(int) –Layer ID
-
documentID(int) –Document ID
Returns:
-
str–Name by ID
LoadFromFavoriteFile
staticmethod
LoadFromFavoriteFile(doc: DocumentAdapter, fileName: str) -> bool
Load the layer data from a favorite file
Parameters:
-
doc(DocumentAdapter) –Document
-
fileName(str) –File name
Returns:
-
bool–Data are loaded: true/false
SaveToFavoriteFile
staticmethod
SaveToFavoriteFile(doc: DocumentAdapter, fileName: str) -> bool
Save the layer data to a favorite file
Parameters:
-
doc(DocumentAdapter) –Document
-
fileName(str) –File name
Returns:
-
bool–Data are saved: true/false
SetLayerFromElement
SetLayerFromElement(ele: BaseElementAdapter)