Working with multiple open models

Dear Dlubal Community

I would like to compare two models via dlubal.api. Both models are opened in the same RFEM GUI. My code looks as follows:

from dlubal.api import rfem
import pandas as pd

rfem_model_path0 = r"Y:\\...\\4269_20260227_v0_Gebäudemodell.rf6"
rfem_model_path1 =  r"Y:\\...\\4269_20260304_v1_Gebäudemodell.rf6"
)

def get_result_table_for(load_case_no: int) -> pd.DataFrame:
    return rfem_app.get_result_table(
    table=rfem.results.ResultTable.MODAL_ANALYSIS_MASSES_IN_LOCATIONS_TABLE,
    loading=rfem.ObjectId(no=load_case_no, object_type=rfem.OBJECT_TYPE_LOAD_CASE)
).data

with rfem.Application() as rfem_app:

    mlist = rfem_app.get_model_list()
    print(mlist)

    id0 = rfem_app.open_model(path=rfem_model_path0)
    rfem_app.set_active_model(model_id=id0)
    v0_data = get_result_table_for(load_case_no=4)

    id1 = rfem_app.open_model(path=rfem_model_path1)
    rfem_app.set_active_model(model_id=id1)
    v1_data = get_result_table_for(load_case_no=4)

Response of the print statement:

>>>
model_info {
  name: "4269_20260304_v1_Gebäudemodell"
  guid: "f7b45932-9de5-4638-bbd7-9cdce4771abe"
  path: "Y:/.../4269_20260304_v1_Gebäudemodell.rf6"
}
model_info {
  name: "4269_20260227_v0_Gebäudemodell"
  guid: "f7b45932-9de5-4638-bbd7-9cdce4771abe"
  path: "Y:/.../4269_20260227_v0_Gebäudemodell.rf6"
}

My questions:

  1. The DataFrames v0_data and v1_data are identical - presumably because the guid is the same. Shouldn't the models be assigned different guids?
  2. How do I correctly address multiple opened models?
  3. Is it possible to read results from models via the API without opening them in the GUI?

Thanks for your help.
Lucas

Hi Lucas,

you're on the right track, the guid makes the trouble here, because it is identical. I guess you just copied the file in the explorer and renamed it. In this case, the guid will be the same for both projects, which is not what you wanted. Instead you should use 'Save as' from within RFEM, then a new guid is created and everything works as expected.

I hope this helps.

Best regards
Robert Milrath

Hi Robert - thanks for your help. Is it possible to read results without opening the GUI? Can my code be simplified?

Hi Lucas,

the code seems to be ok. You can use the RFEMServer if you don't want to use the GUI. For detailed information have a look at RFEM 6 als Server starten.

One more request from me: please do not change the topic within a chat. It is better to start a new topic; this is cleaner and helps us to keep our community well structured. Thank you.

Happy coding.

Best regards
Robert Milrath