Application#

The dlubal.api.rfem.Application class serves as the gRPC client, offering full access to functionalities and underlying data, enabling seamless management and interaction with RFEM.


dlubal.api.rfem.Application.__init__(self, api_key_value=None, api_key_name=None, url='127.0.0.1', port=9000, ssl=False, ssl_file='')#

Initialize the RFEM client and connect to gRPC server.

Parameters:
  • api_key_value (str | None) – The API key for authentication, obtained from the Extranet > My Data. Can be skipped if an API key is stored in config.ini file.

  • api_key_name (str | None) – The name of a stored API key in the config.ini file. Used to retrieve the corresponding api_key_value. If not provided, the default API key will be used.

  • url (str | 127.0.0.1) – The gRPC server’s URL. Use this to connect to a remote server by specifying its IP.

  • port (int | 9000) – The server’s port number. Adjust if the server uses a different port.

  • ssl (bool | False) – Enables SSL encryption for secure communication.

  • ssl_file (str | None) – Path to the SSL certificate file (e.g., .crt). Used only if SSL encryption is enabled.


Usage

from dlubal.api import rfem, common

# Initialize and connect the RFEM client
with rfem.Application() as rfem_app:

      # Create new model
      rfem_app.create_model(name="demo_model")

      # Create model object
      rfem_app.create_object(
         rfem.structure_core.Node(
            coordinate_1 = 3.0
         )
      )

Tip

The with context manager automatically closes the client-server connection when the block ends. If you instantiate rfem.Application() without with, remember to call close_connection() yourself.


Methods#