Bar reinforcement in C# [SOLVED]

hello. i am trying to create a script that takes a existing model and applies some amount (the same for all beams) of longitutional and stirrup reinforcement to all beams in the model.

I wonder how this could be done in C# since the reinforcement is drawn by hand in FEM:

something like this?

Hi @Jona995k !

Have a look at the following example related to Slab. It might give you some idea.

I need to create one for Bar as well as it is not super easy to navigate through the object classes for reinforcement.

Below, you can see the documentation for Beam.

// EDIT BEAM
var reinforcement = FemDesign.Materials.MaterialDatabase.GetDefault().MaterialByName("B500B");


var diameter_16 = 0.016;
var cover = 0.025;
double st = 0;
double end = 2;
var point = new FemDesign.Geometry.Point2d(0,0);
var anchorLength = 0.8;
           

var wire = new Wire(diameter_16, reinforcement, WireProfileType.Ribbed);

var elements = new List<FemDesign.GenericClasses.IStructureElement> {};

// Loop through all bars in the model and add longitudinal reinforcement
for (int i = 0; i < model.Entities.Bars.Count; i++)
{
    var beam = model.Entities.Bars[i];
    var longbar = new LongitudinalBar(beam, point, anchorLength, anchorLength, st, end, false);

    var arm_top = new LongitudinalBarReinforcement(beam, wire, longbar);
    var arm_list = new List<BarReinforcement> { arm_top };

    var reinfbar = FemDesign.Reinforcement.LongitudinalBarReinforcement.AddReinforcementToBar(beam, arm_list, true);
    elements.Add(reinfbar);
}





var model1 = new Model(Country.DK, elements);

using (var connection = new FemDesignConnection(keepOpen: true))
{
    connection.Open(model);
}

from your answer i wrote this. but the reinforcement is not transfered to the new model. is there an obvious reason why? :slight_smile:

nevermind i solved it! :slight_smile:

1 Like

Great! Do you mind in showing where the mistake was ? It will help other users :slight_smile:

// script works. simple mistake. just needed to declare variables correctly

var model = new Model(Country.DK, elements);

using (var connection = new FemDesignConnection(keepOpen: true))
{
    connection.Open(model);
}