Create reinforcement with API [SOLVED]

Hi,

I saw in the API FemDesign.Core/Reinforcement/SurfaceReinforcement.cs that there are some functions to create surface reinforcement in Grasshopper and Dynamo. Is there an easy way to do it with C#?

I mean, it’s always possible to edit the xml file from C#, add new lines and create unique GUIDS somehow. But it is quite a complex process. The approach I normally follow is to create the basic reinforcement I want manually with the normal Fem Design user interface and then accessing the surface reinforcement in the following way:

slab[i].SurfaceReinforcement[i].Straight.Cover = 0.03;
slab[i].SurfaceReinforcement[i].Straight.Space = 0.10;

Then I can create a for loop to edit those parameters. Is there any “easy” way to add reinforcement using C# without editing the main model and saving it as .struxml?

Hi @dfepe !

Theoretically, you can create a slab with reinforcement using c#.
There are method which should help you in creating a slab with several type of reinforcement.

As you are familiar with Grasshopper, the way to add reinforcements to a slab is basically the same in c#.

The parameters like space and cover are stored inside the FemDesign.Reinforcement.Straight class.

The code to add reinforcement to a slab is shown in the following link.

Not sure if I have fully replied to your question. Are you trying to modify also an existing cover/space?

Could you add an example? I don’t know how to define the list containing srfReinfs

1 Like

Hi @dfepe

I have created a minimal example that should help you in get started with the topic.

The program below is creating a slab with reinforcement on the x/y direction on the top and bottom face.

Let me know if you need some more explaination.

Hi Marco, I encounter an issue when trying to apply the reinforcement to a wall which includes a round hole:

Removing the hole allowes for the operation to be executed without any issues.

Do you have any idea if there is a way around this? :smiley:

It seems that we do have a bug.

I have opened a GitHub issue and we will come back to you as soon as it is solved.

You can expect to have this feature solved in early January.

1 Like

Maybe a stupid question but I’m already stuck in deconstructing the database variables. If I try to debug the code then it doesn’t have the location for filePath. I added a simple string and it reads in the locals but still gives an error.

Ehi @arturander

Can you show the content of Materjald.struxml?

however, as you are reading your custom material database, I think you should write:

var materialDatabase = FemDesign.Materials.DeserializeStruxml(filePath);
var material = materialDatabase.MaterialByName("C25/30");

I just exported my default materials and I can read from the notepad that there are the concrete classes present.
Materjalid.struxml (60.1 KB)

In the locals it reads but it doesn’t solve the deserialize problem. And debugging step by step I really can’t tell what is wrong at the moment. Last working line is 29, where it tries to return the concrete class parameters.

It seems that you are using a .dll without any material/sections on it.

Have you downloaded the API from nuget?

Or you are referincing the .dll from a different location?
If you are referencing the .dll locally, try to dowload the femdesign_csharp.zip

Yes, I have fiddled with the examples in the past about half or year ago. Updating nugget fixed the issue. Thanks! :slight_smile:

One more comment. In the code the rebar cover is defined but in the calculation parameters it’s not. Is it possible in current API solution?
And probably there would be more similar questions coming, is there a documentation file to look up for these possibilities of different methods?

Ehi @arturander

It should be possible and I can help you with it.

In FEM-Design, we have access to most of the Calculation/Design parameters with a text file that can be loaded programmatically.

The starting point will be to dump an existing settings file which can be modified to better suite your needs.
Have a look at the explanation in the following
documentation page

Loading the cfg.xml file will only require a simple:

femdesign.SetConfig(filePath)