Esempio n. 1
0
        /// <summary>
        /// Generates selection list for cell oritentation.
        /// </summary>
        /// <param name="index">Component input index. (first input is index 0)</param>
        /// <param name="offset">Vertical offset of the menu, to help with positioning.</param>
        public static void OrientSelect(ref IGH_Component Component, ref GH_Document GrasshopperDocument, int index, float offset)
        {
            // Instantiate  new value list
            var vallist = new Grasshopper.Kernel.Special.GH_ValueList();

            vallist.ListMode = Grasshopper.Kernel.Special.GH_ValueListMode.Cycle;
            vallist.CreateAttributes();

            // Customise value list position
            float  xCoord   = (float)Component.Attributes.Pivot.X - 200;
            float  yCoord   = (float)Component.Attributes.Pivot.Y + index * 40 - offset;
            PointF cornerPt = new PointF(xCoord, yCoord);

            vallist.Attributes.Pivot = cornerPt;

            // Populate value list with our own data
            vallist.ListItems.Clear();
            var items = new List <Grasshopper.Kernel.Special.GH_ValueListItem>();

            items.Add(new Grasshopper.Kernel.Special.GH_ValueListItem("Default", "0"));
            items.Add(new Grasshopper.Kernel.Special.GH_ValueListItem("RotateZ", "1"));
            items.Add(new Grasshopper.Kernel.Special.GH_ValueListItem("RotateY", "2"));
            items.Add(new Grasshopper.Kernel.Special.GH_ValueListItem("RotateX", "3"));

            vallist.ListItems.AddRange(items);

            // Until now, the slider is a hypothetical object.
            // This command makes it 'real' and adds it to the canvas.
            GrasshopperDocument.AddObject(vallist, false);

            //Connect the new slider to this component
            Component.Params.Input[index].AddSource(vallist);
            Component.Params.Input[index].CollectData();
        }
Esempio n. 2
0
        /// <summary>
        ///  Replace a value list with one that has been pre-populated with possible speeds.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void OnParameterSourcesChanged(Object sender, GH_ParamServerEventArgs e)
        {
            int       index = e.ParameterIndex;
            IGH_Param param = e.Parameter;

            //Only add value list to the first input
            if (index != 0)
            {
                return;
            }

            //Only change value lists
            var extractedItems = param.Sources.Where(p => p.Name == "Value List");

            //Set up value list
            Dictionary <string, string> options = new Dictionary <string, string>();

            foreach (KeyValuePair <double, Speed> entity in Util.ABBSpeeds())
            {
                options.Add(entity.Value.Name, entity.Key.ToString());
            }
            Grasshopper.Kernel.Special.GH_ValueList gH_ValueList = Canvas.Component.CreateValueList("Speeds", options);

            //The magic
            Canvas.Component.ChangeObjects(extractedItems, gH_ValueList);
        }
Esempio n. 3
0
        /// <summary>
        /// Generates selection list for cell oritentation.
        /// </summary>
        /// <param name="index">Component input index. (first input is index 0)</param>
        /// <param name="offset">Vertical offset of the menu, to help with positioning.</param>
        public static void OrientSelect(ref IGH_Component Component, ref GH_Document GrasshopperDocument, int index, float offset)
        {
            // Instantiate  new value list
            var vallist = new Grasshopper.Kernel.Special.GH_ValueList();
            vallist.ListMode = Grasshopper.Kernel.Special.GH_ValueListMode.Cycle;
            vallist.CreateAttributes();

            // Customise value list position
            float xCoord = (float)Component.Attributes.Pivot.X - 200;
            float yCoord = (float)Component.Attributes.Pivot.Y + index * 40 - offset;
            PointF cornerPt = new PointF(xCoord, yCoord);
            vallist.Attributes.Pivot = cornerPt;

            // Populate value list with our own data
            vallist.ListItems.Clear();
            var items = new List<Grasshopper.Kernel.Special.GH_ValueListItem>();
            items.Add(new Grasshopper.Kernel.Special.GH_ValueListItem("Default", "0"));
            items.Add(new Grasshopper.Kernel.Special.GH_ValueListItem("RotateZ", "1"));
            items.Add(new Grasshopper.Kernel.Special.GH_ValueListItem("RotateY", "2"));
            items.Add(new Grasshopper.Kernel.Special.GH_ValueListItem("RotateX", "3"));

            vallist.ListItems.AddRange(items);

            // Until now, the slider is a hypothetical object.
            // This command makes it 'real' and adds it to the canvas.
            GrasshopperDocument.AddObject(vallist, false);

            //Connect the new slider to this component
            Component.Params.Input[index].AddSource(vallist);
            Component.Params.Input[index].CollectData();
        }
