示例#1
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)
        {
            Plane plane    = Plane.WorldXY;
            Curve perimCrv = null;

            coreCrvs     = new List <Curve>();
            rectangles   = new List <Rectangle3d>();
            obstacleCrvs = new List <Curve>();
            DA.GetData(IN_autoColor, ref autoColor);

            DA.GetData(IN_plane, ref plane);
            DA.GetData(IN_perimCrv, ref perimCrv);
            DA.GetDataList(IN_voxelRects, rectangles);
            DA.GetDataList(IN_obstacleCrvs, obstacleCrvs);
            bool coreReceived = DA.GetDataList(IN_coreCrvs, coreCrvs);

            _plan = new SmartPlan(perimCrv, coreCrvs, rectangles, obstacleCrvs, plane);

            Rhino.RhinoDoc   doc    = Rhino.RhinoDoc.ActiveDoc;
            Rhino.UnitSystem system = doc.ModelUnitSystem;
            _plan.projectUnits = system.ToString() == "Meters" ? 0 : 1;

            _plan.ComputeCovid();

            compromisedMetric = _plan.GetCovidMetric();

            DA.SetDataList(OUT_hit, compromisedMetric);
            DA.SetDataTree(OUT_lines, _plan.covidLines);
        }
示例#2
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)
        {
            Curve perimeter = null;
            Plane plane     = Plane.Unset;

            rectangles = new List <Rectangle3d>();

            DA.GetData(IN_plane, ref plane);
            DA.GetData(IN_AutoColor, ref autoColor);
            if (!DA.GetData(IN_perimCurve, ref perimeter))
            {
                return;
            }
            if (!DA.GetDataList(IN_rects, rectangles))
            {
                return;
            }

            try
            {
                _plan = new SmartPlan(perimeter, rectangles, plane);
                _plan.ComputeDistToPerimeter();
                perimeterDist = _plan.getPerimDistances();
                DA.SetDataList(OUT_perimeterMetric, perimeterDist);
            }
            catch (Exception e)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.ToString());
            }
        }
 public static SolveResults ComputeBetweenExit(SmartPlan plan)
 {
     SolveResults result = new SolveResults();
     plan.ComputeExitBetweenAccess();
     result.Value = plan;
     return result;
 }
示例#4
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)
        {
            List <Curve> interiorPartitions;
            Plane        plane = Plane.Unset;

            try
            {
                if (InPreSolve)
                {
                    rectangles         = new List <Rectangle3d>();
                    interiorPartitions = new List <Curve>();

                    DA.GetData(IN_AutoColor, ref autoColor);
                    DA.GetData(IN_plane, ref plane);
                    if (!DA.GetDataList(IN_rects, rectangles))
                    {
                        return;
                    }
                    DA.GetDataList(IN_partitions, interiorPartitions);


                    _plan = new SmartPlan(rectangles, interiorPartitions, plane);


                    Task <SolveResults> task = Task.Run(() => ComputeMSP(_plan), CancelToken);
                    TaskList.Add(task);
                    return;
                }

                if (!GetSolveResults(DA, out SolveResults result))
                {
                    rectangles         = new List <Rectangle3d>();
                    interiorPartitions = new List <Curve>();

                    DA.GetData(IN_AutoColor, ref autoColor);
                    DA.GetData(IN_plane, ref plane);
                    DA.GetDataList(IN_rects, rectangles);
                    DA.GetDataList(IN_partitions, interiorPartitions);

                    _plan  = new SmartPlan(rectangles, interiorPartitions, plane);
                    result = ComputeMSP(_plan);
                    _plan  = result.Value;
                }


                if (result != null)
                {
                    _mspMetric    = _plan.getMSP();
                    _rawMspMetric = _plan.getMSPRaw();
                    DA.SetDataList(OUT_mspMetric, _mspMetric);
                    DA.SetDataList(OUT_mspRawMetric, _rawMspMetric);
                    DA.SetDataTree(OUT_paths, _plan.pathCurves);
                }
            }
            catch (Exception e)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.ToString());
            }
        }
