RSTAB9 API II C# | create_object_list order of objects

I am wondering about if order of object in a call await app.create_object_list(batch); is important?

...
var batch = new List<IMessage>();

if (materials != null) batch.AddRange(materials.Values);

if (sections != null) batch.AddRange(sections.Values);

if (nodes != null) batch.AddRange(nodes.Values);

if (members != null) batch.AddRange(members.Values);

if (members != null) batch.AddRange(members.Values);

if (efl != null) batch.AddRange(steelEffectiveLengths);

await app.create_object_list(batch);

In my case some members are designed on member level and some via member set parent.

Some members have steelEffectiveLengths number assigned to it, but that means steel effective length needs to exist before member (first without members assigned to it and after again with members assigned to it?

Some members that are designed via memberSet parent, so memberSet should be defined first but it needs members in order to be created?

So is order important in API II as it was in API I and can you export objects with some properties missing, for example steel effective lengths without members assigned to it?

Hi Bojan,

The order in which the objects are created does not necessarily lead to an error, but it can lead to undesired results.
In the bad Python example, I create lines without having created the nodes, which I then do in the second step. The model works, but I would still not recommend this approach.

Not recommended way of creating objects in RFEM:

from dlubal.api import rfem
with rfem.Application(port=9000) as rfem_app:
    # Step 1: Create a New Model
    model_name='order_of_objects_python'
    rfem_app.create_model(name=model_name)

    # Step 2: Create Objects in a Specific Order
    list_of_objects =[
        rfem.structure_core.Member(
            no=1,
            line=1,
            node_start=1,
            node_end=2,
            section_start=1
        ),
        rfem.structure_core.Member(
            no=2,
            line=2,
            node_start=2,
            node_end=3,
            section_start=2
        ),
        rfem.structure_core.Material(
            no=1,
            name='S235',
        ),
        rfem.structure_core.Section(
            no=1,
            name='HEB 300',
            material=1,
            shear_stiffness_deactivated=True,
        ),
        rfem.structure_core.Section(
            no=2,
            name='IPE 200',
            material=1,
            shear_stiffness_deactivated=True,
        ),
    ]
    list_of_nodes=[
        rfem.structure_core.Node(
            no=1,
        ),
        rfem.structure_core.Node(
            no=2,
            coordinate_3=10.0,
        ),
        rfem.structure_core.Node(
            no=3,
            coordinate_3=20.0,
        ),
    ]
    # Step 3: Create Objects in the Application
    rfem_app.create_object_list(list_of_objects)

    # Step 4: Create Nodes after other objects
    rfem_app.create_object_list(list_of_nodes)

The API is quite forgiving here, but you shouldn't push it.

In your case, you can, for example, create the steelEffectiveLengths without assignment and then make the assignment in the member itself. The reverse approach also works: create the members without assignment to the steelEffectiveLengths, then create the steelEffectiveLengths with the list of associated members.

Happy coding.

Best regards
Robert Milrath