public List <Brep> Compute()
        {
            globalBaseCrvLi  = new List <Curve>(); // global parameter
            globalTowerCrvLi = new List <Curve>(); // global parameter
            globalPtCrvLi    = new List <Point3d>();
            double[]       p    = c2.DivideByCount(numDiv, true);
            List <Point3d> ptLi = new List <Point3d>();         // points on the site boundary

            for (int i = 0; i < p.Length; i++)
            {
                Point3d pts = c2.PointAt(p[i]);
                ptLi.Add(pts);
                globalPtCrvLi.Add(pts);
            }

            // GENERATE NORMALS FROM THE POINT - SCALE=SETBACK DISTANCE
            List <LineCurve> lineLi = new List <LineCurve>();

            for (int i = 0; i < ptLi.Count; i++)
            {
                Point3d P = Point3d.Unset;
                Point3d Q = Point3d.Unset;
                if (i == 0)
                {
                    P = ptLi[ptLi.Count - 1];
                    Q = ptLi[0];
                }
                else
                {
                    P = ptLi[i - 1];
                    Q = ptLi[i];
                }
                double  sc  = 1 / P.DistanceTo(Q);
                double  sc2 = OFFSET_INP;
                double  dx  = P.X - (Q.Y - P.Y) * sc;
                double  dy  = P.Y + (Q.X - P.X) * sc;
                Point3d u   = new Point3d(dx, dy, 0);
                double  dx2 = P.X - (Q.Y - P.Y) * sc * sc2;
                double  dy2 = P.Y + (Q.X - P.X) * sc * sc2;
                double  ex2 = P.X + (Q.Y - P.Y) * sc * sc2;
                double  ey2 = P.Y - (Q.X - P.X) * sc * sc2;
                Point3d u2  = new Point3d(dx2, dy2, 0);
                Point3d v2  = new Point3d(ex2, ey2, 0);
                Rhino.Geometry.PointContainment contU = c2.Contains(u, Plane.WorldXY, Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance);
                if (contU.ToString() == "Inside")
                {
                    LineCurve linePu = new LineCurve(P, u2);
                    lineLi.Add(linePu);
                }
                else
                {
                    LineCurve linePu = new LineCurve(P, v2);
                    lineLi.Add(linePu);
                }
            }

            // FIND INTX - NORMAL x SETBACK CURVE; REMOVE OTHER NORMALS
            List <LineCurve> fLineLi = new List <LineCurve>();

            for (int i = 0; i < lineLi.Count; i++)
            {
                double t   = Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance;
                var    evt = Rhino.Geometry.Intersect.Intersection.CurveCurve(OFFSET_CRV, lineLi[i], t, t);
                try
                {
                    Point3d   A    = lineLi[i].PointAtStart;
                    Point3d   pA   = evt[0].PointA;
                    LineCurve line = new LineCurve(A, pA);
                    fLineLi.Add(line);
                }
                catch (Exception) { }
            }

            // JOIN ADJACENT NORMAL SEGMENTS TO FORM POLYGONS
            // 1st point is point on site, 2nd = normal @ setback dist
            List <PolylineCurve> polyCrvLi = new List <PolylineCurve>();

            for (int i = 0; i < lineLi.Count; i++)
            {
                if (i == 0)
                {
                    LineCurve     A    = lineLi[lineLi.Count - 1];
                    LineCurve     B    = lineLi[0];
                    Point3d       a0   = A.PointAtStart;
                    Point3d       a1   = A.PointAtEnd;
                    Point3d       b0   = B.PointAtStart;
                    Point3d       b1   = B.PointAtEnd;
                    Point3d[]     pts  = { a0, b0, b1, a1, a0 };
                    PolylineCurve poly = new PolylineCurve(pts);
                    double        ar2  = AreaMassProperties.Compute(poly).Area;
                    if (ar2 > minTowerAr)
                    {
                        polyCrvLi.Add(poly);
                    }
                    //polyCrvLi.Add(poly);
                }
                else
                {
                    LineCurve     A    = lineLi[i - 1];
                    LineCurve     B    = lineLi[i];
                    Point3d       a0   = A.PointAtStart;
                    Point3d       a1   = A.PointAtEnd;
                    Point3d       b0   = B.PointAtStart;
                    Point3d       b1   = B.PointAtEnd;
                    Point3d[]     pts  = { a0, b0, b1, a1, a0 };
                    PolylineCurve poly = new PolylineCurve(pts);
                    double        ar2  = AreaMassProperties.Compute(poly).Area;
                    if (ar2 > minTowerAr)
                    {
                        polyCrvLi.Add(poly);
                    }
                    //polyCrvLi.Add(poly);
                }
            }
            double      baseExtrHt = 0.0;
            double      spineHt    = 0.0;
            List <Brep> fbrepLi    = new List <Brep>();

            try
            {   // BASE PROCESSES= EXTRUSION & COPY
                double c2Area     = AreaMassProperties.Compute(c2).Area;
                double offsetArea = AreaMassProperties.Compute(OFFSET_CRV).Area;
                double flrAr      = c2Area - offsetArea;
                int    numFlrs2   = (int)(SITE_AR * baseFsr / flrAr) + 1;
                baseExtrHt = numFlrs2 * flrHt;
                for (int i = 0; i < numFlrs2; i++)
                {
                    Curve c2_copy = c2.DuplicateCurve();
                    Rhino.Geometry.Transform xform = Rhino.Geometry.Transform.Translation(0, 0, spineHt);
                    c2_copy.Transform(xform);
                    Curve OFFSET_CRV_copy = OFFSET_CRV.DuplicateCurve();
                    OFFSET_CRV_copy.Transform(xform);
                    spineHt += flrHt;
                    globalBaseCrvLi.Add(c2_copy);
                    globalBaseCrvLi.Add(OFFSET_CRV_copy);
                }

                // base extrusions
                Extrusion outerExtr = Rhino.Geometry.Extrusion.Create(c2, baseExtrHt, true);
                var       t0        = outerExtr.GetBoundingBox(true);
                if (t0.Max.Z <= 0)
                {
                    outerExtr = Rhino.Geometry.Extrusion.Create(c2, baseExtrHt, true);
                }
                Brep outerBrep = outerExtr.ToBrep();

                Extrusion innerExtr = Rhino.Geometry.Extrusion.Create(OFFSET_CRV, -baseExtrHt, true);
                var       t1        = innerExtr.GetBoundingBox(true);
                if (t1.Max.Z <= 0)
                {
                    innerExtr = Rhino.Geometry.Extrusion.Create(OFFSET_CRV, baseExtrHt, true);
                }
                Brep   innerBrep  = innerExtr.ToBrep();
                Brep[] netBrepArr = Brep.CreateBooleanDifference(outerBrep, innerBrep, 0.01);
                Brep   netBrep    = netBrepArr[0];
                fbrepLi.Add(netBrep);
            }
            catch (Exception) { }

            // Tower POLY FOR THE TOWERS
            List <Curve>         towerPolyLi = new List <Curve>();
            List <PolylineCurve> fPolyLi     = new List <PolylineCurve>();
            int numSel = numTowers;

            double cumuArPoly = 0.0;

            for (int i = 0; i < numSel; i++)
            {
                int idx = rnd.Next(polyCrvLi.Count);
                fPolyLi.Add(polyCrvLi[idx]);
                cumuArPoly += AreaMassProperties.Compute(polyCrvLi[idx]).Area;
            }
            // Tower POLY EXTRUSION
            double towerHtReq = SITE_AR * towerFsr / cumuArPoly;

            for (int i = 0; i < fPolyLi.Count; i++)
            {
                PolylineCurve crv   = fPolyLi[i];
                Extrusion     extr0 = Extrusion.Create(crv, -towerHtReq * flrHt, true);
                var           t0    = extr0.GetBoundingBox(true);
                if (t0.Max.Z <= 0)
                {
                    extr0 = Extrusion.Create(crv, towerHtReq * flrHt, true);
                }
                Brep      brep  = extr0.ToBrep();
                Transform xform = Rhino.Geometry.Transform.Translation(0, 0, baseExtrHt);
                brep.Transform(xform);
                fbrepLi.Add(brep);
            }
            // Tower POLY FLOOR COPIES
            // spineHt initialized above & updated from base curve copies
            int numFlrs = (int)(SITE_AR * towerFsr / cumuArPoly) + 1;

            for (int i = 0; i < numFlrs; i++)
            {
                for (int j = 0; j < fPolyLi.Count; j++)
                {
                    Curve crv = fPolyLi[j].DuplicateCurve();
                    Rhino.Geometry.Transform xform = Rhino.Geometry.Transform.Translation(0, 0, spineHt);
                    crv.Transform(xform);
                    globalTowerCrvLi.Add(crv);
                }
                spineHt += flrHt;
            }
            return(fbrepLi);
        }
