using FeMM.Grasshopper.DataTypes.FeMM;
using FeMM.Grasshopper.Helpers;
using Grasshopper.Kernel;
using System;
namespace FeMM.Grasshopper.Components.MeCheck
{
public class MixedSectionComponent : GH_Component
{
/// <summary>
/// Initializes a new instance of the MixedSectionComponent class.
/// </summary>
public MixedSectionComponent()
: base("Mixed Section", "MS", "Define a mixed section composed by two base sections and 2 materials", CategoryNameConstants.CATEGORY_CHECKS, CategoryNameConstants.SUBCATEGORY_MECHECK)
{
}
/// <summary>
/// Registers all the input parameters for this component.
/// </summary>
protected override void RegisterInputParams(GH_InputParamManager pManager)
{
pManager.AddTextParameter("Name", "N", "The name of the section", GH_ParamAccess.item);
pManager.AddGenericParameter("Concrete Section", "CS", "Geometry of the upper rect section", GH_ParamAccess.item);
//pManager.AddGenericParameter("Concrete Material", "CM", "Material of the upper part of the section", GH_ParamAccess.item);
//pManager.AddGenericParameter("Reinforcement Material", "RM", "Material of the upper part of the section", GH_ParamAccess.item);
pManager.AddNumberParameter("Reinforcement area", "RA", "The total area of the reicorcements on the upper part", GH_ParamAccess.item);
pManager.AddNumberParameter("Reinforcement cover", "RC", "The distance from the external to the reiforcements", GH_ParamAccess.item);
pManager.AddGenericParameter("Steel Section", "SS", "Geometry of the lower I section", GH_ParamAccess.item);
pManager.AddNumberParameter("Concrete Offset", "CO", "The distance between top flange and concrete slab", GH_ParamAccess.item, 0);
//pManager.AddGenericParameter("Web Material", "WM", "Material of the lower part of the section", GH_ParamAccess.item);
}
/// <summary>
/// Registers all the output parameters for this component.
/// </summary>
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("Mixed Section", "MS", "The mixed section", GH_ParamAccess.item);
}
/// <summary>
/// This is the method that actually does the work.
/// </summary>
/// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
protected override void SolveInstance(IGH_DataAccess DA)
{
string name = "";
GH_BeamSection concrete_section = null;
double r_area = 0;
double r_cover = 0;
GH_BeamSection steel_section = null;
double concreteOffset = 0;
if (!DA.GetData(0, ref name))
return;
if (!DA.GetData(1, ref concrete_section))
return;
if (!DA.GetData(2, ref r_area))
return;
if (!DA.GetData(3, ref r_cover))
return;
if (!DA.GetData(4, ref steel_section))
return;
DA.GetData(5, ref concreteOffset);
// TODO: Dati che si possono prelevare dagli input dei materiali
// SpecificCompressiveStrength
// MinimumYieldStress
// MinimumYieldStress (rebar)
// steel.Modulus / concrete.Modulus
var section = new GH_MixedSection()
{
Name = name,
ConcreteSection = concrete_section,
ReinforcementCover = r_cover,
ReinforcementArea = r_area,
SteelSection = steel_section,
VerticalOffset = concreteOffset,
};
DA.SetData(0, section);
}
/// <summary>
/// Provides an Icon for the component.
/// </summary>
protected override System.Drawing.Bitmap Icon => Properties.Resources.MixedSectionIcon;
/// <summary>
/// Gets the unique ID for this component. Do not change this ID after release.
/// </summary>
public override Guid ComponentGuid => new("69597ff0-4cc5-45f6-8566-51fb80caa057");
}
}