示例#5
0
        public static SolveResults ComputeMSP(SmartPlan plan)
        {
            SolveResults result = new SolveResults();

            plan.ComputeSampleMeanShortestPath();
            result.Value = plan;
            return(result);
        }
示例#6
0
        public static SolveResults ComputeNeighborhoodSize(SmartPlan plan)
        {
            SolveResults result = new SolveResults();

            plan.ComputeNeighSize();
            result.Value = plan;
            return(result);
        }
        public static SolveResults ComputeIsovistClustering(SmartPlan plan)
        {
            SolveResults result = new SolveResults();

            plan.ComputeIsovist();
            result.Value = plan;
            return(result);
        }
示例#8
0
        public static SolveResults ComputeAttractions(SmartPlan plan)
        {
            SolveResults result = new SolveResults();

            plan.ComputeAttractionViz();
            result.Value = plan;
            return(result);
        }
示例#9
0
        public static SolveResults ComputeSolar(SmartPlan plan)
        {
            SolveResults result = new SolveResults();

            plan.ComputeSolarAccess();
            result.Value = plan;
            return(result);
        }
示例#10
0
        public static SolveResults ComputeExit(SmartPlan plan)
        {
            SolveResults result = new SolveResults();

            plan.ComputeBetweenPaths();
            result.Value = plan;
            return(result);
        }
示例#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)
        {
            Curve  perimeter   = null;
            double _resolution = double.NaN;
            Plane  plane       = Plane.Unset;

            DA.GetData(IN_plane, ref plane);
            DA.GetData(IN_perimCurve, ref perimeter);

            List <Curve> coreCrvs = new List <Curve>();

            DA.GetDataList(IN_coreCurves, coreCrvs);
            DA.GetData(IN_resolution, ref _resolution);

            if (_resolution < 1.0)
            {
                _resolution = 0.5;
            }
            else if (_resolution == 2.0) //2.0 providing bugs..
            {
                _resolution = 2.1;
            }

            SmartPlan _plan;

            try
            {
                _plan = new SmartPlan(perimeter, coreCrvs, _resolution, plane);
                var _cells         = _plan.getCells();
                int totalNeighbors = 0;
                foreach (var c in _plan.Cells)
                {
                    var neighCount = _plan.GetNeighbors(c.Value).Count();
                    totalNeighbors += neighCount;
                }

                DA.SetDataList(OUT_cells, _cells);
                DA.SetData(OUT_resolution, _plan._resolution);
            }
            catch (Exception e)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.ToString());
            }
        }