Esempio n. 4
0
        /// <summary>
        ///  Replace a value list with one that has been pre-populated with possible methonds.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void OnParameterSourcesChanged(Object sender, GH_ParamServerEventArgs e)
        {
            int       index = e.ParameterIndex;
            IGH_Param param = e.Parameter;

            //Only add value list to the first input
            if (param.Name != "*Method")
            {
                return;
            }

            //Only change value lists
            var extractedItems = param.Sources.Where(p => p.Name == "Value List");

            //Set up value list
            Dictionary <string, string> options = new Dictionary <string, string>();

            foreach (int entity in typeof(MotionType).GetEnumValues())
            {
                MotionType m = (MotionType)entity;

                options.Add(m.ToString(), entity.ToString());
            }
            Grasshopper.Kernel.Special.GH_ValueList gH_ValueList = Canvas.Component.CreateValueList("Mothods", options);

            //The magic
            Canvas.Component.ChangeObjects(extractedItems, gH_ValueList);
        }
        /// <summary>
        ///  Replace a value list with one that has been pre-populated with possible methonds.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void OnParameterSourcesChanged(Object sender, GH_ParamServerEventArgs e)
        {
            int       index = e.ParameterIndex;
            IGH_Param param = e.Parameter;

            switch (param.Name)
            {
            case "*Method":

                #region Change Value List

                //Only change value lists
                var extractedItems = param.Sources.Where(p => p.Name == "Value List");

                //Set up value list
                Dictionary <string, string> options = new Dictionary <string, string>();
                foreach (int entity in typeof(MotionType).GetEnumValues())
                {
                    MotionType m = (MotionType)entity;

                    options.Add(m.ToString(), entity.ToString());
                }
                Grasshopper.Kernel.Special.GH_ValueList gH_ValueList = Canvas.Component.CreateValueList("Mothods", options);

                //The magic
                Canvas.Component.ChangeObjects(extractedItems, gH_ValueList);
                break;

                #endregion Change Value List

            case "Plane":
                if (param.Sources.Count == 0)
                {
                    return;
                }

                foreach (var p in param.Sources)
                {
                    if (p.Name == "Panel")
                    {
                        this.c_motionType = MotionType.AbsoluteJoint;
                        return;
                    }
                }
                break;

            default:
                break;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Component           = this;
            GrasshopperDocument = this.OnPingDocument();
            if (Component.Params.Input[10].SourceCount == 0)
            {
                //instantiate  new value list
                var vallist = new Grasshopper.Kernel.Special.GH_ValueList();
                vallist.CreateAttributes();

                //customise value list position
                int inputcount = this.Component.Params.Input[10].SourceCount;
                //vallist.Attributes.Pivot = new PointF((float)this.Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30,
                //    (float)this.Component.Params.Input[1].Attributes.Bounds.Y + inputcount * 30);
                vallist.Attributes.Pivot = new PointF(Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, Component.Params.Input[10].Attributes.Bounds.Y + inputcount * 30);
                //populate value list with our own data
                vallist.ListItems.Clear();
                var item1 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24h", "0");
                var item2 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28h", "1");
                var item3 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32h", "2");
                var item4 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24c", "3");
                var item5 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28c", "4");
                var item6 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32c", "5");
                var item7 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL CROSSLAM", "6");
                var item8 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL ITA", "7");
                vallist.ListItems.Add(item1);
                vallist.ListItems.Add(item2);
                vallist.ListItems.Add(item3);
                vallist.ListItems.Add(item4);
                vallist.ListItems.Add(item5);
                vallist.ListItems.Add(item6);
                vallist.ListItems.Add(item7);
                vallist.ListItems.Add(item8);

                //Until now, the slider is a hypothetical object.
                // This command makes it 'real' and adds it to the canvas.
                GrasshopperDocument.AddObject(vallist, false);

                //Connect the new slider to this component
                this.Component.Params.Input[10].AddSource(vallist);
            }
            //AQUI COMEÇA O PLGUIN MESMO
            double t1     = 0;
            double t2     = 0;
            double al1    = 0;
            double al2    = 0;
            double npar   = 0;
            double npep   = 0;
            double d      = 0;
            string type   = "bolt";
            int    wood   = 0;
            bool   pdrill = false;
            double pk     = 0;
            bool   sd     = false;
            double kmod   = 0;
            double Vrd    = 0;
            double a1     = 0;
            double a4     = 0;
            double dw     = 0;

            if (!DA.GetData <double>(0, ref Vrd))
            {
                return;
            }
            if (!DA.GetData <double>(1, ref t1))
            {
                return;
            }
            if (!DA.GetData <double>(2, ref t2))
            {
                return;
            }
            if (!DA.GetData <double>(3, ref al1))
            {
                return;
            }
            if (!DA.GetData <double>(4, ref al2))
            {
                return;
            }
            if (!DA.GetData <double>(5, ref npar))
            {
                return;
            }
            if (!DA.GetData <double>(6, ref npep))
            {
                return;
            }
            if (!DA.GetData <double>(7, ref d))
            {
                return;
            }
            if (!DA.GetData <bool>(8, ref sd))
            {
                return;
            }
            if (!DA.GetData <double>(9, ref kmod))
            {
                return;
            }
            if (!DA.GetData <int>(10, ref wood))
            {
                return;
            }
            if (!DA.GetData <double>(11, ref a1))
            {
                return;
            }
            if (!DA.GetData <double>(12, ref a4))
            {
                return;
            }
            if (!DA.GetData <double>(1, ref a4))
            {
                return;
            }

            //Pegar valores da Madeira do Excel
            string text = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);

            text = Path.Combine(Directory.GetParent(text).FullName, "Plug-ins");
            var    reader   = new StreamReader(File.OpenRead(text + "\\Madeira\\MLCPROP.csv"));
            int    cont     = -1;
            bool   stop     = false;
            string woodtype = "";
            double fc90     = 0;

            while (!reader.EndOfStream || stop == false)
            {
                var line   = reader.ReadLine();
                var values = line.Split(',');
                if (cont == wood)
                {
                    pk       = 1000 * Double.Parse(values[7]);
                    woodtype = values[13];
                    fc90     = 10 * Double.Parse(values[4]);
                    stop     = true;
                }
                cont++;
            }
            //CALCULO DAS LIGAÇÕES
            var    fast     = new Fastener(type, d, dw, -1, true, 1000);
            var    analysis = new TimberToTimberCapacity(fast, t1, t2, al1, al2, woodtype, "steel", pdrill, pk, pk, fc90, woodtype, -1, -1, npar, npep, a1);
            double fvd      = 0;

            if (sd == false)
            {
                fvd = kmod * analysis.FvkSingleShear() / 1.3;
            }
            else
            {
                fvd = kmod * analysis.FvkDoubleShear() / 1.3;
            }
            double faxd = kmod * analysis.variables.Faxrk / 1.3;
            double DIV  = 0;

            DIV = 1000 * Vrd / fvd;
            DA.SetData(0, fvd);
            DA.SetData(1, DIV);
        }
