RFEM 6 Python API – problem updating ULS configuration without breaking radio buttons
Environment
RFEM 6.12.8
Python gRPC API
EN 1992-1-1
I am trying to update a single setting in an existing concrete design ULS configuration through the API. The aim is simply to switch off:
Minimum shear reinforcement acc. to 9.3.2 and 9.6.4
while keeping all other ULS settings exactly as they are.
My first attempt was:
uls = rfem_app.get_object(
rfem.concrete_design_objects.ConcreteDesignUlsConfiguration(no=13)
)
tree = uls.settings_surface_ec2
common.set_tree_value(
tree=tree,
path=["limits_of_reinforcement_areas", "minimum_shear_reinforcement"],
value=False,
)
uls.ClearField("standard_parameters")
uls.ClearField("standard_parameters_tree")
rfem_app.update_object(uls)
After reloading the ULS configuration, the minimum shear reinforcement setting is correctly set to False, but it modified the other settings. For instance, under Surface required shear reinforcement – shear capacity, Use required longitudinal reinforcement is now False (but I want to keep it as True.
To investigate further I wrote a helper that updates both settings_surface_ec2 and standard_parameters_tree in the same pass, applies all updates together, clears the required fields immediately before update_object, and confirms the final values after reloading the object (to set min shear req to False, and use required longitudinal reo to True).
The helper:
def _set_surface_tree_values(
rfem_app,
*,
uls_config_no: int,
updates: List[Dict[str, Any]],
action_desc: str,
log_tree: bool = False,
) -> None:
uls = rfem_app.get_object(
rfem.concrete_design_objects.ConcreteDesignUlsConfiguration(no=uls_config_no)
)
surf_tree = uls.settings_surface_ec2
standard_tree = getattr(uls, "standard_parameters_tree", None)
trees_to_update = [("settings_surface_ec2", surf_tree)]
if standard_tree is not None:
trees_to_update.append(("standard_parameters_tree", standard_tree))
for update in updates:
path = update["path"]
value = update["value"]
for tree_label, tree in trees_to_update:
common.set_tree_value(tree=tree, path=path, value=value)
try:
uls.ClearField("standard_parameters")
except:
pass
try:
uls.ClearField("standard_parameters_tree")
except:
pass
rfem_app.update_object(uls)
refreshed = rfem_app.get_object(
rfem.concrete_design_objects.ConcreteDesignUlsConfiguration(no=uls_config_no)
)
I called it like this:
_set_surface_tree_values(
rfem_app,
uls_config_no=10,
action_desc="Disable min shear + preserve selection",
updates=[
{
"path": ["limits_of_reinforcement_areas", "minimum_shear_reinforcement"],
"value": False,
},
{
"path": [
"surface_required_shear_reinforcement_shear_capacity",
"surface_longitudinal_reinforcement_use_provided",
],
"value": False,
},
{
"path": [
"surface_required_shear_reinforcement_shear_capacity",
"surface_longitudinal_reinforcement_use_required",
],
"value": True,
},
],
)
Even when all three updates are applied at once and written to both trees, the same behaviour occurs. The checkbox (min shear req) updates correctly, but the radio buttons (surface_required_shear_reinforcement_shear_capacity) revert to False/False immediately after update_object.
It appears that clearing standard_parameters and standard_parameters_tree is required to avoid the gRPC error, but clearing them seems to cause RFEM to regenerate those fields and discard the previous radio-button state?
My questions:
-
Is there any supported way to turn off minimum shear reinforcement in a ULS configuration without altering the shear-capacity radio-button selection?
-
What am I doing wrong when I try to set both options above?
If anyone has an example of updating a ULS configuration while preserving the other values, that would be epic.
In summary:
Below is a screenshot of the default concrete ULS configuration. All I want to do is uncheck “Minimum shear reinforcement acc. to 9.3.2 and 9.6.4” and leave everything else exactly the same.
If I set only that field to False, RFEM wipes some of the other values (for example, it turns “Use required longitudinal reinforcement” to False).
If I try to set minimum shear reinforcement to False and then explicitly re-set “Use required longitudinal reinforcement” to True, the update still does not stick.
This is why I’m trying to understand the correct way to update a ULS configuration through the API without RFEM regenerating or overwriting other settings.
