Skip to content

FileNameService

Implementation of the file name service

FileNameService

Canonical path: FileNameService.FileNameService

Definition of service class FileNameService

get_filename_without_root_path staticmethod

get_filename_without_root_path(str_file_name: str, str_path: str) -> str

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:

>>> FileNameService.get_filename_without_root_path(
...     "c:\programdata\Allplan\etc\library\python\macrocolumn.pyp",
...     "c:\programdata\Allplan\etc\")
'library\python\macrocolumn.pyp'

get_global_standard_path staticmethod

get_global_standard_path(local_path: str) -> str

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:

>>> FileNameService.get_global_standard_path("etc\library\python\macrocolumn.pyp")
'C:\ProgramData\Allplan\Etc\library\python\macrocolumn.pyp'

get_lib_pyp_sricpt_path staticmethod

get_lib_pyp_sricpt_path(file_name: str) -> str

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:

>>> FileNameService.get_lib_pyp_sricpt_path("etc\library\python\macrocolumn.pyp")
'library\python\macrocolumn.pyp'

get_pyp_path_from_lib_struct staticmethod

get_pyp_path_from_lib_struct(file_name: str) -> tuple[bool, str]

Searches the file_name in the parts (Cur_proj, Std, Etc ) of the library.

Parameters:

  • file_name (str) –

    name of file without lib_path

Returns:

  • bool

    True when file exist state, False otherwise

  • str

    str_file_name with lib_path

Examples:

>>> FileNameService.get_pyp_path_from_lib_struct("library\python\macrocolumn.pyp")
(True, 'c:\programdata\Allplan\etc\library\python\macrocolumn.pyp')

search_pyp_file staticmethod

search_pyp_file(file_name: str) -> tuple[bool, str]

Searches the pyp file_name in all library folders in the parts (Cur_proj, Std, Etc )

Parameters:

  • file_name (str) –

    name of file without lib_path

Returns:

  • bool

    True when file exist state, False otherwise

  • str

    str_file_name with lib_path

set_node_script_default_path staticmethod

set_node_script_default_path(node_script_default_path: str)

Set the default path of the node scripts

Parameters:

  • node_script_default_path (str) –

    description

update_global_standard_path staticmethod

update_global_standard_path(global_path: str) -> str

update the global standard path for a new location

Parameters:

  • global_path (str) –

    global path

Returns:

  • str

    updated global path (empty if not exists)

Placeholder