from dlubal.api import rfem

with rfem.Application() as rfem_app:
    # Get Member Transverse Stiffener object
    obj: rfem.types_for_members.MemberTransverseStiffener = rfem_app.get_object(
        rfem.types_for_members.MemberTransverseStiffener(no=3)
    )
    print(f'obj before modification:\n{obj}')
    obj.members.append(4)

    components_row= obj.components.rows.add()
    components_row.no=1
    components_row.stiffener_type = rfem.types_for_members.MemberTransverseStiffener.ComponentsRow.STIFFENER_TYPE_STIFFENER_COMPONENT_TYPE_FLAT
    components_row.position = 1.572
    components_row.position_type= rfem.types_for_members.MemberTransverseStiffener.ComponentsRow.POSITION_TYPE_STIFFENER_COMPONENT_POSITION_DOUBLE_SIDED
    components_row.multiple = True
    components_row.note='My added row'
    components_row.multiple_offset=1.667
    components_row.thickness=0.008

    print(f'obj after modification:\n{obj.components.rows}')

    rfem_app.update_object(
        obj=obj
    )

    # Get Steel Effective Lengths object
    obj: rfem.steel_design.SteelEffectiveLengths = rfem_app.get_object(
        obj=rfem.steel_design.SteelEffectiveLengths(no=3)
    )
    # Important to set intermediate nodes to True to be able to add nodal supports
    obj.intermediate_nodes=True

    print(f'obj before modification:\n{obj.nodal_supports.rows}')
    components_row= rfem.steel_design.SteelEffectiveLengths.NodalSupportsRow()
    components_row.support_type = rfem.steel_design.SteelEffectiveLengths.NodalSupportsRow.SUPPORT_TYPE_FIXED_IN_Y
    components_row.eccentricity_type= rfem.steel_design.SteelEffectiveLengths.NodalSupportsRow.ECCENTRICITY_TYPE_AT_UPPER_FLANGE
    obj.nodal_supports.rows.insert(1, components_row)
    components_row= rfem.steel_design.SteelEffectiveLengths.NodalSupportsRow()
    components_row.support_type = rfem.steel_design.SteelEffectiveLengths.NodalSupportsRow.SUPPORT_TYPE_FIXED_IN_Y
    components_row.eccentricity_type = rfem.steel_design.SteelEffectiveLengths.NodalSupportsRow.ECCENTRICITY_TYPE_AT_UPPER_FLANGE
    obj.nodal_supports.rows.insert(1, components_row)
    print(f'components_row.nodes: {components_row.nodes}')
    rfem_app.update_object(
        obj=obj
    )