Quick Start#
This section guides the user through the basic usage of the package. How the functions are designed, their basic initialization, client class functionality and more.
Functions#
Using gRPC, functions are defined in .proto files. This approach allows the generation of API functions in languages such as Python, C#/.NET, C++, Java, PHP, and more.
The functions are divided into two sections: Application and Object. Application functions provide app and model functionality. In this context, a lean interface is implemented, meaning there are only three types of model functions:
Functions to work with individual objects
Functions to work with multiple objects
Functions to handle results
To get, set, update, or delete object(s), the functions are named _object
or _object_list
.
Using _object_list
functions to edit multiple objects at once offers significant performance benefits and is strongly recommended.
For complete scripts, please refer to our Examples.
Import#
From API package import rfem
and Application
(renamed to RFEM).
from dlubal.api import rfem
from dlubal.api.rfem.application import Application
Application Class#
Application class facilitates all functionality regarding connection and authorization. Information about API key, url and SSL are set dynamicaly as parameters. API key can be used once, can be saved or used as alias of the saved key. IP adresss and port are set separately. URL can point to typical localhost (127.0.0.1) when used locally or to any other IP address when used remotely. Port number defaults to 9000. It is set in RFEM - Options - Program Options settings.
SSL can be set in the same settings and is optional when connecting to localhost. This protocol secures the communication between the server and client and is required when accessing different IP. Before using it, SSL certificate and private key have to be created. Refer to SSL Connection.
Initialization#
Set the scope manager with
setting api_key_name
for the project or using default value.
Close all opened models.
This is handy when your project requires fresh start.
Then create new model with the name
parameter.
with Application() as RFEM:
RFEM.close_all_models(save_changes=False)
RFEM.create_model(name='cantilever')
Adding Inputs#
Last step of this intoduction is to add objects
and parameters
.
As mentioned above, we reccomend to always use create_object_list
since this is best for the performance of your script.
There are no restrictions regarding setting different types together.
structure = [
rfem.structure_core.Material(name='S235'),
rfem.structure_core.Section(name='IPE 200', material=1),
rfem.structure_core.Node(coordinate_1=1.0),
rfem.structure_core.Node(coordinate_1=3.0),
rfem.structure_core.Line(definition_nodes=[1,2]),
rfem.structure_core.Member(line=1, section_start=1)
]
RFEM.create_object_list(structure)
RFEM.update_object(rfem.types_for_nodes.NodalSupport(no=2, nodes=[1]))
Connection is closed automatically at the end of the script or scope of Application class.
Optionaly you can close it via RFEM.close_connection()
.