Esempio n. 7
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Component           = this;
            GrasshopperDocument = this.OnPingDocument();
            if (Component.Params.Input[8].SourceCount == 0)
            {
                //instantiate  new value list
                var vallist = new Grasshopper.Kernel.Special.GH_ValueList();
                vallist.CreateAttributes();

                //customise value list position
                int inputcount = this.Component.Params.Input[8].SourceCount;
                //vallist.Attributes.Pivot = new PointF((float)this.Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30,
                //    (float)this.Component.Params.Input[1].Attributes.Bounds.Y + inputcount * 30);
                vallist.Attributes.Pivot = new PointF(Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, Component.Params.Input[8].Attributes.Bounds.Y + inputcount * 30);
                //populate value list with our own data
                vallist.ListItems.Clear();
                var item1 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24h", "0");
                var item2 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28h", "1");
                var item3 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32h", "2");
                var item4 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24c", "3");
                var item5 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28c", "4");
                var item6 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32c", "5");
                var item7 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL CROSSLAM", "6");
                var item8 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL ITA", "7");
                vallist.ListItems.Add(item1);
                vallist.ListItems.Add(item2);
                vallist.ListItems.Add(item3);
                vallist.ListItems.Add(item4);
                vallist.ListItems.Add(item5);
                vallist.ListItems.Add(item6);
                vallist.ListItems.Add(item7);
                vallist.ListItems.Add(item8);

                //Until now, the slider is a hypothetical object.
                // This command makes it 'real' and adds it to the canvas.
                GrasshopperDocument.AddObject(vallist, false);

                //Connect the new slider to this component
                this.Component.Params.Input[8].AddSource(vallist);
            }
            string text = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);

            text = Path.Combine(Directory.GetParent(text).FullName, "Plug-ins");
            var reader = new StreamReader(File.OpenRead(text + "\\Madeira\\MLCPROP.csv"));
            //inputs
            double Nd    = 0;
            double Myd   = 0;
            double Mzd   = 0;
            double b     = 0;
            double h     = 0;
            double l     = 0;
            double kflam = 0;
            double Kmod  = 0;
            double Km    = 0.7;
            double Ym    = 0;
            double fc0k  = 0;
            double fmk   = 0;
            double E05   = 0;
            double Bc    = 0.2;
            int    test  = 0;

            if (!DA.GetData <double>(0, ref Nd))
            {
                return;
            }
            if (!DA.GetData <double>(1, ref Myd))
            {
                return;
            }
            if (!DA.GetData <double>(2, ref Mzd))
            {
                return;
            }
            if (!DA.GetData <double>(3, ref b))
            {
                return;
            }
            if (!DA.GetData <double>(4, ref h))
            {
                return;
            }
            if (!DA.GetData <double>(5, ref l))
            {
                return;
            }
            if (!DA.GetData <double>(6, ref kflam))
            {
                return;
            }
            if (!DA.GetData <int>(8, ref test))
            {
                return;
            }
            if (!DA.GetData <double>(7, ref Kmod))
            {
                return;
            }
            int  cont = -1;
            bool stop = false;

            while (!reader.EndOfStream || stop == false)
            {
                var line   = reader.ReadLine();
                var values = line.Split(',');
                if (cont == test)
                {
                    Ym   = Double.Parse(values[12]);
                    fc0k = Double.Parse(values[1]);
                    fmk  = Double.Parse(values[3]);
                    E05  = Double.Parse(values[9]);
                    if (values[13] == "MLC")
                    {
                        Bc = 0.1;
                    }
                    stop = true;
                }
                cont++;
            }
            //Definição de valores geométricos
            double A    = h * b;
            double Iy   = b * Math.Pow(h, 3) / 12;
            double Iz   = h * Math.Pow(b, 3) / 12;
            double Wy   = Iy * (2 / h);
            double Wz   = Iz * (2 / b);
            double ry   = Math.Sqrt(Iy / A);
            double rz   = Math.Sqrt(Iz / A);
            double lamy = ry / (100 * l);
            double lamz = rz / (100 * l);
            double lef  = kflam * l * 100;

            //Definição de valores do material (ver se os sigmas devem mesmo serem multiplicados por 100)
            double lampi   = Math.Sqrt(fc0k / E05) / Math.PI;
            double fc0d    = Kmod * fc0k / Ym;
            double fmd     = Kmod * fmk / Ym;
            double lamyrel = lamy * lampi;
            double lamzrel = lamz * lampi;
            double sigN    = Nd / A;
            double sigMy   = 100 * Myd / Wy;
            double sigMz   = 100 * Mzd / Wz;
            double G05     = E05 / 16;

            //Definição dos valores de cálculo necessários para verificação em pilares ou vigas (exclui parte em que dizia que lamrely=lamm e lamrelz=sgmcrit)
            double sigMcrit = (Math.PI * Math.Pow(b, 2) * Math.Sqrt(E05 * G05 * (1 - 0.63 * (b / h)))) / (h * lef);
            double lamm     = Math.Sqrt(fmk / sigMcrit);
            double ky       = 0.5 * (1 + Bc * (lamyrel - 0.3) + Math.Pow(lamyrel, 2));
            double kz       = 0.5 * (1 + Bc * (lamzrel - 0.3) + Math.Pow(lamzrel, 2));
            double kyc      = 1 / (ky + Math.Sqrt(Math.Pow(ky, 2) - Math.Pow(lamyrel, 2)));
            double kzc      = 1 / (kz + Math.Sqrt(Math.Pow(kz, 2) - Math.Pow(lamzrel, 2)));

            //Verificação de comportamento de Pilares
            if (lamm < 0.75)
            {
                if (lamyrel <= 0.3 && lamzrel <= 0.3)
                {
                    double DIVY = Math.Pow(sigN / fc0d, 2) + (sigMy / fmd) + Km * (sigMz / fmd);
                    double DIVZ = Math.Pow(sigN / fc0d, 2) + Km * (sigMy / fmd) + (sigMz / fmd);
                    DA.SetData(0, DIVY);
                    DA.SetData(1, DIVZ);
                }
                else
                {
                    List <double> divs = new List <double>();
                    double        DIVY = (sigN / (kyc * fc0d)) + (sigMy / fmd) + Km * (sigMz / fmd);
                    double        DIVZ = (sigN / (kzc * fc0d)) + Km * (sigMy / fmd) + (sigMz / fmd);
                    DA.SetData(0, DIVY);
                    DA.SetData(1, DIVZ);
                }
            }
            //Verificação de comportamento de Vigas
            else
            {
                if (lamm >= 0.75 && lamm < 1.4)
                {
                    double kcrit = 1.56 - 0.75 * lamm;
                    double DIVY  = Math.Pow(sigMy / (kcrit * fmd), 2) + (sigN / (kzc * fc0d));
                    double DIVZ  = 0;
                    DA.SetData(0, DIVY);
                    DA.SetData(1, DIVZ);
                }
                if (lamm >= 1.4)
                {
                    double kcrit = 1 / Math.Pow(lamm, 2);
                    double DIVY  = Math.Pow(sigMy / (kcrit * fmd), 2) + (sigN / (kzc * fc0d));
                    double DIVZ  = 0;
                    DA.SetData(0, DIVY);
                    DA.SetData(1, DIVZ);
                }
            }

            //Outros Outputs
            DA.SetData(2, lamm);
        }