示例#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)
        {
            Curve  perimeter   = null;
            double _resolution = double.NaN;
            Plane  plane       = Plane.Unset;

            DA.GetData(IN_plane, ref plane);
            DA.GetData(IN_perimCurve, ref perimeter);

            List <Curve> coreCrvs = new List <Curve>();

            DA.GetDataList(IN_coreCurves, coreCrvs);
            DA.GetData(IN_resolution, ref _resolution);

            if (_resolution < 1.0)
            {
                _resolution = 0.5;
            }
            else if (_resolution == 2.0) //2.0 providing bugs..
            {
                _resolution = 2.1;
            }

            SmartPlan _plan;

            try
            {
                //  _plan = new SmartPlan(perimeter, coreCrvs, _resolution, plane);
                _plan = new SmartPlan(perimeter, coreCrvs, _resolution, plane);
                var _cells = _plan.getCells();

                Polyline convexHull;
                var      convexity = _plan.GetConvexity(out convexHull);

                DA.SetDataList(OUT_cells, _cells);
                DA.SetData(OUT_convexity, convexity);
                DA.SetData(OUT_poly, convexHull);
            }
            catch (Exception e)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.ToString());
            }
        }
        /// <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)
        {
            Curve        perimeter = null;
            List <Curve> coreCrvs  = new List <Curve>();
            List <Curve> interiorPartitions;
            Plane        plane = Plane.Unset;

            try
            {
                if (InPreSolve)
                {
                    rectangles         = new List <Rectangle3d>();
                    interiorPartitions = new List <Curve>();

                    DA.GetData(IN_AutoColor, ref autoColor);
                    DA.GetData(IN_plane, ref plane);
                    DA.GetData(IN_perimCurve, ref perimeter);
                    bool coreReceived = DA.GetDataList(IN_coreCurves, coreCrvs);
                    DA.GetDataList(IN_rects, rectangles);

                    if (rectangles.Count > 3000)
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Analysis grid contains" +
                                          " too many voxels, please keep the number of voxels coming in below 3,000");
                    }
                    DA.GetDataList(IN_partitions, interiorPartitions);

                    if (coreReceived)
                    {
                        _plan = new SmartPlan(perimeter, coreCrvs, rectangles, interiorPartitions, plane);
                    }
                    else
                    {
                        _plan = new SmartPlan(perimeter, rectangles, interiorPartitions, plane);
                    }
                    Rhino.RhinoApp.WriteLine(_plan.ToString());

                    Task <SolveResults> task = Task.Run(() => ComputeIsovistClustering(_plan), CancelToken);
                    TaskList.Add(task);
                    return;
                }

                if (!GetSolveResults(DA, out SolveResults result))
                {
                    rectangles         = new List <Rectangle3d>();
                    interiorPartitions = new List <Curve>();

                    DA.GetData(IN_AutoColor, ref autoColor);
                    DA.GetData(IN_plane, ref plane);
                    DA.GetData(IN_perimCurve, ref perimeter);
                    bool coreReceived = DA.GetData(IN_coreCurves, ref coreCrvs);
                    DA.GetDataList(IN_rects, rectangles);
                    DA.GetDataList(IN_partitions, interiorPartitions);

                    if (coreReceived)
                    {
                        _plan = new SmartPlan(perimeter, coreCrvs, rectangles, interiorPartitions, plane);
                    }
                    else
                    {
                        _plan = new SmartPlan(perimeter, rectangles, interiorPartitions, plane);
                    }

                    Rhino.RhinoApp.WriteLine(_plan.ToString());

                    result = ComputeIsovistClustering(_plan);
                    _plan  = result.Value;
                }

                if (result != null)
                {
                    _plan.ComputeIsoCluteringCoeff();
                    clusterCoeff    = _plan.getClusterCoeff();
                    clusterCoeffRaw = _plan.getClusterCoeffRaw();
                    DA.SetDataList(OUT_clusteringCoefficientRaw, clusterCoeffRaw);
                    DA.SetDataList(OUT_clusteringCoefficientRemap, clusterCoeff);
                }
            }
            catch (Exception e)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.ToString());
            }
        }
示例#14
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)
        {
            Curve        perimeter = null;
            List <Curve> coreCrvs  = new List <Curve>();
            List <Curve> interiorPartitions;
            List <Curve> attractors;
            List <Curve> obstacles;
            Plane        plane = Plane.Unset;

            try
            {
                if (InPreSolve)
                {
                    rectangles         = new List <Rectangle3d>();
                    interiorPartitions = new List <Curve>();
                    attractors         = new List <Curve>();
                    obstacles          = new List <Curve>();

                    DA.GetData(IN_AutoColor, ref autoColor);
                    DA.GetData(IN_plane, ref plane);
                    DA.GetData(IN_perimCurve, ref perimeter);
                    DA.GetDataList(IN_coreCurves, coreCrvs);
                    DA.GetDataList(IN_rects, rectangles);
                    DA.GetDataList(IN_partitions, interiorPartitions);

                    DA.GetDataList(IN_attCrvs, attractors);
                    DA.GetDataList(IN_obstCrvs, obstacles);

                    _plan = new SmartPlan(perimeter, coreCrvs, rectangles, interiorPartitions, attractors, obstacles, plane);

                    Task <SolveResults> task = Task.Run(() => ComputeAttractions(_plan), CancelToken);
                    TaskList.Add(task);
                    return;
                }

                if (!GetSolveResults(DA, out SolveResults result))
                {
                    rectangles         = new List <Rectangle3d>();
                    interiorPartitions = new List <Curve>();
                    attractors         = new List <Curve>();
                    obstacles          = new List <Curve>();

                    DA.GetData(IN_AutoColor, ref autoColor);
                    DA.GetData(IN_plane, ref plane);
                    DA.GetData(IN_perimCurve, ref perimeter);
                    DA.GetData(IN_coreCurves, ref coreCrvs);
                    DA.GetDataList(IN_rects, rectangles);
                    DA.GetDataList(IN_partitions, interiorPartitions);

                    DA.GetDataList(IN_attCrvs, attractors);
                    DA.GetDataList(IN_obstCrvs, obstacles);

                    _plan  = new SmartPlan(perimeter, coreCrvs, rectangles, interiorPartitions, attractors, obstacles, plane);
                    result = ComputeAttractions(_plan);
                    _plan  = result.Value;
                }

                if (result != null)
                {
                    _attractor = _plan.getAttractionMetric();
                    DA.SetDataList(OUT_attractorMetric, _attractor);
                    DA.SetDataTree(OUT_attractorViewLines, _plan.testLines);
                }
            }
            catch (Exception e)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.ToString());
            }
        }
