RFEM6 API II PYTHON | rebar_diameter_auto_diameters

Hi,

I've been using this page of the API documentation: SurfaceReinforcement — Dlubal API documentation

I have a surface and have successfully made the top and bottom rebar. I have set the diameter to auto, and the spacing to fixed at 0.2m. I was also able to set the min and max diameter, and was able to check the list of possible diameters, but wasn't able to set the list of Diameters for reinforcement.

This is my code:

    usable_diameters = [12, 16, 20, 24, 28, 32, 36]
    # Convert diameters from millimetres to metres – RFEM API expects metres
    mm_to_m = 1.0 / 1000.0
    min_diameter_m = min(usable_diameters) * mm_to_m
    max_diameter_m = max(usable_diameters) * mm_to_m
    # Keep the usable diameter list in millimetres (integers) as required by the API
    usable_diameters_mm = [int(d) for d in usable_diameters]  # Convert to integers
    
    logger.info(f"Final usable_diameters_mm being passed to RFEM API: {usable_diameters_mm}")
    logger.info(f"Min diameter (m): {min_diameter_m}, Max diameter (m): {max_diameter_m}")

    # Surface reinforcement including additional transverse reinforcement (90°)
    logger.info("Creating main surface reinforcement with parameters:")
    logger.info(f"  rebar_diameter_auto_diameters_enabled: False (using custom list)")
    logger.info(f"  rebar_diameter_auto_diameters: {usable_diameters_mm}")
    logger.info(f"  rebar_diameter_auto_minimum: {min_diameter_m}")
    logger.info(f"  rebar_diameter_auto_maximum: {max_diameter_m}")
    
    surface_reinf = rfem.types_for_concrete_design.SurfaceReinforcement(
        no=1,
        surfaces=[surfaces["footing_surface"]],
        material=rebar_mat_no,

        # Main reinforcement – fixed spacing, auto diameter within limits
        rebar_spacing=LONG_REBAR_SPACING,
        rebar_spacing_auto_enabled=False,
        rebar_diameter_auto_enabled=True,
        rebar_diameter_auto_minimum=min_diameter_m,
        rebar_diameter_auto_maximum=max_diameter_m,
        rebar_diameter_auto_diameters_enabled=True,  
        rebar_diameter_auto_diameters=usable_diameters_mm,

        # Additional transverse reinforcement (90° direction)
        additional_transverse_reinforcement_enabled=True,
        additional_rebar_spacing=LONG_REBAR_SPACING,
        additional_rebar_spacing_auto_enabled=False,
        additional_rebar_diameter_auto_enabled=True,
        additional_rebar_diameter_auto_minimum=min_diameter_m,
        additional_rebar_diameter_auto_maximum=max_diameter_m,
        additional_rebar_diameter_auto_diameters_enabled=True,  
        additional_rebar_diameter_auto_diameters=usable_diameters_mm,

        # Use custom coordinate system if provided
        projection_coordinate_system=coord_system_no if coord_system_no is not None else 0,

        user_defined_name_enabled=True,
        name="Footing Main Reinf",
    )
    objects.append(surface_reinf)

As you can see the diameters for reinforcement isn't matching my list in the code.

Any ideas of what I am doing wrong? I know for the min and max diameter I have to put the values in meters, but then in the api docs for rebar_diameter_auto_diameters it expects integers so I figured it had to be millimetres.

Thanks!
Samuel

Hello Samuel,

thank you for your inquiry! :blush: I was able to reproduce the issue and will forward it to our development team. Once a solution is available, we will be sure to keep you updated. :rocket:

Regards,
Robert

1 Like

Amazing thank you very much I really appreciate it!

Hi Robert,

Did Dlubal ever find the fix for this?

I tried skipping setting rebar_diameter_auto_diameters_enabled = True, to see if then rebar_diameter_auto_diameters would work (I thought of trying this based off another issue I had and advice Tomas gave in the below forum RFEM6 API II PYTHON | NodalLoad with has_specific_direction - API & Interfaces - Dlubal Community) but that didn’t work.

I also tried a workaround of having an existing surface reinforcement with the correct usable diameters set in my template file which I copy and modify with the python api to automate the model, but I got the below error:

2025-09-05 10:58:12 [ERROR] infrastructure.rfem_api.foundation.rfem6_foundation - Error in foundation model creation: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNKNOWN
details = "Failed to update Surface Reinforcement No. 1. Modification of property projection_coordinate_system in Surface Reinforcement No. 1 is not allowed."
debug_error_string = "UNKNOWN:Error received from peer {grpc_message:"Failed to update Surface Reinforcement No. 1. Modification of property projection_coordinate_system in Surface Reinforcement No. 1 is not allowed.", grpc_status:2, created_time:"2025-09-05T03:58:12.9298739+00:00"}"

So my attempted work around won’t work because I can’t modify the coordinate system of the reinforcement.

Thanks!

Samuel

Hi Samuel,

I have some good news: the error has been fixed in version 2.11.10. It now works as expected, and no data type conversions are necessary.

I have modified the code as follows:

usable_diameters = [0.012, 0.016, 0.020, 0.024, 0.028, 0.032, 0.036]
min_diameter = min(usable_diameters)
max_diameter = max(usable_diameters)
LONG_REBAR_SPACING = 30
LONG_REBAR_SPACING_90_DEGREE = 20
surfaces=[1, 2, 3]
rebar_mat_no = 3
surface_reinforcement = rfem.types_for_concrete_design.SurfaceReinforcement(
    no=2,
    surfaces=surfaces,
    material=rebar_mat_no,

    # Main reinforcement – fixed spacing, auto diameter within limits
    rebar_spacing=LONG_REBAR_SPACING,
    rebar_spacing_auto_enabled=False,
    rebar_diameter_auto_enabled=True,
    rebar_diameter_auto_minimum=min_diameter,
    rebar_diameter_auto_maximum=max_diameter,
    rebar_diameter_auto_diameters_enabled=True,
    rebar_diameter_auto_diameters=usable_diameters,

    # Additional transverse reinforcement (90° direction)
    additional_transverse_reinforcement_enabled=True,
    additional_rebar_spacing=LONG_REBAR_SPACING_90_DEGREE,
    additional_rebar_spacing_auto_enabled=False,
    additional_rebar_diameter_auto_enabled=True,
    additional_rebar_diameter_auto_minimum=min_diameter,
    additional_rebar_diameter_auto_maximum=max_diameter,
    additional_rebar_diameter_auto_diameters_enabled=True,
    additional_rebar_diameter_auto_diameters=usable_diameters,
    user_defined_name_enabled=True,
    name="Footing Main Reinforcement",
)
object_list.append(surface_reinforcement)

More informations can be found here.

Please give it a try, feedback welcome :slight_smile:.

Best regards
Robert Milrath

2 Likes

Amazing, thank you very much Robert the code works perfectly now!

1 Like