Results Multiple Models#
|   | In this example we will demonstrate how to: 
 | 
from dlubal.api import rfem, common
with rfem.Application() as rfem_app:
    model_list = rfem_app.get_model_list()
    print(f"\nModel List:\n{model_list}")
    for model_id in model_list.model_info:
        if rfem_app.has_results(
            model_id=common.ModelId(
                guid=model_id.guid
            )).value :
            # --- Retriev results from the specified model (already calculated) ---
            # 1. get_results: Returns all results of the specified type from the specified model's database.
            #    This retrieves the complete result dataset, including all possible columns. It is suitable for
            #    detailed analytics, filtering, or accessing values not shown in the RFEM GUI.
            #    The `model_id` parameter ensures results are pulled from the correct model context.
            df_internal_forces = rfem_app.get_results(
                results_type=rfem.results.ResultsType.STATIC_ANALYSIS_MEMBERS_INTERNAL_FORCES,
                model_id=common.ModelId(guid=model_id.guid)
            ).data
            print(f"\nInternal Forces | All | {model_id.name}:")
            print(df_internal_forces)
            # 2. get_result_table: Returns a simplified result table as shown in the RFEM GUI by default.
            #    This includes only the key summary values, providing a quick overview for end users or exports.
            #    The `model_id` parameter ensures the table is retrieved for the correct model instance.
            df_internal_forces_table = rfem_app.get_result_table(
                table = rfem.results.ResultTable.STATIC_ANALYSIS_MEMBERS_INTERNAL_FORCES_TABLE,
                loading= rfem.ObjectId(
                    no=1,
                    object_type=rfem.OBJECT_TYPE_LOAD_CASE,
                ),
                model_id = common.ModelId(guid=model_id.guid)
            ).data
            print(f"\nInternal Forces | Table | {model_id.name}:")
            print(df_internal_forces_table)
using Rfem = Dlubal.Api.Rfem;
using Dlubal.Api.Common;
ApplicationRfem? rfemApp = null;
try
{
    rfemApp = new ApplicationRfem();
    var modelList = await rfemApp.get_model_list();
    Console.WriteLine($"Model List: {modelList}");
    foreach (var modelId in modelList.ModelInfo)
    {
        Console.WriteLine($"- {modelId.Name}");
        // 1. Get full results from the model (complete dataset)
        var dfInternalForces = await rfemApp.get_results(
            Rfem.Results.ResultsType.StaticAnalysisMembersInternalForces,
            modelId: new ModelId { Guid = modelId.Guid }
        );
        Console.WriteLine($"\nInternal Forces | All | {modelId.Name}:");
        Console.WriteLine(dfInternalForces.Data);
        // 2. Get simplified result table as seen in RFEM GUI
        var dfInternalForcesTable = await rfemApp.get_result_table(
            table: Rfem.Results.ResultTable.StaticAnalysisMembersInternalForcesTable,
            loading: new Rfem.ObjectId
            {
                No = 1,
                ObjectType = Rfem.ObjectType.LoadCombination
            },
            modelId: new ModelId { Guid = modelId.Guid }
        );
        Console.WriteLine($"\nInternal Forces | Table | {modelId.Name}:");
        Console.WriteLine(dfInternalForcesTable.Data);
    }
}
catch (Exception ex)
{
    Console.WriteLine($"Error: {ex.Message}");
}
finally
{
    if (rfemApp != null) await rfemApp.close_connection();
}