Esempio n. 8
0
        /// <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)
        {
            Component           = this;
            GrasshopperDocument = this.OnPingDocument();
            if (Component.Params.Input[10].SourceCount == 0)
            {
                //instantiate  new value list
                var vallist = new Grasshopper.Kernel.Special.GH_ValueList();
                vallist.CreateAttributes();

                //customise value list position
                int inputcount = this.Component.Params.Input[12].SourceCount;
                //vallist.Attributes.Pivot = new PointF((float)this.Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30,
                //    (float)this.Component.Params.Input[1].Attributes.Bounds.Y + inputcount * 30);
                vallist.Attributes.Pivot = new PointF(Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, Component.Params.Input[12].Attributes.Bounds.Y + inputcount * 30);
                //populate value list with our own data
                vallist.ListItems.Clear();
                var item1 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24h", "0");
                var item2 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28h", "1");
                var item3 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32h", "2");
                var item4 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24c", "3");
                var item5 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28c", "4");
                var item6 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32c", "5");
                var item7 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL CROSSLAM", "6");
                var item8 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL ITA", "7");
                vallist.ListItems.Add(item1);
                vallist.ListItems.Add(item2);
                vallist.ListItems.Add(item3);
                vallist.ListItems.Add(item4);
                vallist.ListItems.Add(item5);
                vallist.ListItems.Add(item6);
                vallist.ListItems.Add(item7);
                vallist.ListItems.Add(item8);

                //Until now, the slider is a hypothetical object.
                // This command makes it 'real' and adds it to the canvas.
                GrasshopperDocument.AddObject(vallist, false);

                //Connect the new slider to this component
                this.Component.Params.Input[10].AddSource(vallist);
            }
            if (Component.Params.Input[11].SourceCount == 0)
            {
                //instantiate  new value list
                var vallist = new Grasshopper.Kernel.Special.GH_ValueList();
                vallist.CreateAttributes();

                //customise value list position
                int inputcount = this.Component.Params.Input[12].SourceCount;
                //vallist.Attributes.Pivot = new PointF((float)this.Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30,
                //    (float)this.Component.Params.Input[1].Attributes.Bounds.Y + inputcount * 30);
                vallist.Attributes.Pivot = new PointF(Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, Component.Params.Input[14].Attributes.Bounds.Y + inputcount * 30);
                //populate value list with our own data
                vallist.ListItems.Clear();
                var item1 = new Grasshopper.Kernel.Special.GH_ValueListItem("Single Shear", "0");
                var item2 = new Grasshopper.Kernel.Special.GH_ValueListItem("Double Shear Steel In", "1");
                var item3 = new Grasshopper.Kernel.Special.GH_ValueListItem("Double Shear Steel Out", "2");
                //Until now, the slider is a hypothetical object.
                // This command makes it 'real' and adds it to the canvas.
                GrasshopperDocument.AddObject(vallist, false);

                //Connect the new slider to this component
                this.Component.Params.Input[11].AddSource(vallist);
            }

            //AQUI COMEÇA O PLGUIN MESMO
            double Nrd        = 0;
            double Vrd        = 0;
            double t          = 0;
            double tsteel     = 0;
            double alfa       = 0;
            double n_par      = 0;
            double n_pep      = 0;
            double d          = 0;
            double dw         = 0;
            int    wood       = 0;
            int    shear_type = 0;
            double kmod       = 0;
            double a1         = 0;
            double a4         = 0;

            string woodtype = "";
            double fc90     = 0;

            //Constant Values
            string type        = "bolt";
            bool   pre_drilled = true;
            double pk          = 0;
            double l           = -1;   //irrelevant
            bool   smooth      = true; //irrelevant
            double fu          = 1000; //default
            double alfa_fast   = -1;   //irrelevant

            if (!DA.GetData <double>(0, ref Nrd))
            {
                return;
            }
            if (!DA.GetData <double>(1, ref Vrd))
            {
                return;
            }
            if (!DA.GetData <double>(2, ref t))
            {
                return;
            }
            if (!DA.GetData <double>(3, ref tsteel))
            {
                return;
            }
            if (!DA.GetData <double>(4, ref alfa))
            {
                return;
            }
            if (!DA.GetData <double>(6, ref n_par))
            {
                return;
            }
            if (!DA.GetData <double>(7, ref n_pep))
            {
                return;
            }
            if (!DA.GetData <double>(8, ref d))
            {
                return;
            }
            if (!DA.GetData <double>(8, ref dw))
            {
                return;
            }
            if (!DA.GetData <int>(9, ref wood))
            {
                return;
            }
            if (!DA.GetData <int>(10, ref shear_type))
            {
                return;
            }
            if (!DA.GetData <double>(11, ref kmod))
            {
                return;
            }
            if (!DA.GetData <double>(12, ref a1))
            {
                return;
            }
            if (!DA.GetData <double>(13, ref a4))
            {
                return;
            }

            string text = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);

            text = Path.Combine(Directory.GetParent(text).FullName, "Plug-ins");
            var  reader = new StreamReader(File.OpenRead(text + "\\Madeira\\MLCPROP.csv"));
            int  cont   = -1;
            bool stop   = false;

            while (!reader.EndOfStream || stop == false)
            {
                var line   = reader.ReadLine();
                var values = line.Split(',');
                if (cont == wood)
                {
                    pk       = 1000 * Double.Parse(values[7]);
                    fc90     = 10 * Double.Parse(values[4]);
                    woodtype = values[13];
                    stop     = true;
                }
                cont++;
            }

            //CALCULO DAS LIGAÇÕES
            var    fast     = new Fastener(type, d, dw, l, smooth, fu);
            var    analysis = new TimberToSteelCapacity(fast, pre_drilled, pk, alfa, alfa_fast, woodtype, t, tsteel, fc90, n_par, n_pep, shear_type, a1);
            double fvd      = 0;

            if (shear_type == 0)
            {
                fvd = kmod * analysis.FvrkSingleShear() / 1.3;
            }
            else
            {
                fvd = kmod * analysis.FvrkDoubleShear() / 1.3;
            }
            double faxd = kmod * analysis.variables.Faxrk / 1.3;
            double DIV  = 0;

            DIV = 1000 * Vrd / fvd;

            //Steel Plate
            double Fsrd     = Math.Min(1.2 * a4 * tsteel * 400 / 1.35, 2.4 * fast.d * tsteel * 400 / 1.35);
            double DIVsteel = 1000 * Vrd / Fsrd;

            DA.SetData(0, fvd);
            DA.SetData(1, faxd);
            DA.SetData(2, DIV);
            DA.SetData(3, DIVsteel);
        }
