using FeMM.Common.Models;
using FeMM.Grasshopper.Components.Parameters;
using FeMM.Grasshopper.DataTypes.FeMM;
using FeMM.Grasshopper.Helpers;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Parameters;
using System;
using System.Collections.Generic;

namespace FeMM.Grasshopper.Components.ElementProperties
{
    public class LinkPinnedPropertyComponent : GH_Component
    {
        /// <summary>
        /// Initializes a new instance of the RigidLinkPropertyComponent class.
        /// </summary>
        public LinkPinnedPropertyComponent()
          : base("Pinned Link Property", "PLP", "Pinned Link property for Straus7", CategoryNameConstants.CATEGORY_FEMM, CategoryNameConstants.SUBCATEGORY_PROPERTIES)
        {
        }

        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_InputParamManager pManager)
        {
            pManager.AddTextParameter("Name", "N", "Property name", GH_ParamAccess.item, "Pinned Link Property");
        }

        /// <summary>
        /// Registers all the output parameters for this component.
        /// </summary>
        protected override void RegisterOutputParams(GH_OutputParamManager pManager)
        {
            pManager.AddGenericParameter("Property", "P", "Link property", 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 = "";

            if (!DA.GetData("Name", ref name))
                return;

            var strausRigidLinkModel = new StrausPinnedLinkModel(name);

            var gh_bp = new GH_FunctionDefinition(strausRigidLinkModel);
            DA.SetData(0, gh_bp);
        }

        public override GH_Exposure Exposure => GH_Exposure.secondary;

        /// <summary>
        /// Provides an Icon for the component.
        /// </summary>
        protected override System.Drawing.Bitmap Icon => Properties.Resources.LinkPropertyIcon;

        /// <summary>
        /// Gets the unique ID for this component. Do not change this ID after release.
        /// </summary>
        public override Guid ComponentGuid => new("14b545f7-28e3-48b3-8e6b-c3c43fd51f7b");
    }
}
303 files24 directories