using FeMM.Common.Models;
using FeMM.Grasshopper.DataTypes.FeMM;
using FeMM.Grasshopper.Helpers;
using Grasshopper.Kernel;
using System;
namespace FeMM.Grasshopper.Components.Sections
{
public class BeamSectionSolidCircleComponent : GH_Component
{
/// <summary>
/// Initializes a new instance of the SolidCircleBeamSectionComponent class.
/// </summary>
public BeamSectionSolidCircleComponent()
: base("Solid Circle", "SC", "Defines a solid circle beam section", CategoryNameConstants.CATEGORY_FEMM, CategoryNameConstants.SUBCATEGORY_SECTIONS)
{
}
/// <summary>
/// Registers all the input parameters for this component.
/// </summary>
protected override void RegisterInputParams(GH_InputParamManager pManager)
{
pManager.AddNumberParameter("Diameter", "D", "The section diameter", GH_ParamAccess.item);
}
/// <summary>
/// Registers all the output parameters for this component.
/// </summary>
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("Section", "S", "The solid circular 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)
{
double d = 0;
if (!DA.GetData(0, ref d))
return;
var sectionModel = new SectionModel()
{
SectionType = SectionModel.SectionTypes.SolidCircle,
D = d
};
sectionModel.CalculateSection();
var section = new GH_BeamSection(sectionModel);
DA.SetData(0, section);
}
/// <summary>
/// Provides an Icon for the component.
/// </summary>
protected override System.Drawing.Bitmap Icon => Properties.Resources.SolidCircleBeamSectionIcon;
/// <summary>
/// Gets the unique ID for this component. Do not change this ID after release.
/// </summary>
public override Guid ComponentGuid => new("a5965076-70d7-4ce1-bbb6-966dadf0d9b6");
}
}