Exemple #2
0
        public void Compute()
        {
            genBaseMass();
            globalPtCrvLi = new List <Point3d>();
            List <PolylineCurve> polyLi = new List <PolylineCurve>(); // base of towers: poly

            for (int i = 0; i < outerPtLi.Count - 1; i++)
            {
                Point3d        p           = outerPtLi[i];
                Point3d        q           = outerPtLi[i + 1];
                Point3d        a           = innerPtLi[i];
                Point3d        b           = innerPtLi[i + 1];
                double         t           = (double)(1.00 / numDiv);
                List <Point3d> inner_subLi = new List <Point3d>();
                List <Point3d> outer_subLi = new List <Point3d>();
                for (double j = 0.0; j < 1.0; j += t)
                {
                    double  x = a.X + (b.X - a.X) * j;
                    double  y = a.Y + (b.Y - a.Y) * j;
                    Point3d A = new Point3d(x, y, 0); //a+j*(b-a)
                    // globalPtCrvLi.Add(A);
                    // inner_subLi.Add(A);
                    Point3d R = ProjPtLine(p, q, A);//normal from interp _ab to pq
                    if (PtInSeg(p, q, R) == true)
                    {
                        globalPtCrvLi.Add(A);
                        inner_subLi.Add(A);
                        globalPtCrvLi.Add(R);
                        outer_subLi.Add(R);
                    }
                    else
                    {
                        break;
                    }
                }
                for (int j = 0; j < outer_subLi.Count - 1; j++)
                {
                    try
                    {
                        Point3d        A   = inner_subLi[j];
                        Point3d        B   = inner_subLi[j + 1];
                        Point3d        P   = outer_subLi[j];
                        Point3d        Q   = outer_subLi[j + 1];
                        List <Point3d> pts = new List <Point3d> {
                            A, B, Q, P, A
                        };
                        PolylineCurve poly = new PolylineCurve(pts);
                        double        ar2  = AreaMassProperties.Compute(poly).Area;
                        if (ar2 > minTowerAr)
                        {
                            polyLi.Add(poly);
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            globalTowerCrvLi = new List <Curve>();
            int numSel = numTowers;
            List <PolylineCurve> fPolyLi = new List <PolylineCurve>();
            double cumuArPoly            = 0.0;

            for (int i = 0; i < numSel; i++)
            {
                try
                {
                    int idx = rnd.Next(polyLi.Count);
                    fPolyLi.Add(polyLi[idx]);
                    cumuArPoly += AreaMassProperties.Compute(polyLi[idx]).Area;
                }
                catch (Exception) { }
            }

            int    numFlrs = (int)(SITE_AR * towerFsr / cumuArPoly) + 1;
            double towerHt = numFlrs * flrHt;

            for (int i = 0; i < fPolyLi.Count; i++)
            {
                try
                {
                    PolylineCurve poly = fPolyLi[i];
                    Extrusion     extr = Rhino.Geometry.Extrusion.Create(poly, towerHt, true);
                    var           B    = extr.GetBoundingBox(true);
                    if (B.Max.Z <= 0)
                    {
                        extr = Rhino.Geometry.Extrusion.Create(poly, -towerHt, true);
                    }
                    Brep brep = extr.ToBrep();
                    Rhino.Geometry.Transform xform2 = Rhino.Geometry.Transform.Translation(0, 0, BaseMassHt);
                    brep.Transform(xform2);
                    globalBrepLi.Add(brep);
                }
                catch (Exception) { }
            }

            // Tower POLY FLOOR COPIES
            // spineHt initialized above & updated from base curve copies

            double spineHt = BaseMassHt;

            if (numFlrs > 0)
            {
                for (int i = 0; i < numFlrs; i++)
                {
                    for (int j = 0; j < fPolyLi.Count; j++)
                    {
                        Curve crv = ((Curve)fPolyLi[j]).DuplicateCurve();
                        Rhino.Geometry.Transform xform3 = Rhino.Geometry.Transform.Translation(0, 0, spineHt);
                        crv.Transform(xform3);
                        globalTowerCrvLi.Add(crv);
                    }
                    spineHt += flrHt;
                }
            }
        }
Exemple #3
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List <Curve> sites            = new List <Curve>();
            double       fsr              = double.NaN;
            double       setback          = double.NaN;
            double       flrHt            = double.NaN;
            double       minAr            = double.NaN;
            double       slendernessRatio = double.NaN;

            if (!DA.GetDataList(0, sites))
            {
                return;
            }
            if (!DA.GetData(1, ref setback))
            {
                return;
            }
            if (!DA.GetData(2, ref fsr))
            {
                return;
            }
            if (!DA.GetData(3, ref flrHt))
            {
                return;
            }
            if (!DA.GetData(4, ref minAr))
            {
                return;
            }
            if (!DA.GetData(5, ref slendernessRatio))
            {
                return;
            }

            List <Extrusion>     massLi       = new List <Extrusion>();
            List <List <Curve> > listFlrCrvLi = new List <List <Curve> >();
            List <Curve>         flrCrvLi     = new List <Curve>();
            string msg = "";

            msg += "\nfsr: " + fsr.ToString();
            msg += "\nsetback: " + setback.ToString();
            string MSG = "Debug BLOCK:\n";

            for (int i = 0; i < sites.Count; i++)
            {
                //OFFSET FROM THE SITE BOUNDARY
                Curve   c1 = sites[i].DuplicateCurve();
                Curve   c2 = Rhino.Geometry.Curve.ProjectToPlane(c1, Plane.WorldXY);
                Curve[] c2Offs;
                Point3d cen = AreaMassProperties.Compute(c2).Centroid;
                Rhino.Geometry.PointContainment cont = sites[i].Contains(cen, Plane.WorldXY, Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance);
                if (cont.ToString() == "Inside")
                {
                    c2Offs = c2.Offset(cen, Vector3d.ZAxis, setback, 0.01, CurveOffsetCornerStyle.Sharp);
                }
                else
                {
                    c2Offs = c2.Offset(cen, Vector3d.ZAxis, -setback, 0.01, CurveOffsetCornerStyle.Sharp);
                }
                try
                {
                    if (c2Offs.Length == 1)
                    {
                        Curve  OFFSET_CRV_         = c2Offs[0];
                        Curve  OFFSET_CRV          = Curve.ProjectToPlane(OFFSET_CRV_, Plane.WorldXY);
                        double arSite              = Rhino.Geometry.AreaMassProperties.Compute(sites[i]).Area;
                        double arOffset            = AreaMassProperties.Compute(OFFSET_CRV).Area; // 1 floor
                        double num_flrs            = fsr * arSite / arOffset;
                        double ht                  = num_flrs * flrHt;
                        double gotSlendernessRatio = ht / arOffset;
                        if (gotSlendernessRatio < slendernessRatio)
                        {
                            msg += "\nExceeded slenderness ratio";
                        }
                        else if (arOffset <= minAr)
                        {
                            msg += "\nar site: " + arSite.ToString() + "\nar offset: " + arOffset.ToString() + "\nht: " + ht.ToString();
                        }
                        else
                        {
                            Vector3d  vec  = new Vector3d(0, 0, ht);
                            Curve     c3   = Rhino.Geometry.Curve.ProjectToPlane(OFFSET_CRV, Plane.WorldXY);
                            Extrusion mass = Rhino.Geometry.Extrusion.Create(c3, ht, true);
                            var       B    = mass.GetBoundingBox(true);
                            MSG += "Z = " + B.Max.Z.ToString() + ", " + B.Min.Z.ToString();
                            if (B.Max.Z <= 0.01)
                            {
                                mass = Extrusion.Create(c3, -ht, true);
                            }
                            massLi.Add(mass);

                            for (int j = 0; j < num_flrs; j++)
                            {
                                Rhino.Geometry.Transform xform = Rhino.Geometry.Transform.Translation(0, 0, j * flrHt);
                                Curve c4 = c3.DuplicateCurve();
                                c4.Transform(xform);
                                flrCrvLi.Add(c4);
                            }
                        }
                    }
                }
                catch (Exception) { }
                //listFlrCrvLi.Add(flrCrvLi);
            }

            DA.SetDataList(0, massLi);
            DA.SetDataList(1, flrCrvLi);
            // DA.SetData(2, msg);
            // DA.SetData(3, MSG);
        }
Exemple #4
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Curve         siteCrv     = null;
            double        flrHt       = double.NaN;
            double        minAr       = double.NaN;
            string        stepbackstr = "2,3,4";
            string        htstr       = "2,3,4";
            string        outputMsg   = "";
            List <double> stepbackLi  = new List <double>();
            List <double> htLi        = new List <double>();

            if (!DA.GetData(0, ref siteCrv))
            {
                return;
            }
            //if (!DA.GetData(1, ref fsr)) return;
            if (!DA.GetData(1, ref flrHt))
            {
                return;
            }
            // if (!DA.GetData(3, ref stepbackstr)) return;
            // if (!DA.GetData(4, ref htstr)) return;
            bool t0 = DA.GetData(2, ref stepbackstr);
            bool t1 = DA.GetData(3, ref htstr);

            if (!DA.GetData(4, ref minAr))
            {
                return;
            }

            string[] stepbackArr = stepbackstr.Split(',');
            for (int i = 0; i < stepbackArr.Length; i++)
            {
                double x = Convert.ToDouble(stepbackArr[i]);
                stepbackLi.Add(x);
            }

            string[] htArr = htstr.Split(',');
            for (int i = 0; i < htArr.Length; i++)
            {
                double x = Convert.ToDouble(htArr[i]);
                htLi.Add(x);
            }
            List <string> flrReqLi = new List <string>();
            List <Brep>   brepLi   = new List <Brep>();
            List <Curve>  flrCrvLi = new List <Curve>();
            double        spineht  = 0.0;
            double        flrItr   = 0.0; // continuous ht counter for floors

            try
            {
                for (int i = 0; i < stepbackLi.Count; i++)
                {
                    Curve  c0_    = siteCrv.DuplicateCurve();
                    Curve  c0     = Rhino.Geometry.Curve.ProjectToPlane(c0_, Plane.WorldXY);
                    double got_ar = AreaMassProperties.Compute(c0).Area;
                    if (got_ar < minAr)
                    {
                        continue;
                    }                                 // this curve has less area than min specs
                    Point3d cen = AreaMassProperties.Compute(c0).Centroid;

                    double di = stepbackLi[i];
                    if (i > 0 && stepbackLi[i] < stepbackLi[i - 1])
                    {
                        stepbackLi[i - 1] += 1;
                    }
                    Curve[] c1  = c0.Offset(cen, Vector3d.ZAxis, di, 0.01, CurveOffsetCornerStyle.Sharp);
                    Curve   c2_ = null;
                    Curve   c2  = null;
                    if (c1.Length != 1)
                    {
                        c2 = c0;
                    }
                    else
                    {
                        c2_ = c1[0].DuplicateCurve();
                        c2  = Curve.ProjectToPlane(c2_, Plane.WorldXY);
                    }
                    double ht = htLi[i];
                    if (ht == 0)
                    {
                        continue;
                    }
                    double numFlrs = ht / flrHt;
                    for (int j = 0; j < numFlrs; j++)
                    {
                        Curve c3 = c2.DuplicateCurve();
                        Rhino.Geometry.Transform xform_itr = Rhino.Geometry.Transform.Translation(0, 0, flrItr);
                        c3.Transform(xform_itr);
                        flrCrvLi.Add(c3);
                        flrItr += flrHt;
                    }
                    flrReqLi.Add(numFlrs.ToString());
                    Extrusion mass = Rhino.Geometry.Extrusion.Create(c2, ht, true);  //
                    var       B    = mass.GetBoundingBox(true);
                    if (B.Max.Z < 0.01)
                    {
                        mass = Extrusion.Create(c2, -ht, true);  //
                    }
                    Brep brep = mass.ToBrep();
                    Rhino.Geometry.Transform xform = Rhino.Geometry.Transform.Translation(0, 0, spineht);
                    brep.Transform(xform);
                    brepLi.Add(brep);
                    spineht += ht;
                }
                DA.SetDataList(0, flrCrvLi);
                DA.SetDataList(1, brepLi);
            }
            catch (Exception) { }

            double grossFlrAr = 0.0;

            for (int i = 0; i < flrCrvLi.Count; i++)
            {
                grossFlrAr += AreaMassProperties.Compute(flrCrvLi[i]).Area;
            }
            double siteAr = AreaMassProperties.Compute(siteCrv).Area;
            double gotfsr = grossFlrAr / siteAr;

            outputMsg = "Gross Floor Area = " + Math.Round(grossFlrAr, 2).ToString() +
                        ", Got fsr / far = " + Math.Round(gotfsr, 2).ToString();
            DA.SetData(2, outputMsg);
            DA.SetDataList(3, flrReqLi);
        }
Exemple #5
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Curve  siteCrv          = null;
            double fsr              = double.NaN;
            double flrHt            = double.NaN;
            double setback          = double.NaN;
            double bayDepth         = double.NaN;
            double slendernessRatio = double.NaN;

            if (!DA.GetData(0, ref siteCrv))
            {
                return;
            }
            if (!DA.GetData(1, ref fsr))
            {
                return;
            }
            if (!DA.GetData(2, ref flrHt))
            {
                return;
            }
            if (!DA.GetData(3, ref setback))
            {
                return;
            }
            if (!DA.GetData(4, ref bayDepth))
            {
                return;
            }
            if (!DA.GetData(5, ref slendernessRatio))
            {
                return;
            }

            Curve   c0_ = siteCrv.DuplicateCurve();
            Curve   c0  = Curve.ProjectToPlane(c0_, Plane.WorldXY);
            Point3d cen = AreaMassProperties.Compute(c0).Centroid;

            Curve[] outerCrvArr = c0.Offset(cen, Vector3d.ZAxis, setback, 0.01, CurveOffsetCornerStyle.Sharp);
            Curve[] innerCrvArr = outerCrvArr[0].Offset(cen, Vector3d.ZAxis, bayDepth, 0.01, CurveOffsetCornerStyle.Sharp);

            string debugMsg = "";

            try
            {
                if (innerCrvArr.Length != 1)
                {
                    debugMsg += "\ninner crv error"; return;
                }
                if (outerCrvArr.Length != 1)
                {
                    debugMsg += "\nouter crv error"; return;
                }
                double siteAr              = AreaMassProperties.Compute(siteCrv).Area;
                double GFA                 = siteAr * fsr;
                double outerAr             = AreaMassProperties.Compute(outerCrvArr[0]).Area;
                double innerAr             = AreaMassProperties.Compute(innerCrvArr[0]).Area;
                double netAr               = outerAr - innerAr;
                double numFlrs             = GFA / netAr;
                double reqHt               = numFlrs * flrHt;
                double gotSlendernessRatio = reqHt / netAr;
                if (gotSlendernessRatio < slendernessRatio)
                {
                    return;
                }
                if (setback > 0 && bayDepth > 0 && flrHt > 0)
                {
                    List <string> numFlrReqLi = new List <string>();
                    List <Curve>  crvLi       = new List <Curve>();
                    double        flrCounter  = 0.0;
                    for (int i = 0; i < numFlrs; i++)
                    {
                        Curve c0crv = outerCrvArr[0].DuplicateCurve();
                        Curve c1crv = innerCrvArr[0].DuplicateCurve();
                        Rhino.Geometry.Transform xform = Rhino.Geometry.Transform.Translation(0, 0, flrCounter);
                        c0crv.Transform(xform);
                        c1crv.Transform(xform);
                        crvLi.Add(c0crv);
                        crvLi.Add(c1crv);
                        flrCounter += flrHt;
                    }
                    numFlrReqLi.Add(flrCounter.ToString());

                    List <Brep> brepLi    = new List <Brep>();
                    Extrusion   outerMass = Rhino.Geometry.Extrusion.Create(outerCrvArr[0], reqHt, true);
                    var         B         = outerMass.GetBoundingBox(true);
                    if (B.Max.Z < 0.01)
                    {
                        outerMass = Extrusion.Create(outerCrvArr[0], -reqHt, true);
                    }
                    Brep outerBrep = outerMass.ToBrep();

                    Extrusion innerMass = Rhino.Geometry.Extrusion.Create(innerCrvArr[0], reqHt, true);
                    var       B2        = innerMass.GetBoundingBox(true);
                    if (B2.Max.Z < 0.01)
                    {
                        innerMass = Extrusion.Create(innerCrvArr[0], -reqHt, true);
                    }
                    Brep innerBrep = innerMass.ToBrep();

                    Brep[] netBrep = Brep.CreateBooleanDifference(outerBrep, innerBrep, 0.1);
                    try { brepLi.Add(netBrep[0]); }
                    catch (Exception)
                    {
                        debugMsg += "Error in brep subtraction";
                    }
                    DA.SetDataList(0, crvLi);
                    DA.SetDataList(1, brepLi);
                }
            }
            catch (Exception)
            {
                debugMsg += "Error in system";
            }
            // DA.SetDataList(2, debugMsg);
        }