### Get Installed TIA Portal Software Information Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieve lists of installed TIA Portal bundles and products. ```APIDOC get_installed_bundles() -> List[ProductBundle] Description: Get a list of installed TIA Portal bundles. Returns: List[ProductBundle]: A list of installed product bundles. Example: product_bundles = siemens_tia_scripting.get_installed_bundles() get_installed_products() -> List[Product] Description: Get a list of installed TIA Portal products. Returns: List[Product]: A list of installed products. Example: products = siemens_tia_scripting.get_installed_products() ``` -------------------------------- ### Get Rule Sets Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of Test Suite Styleguide rule sets from the TIA Portal project. Requires Test Suite to be installed and licensed. Returns a list of RuleSet objects. ```Python def get_rule_sets() -> List[RuleSet]: """Description: Get a list of Test Suite Styleguide rule sets in the TIA Portal project Needs Test Suite installed and licensed. *Returns* → `List[RuleSet]` All Rule sets as list Example usage rule_sets = project.get_rule_sets() """ ``` -------------------------------- ### Get System Tests Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of Test Suite system tests from the TIA Portal project. Requires Test Suite to be installed and licensed. Returns a list of SystemTest objects. ```Python def get_system_tests() -> List[SystemTest]: """Description: Get a list of Test Suite system tests in the TIA Portal project Needs Test Suite installed and licensed. *Returns* → `List[SystemTest]` All System tests as list Example usage tests = project.get_system_tests() """ ``` -------------------------------- ### Get Application Tests Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of Test Suite application tests from the TIA Portal project. Requires Test Suite to be installed and licensed. Returns a list of ApplicationTest objects. ```Python def get_application_tests() -> List[ApplicationTest]: """Description: Get a list of Test Suite application tests in the TIA Portal project Needs Test Suite installed and licensed. *Returns* → `List[ApplicationTest]` All Application tests as list Example usage tests = project.get_application_tests() """ ``` -------------------------------- ### Get TIA Portal Instance Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the TIA Portal application instance from the current project context. Returns the Portal object. ```Python def get_portal() -> Portal: """Description: Get the TIA Portal instance from the current project Example usage portal = project.get_portal() """ ``` -------------------------------- ### Get Test Suite Style Guide Rule Set Property Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a specific property of a Test Suite style guide rule set. Properties are converted to strings if possible, aiding in accessing rule set configurations. ```python def get_property(name: str) -> str: """Get the property of the Test Suite style guide rule set. Properties which are not string will be converted to string if possible. Args: name: Property name of the rule set. Returns: The value of the property as a string. """ pass # Placeholder for actual implementation ``` -------------------------------- ### Get System Blocks Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the list of system blocks associated with the software unit. Returns a list of SystemBlock objects. ```python def get_system_blocks() -> List[SystemBlock]: """Get the list of the system blocks of the software unit""" # Example usage: # blocks = software_unit.get_system_blocks() ``` -------------------------------- ### Get Project Library Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the project library object, which provides access to project-specific libraries. Returns the ProjectLibrary object. ```Python def get_project_library() -> ProjectLibrary: """Description: Get the project library *Returns* → `ProjectLibrary` Project library Example usage project_lib = project.get_project_library() """ ``` -------------------------------- ### Get Type Version GUID Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the globally unique identifier (GUID) for the type version. Returns the GUID as a string. ```Python def get_type_version_guid() -> str: """Description: Get the GUID of the type version *Returns* → `str` GUID Example usage guid = plc_object.get_type_version_guid() """ ``` -------------------------------- ### TIA Portal Product Information Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Provides methods to retrieve information about the TIA Portal product. This includes getting the product's name, release version, and general version. ```APIDOC Product Information: get_name() -> str Description: Get the name of the TIA Portal product Returns: Name of the TIA Portal product Example usage: product_name = product.get_name() get_release() -> str Description: Get the release of the TIA Portal product Returns: Release tag of the TIA Portal product Example usage: product_release = product.get_release() get_version() -> str Description: Get the version of the TIA Portal product Returns: Version of the TIA Portal product Example usage: product_version = product.get_version() ``` -------------------------------- ### Get Type GUID Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the globally unique identifier (GUID) for the type. Returns the GUID as a string. ```Python def get_type_guid() -> str: """Description: Get the GUID of the type *Returns* → `str` GUID Example usage guid = plc_object.get_type_guid() """ ``` -------------------------------- ### TIA Portal Bundle Information Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Provides methods to retrieve information about a TIA Portal Bundle. This includes getting the bundle's title, release version, and a list of associated products. ```APIDOC Bundle Information: get_title() -> str Description: Get the title of the TIA Portal Bundle Returns: Title of the Siemens bundle Example usage: bundle_title = bundle.get_title() get_release() -> str Description: Get the release of the TIA Portal Bundle Returns: Release of the Siemens bundle Example usage: bundle_release = bundle.get_release() get_products() -> List[Product] Description: Get the list of products of the TIA Portal Bundle Returns: List of Siemens products Example usage: bundle_products = bundle.get_products() ``` -------------------------------- ### Get TIA Project-Server Name Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the name of the TIA Project-Server. This can be useful for identifying or logging server instances. ```python def get_server_name() -> str: """Get the server name of the TIA Project-Server. Returns: The server name as a string. """ pass # Placeholder for actual implementation ``` -------------------------------- ### TIA Portal Project Methods Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md This section details various methods for interacting with a TIA Portal project. It covers operations such as archiving, saving, exporting/importing CAx data, and retrieving project elements like PLCs, HMIs, and test suites. Each method includes its signature, parameter descriptions, return values, and usage examples. ```APIDOC Project Methods: get_property(name: str) Description: Retrieves a property value from the TIA Portal object. Parameters: name: The name of the property to retrieve (e.g., "CreationDate"). Example Usage: property_value = tiap_object.get_property(name = "CreationDate") is_consistent() -> bool Description: Checks if the program block is consistent. Returns: True if consistent, False otherwise. Example Usage: value = programblock.is_consistent() get_type_version_guid() -> str Description: Retrieves the GUID of the type version. Returns: The GUID as a string. Example Usage: guid = plc_object.get_type_version_guid() get_type_guid() -> str Description: Retrieves the GUID of the type. Returns: The GUID as a string. Example Usage: guid = plc_object.get_type_guid() get_properties() -> List[str] Description: Retrieves all properties of the object. Returns: A list of strings, where each string is a property name. Example Usage: properties = tiap_object.get_properties() get_portal() -> Portal Description: Retrieves the TIA Portal instance from the current project. Returns: The Portal object. Example Usage: portal = project.get_portal() archive(target_directory_path: str, archive_name: str, delete_existing_archive: bool) -> str Description: Archives the TIA Portal project to a specified directory. Parameters: target_directory_path: The folder path where the archive should be placed. archive_name: The name of the archive file (without extension). delete_existing_archive: A boolean indicating whether to delete an existing archive file with the same name. Returns: The full path of the newly created archive file. Example Usage: archive_fullpath = project.archive(target_directory_path = "C:\\ws\\newfolder", archive_name = "testproj" , delete_existing_archive = True) save_as(target_directory_path: str, project_name: str) -> str Description: Saves the TIA Portal project under a different path and name. Parameters: target_directory_path: The folder path where the project should be saved. project_name: The desired name for the saved project. Returns: The full path of the saved project. Example Usage: project_file_path = project.save_as(target_directory_path = "C:\\ws\\newfolder", project_name = "testproj") export_cax_data(export_file_path: str, log_file_path: str) -> bool Description: Exports the CAx data of the TIA Portal project. Parameters: export_file_path: The full path for the output CAx data file (e.g., .aml). log_file_path: The full path for the export log file. Returns: True if the export was successful, False otherwise. Example Usage: result = project.export_cax_data(export_file_path = "C:\\ws\\exportfolder\\exportCAX.aml", log_file_path = "C:\\ws\\exportfolder\\exportCAX.log") import_cax_data(import_file_path: str, log_file_path: str) -> bool Description: Imports CAx data into the TIA Portal project. Parameters: import_file_path: The full path to the CAx data import file (e.g., .aml). log_file_path: The full path for the import log file. Returns: True if the import was successful, False otherwise. Example Usage: result = project.import_cax_data(import_file_path = "C:\\ws\\importfolder\\importCAX.aml", log_file_path = "C:\\ws\\importfolder\\importCAX.log") get_plcs() -> List[Plc] Description: Retrieves a list of all PLCs configured in the TIA Portal project. Returns: A list of Plc objects. Example Usage: plcs = project.get_plcs() for plc in plcs: ... get_hmis() -> List[Hmi] Description: Retrieves a list of all HMIs configured in the TIA Portal project. Returns: A list of Hmi objects. Example Usage: hmis = project.get_hmis() for hmi in hmis: ... get_application_tests() -> List[ApplicationTest] Description: Retrieves a list of Test Suite application tests in the TIA Portal project. Requires Test Suite installed and licensed. Returns: A list of ApplicationTest objects. Example Usage: tests = project.get_application_tests() get_system_tests() -> List[SystemTest] Description: Retrieves a list of Test Suite system tests in the TIA Portal project. Requires Test Suite installed and licensed. Returns: A list of SystemTest objects. Example Usage: tests = project.get_system_tests() get_rule_sets() -> List[RuleSet] Description: Retrieves a list of Test Suite Styleguide rule sets in the TIA Portal project. Requires Test Suite installed and licensed. Returns: A list of RuleSet objects. Example Usage: rule_sets = project.get_rule_sets() get_project_library() -> ProjectLibrary Description: Retrieves the project library object. Returns: The ProjectLibrary object. Example Usage: project_lib = project.get_project_library() import_umac_config(import_file_path: str) -> int Description: Imports UMAC and UMC Configuration to the TIA Portal project. Parameters: import_file_path: The full path of the import file. Returns: An integer representing the result state of the import. ``` -------------------------------- ### Get Library Type GUID Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the GUID (Globally Unique Identifier) of the library type. This function returns the type's GUID as a string. ```python def get_guid() -> str: """Get the guid of the library type *Returns* → `str` Guid of the type Example usage guid = lib_type.get_guid() """ ``` -------------------------------- ### Get Test Suite Style Guide Rule Set Name Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the name of a Test Suite style guide rule set. This function is used to identify specific rule sets within a project's testing configuration. ```python def get_name() -> str: """Get the name of the Test Suite style guide rule set. Returns: The name of the rule set as a string. """ pass # Placeholder for actual implementation ``` -------------------------------- ### Get TIA Project-Server by URL Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a specific TIA Project-Server found by its URL. The function requires the URL of the Project-Server as a string and returns a `ProjectServer` object. ```python def get_project_server(url: str) -> ProjectServer: Description: Get the TIA Project-Server found by URL *Returns* → `ProjectServer` TIA Project-Server | Parameters | Type | Description | | --- | --- | --- | | url | str | URL of the TIA Project-Server | Example usage portal.get_project_server(url = "https://project.server.net:8735/") ``` -------------------------------- ### Get TIA Project-Server Host Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the hostname or IP address of the TIA Project-Server. This is essential for establishing a connection to the server. ```python def get_host() -> str: """Get the host of the TIA Project-Server. Returns: The host address as a string. """ pass # Placeholder for actual implementation ``` -------------------------------- ### Get All Property Names Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of all available property names for the object. Returns a list of strings representing attribute names. ```python def get_properties() -> List[str]: """Get all properties of the object""" # Returns: Names of the attributes # Example usage: # properties = tiap_object.get_properties() ``` -------------------------------- ### Get PLC Type Version GUID Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the globally unique identifier (GUID) for the type version of the PLC object. ```python def get_type_version_guid() -> str: """Get the GUID of the type version""" # Example usage guid = plc_object.get_type_version_guid() return guid ``` -------------------------------- ### Get Library Type Versions Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of all versions associated with the library type. Returns a list of LibraryTypeVersion objects. ```python def get_versions() -> List[LibraryTypeVersion]: """Get the versions of the library type *Returns* → `List[LibraryTypeVersion]` Versions of the type Example usage versions = lib_type.get_versions() """ ``` -------------------------------- ### Get PLC Type GUID Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the globally unique identifier (GUID) for the type of the PLC object. ```python def get_type_guid() -> str: """Get the GUID of the type""" # Example usage guid = plc_object.get_type_guid() return guid ``` -------------------------------- ### Get Project PLCs Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of all Programmable Logic Controllers (PLCs) configured within the TIA Portal project. Returns a list of Plc objects. ```Python def get_plcs() -> List[Plc]: """Description: Get a list of PLCs in the TIA Portal project *Returns* → `List[Plc]` All PLC's as list Example usage plcs = project.get_plcs() for plc in plcs: ... """ ``` -------------------------------- ### Get All PLC Object Properties Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of all available property names for the PLC object. This is useful for introspection. ```python def get_properties() -> List[str]: """Get all properties of the object""" # Example usage properties = tiap_object.get_properties() return properties ``` -------------------------------- ### Get System Test Name Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the name of the Test Suite system test. Returns the name as a string. ```python def get_name() -> str: """Get the name of the Test Suite system test""" # Returns: Name of the system test # Example usage: # name = sys_test.get_name() ``` -------------------------------- ### Get TIA Project-Servers Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of TIA Project-Servers found by a host filter. The function takes a host filter string as input and returns a list of `ProjectServer` objects. ```python def get_project_servers() -> List[ProjectServer]: Description: Get a list of TIA Project-Servers found by host-filter *Returns* → `List[ProjectServer]` List of TIA Project-Servers | Parameters | Type | Description | | --- | --- | --- | | host_filter | str | Host of the TIA Project-Servers | Example usage portal.get_project_servers(host_filter = "CompanyServer") ``` -------------------------------- ### Get All Object Properties Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of all property names for an object. Returns a list of strings, where each string is a property name. ```python def get_properties() -> List[str]: """Get all properties of the object *Returns* → `List[str]` Names of the attributes Example usage properties = tiap_object.get_properties() """ ``` -------------------------------- ### Get PLC Object Name Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the name of the PLC object. Returns the name as a string. ```python def get_name() -> str: """Get the name of the PLC object""" # Returns: Name of the PLC object # Example usage: # name = plc_object.get_name() ``` -------------------------------- ### Get Object Properties Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of all properties associated with the object. Returns a list of strings, where each string is a property name. ```Python def get_properties() -> List[str]: """Description: Get all properties of the object *Returns* → `List[str]` Names of the attributes Example usage properties = tiap_object.get_properties() """ ``` -------------------------------- ### Get HMI Name Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the name of the HMI. This function returns the HMI's name as a string. ```python def get_name() -> str: """Get the name of the HMI *Returns* → `str` Name of the HMI Example usage hmi_name = hmi.get_name() """ ``` -------------------------------- ### Get External Sources Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the list of external data sources connected to the software unit. Returns a list of ExternalSource objects. ```python def get_external_sources() -> List[ExternalSource]: """Get the list of the external sources of the software unit""" # Example usage: # ext_sources = software_unit.get_external_sources() ``` -------------------------------- ### Get Project HMIs Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of all Human-Machine Interfaces (HMIs) configured within the TIA Portal project. Returns a list of Hmi objects. ```Python def get_hmis() -> List[Hmi]: """Description: Get a list of HMIs in the TIA Portal project *Returns* → `List[Hmi]` All HMI's as list Example usage hmis = project.get_hmis() for hmi in hmis: ... """ ``` -------------------------------- ### Get Library Type Name Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the name of the library type. This function returns the type's name as a string. ```python def get_name() -> str: """Get the name of the library type *Returns* → `str` Name of the type Example usage name = lib_type.get_name() """ ``` -------------------------------- ### Get All Object Properties Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of all available properties for an object. This function is useful for inspecting the attributes of a TIA object. ```python def get_properties() -> List[str]: """Get all properties of the object. Returns: Names of the attributes as a list of strings. """ pass # Placeholder for actual implementation ``` -------------------------------- ### Get Program Blocks from Software Unit Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of all program blocks (e.g., functions, function blocks) within a software unit. This allows for programmatic access to the code structure. ```python def get_program_blocks() -> List[ProgramBlock]: """Get the list of the program blocks. Returns: A list of ProgramBlock objects belonging to the software unit. """ pass # Placeholder for actual implementation ``` -------------------------------- ### PLC Object Information Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Provides methods to retrieve information about a PLC object. Currently, it supports getting the name of the PLC object. ```APIDOC PLC Object Information: get_name() -> str Description: Get the name of the PLC object Returns: Name of the PLC object Example usage: name = plc_object.get_name() ``` -------------------------------- ### Get System Blocks from Software Unit Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of all system blocks (e.g., OBs, FCs, FBs that are part of the system) within a software unit. This function is key for analyzing system-level code components. ```python def get_system_blocks() -> List[SystemBlock]: """Get the list of the system blocks. Returns: A list of SystemBlock objects within the software unit. """ pass # Placeholder for actual implementation ``` -------------------------------- ### Get Global Library Author Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the author of the global library. This function returns the author's name as a string. ```python def get_author() -> str: """Get author of the global library *Returns* → `str` Name of the author Example usage author = global_lib.get_author() """ ``` -------------------------------- ### Get Global Library Path Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the full path of the global library. This function returns the library's file path as a string. ```python def get_path() -> str: """Get the path of the global library *Returns* → `str` Full path of the library Example usage path = global_lib.get_path() """ ``` -------------------------------- ### Get Global Library Name Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the name of the global library. This function returns the library's name as a string. ```python def get_name() -> str: """Get the name of the global library info *Returns* → `str` Name of the global library info Example usage name = global_lib_info.get_name() """ ``` -------------------------------- ### Get TIA Portal Project Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the currently opened TIA Portal project from the active instance. This function returns a `Project` object representing the TIA Portal project. ```python def get_project() -> Project: Description: Get opened TIA Portal project of the current TIA Portal instance *Returns* → `Project` TIA Portal project Example usage project = portal.get_project() ``` -------------------------------- ### Get PLC Tag Tables from Software Unit Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a list of all PLC tag tables associated with a specific software unit. This provides access to the data structures used for communication. ```python def get_plc_tag_tables() -> List[PlcTagTable]: """Get the list of the PLC tag tables. Returns: A list of PlcTagTable objects associated with the software unit. """ pass # Placeholder for actual implementation ``` -------------------------------- ### Get Global Library by Name Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a global library by its name. This function requires the name of the global library as a string parameter and returns a `GlobalLibrary` object. ```python def get_global_library(library_name: str) -> GlobalLibrary: Description: Get global library by name *Returns* → `GlobalLibrary` Global Library | Parameters | Type | Description | | --- | --- | --- | | library_name | str | Name of the global library | Example usage global_lib = portal.get_global_library(library_name = "GlobalLib1") ``` -------------------------------- ### Get Library Type Folder Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the folder containing library types and library type folders. The return type is LibraryTypeFolder. ```python def get_library_type_folder() -> LibraryTypeFolder: """Get the folder containing library types & library type folders *Returns* → `LibraryTypeFolder` Library type folder Example usage library_type = global_lib.get_library_type_folder() """ ``` -------------------------------- ### Get User Data Types Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the list of user-defined data types for the software unit. Returns a list of UserDataType objects. ```python def get_user_data_types() -> List[UserDataType]: """Get the list of the user data types of the software unit""" # Example usage: # udts = software_unit.get_user_data_types() ``` -------------------------------- ### Get Object Properties Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves all properties of an object and allows fetching specific properties by name. Properties not of string type are converted to strings if possible. ```APIDOC tiap_object.get_property(name: str) -> str Description: Get the property of the object. Parameters: name: str - Property name of the object Returns: str - Value of the property as string Example usage: property_value = tiap_object.get_property(name = "CreationDate") tiap_object.get_properties() -> List[str] Description: Get all properties of the object. Returns: List[str] - Names of the attributes Example usage: properties = tiap_object.get_properties() ``` -------------------------------- ### Library Type Version Information Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Methods to retrieve metadata for a library type version, such as author, GUID, version number, modification date, state, and the associated type object. ```APIDOC projectlib.get_author() -> str Description: Get the author of the library type version. Returns: str - Author Example usage: author = projectlib.get_author() lib_type_version.get_guid() -> str Description: Get the GUID of the library type version. Returns: str - GUID Example usage: guid = lib_type_version.get_guid() lib_type_version.get_version_number() -> str Description: Get the version number of the library type version. Returns: str - version number Example usage: version_number = lib_type_version.get_version_number() lib_type_version.get_modified_date() -> str Description: Get the modification date of the library type version. Returns: str - Modification date Example usage: date = lib_type_version.get_modified_date() lib_type_version.get_state() -> str Description: Get the state of the library type version. Returns: str - State of the library type version Example usage: state = lib_type_version.get_state() lib_type_version.get_type_object() -> LibraryType Description: Get the type of the library type version. Returns: LibraryType - Library type object Example usage: lib_type = lib_type_version.get_type_object() ``` -------------------------------- ### PLC Control Operations Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Functions for managing PLC (Programmable Logic Controller) connections and operations, including getting PLC name, online state, going online, and downloading to the PLC. ```APIDOC plc.get_name() -> str Description: Get the name of the PLC. Returns: str - Name of the PLC Example usage: plc_name = plc.get_name() plc.get_online_state() -> str Description: Get the current online state of the PLC. Returns: str - Online state Example usage: plc.get_online_state() plc.go_online(mode: str, pci_interface: str, ip_address: str) -> str Description: Go online with the PLC. Parameters: mode: str - Configuration mode pci_interface: str - PC Interface name ip_address: str - IP address Returns: str - Online status Example usage: plc.go_online(mode = "PN/IE", pci_interface = "PLCSIM", ip_address = "192.168.0.10") plc.download(mode: str, pci_interface: str, ip_address: str) -> str Description: Download the PLC. Parameters: mode: str - Configuration mode pci_interface: str - PC Interface name ip_address: str - IP address Returns: str - Result of the download Example usage: result = plc.download(mode = "PN/IE", pci_interface = "PLCSIM", ip_address = "192.168.0.10") ``` -------------------------------- ### Get PLC Object Name Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the name of the PLC object. This method returns the object's identifier as a string. ```python def get_name() -> str: """Get the name of the PLC object""" # Example usage name = plc_object.get_name() return name ``` -------------------------------- ### Get Software Unit Name Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the name of a software unit within the TIA Portal project. This function is useful for identifying specific software components. ```python def get_name() -> str: """Get the name of the software unit. Returns: The name of the software unit as a string. """ pass # Placeholder for actual implementation ``` -------------------------------- ### Get Named Value Types Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the list of named value types used within the software unit. Returns a list of NamedValueType objects. ```python def get_named_value_types() -> List[NamedValueType]: """Get the list of the named value types of the software unit""" # Example usage: # nvts = software_unit.get_named_value_types() ``` -------------------------------- ### Get TIA Project-Server Port Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the network port number used by the TIA Project-Server. This is required for connecting to the server's services. ```python def get_port() -> int: """Get the port of the TIA Project-Server. Returns: The port number as an integer. """ pass # Placeholder for actual implementation ``` -------------------------------- ### Get Object Property Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a specific property of an object by its name. Properties not of type string are converted to string if possible. Returns the property value as a string. ```python def get_property(name: str) -> str: """Get the property of the object Properties which are not string will be converted to string if possible. *Returns* → `str` Value of the property as string | Parameters | Type | Description | | --- | --- | --- | | name | str | Property name of the object | Example usage property_value = tiap_object.get_property(name = "CreationDate") """ ``` -------------------------------- ### Get Object Property Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a specific property of an object. Properties that are not strings are converted to strings if possible. This function is available for various TIA objects. ```python def get_property(name: str) -> str: """Get the property of the object. Properties which are not string will be converted to string if possible. Args: name: Property name of the object. Returns: Value of the property as string. """ pass # Placeholder for actual implementation ``` -------------------------------- ### Get Property Value Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the value of a specific property of an object. Properties not originally strings are converted to strings if possible. Returns the property value as a string. ```python def get_property(name: str) -> str: """Get the property of the object Properties which are not string will be converted to string if possible. """ # Parameters: # name (str): Property name of the object # Returns: Value of the property as string # Example usage: # property_value = tiap_object.get_property(name = "CreationDate") ``` -------------------------------- ### Get PLC Object Property Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves a specific property of the PLC object. Non-string properties are converted to strings if possible. Requires the property name as input. ```python def get_property(name: str) -> str: """Get the property of the object Properties which are not string will be converted to string if possible. """ # Parameters: # name: Property name of the object # Example usage property_value = tiap_object.get_property(name = "CreationDate") return property_value ``` -------------------------------- ### Get Library Type Folder Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Retrieves the folder structure containing library types and library type folders within a project. This is typically used when working with reusable library components. ```python def get_type_folder() -> LibraryTypeFolder: """Get the folder containing library types & library type folders. Returns: The LibraryTypeFolder object representing the library structure. """ pass # Placeholder for actual implementation ``` -------------------------------- ### Manage TIA Portal Instances and Projects Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Functions to open, attach to, or open and attach projects to TIA Portal instances. Includes options for GUI visibility and specifying TIA Portal versions. ```APIDOC open_portal(portal_mode: Optional[Enums.PortalMode] = None, version: Optional[str] = None) -> Portal Description: Open a new TIA Portal instance. Parameters: - portal_mode (Enums.PortalMode, optional): Specifies if the TIA Portal instance should run with or without a user interface. Defaults to None. - version (str, optional): The version string of TIA Portal to be used, in 'major.minor' format (e.g., "18.0"). If not specified, the latest installed TIA Portal version is used. Defaults to None. Returns: Portal: An instance representing the TIA Portal application. Example: portal = siemens_tia_scripting.open_portal(portal_mode = siemens_tia_scripting.Enums.PortalMode.WithGraphicalUserInterface, version = "18.0") attach_portal(portal_mode: Optional[Enums.PortalMode] = None, version: Optional[str] = None) -> Portal Description: Attach to a running TIA Portal instance. Parameters: - portal_mode (Enums.PortalMode, optional): Specifies if the TIA Portal instance should run with or without a user interface. Defaults to None. - version (str, optional): The version string of TIA Portal to be used, in 'major.minor' format (e.g., "18.0"). If not specified, the latest installed TIA Portal version is used. Defaults to None. Returns: Portal: An instance representing the TIA Portal application. Example: portal = siemens_tia_scripting.attach_portal(portal_mode = Enums.PortalMode.WithGraphicalUserInterface, version = "18.0") open_attach_project(project_file_path: str, portal_mode: Optional[Enums.PortalMode] = None) -> Project Description: Attach to a running TIA Portal instance with an already open project, or open the project with a new instance of a fitting TIA Portal version. Parameters: - project_file_path (str): The full path of the project file to open or attach to. - portal_mode (Enums.PortalMode, optional): Specifies if the TIA Portal instance should run with or without a user interface. Defaults to None. Returns: Project: An instance representing the TIA Project. Example: project = siemens_tia_scripting.open_attach_project(project_file_path = "C:\\ws\\testproj\\testproj.ap17", portal_mode = siemens_tia_scripting.Enums.PortalMode.WithGraphicalUserInterface) ``` -------------------------------- ### Open Global Library with Copy Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Opens a global library by first copying it to a temporary directory. This function requires the target directory path, the library's original path, and a boolean to indicate if the temporary project should be deleted after opening. It returns a `GlobalLibrary` object. ```python def open_global_library_with_copy(target_directory_path: str, library_path: str, delete_existing_project: bool) -> GlobalLibrary: Description: Open global library from a copy *Returns* → `GlobalLibrary` Global Library | Parameters | Type | Description | | --- | --- | --- | | target_directory_path | str | Temporary path where the library should be copied before opened | | library_path | str | Full path of the global library | | delete_existing_project | bool | Defines if the temporary project should be deleted | Example usage global_lib = portal.open_global_library_with_copy(target_directory_path = "C:\\ws\\temp", library_path = "C:\\ws\\testlib\\testlib.al17", delete_existing_project = True) ``` -------------------------------- ### Import UMAC and UMC Configuration Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Imports UMAC and UMC configuration files into the TIA Portal project. Requires the full path to the import file. Returns an integer indicating the result state of the import. ```Python def import_umac_config(import_file_path: str) -> int: """Description: Import UMAC and UMC Configuration to the TIA Portal project | Parameters | Type | Description | | --- | --- | --- | | import_file_path | str | Full path of the import file | """ ``` -------------------------------- ### TIA Portal Project Management Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Functions for opening, copying, retrieving, and creating TIA Portal projects. These methods allow for managing project files and archives. ```APIDOC open_project(project_file_path: str, server_project_view: Optional[bool] = None) -> Project Opens a TIA Portal project or local session. Parameters: - project_file_path (str): Full path of the project file. - server_project_view (Optional[bool]): If set to true, opens the project in server project view. Defaults to false. Returns: - Project: The opened TIA Portal project object. Example: project = portal.open_project(project_file_path = "C:\\ws\\testproj\\testproj.ap17") open_project_with_copy(project_file_path: str, target_directory_path: str, delete_existing_project: bool) -> Project Opens a TIA Portal project or local session by copying it to a separate folder first. Parameters: - project_file_path (str): Full path of the project file to copy and open. - target_directory_path (str): Temporary path where the project should be copied before opening. - delete_existing_project (bool): Defines if the temporary project copy should be deleted after opening. Returns: - Project: The opened TIA Portal project object. Example: project = portal.open_project_with_copy(project_file_path = "C:\\ws\\testproj\\testproj.ap17", target_directory_path = "C:\\ws\\temp" , delete_existing_project = True) retrieve_archive(target_directory_path: str, archive_file_path: str, delete_existing_project: bool) -> Project Retrieves a TIA Portal project archive into a specified directory. Parameters: - target_directory_path (str): Temporary path where the project should be copied before opening. - archive_file_path (str): Full path of the archived project file. - delete_existing_project (bool): Defines if the temporary project copy should be deleted after retrieval. Returns: - Project: The retrieved TIA Portal project object. Example: project = portal.retrieve_archive(archive_file_path = "C:\\ws\\testproj\\testproj.zap17", target_directory_path = "C:\\ws\\temp" , delete_existing_project = True) create_project(target_directory_path: str, project_name: str, delete_existing_project: bool) -> Project Creates a new TIA Portal project in the specified directory. Parameters: - target_directory_path (str): Temporary path where the new project should be created. - project_name (str): The name for the new TIA Portal project. - delete_existing_project (bool): Defines if any existing temporary project should be deleted before creation. Returns: - Project: The newly created TIA Portal project object. ``` -------------------------------- ### Open Global Library by Path Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Opens a global library located at a specified file path. The function takes the full path to the library file as input and returns a `GlobalLibrary` object. ```python def open_global_library(library_path: str) -> GlobalLibrary: Description: Open global library by path *Returns* → `GlobalLibrary` Global Library | Parameters | Type | Description | | --- | --- | --- | | library_path | str | Full path of the global library | Example usage global_lib = portal.open_global_library(library_path = "C:\\ws\\testlib\\testlib.al17") ``` -------------------------------- ### Import UMAC Configuration Source: https://github.com/lixiang6632/context7/blob/master/siemens_tia_scripting.md Imports UMAC configuration from a specified file path. It requires the path to the import file and optionally the name of the environment variable storing the secret key for decryption. ```python def import_umac_config(import_file_path: str, secret_env_name: str) -> None: """Imports UMAC configuration from a file. Args: import_file_path: The full path to the UMAC configuration file to import. secret_env_name: The name of the environment variable where the secret is stored. """ pass # Placeholder for actual implementation ```