ladybug_rhino.pythonpath module

Functions for managing the setting of Rhino’s IronPython path.

ladybug_rhino.pythonpath.clean_rhino_scripts(directory=None)[source]

Remove installed Ladybug Tools packages from the old library directory.

This function is usually run in order to avoid potential namespace conflicts.

Parameters:

directory – The directory to be cleaned. If None, the function will search for all installed copies of the current user’s Rhino scripts folder.

ladybug_rhino.pythonpath.copy_packages_to_rhino_scripts(python_package_dir, directory=None)[source]

Copy Ladybug tools packages into a directory.

Parameters:
  • python_package_dir – The path to a directory that contains the Ladybug Tools core libraries.

  • directory – The directory into which the packages will be copied. If None, the function will search for all installed copies of the current user’s Rhino scripts folder.

ladybug_rhino.pythonpath.create_python_package_dir()[source]

Get the default path where the ladybug_tools Python packages are installed.

This method works both on Windows and Mac. If the folder is not found, this method will create the folder.

ladybug_rhino.pythonpath.filter_existing_paths(existing_paths)[source]

Filter out any duplicate/unwanted search paths.

ladybug_rhino.pythonpath.find_installed_rhino_scripts()[source]

Get the path to the current user’s Rhino scripts folder if it exists.

ladybug_rhino.pythonpath.find_installed_rhino_versions_windows()[source]

Get a list of the compatible Rhino versions installed on this Windows machine.

ladybug_rhino.pythonpath.find_ironpython_settings_windows()[source]

Get a list of all settings XML files for the supported RHINO_VERSIONS.

ladybug_rhino.pythonpath.iron_python_search_path(python_package_dir, settings_file=None, destination_file=None)[source]

Set Rhino to search for libraries in a given directory (on either OS).

This is used as part of the installation process to ensure that Grasshopper looks for the core Python libraries in the ladybug_tools folder. The file will not be edited if the python_package_dir is already in the settings file.

Parameters:
  • python_package_dir – The path to a directory that contains the Ladybug Tools core libraries.

  • settings_file – An optional XML settings file to which the python_package_dir will be added. If None, this method will search the current user’s folder for all copies of this file for the installed Rhino versions.

  • destination_file – Optional destination file to write out the edited settings file. If it is None, the settings_file will be overwritten.

ladybug_rhino.pythonpath.iron_python_search_path_windows(python_package_dir, settings_file, destination_file=None)[source]

Set Rhino to search for libraries in a given directory (on Windows).

This is used as part of the installation process to ensure that Grasshopper looks for the core Python libraries in the ladybug_tools folder. The file will not be edited if the python_package_dir is already in the settings file.

Parameters:
  • python_package_dir – The path to a directory that contains the Ladybug Tools core libraries.

  • settings_file – An XML settings file to which the python_package_dir will be added.

  • destination_file – Optional destination file to write out the edited settings file. If it is None, the settings_file will be overwritten.

ladybug_rhino.pythonpath.script_editor_search_path(python_package_dir=None)[source]

Set the Rhino 8+ ScriptEditor to search for libraries (on either OS).

Parameters:

python_package_dir – The path to a directory that contains the Ladybug Tools core libraries. If None, it will be set to the current python_package_path of the ladybug.config module