535x
005416
2023-09-12

How can I enable model add-ons when using WebService?

How can I enable model add-ons when using WebService?
How can I create a new model with add-ons enabled?


Answer:

When creating models with WebService, it is useful to create models which are ready to be calculated or designed without manually changing things inside RFEM.
For example, when defining structures with membranes or cables, a freshly created model without add-ons cannot be successfully calculated.

In order to create a new model with add-ons enabled, you need to consider using the .get_addon_statuses() and .set_addon_statuses() methods.

Please have a look at the example below:

import os

import sys

baseName = os.path.basename(__file__)

dirName = os.path.dirname(__file__)

sys.path.append(dirName + r'/../../..')

from RFEM.initModel import Model

if __name__ == '__main__':

 Model(True, "Hello Model") # Create new model

 Addons = Model.clientModel.service.get_addon_statuses()

 # See structure of addon_statuses_list

 # print(Addons)

 # design_addons list

 Addons[0].stress_analysis_active = True

 Addons[0].steel_design_active = True

 # analysis list

 Addons[3].structure_stability_active = True

 Addons[3].form_finding_active = True

 Model.clientModel.service.set_addon_statuses(Addons)

In this example, we start with setting the directory to the RFEM library and importing it.
Next, we create a new model and create a new variable called "Addons".
This variable is created with direct instructions for the RFEM 6 WebService Server and is understood as 'addon_statuses list'.
By using the 'get' method, our variable has a structure that will be understood by RFEM and can be edited.

Next, we modify this object to enable specific add-ons inside the RFEM 6 model.
By default, the state of the add-ons on this list is set to False. The modification in this example consists of setting the state of addons to True, this means that they will be enabled in the new model.

After this, we use the .set_addon_statuses() method with variable "Addons" as the argument. This sends the information about the True status of add-ons back to RFEM and changes the freshly created model.

In this example, only a few add-ons are shown to be enabled but more are available in RFEM 6. To see the whole list of available add-ons and their names in the "Addons" object, use the print(Addons) function.

The original python code is available in the files below.


Author

Grzegorz Fulczyk supports the development of sales on the Polish market and provides technical support to customers of Dlubal Software.

Downloads


;