示例#15
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)
        {
            Curve perimeter = null;

            double         _resolution = double.NaN;
            List <Point3d> exitPts     = new List <Point3d>();
            double         leaseSpan   = double.NaN;
            int            coreMode    = 1;
            Plane          plane       = Plane.Unset;
            List <double>  areas       = new List <double>();
            double         totalArea   = 0.0;

            DA.GetDataList(IN_areas, areas);

            for (int i = 0; i < areas.Count; i++)
            {
                totalArea += areas[i];
            }

            DA.GetData(IN_plane, ref plane);
            bool cMode = DA.GetData(IN_coreMode, ref coreMode);

            DA.GetData(IN_perimCurve, ref perimeter);

            //List<int> myStuff = new List<int>();
            //if (!DA.GetDataList<int>(0, myStuff)) { return; }

            List <Curve> coreCrvs = new List <Curve>();

            DA.GetDataList(IN_coreCurves, coreCrvs);
            DA.GetData(IN_resolution, ref _resolution);

            if (_resolution < 1.0)
            {
                _resolution = 0.5;
            }
            else if (_resolution == 2.0) //2.0 providing bugs..
            {
                _resolution = 2.1;
            }

            bool successLease = DA.GetData(IN_leaseSpan, ref leaseSpan);

            SmartPlan _plan;

            try
            {
                if (cMode == false) //if no mode specified
                {
                    coreMode = 1;
                }

                if (coreMode == 0)
                {
                    _plan = new SmartPlan(perimeter, coreCrvs, _resolution, plane);
                }
                else
                {
                    _plan = new SmartPlan(perimeter, leaseSpan, _resolution, plane);
                }


                var _cells = _plan.getCells();

                var    calcArea = _cells.Count * _plan._resolution * _plan._resolution;
                int    diff     = 0;
                string message  = "None";

                if (calcArea < totalArea)
                {
                    diff    = (int)Math.Round(totalArea - calcArea);
                    message = String.Format("Plan areas don't meet those specified in the .csv by {0}, either reduce required areas or make plan footprint larger", diff);
                    AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, message);
                    DA.SetData(OUT_areaFeedback, message);
                }
                else
                {
                    diff    = (int)Math.Abs(Math.Round(totalArea - calcArea));
                    message = String.Format("Plan areas satisfied and over by {0}", diff);
                    DA.SetData(OUT_areaFeedback, message);
                }


                DA.SetDataList(OUT_cells, _cells);
                DA.SetDataList(OUT_core, _plan._coreCurves);
                DA.SetData(OUT_perimeter, _plan.perimCurve);
                DA.SetData(OUT_resolution, _plan._resolution);
            }
            catch (Exception e)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.ToString());
            }
        }
