FileNameService
Implementation of the file name service
FileNameService
Canonical path: FileNameService.FileNameService
Definition of service class FileNameService
find_pyp_file_by_uuid
staticmethod
find_pyp_file_by_uuid(script_uuid: str) -> tuple[bool, str]
Searches for a .pyp file with the given UUID in all library folders in the parts (Cur_proj, Std, Etc)
Parameters:
-
script_uuid(str) –UUID of the script to search for
Returns:
-
bool–True when file with matching UUID is found, False otherwise
-
str–str_file_name with lib_path of the found file
get_filename_without_root_path
staticmethod
Cuts the root_path of the filename
Parameters:
-
str_file_name(str) –Full file path
-
str_path(str) –Root directory path
Returns:
-
str–File path relative to the root directory
Examples:
get_global_standard_path
staticmethod
Get the absolute path from a path relative to etc/std/prj directory
Parameters:
-
local_path(str) –local path
Returns:
-
str–global path (empty if not exist)
Examples:
get_lib_pyp_sricpt_path
staticmethod
Searches the file_name in the parts (Cur_proj, Std, Etc )of the library Cuts the library_path of the filename
Parameters:
-
file_name(str) –name of file.
Returns:
-
str–str_file_name without lib_path
Examples:
get_pyp_path_from_lib_struct
staticmethod
get_pyp_path_from_lib_struct(
file_path: str, extended_search: bool = False, script_uuid: str = ""
) -> tuple[bool, str]
Searches the file with given path and optionally an uuid in the parts (Cur_proj, Std, Etc ) of the library.
Parameters:
-
file_path(str) –absolute file path or relative path without lib_path
-
extended_search(bool, default:False) –search the file in all library folders if not found
-
script_uuid(str, default:'') –UUID of the script - if not empty it is used together with file_path to identify the pyp file
Returns:
-
bool–True when file exist and has the specified uuid, False otherwise
-
str–str_file_name with lib_path
Examples:
(True, "c:\programdata\Allplan\etc\library\python\macrocolumn.pyp")
search_pyp_file
staticmethod
search_pyp_file(file_path: str, script_uuid: str = '') -> tuple[bool, str]
Searches the pyp file name (that is extracted from file_path), optionally with the given script_uuid, in all library folders in the parts (Cur_proj, Std, Etc )
Parameters:
-
file_path(str) –file path, absolute or relative
-
script_uuid(str, default:'') –UUID of the script - if not empty it is used together with file name to identify the pyp file
Returns:
-
bool–True when file exist and has the specified uuid, False otherwise
-
str–str_file_name with lib_path
set_node_script_default_path
staticmethod
Set the default path of the node scripts
Parameters:
-
node_script_default_path(str) –description
update_global_standard_path
staticmethod
update the global standard path for a new location
Parameters:
-
global_path(str) –global path
Returns:
-
str–updated global path (empty if not exists)
validate_uuid_in_pyp
staticmethod
For non-empty script_uuid, check if the UUID in the PYP file matches the given script_uuid
Parameters:
-
pyp_file_path(str) –Path to the PYP file
-
script_uuid(str) –UUID of the script to search for
-
has_same_name(bool) –the pyp file has the same name as the pyp file to search for
Returns:
-
bool(bool) –True if script_uuid is empty or matches the UUID in the file, False otherwise