Esempio n. 9
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Component           = this;
            GrasshopperDocument = this.OnPingDocument();
            if (Component.Params.Input[4].SourceCount == 0)
            {
                //instantiate  new value list
                var vallist = new Grasshopper.Kernel.Special.GH_ValueList();
                vallist.CreateAttributes();

                //customise value list position
                int inputcount = this.Component.Params.Input[4].SourceCount;
                //vallist.Attributes.Pivot = new PointF((float)this.Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30,
                //    (float)this.Component.Params.Input[1].Attributes.Bounds.Y + inputcount * 30);
                vallist.Attributes.Pivot = new PointF(Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, Component.Params.Input[4].Attributes.Bounds.Y + inputcount * 30);
                //populate value list with our own data
                vallist.ListItems.Clear();
                var item1 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24h", "0");
                var item2 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28h", "1");
                var item3 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32h", "2");
                var item4 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24c", "3");
                var item5 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28c", "4");
                var item6 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32c", "5");
                var item7 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL CROSSLAM", "6");
                var item8 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL ITA", "7");
                vallist.ListItems.Add(item1);
                vallist.ListItems.Add(item2);
                vallist.ListItems.Add(item3);
                vallist.ListItems.Add(item4);
                vallist.ListItems.Add(item5);
                vallist.ListItems.Add(item6);
                vallist.ListItems.Add(item7);
                vallist.ListItems.Add(item8);

                //Until now, the slider is a hypothetical object.
                // This command makes it 'real' and adds it to the canvas.
                GrasshopperDocument.AddObject(vallist, false);

                //Connect the new slider to this component
                this.Component.Params.Input[4].AddSource(vallist);
            }
            string text = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);

            text = Path.Combine(Directory.GetParent(text).FullName, "Plug-ins");
            var reader = new StreamReader(File.OpenRead(text + "\\Madeira\\MLCPROP.csv"));

            double Mt   = 0;
            double h    = 0;
            double b    = 0;
            double Kmod = 0;
            double Gamm = 0;
            double Fvk  = 0;
            int    test = 0;

            if (!DA.GetData <double>(0, ref Mt))
            {
                return;
            }
            if (!DA.GetData <double>(1, ref h))
            {
                return;
            }
            if (!DA.GetData <double>(2, ref b))
            {
                return;
            }
            if (!DA.GetData <double>(3, ref Kmod))
            {
                return;
            }
            if (!DA.GetData(4, ref test))
            {
                return;
            }
            int  cont = -1;
            bool stop = false;

            while (!reader.EndOfStream || stop == false)
            {
                var line   = reader.ReadLine();
                var values = line.Split(',');
                if (cont == test)
                {
                    Fvk  = Double.Parse(values[6]);
                    Gamm = Double.Parse(values[12]);
                    stop = true;
                }
                cont++;
            }
            double bef  = 0.67 * b;
            double Sigv = (3 / 2) * (Mt / (bef * h));
            double fvd  = Kmod * Fvk / Gamm;
            double Div  = Sigv / fvd;

            DA.SetData(0, Div);
        }