示例#16
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)
        {
            List <Curve> interiorPartitions;
            Plane        plane = Plane.Unset;

            try
            {
                if (InPreSolve)
                {
                    rectangles         = new List <Rectangle3d>();
                    interiorPartitions = new List <Curve>();

                    DA.GetData(IN_AutoColor, ref autoColor);
                    DA.GetData(IN_plane, ref plane);
                    if (!DA.GetDataList(IN_rects, rectangles))
                    {
                        return;
                    }
                    DA.GetDataList(IN_partitions, interiorPartitions);


                    _plan = new SmartPlan(rectangles, interiorPartitions, plane);

                    if (_plan.getCells().Count > 200)
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Too many nodes used for this computation");
                        return;
                    }
                    else
                    {
                        Task <SolveResults> task = Task.Run(() => ComputeMSP(_plan), CancelToken);
                        TaskList.Add(task);
                        return;
                    }
                }

                if (!GetSolveResults(DA, out SolveResults result))
                {
                    rectangles         = new List <Rectangle3d>();
                    interiorPartitions = new List <Curve>();

                    DA.GetData(IN_AutoColor, ref autoColor);
                    DA.GetData(IN_plane, ref plane);
                    DA.GetDataList(IN_rects, rectangles);
                    DA.GetDataList(IN_partitions, interiorPartitions);

                    _plan = new SmartPlan(rectangles, interiorPartitions, plane);
                    if (_plan.getCells().Count > 150)
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Too many nodes used for this computation. Either increase the resolution of " +
                                          "the plan or use the 'Sampled Mean Shortest Path' component.");
                        return;
                    }
                    else
                    {
                        result = ComputeMSP(_plan);
                        _plan  = result.Value;
                    }
                }


                if (result != null)
                {
                    _mspMetric    = _plan.getMSP();
                    _rawMspMetric = _plan.getMSPRaw();
                    DA.SetDataList(OUT_mspMetric, _mspMetric);
                    DA.SetDataList(OUT_mspRawMetric, _rawMspMetric);
                    DA.SetDataTree(OUT_paths, _plan.pathCurves);
                }
            }
            catch (Exception e)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.ToString());
            }
        }
示例#17
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)
        {
            Curve        perimeter = null;
            List <Curve> coreCrvs  = new List <Curve>();
            List <Curve> interiorPartitions;
            Plane        plane = Plane.Unset;

            try
            {
                if (InPreSolve)
                {
                    rectangles         = new List <Rectangle3d>();
                    interiorPartitions = new List <Curve>();

                    // DA.GetData(IN_reset, ref iReset);
                    DA.GetData(IN_AutoColor, ref autoColor);
                    DA.GetData(IN_plane, ref plane);
                    DA.GetData(IN_perimCurve, ref perimeter);
                    bool coreReceived = DA.GetDataList(IN_coreCurves, coreCrvs);
                    DA.GetDataList(IN_rects, rectangles);
                    DA.GetDataList(IN_partitions, interiorPartitions);

                    if (coreReceived)
                    {
                        _plan = new SmartPlan(perimeter, coreCrvs, rectangles, interiorPartitions, plane);
                    }
                    else
                    {
                        _plan = new SmartPlan(perimeter, rectangles, interiorPartitions, plane);
                    }


                    Task <SolveResults> task = Task.Run(() => ComputeIso(_plan), CancelToken);
                    TaskList.Add(task);
                    return;
                }

                if (!GetSolveResults(DA, out SolveResults result))
                {
                    rectangles         = new List <Rectangle3d>();
                    interiorPartitions = new List <Curve>();

                    DA.GetData(IN_AutoColor, ref autoColor);
                    DA.GetData(IN_plane, ref plane);
                    DA.GetData(IN_perimCurve, ref perimeter);
                    bool coreReceived = DA.GetData(IN_coreCurves, ref coreCrvs);
                    DA.GetDataList(IN_rects, rectangles);
                    DA.GetDataList(IN_partitions, interiorPartitions);

                    if (coreReceived)
                    {
                        _plan = new SmartPlan(perimeter, coreCrvs, rectangles, interiorPartitions, plane);
                    }
                    else
                    {
                        _plan = new SmartPlan(perimeter, rectangles, interiorPartitions, plane);
                    }

                    result = ComputeIso(_plan);
                    _plan  = result.Value;
                }

                if (result != null)
                {
                    iso = _plan.getIsovist();
                    DA.SetDataList(OUT_isovistMetric, iso);
                    DA.SetDataList(OUT_isovistPolys, _plan.isoPolylines);
                }
            }
            catch (Exception e)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.ToString());
            }

            // Params.ParameterChanged -= ObjectEventHandler;
            // Params.ParameterChanged += ObjectEventHandler;
        }
