679x
005416
2023-09-12

如何使用网络服务启用模型模块?

如何使用网络服务启用模型模块?
如何创建一个新的模型,并启用模块?


回复:

当使用网络服务创建模型时,创建的模型不需要在 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.


作者

Grzegorz Fulczyk 负责 Dlubal 软件在波兰市场的销售开发,并为客户提供技术支持。

下载


;