Esempio n. 10
0
        /// <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)
        {
            Component           = this;
            GrasshopperDocument = this.OnPingDocument();
            if (Component.Params.Input[2].SourceCount == 0)
            {
                //instantiate  new value list
                var vallist = new Grasshopper.Kernel.Special.GH_ValueList();
                vallist.CreateAttributes();

                //customise value list position
                int inputcount = this.Component.Params.Input[2].SourceCount;
                //vallist.Attributes.Pivot = new PointF((float)this.Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30,
                //    (float)this.Component.Params.Input[1].Attributes.Bounds.Y + inputcount * 30);
                vallist.Attributes.Pivot = new PointF(Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, Component.Params.Input[2].Attributes.Bounds.Y + inputcount * 30);
                //populate value list with our own data
                vallist.ListItems.Clear();
                var item1 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24h", "0");
                var item2 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28h", "1");
                var item3 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32h", "2");
                var item4 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24c", "3");
                var item5 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28c", "4");
                var item6 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32c", "5");
                var item7 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL CROSSLAM", "6");
                var item8 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL ITA", "7");
                vallist.ListItems.Add(item1);
                vallist.ListItems.Add(item2);
                vallist.ListItems.Add(item3);
                vallist.ListItems.Add(item4);
                vallist.ListItems.Add(item5);
                vallist.ListItems.Add(item6);
                vallist.ListItems.Add(item7);
                vallist.ListItems.Add(item8);

                //Until now, the slider is a hypothetical object.
                // This command makes it 'real' and adds it to the canvas.
                GrasshopperDocument.AddObject(vallist, false);

                //Connect the new slider to this component
                this.Component.Params.Input[2].AddSource(vallist);
            }


            string type   = "screw";
            double d      = 0;
            double pk     = 0;
            double alfa   = 0;
            bool   pdrill = false;
            int    wood   = 0;



            if (!DA.GetData <string>(0, ref type))
            {
                return;
            }
            if (!DA.GetData <double>(1, ref d))
            {
                return;
            }
            if (!DA.GetData <int>(2, ref wood))
            {
                return;
            }
            if (!DA.GetData <double>(3, ref alfa))
            {
                return;
            }
            if (!DA.GetData <bool>(4, ref pdrill))
            {
                return;
            }

            //Pegar valores da Madeira do Excel
            string text = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);

            text = Path.Combine(Directory.GetParent(text).FullName, "Plug-ins");
            var    reader   = new StreamReader(File.OpenRead(text + "\\Madeira\\MLCPROP.csv"));
            int    cont     = -1;
            bool   stop     = false;
            string woodtype = "";

            while (!reader.EndOfStream || stop == false)
            {
                var line   = reader.ReadLine();
                var values = line.Split(',');
                if (cont == wood)
                {
                    pk       = 1000 * Double.Parse(values[7]);
                    woodtype = values[13];
                    stop     = true;
                }
                cont++;
            }
            //CALCULOS DE BRITTLE FAILURE (minimos espaçamentos aceitáveis)
            Fastener       fast     = new Fastener(type, d, -1, -1, true, -1);
            BrittleFailure analysis = new BrittleFailure(fast, pk, alfa, pdrill);
            double         a1       = analysis.a1;
            double         a2       = analysis.a2;
            double         a3c      = analysis.a3c;
            double         a3t      = analysis.a3t;
            double         a4c      = analysis.a4c;
            double         a4t      = analysis.a4t;
            double         a1best   = analysis.a1_n;

            DA.SetData(0, a1);
            DA.SetData(1, a1best);
            DA.SetData(2, a2);
            DA.SetData(3, a3c);
            DA.SetData(4, a3t);
            DA.SetData(5, a4c);
            DA.SetData(6, a4t);
        }
