Automate the creation of loads using formulas

Hello,
I would like to automate (via Python) the creation of formulas in order to create linear loads. Here is an example of what I want to create automatically via the API:
image
Have a good day,

Hi amazigh,

you can use the global parameters as described in the documentation. Here is a code snippet to get a better understanding:

from dlubal.api import RFEM

with RFEM.Application(port=9000) as RFEM_app:

# Get base data
rfem_app.create_object_list(
    [
        rfem.global_parameters.GlobalParameter(
            no=1,
            name='parameter_a',
            definition_type=rfem.global_parameters.GlobalParameter.DEFINITION_TYPE_VALUE,
            value=666,
            comment='Set via API',
        )
    ]
)

I hope that helps.

Best regards
Robert Milrath

Hello @robert.milrath Thank you very much for your response, it works wonderfully well.
I would like these formulas to be used automatically in the overall bar loads. Specifically, in the image below, I would like to replace Vent_lat_poteau with F_poteau which is defined as follows: RFEM.global_parameters.GlobalParameter(no=1,name='F_poteau',symbol='F_poteau',unit_group=RFEM.global_parameters.GlobalParameter.UNIT_GROUP_LOADS_FORCE_PER_UNIT_LENGTH,unit='kN/m', definition_type=RFEM.global_parameters.GlobalParameter.DEFINITION_TYPE_FORMULA,formula='CsCdPsi_lambdaC_f0_poteauP_dynL_poteau')) and for this to be recognized in RFEM6 as a formula and not as a float.
image

Thank you for your valuable help!

Hi amazigh,

you can get the global variable like any other object from RFEM:

from dlubal.api import RFEM

with RFEM.Application() as RFEM_app:
# Get Node number 1 from the active model and print its coordinates
node: RFEM.structure_core.Node = RFEM_app.get_object(
RFEM.structure_core.Node(no=1)
)
print(f"node.coordinates:\n{node.coordinates}")

# Get Global Variable number 1 from the active model and print its properties
global_variable: rfem.global_parameters.GlobalParameter = rfem_app.get_object(
    rfem.global_parameters.GlobalParameter(no=1)
)
print(f"global_variable:\n{global_variable}")

I hope this helps.

Best regards
Robert Milrath

Hello Robert,
Thanks a lot for your help but actually I need to get this value by a formula not the magnitude. (as you can see in the picture below).

Something like that :
with RFEM.Application(api_key_value="XXX", url='localhost', port=9000) as RFEM_app:

# Récupération des variables globales
F_poteau: rfem.global_parameters.GlobalParameter = rfem_app.get_object(rfem.global_parameters.GlobalParameter(no=1))

# Extrait des valeurs réelles
Vent_lat_poteau = F_poteau.formula #en N/m

rfem.loads.MemberSetLoad(no=1,load_case=nb_loadcase_proj+7,member_sets=member_sets_poteau,
                         load_direction=rfem.loads.MemberSetLoad.LOAD_DIRECTION_GLOBAL_Y_OR_USER_DEFINED_V_PROJECTED_LENGTH,
                         load_distribution=rfem.loads.SurfaceLoad.LOAD_DISTRIBUTION_UNIFORM,
                         load_type=rfem.loads.SurfaceLoad.LOAD_TYPE_FORCE,
                         magnitude=Vent_lat_poteau)

The problem is that MemberSetLoad takes only float values but not formulas. How to put formulas with Python inside MemberSetLoad magnitude ?

Hi amazigh,

unfortunately this does not work at the moment. It is already reported to the development team (RUS ID 5887), I added you in the list of requester, I think this is in your best interest. You can find news on this topic in the release notes, if there is anything to report.

Thank you for your understanding.

Best regards
Robert Milrath

Hi Robert,

Ok thanks a lot. When do you think they will fix this issue ?

have a nice day,

Hi amazigh,

unfortunately I cannot tell you a rollout date yet. If I have some additional informations I'll let you know.

Best regards
Robert Milrath