示例#18
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)
        {
            Curve           perimeter        = null;
            List <Brep>     _obstacles       = new List <Brep>();
            List <Brep>     ACTUAL_obstacles = new List <Brep>();
            List <Vector3d> SunVectors       = new List <Vector3d>();
            List <Curve>    partitionCurves  = new List <Curve>();
            Plane           plane            = Plane.Unset;
            double          floorToCeiling   = double.NaN;

            Brep extrBrep = new Brep();

            try
            {
                if (InPreSolve)
                {
                    rectangles       = new List <Rectangle3d>();
                    _obstacles       = new List <Brep>();
                    ACTUAL_obstacles = new List <Brep>();
                    SunVectors       = new List <Vector3d>();
                    partitionCurves  = new List <Curve>();

                    DA.GetData(IN_AutoColor, ref autoColor);
                    DA.GetData(IN_plane, ref plane);
                    DA.GetDataList(IN_vectors, SunVectors);
                    DA.GetData(IN_perimCurve, ref perimeter);
                    DA.GetDataList(IN_partitionC, partitionCurves);
                    DA.GetData(IN_ftoCeil, ref floorToCeiling);
                    bool obstaclesPresent = DA.GetDataList(IN_Obstacles, _obstacles);
                    if (obstaclesPresent)
                    {
                        ACTUAL_obstacles.AddRange(_obstacles);
                    }
                    DA.GetDataList(IN_rects, rectangles);

                    Transform project = Transform.PlanarProjection(plane);
                    for (int i = 0; i < partitionCurves.Count; i++)
                    {
                        partitionCurves[i].Transform(project);
                    }

                    perimeter.Transform(project);

                    Vector3d extrusionVec = new Vector3d(0, 0, 1) * floorToCeiling;
                    for (int i = 0; i < partitionCurves.Count; i++)
                    {
                        var extr = Surface.CreateExtrusion(partitionCurves[i], extrusionVec);
                        var brep = extr.ToBrep();
                        ACTUAL_obstacles.Add(brep);
                    }
                    perimeter.Translate(extrusionVec);

                    extrBrep = Rhino.Geometry.Brep.CreatePlanarBreps(perimeter, 0.0001)[0];
                    ACTUAL_obstacles.Add(extrBrep);


                    _plan = new SmartPlan(rectangles, SunVectors, ACTUAL_obstacles, plane);

                    Task <SolveResults> task = Task.Run(() => ComputeSolar(_plan), CancelToken);
                    TaskList.Add(task);
                    return;
                }
                if (!GetSolveResults(DA, out SolveResults result))
                {
                    rectangles       = new List <Rectangle3d>();
                    ACTUAL_obstacles = new List <Brep>();
                    _obstacles       = new List <Brep>();
                    SunVectors       = new List <Vector3d>();
                    partitionCurves  = new List <Curve>();

                    DA.GetData(IN_AutoColor, ref autoColor);
                    DA.GetData(IN_plane, ref plane);
                    DA.GetDataList(IN_vectors, SunVectors);
                    DA.GetData(IN_perimCurve, ref perimeter);
                    DA.GetDataList(IN_partitionC, partitionCurves);
                    DA.GetData(IN_ftoCeil, ref floorToCeiling);
                    bool obstaclesPresent = DA.GetDataList(IN_Obstacles, _obstacles);
                    if (obstaclesPresent)
                    {
                        ACTUAL_obstacles.AddRange(_obstacles);
                    }
                    DA.GetDataList(IN_rects, rectangles);


                    Transform project = Transform.PlanarProjection(plane);
                    for (int i = 0; i < partitionCurves.Count; i++)
                    {
                        partitionCurves[i].Transform(project);
                    }

                    perimeter.Transform(project);

                    Vector3d extrusionVec = new Vector3d(0, 0, 1) * floorToCeiling;
                    for (int i = 0; i < partitionCurves.Count; i++)
                    {
                        var extr = Surface.CreateExtrusion(partitionCurves[i], extrusionVec);
                        var brep = extr.ToBrep();
                        ACTUAL_obstacles.Add(brep);
                    }
                    perimeter.Translate(extrusionVec);

                    extrBrep = Rhino.Geometry.Brep.CreatePlanarBreps(perimeter, 0.0001)[0];
                    ACTUAL_obstacles.Add(extrBrep);

                    _plan  = new SmartPlan(rectangles, SunVectors, ACTUAL_obstacles, plane);
                    result = ComputeSolar(_plan);
                    _plan  = result.Value;
                }

                if (result != null)
                {
                    sunAccess = _plan.getSolarMetric();
                    DA.SetDataList(OUT_SolarAccessMetric, sunAccess);
                    DA.SetData(OUT_obs, _plan.obstacleMeshJoined);
                }
            }

            catch (Exception e)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.ToString());
            }
        }
        /// <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)
        {
            List<Curve> interiorPartitions = new List<Curve>();
            List<Point3d> exitPts = new List<Point3d>();
            Plane plane = Plane.Unset;

            try
            {
                if (InPreSolve)
                {
                    rectangles = new List<Rectangle3d>();
                    interiorPartitions = new List<Curve>();

                    DA.GetData(IN_AutoColor, ref autoColor);
                    DA.GetData(IN_plane, ref plane);
                    if (!DA.GetDataList(IN_rects, rectangles)) return;
                    DA.GetDataList(IN_partitions, interiorPartitions);
                    if (!DA.GetDataList(IN_exitPts, exitPts)) return;

                    if (interiorPartitions.Count == 0 || interiorPartitions == null)
                        _plan = new SmartPlan(rectangles, exitPts, plane);
                    else
                        _plan = new SmartPlan(rectangles, interiorPartitions, exitPts, plane);

                    if (rectangles.Count * exitPts.Count > 10000)
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Try either increasing the voxel resoultion or reducing the amount of exit points.. Currently" +
                            "the computation is too large.");
                        return;
                    }

                    Task<SolveResults> task = Task.Run(() => ComputeBetweenExit(_plan), CancelToken);
                    TaskList.Add(task);
                    return;
                }

                if (!GetSolveResults(DA, out SolveResults result))
                {
                    rectangles = new List<Rectangle3d>();
                    interiorPartitions = new List<Curve>();

                    DA.GetData(IN_AutoColor, ref autoColor);
                    DA.GetData(IN_plane, ref plane);
                    DA.GetDataList(IN_rects, rectangles);
                    DA.GetDataList(IN_partitions, interiorPartitions);
                    DA.GetDataList(IN_exitPts, exitPts);

                    if (interiorPartitions.Count == 0 || interiorPartitions == null)
                        _plan = new SmartPlan(rectangles, exitPts, plane);
                    else
                        _plan = new SmartPlan(rectangles, interiorPartitions, exitPts, plane);

                    if (rectangles.Count * exitPts.Count > 10000)
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Try either increasing the voxel resoultion or reducing the amount of exit points.. Currently" +
                            "the computation is too large.");
                        return;
                    }

                    result = ComputeBetweenExit(_plan);
                    _plan = result.Value;
                }

                if (result != null)
                {
                    _exitMetric = _plan.getExitMetric();
                    DA.SetDataList(OUT_pathMetric, _exitMetric);
                    DA.SetDataTree(OUT_paths, _plan.pathCurves);
                }
            }
            catch (Exception e)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.ToString());
            }
        }