Esempio n. 11
0
        /// <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)
        {
            Component           = this;
            GrasshopperDocument = this.OnPingDocument();
            if (Component.Params.Input[8].SourceCount == 0)
            {
                //instantiate  new value list
                var vallist = new Grasshopper.Kernel.Special.GH_ValueList();
                vallist.CreateAttributes();

                //customise value list position
                int inputcount = this.Component.Params.Input[8].SourceCount;
                //vallist.Attributes.Pivot = new PointF((float)this.Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30,
                //    (float)this.Component.Params.Input[1].Attributes.Bounds.Y + inputcount * 30);
                vallist.Attributes.Pivot = new PointF(Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, Component.Params.Input[8].Attributes.Bounds.Y + inputcount * 30);
                //populate value list with our own data
                vallist.ListItems.Clear();
                var item1 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24h", "0");
                var item2 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28h", "1");
                var item3 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32h", "2");
                var item4 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24c", "3");
                var item5 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28c", "4");
                var item6 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32c", "5");
                var item7 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL CROSSLAM", "6");
                var item8 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL ITA", "7");
                vallist.ListItems.Add(item1);
                vallist.ListItems.Add(item2);
                vallist.ListItems.Add(item3);
                vallist.ListItems.Add(item4);
                vallist.ListItems.Add(item5);
                vallist.ListItems.Add(item6);
                vallist.ListItems.Add(item7);
                vallist.ListItems.Add(item8);

                //Until now, the slider is a hypothetical object.
                // This command makes it 'real' and adds it to the canvas.
                GrasshopperDocument.AddObject(vallist, false);

                //Connect the new slider to this component
                this.Component.Params.Input[8].AddSource(vallist);
            }
            string text = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);

            text = Path.Combine(Directory.GetParent(text).FullName, "Plug-ins");
            var reader = new StreamReader(File.OpenRead(text + "\\Madeira\\MLCPROP.csv"));

            //inputs
            double Fcad   = 0;
            double acomp  = 0;
            double lFcad  = 0;
            double d1     = 0;
            double d1tipo = 0;
            double d2     = 0;
            double d2tipo = 0;
            double b      = 0;
            double h      = 0;
            double Kmod   = 0;
            double Ym     = 0;
            double fc0k   = 0;
            double fc90k  = 0;
            double E05    = 0;
            int    test   = 0;

            if (!DA.GetData <double>(0, ref Fcad))
            {
                return;
            }
            if (!DA.GetData <double>(1, ref acomp))
            {
                return;
            }
            if (!DA.GetData <double>(2, ref lFcad))
            {
                return;
            }
            if (!DA.GetData <double>(3, ref d1))
            {
                return;
            }
            if (!DA.GetData <double>(3, ref d1tipo))
            {
                return;
            }
            if (!DA.GetData <double>(4, ref d2))
            {
                return;
            }
            if (!DA.GetData <double>(4, ref d2tipo))
            {
                return;
            }
            if (!DA.GetData <double>(5, ref b))
            {
                return;
            }
            if (!DA.GetData <double>(6, ref h))
            {
                return;
            }
            if (!DA.GetData <double>(7, ref Kmod))
            {
                return;
            }
            if (!DA.GetData <int>(8, ref test))
            {
                return;
            }
            int    cont          = -1;
            bool   stop          = false;
            double tipodemadeira = 0;

            while (!reader.EndOfStream || stop == false)
            {
                var line   = reader.ReadLine();
                var values = line.Split(',');
                if (cont == test)
                {
                    Ym    = Double.Parse(values[12]);
                    fc0k  = Double.Parse(values[1]);
                    fc90k = Double.Parse(values[4]);
                    E05   = Double.Parse(values[9]);
                    if (values[13] == "SOLID")
                    {
                        tipodemadeira = 1;
                    }
                    stop = true;
                }
                cont++;
            }

            //Definição de valores do material
            double fc0d  = Kmod * fc0k / Ym;
            double fc90d = Kmod * fc90k / Ym;

            //compressão perpendicular ou em ângulo (garantir que acomp foi fornecido corretamente)
            if (acomp <= 90)
            {
                //Definição de valores geométricos e de tensão efetiva
                double d1min   = Math.Min(d1 / 2, lFcad);
                double d1ef    = Math.Min(d1min, 3);
                double d2min   = Math.Min(d2 / 2, lFcad);
                double d2ef    = Math.Min(d2min, 3);
                double lef     = lFcad + d1ef + d2ef;
                double Aef     = lef * b;
                double sigc90d = Fcad / Aef;
                double kc90    = 1;

                // determinando valor de kc90 (caso não seja majorado por um if abaixo, deve valer igual a 1.0)
                // ifs também perguntam se a madeira é MLC ou SOLID (coluna 13 do excel deve ser preenchida)

                if (d1tipo == 0 && d2tipo == 1 && d2 >= 2 * h)
                {
                    if (tipodemadeira == 0 && lFcad <= 40)
                    {
                        kc90 = 1.75;
                    }
                    if (tipodemadeira == 1)
                    {
                        kc90 = 1.5;
                    }
                }

                if (d2tipo == 0 && d1tipo == 1 && d1 >= 2 * h)
                {
                    if (tipodemadeira == 0 && lFcad <= 40)
                    {
                        kc90 = 1.75;
                    }
                    if (tipodemadeira == 1)
                    {
                        kc90 = 1.5;
                    }
                }

                if (d2tipo == 1 && d1tipo == 1)
                {
                    if (d1 >= 2 * h && d2 >= 2 * h)
                    {
                        if (tipodemadeira == 0 && lFcad <= 40)
                        {
                            kc90 = 1.75;
                        }
                        if (tipodemadeira == 1)
                        {
                            kc90 = 1.5;
                        }
                    }
                }

                //Verificação de compressão perpendicular ou em ângulo

                double acompR = Math.PI * acomp / 180;
                double DIV    = sigc90d * (fc0d * Math.Pow(Math.Sin(acompR), 2) / (kc90 * fc90d) + Math.Pow(Math.Cos(acompR), 2)) / fc0d;
                DA.SetData(0, DIV);
            }
        }
