Example #1
0
        public override IGH_Goo Duplicate()
        {
            var res = new GH_Section()
            {
                Value = Value.Duplicate(),
            };

            return(res);
        }
Example #2
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var brpList     = DA.GetDataList <Brep>(0);
            var plnList     = DA.GetDataList <Plane>(1);
            var secAttrList = DA.GetDataList <GH_SectionAttributes>(2);

            if (secAttrList.Count == 0)
            {
                secAttrList.Add(new GH_SectionAttributes()
                {
                    Value = new SectionAttributes(),
                });
            }

            var outList = new List <GH_Section>();

            for (int i = 0; i < brpList.Count; i++)
            {
                var brp = brpList.GetItemOrLast(i);
                var pln = plnList.GetItemOrLast(i);

                var sec = CreateSection(brp, pln);

                var secAttr = secAttrList.GetItemOrLast(i).Value;

                var id = secAttr.Id;
                if (i >= secAttrList.Count)
                {
                    id = id - (secAttrList.Count - 1) + i;
                }

                sec.Id         = id;
                sec.Name       = secAttr.Name;
                sec.MaterialId = secAttr.MaterialId;
                sec.Unit       = Units.Unit_Length.None;

                var ghSec = new GH_Section()
                {
                    Value = sec,
                };

                outList.Add(ghSec);
            }

            DA.SetDataList(0, outList);
        }