RFEM: validate material/section input from the API

Hello. For my company, I am writing a wrapper around the API to standardise and simplify the use of the API, by having simple, straightforward commands. I have also added exception handling so that our colleagues, also those with less programming experience, know what part of their input is invalid.

While working on this, I have a few questions, which I have addressed below.

Question 1: material/section input validation
I am now working on the materials and sections, and I was wondering whether there is any straightforward way to validate the user input. For example, when I run the below example, where there is a clear typo, "225" instead of "235":

rfem.structure_core.Material(no = 1, name = "S225")

or for sections:

rfem.structure_core.Section(no = 1, material = 1 name = "HAA 220")

The API still creates a material named "S255" or section "HAA 200" in RFEM, but since they do not exist in the library, these objects are invalid. Naturally, it would be preferable that the end-user receives a ValueError in Python rather than an invalid material/section in RFEM.

So my question is: is there any method from the API that allows the input to be validated? E.g., is there a list of all built-in materials/sections available somewhere?

Question 2: material norm auto-selection
The second question is for materials specifically. When I create a material with name = "S235" RFEM automatically selects EN 1993-1-1:2005-05. If my colleagues require a different norm, they need to type name = "<material> | <norm>". Since norms are rather complex strings, this is prone to errors. So, is there any way to configure the model with the API such, that it automatically selects the correct norm, without having to specify it for every call? Additionally, just like the previous question, is there any way to validate the norm given by the user input?

Question 3: user-defined materials
The third and last questions is for materials specifically. I have been able to figure out how user-defined sections can be defined, but I have not been successful for materials.

Based on the interactions in the GUI of RFEM, I see that user-defined materials require at least a Young's and shear modulus to be valid. I tried passing elasticity_modulus_global and shear_modulus_global, since this is given by the tooltip in the Materials table in RFEM, but it did not yield a valid material.


I then tried to reverse-engineer it: create a user-defined material in RFEM by hand and then read it with the API. I could not find any references to any of the two fields. So, how can I create a user-defined material with the API?

Hi TomWB,

Welcome to the community, and thanks for your great questions! Here's a quick rundown:

1. Material/Section Validation:
Currently, validation can be done using the plausibility_check() method. We’re aware it’s not ideal, and we’re considering integrating real-time validation into the object creation methods in future updates.

2. Material Norm Auto-Selection:
This is a useful suggestion, but it hasn’t been planned yet. I’ve added it to our backlog for future consideration.

3. User-Defined Materials:
Creating user-defined materials via the API is currently limited, but the good news is a solution is in development (RUS 4627) and should be available in the next 1-2 weeks.

Thanks for the great input, and I’ll keep you updated!

Best regards,
Tomas

2 Likes