Esempio n. 12
0
        /// <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)
        {
            Component           = this;
            GrasshopperDocument = this.OnPingDocument();
            if (Component.Params.Input[8].SourceCount == 0)
            {
                //instantiate  new value list
                var vallist = new Grasshopper.Kernel.Special.GH_ValueList();
                vallist.CreateAttributes();

                //customise value list position
                int inputcount = this.Component.Params.Input[8].SourceCount;
                //vallist.Attributes.Pivot = new PointF((float)this.Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30,
                //    (float)this.Component.Params.Input[1].Attributes.Bounds.Y + inputcount * 30);
                vallist.Attributes.Pivot = new PointF(Component.Attributes.DocObject.Attributes.Bounds.Left - vallist.Attributes.Bounds.Width - 30, Component.Params.Input[8].Attributes.Bounds.Y + inputcount * 30);
                //populate value list with our own data
                vallist.ListItems.Clear();
                var item1 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24h", "0");
                var item2 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28h", "1");
                var item3 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32h", "2");
                var item4 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 24c", "3");
                var item5 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 28c", "4");
                var item6 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL 32c", "5");
                var item7 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL CROSSLAM", "6");
                var item8 = new Grasshopper.Kernel.Special.GH_ValueListItem("GL ITA", "7");
                vallist.ListItems.Add(item1);
                vallist.ListItems.Add(item2);
                vallist.ListItems.Add(item3);
                vallist.ListItems.Add(item4);
                vallist.ListItems.Add(item5);
                vallist.ListItems.Add(item6);
                vallist.ListItems.Add(item7);
                vallist.ListItems.Add(item8);

                //Until now, the slider is a hypothetical object.
                // This command makes it 'real' and adds it to the canvas.
                GrasshopperDocument.AddObject(vallist, false);

                //Connect the new slider to this component
                this.Component.Params.Input[13].AddSource(vallist);
            }

            double t1      = 0;
            double t2      = 0;
            double alfast  = 0;
            double Nscrews = 0;
            double d       = 0;
            double dh      = 0;
            double l       = 0;
            double lt      = 0;
            int    wood    = 0;
            double pk      = 0;
            double kmod    = 0;
            double Frd     = 0;


            if (!DA.GetData <double>(0, ref Frd))
            {
                return;
            }
            if (!DA.GetData <double>(1, ref Nscrews))
            {
                return;
            }
            if (!DA.GetData <double>(2, ref Frd))
            {
                return;
            }
            if (!DA.GetData <double>(3, ref Frd))
            {
                return;
            }
            if (!DA.GetData <double>(4, ref Ctype))
            {
                return;
            }
            if (!DA.GetData <double>(5, ref afast))
            {
                return;
            }
            if (!DA.GetData <double>(6, ref d))
            {
                return;
            }
            if (!DA.GetData <double>(7, ref dh))
            {
                return;
            }
            if (!DA.GetData <double>(8, ref l))
            {
                return;
            }
            if (!DA.GetData <double>(9, ref lt))
            {
                return;
            }
            if (!DA.GetData <int>(10, ref wood))
            {
                return;
            }
            if (!DA.GetData <double>(11, ref kmod))
            {
                return;
            }



            //Pegar valores da Madeira do Excel
            string text = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);

            text = Path.Combine(Directory.GetParent(text).FullName, "Plug-ins");
            var    reader   = new StreamReader(File.OpenRead(text + "\\Madeira\\MLCPROP.csv"));
            int    cont     = -1;
            bool   stop     = false;
            string woodtype = "";

            while (!reader.EndOfStream || stop == false)
            {
                var line   = reader.ReadLine();
                var values = line.Split(',');
                if (cont == wood)
                {
                    pk       = 1000 * Double.Parse(values[7]);
                    woodtype = values[13];
                    stop     = true;
                }
                cont++;
            }



            double f_ax_k = 3.6 * 0.001 * Math.Pow(pk, 1.5);
        }