Exemplo n.º 1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="dataAccess">
        /// The DA object is used to retrieve from inputs and store in outputs.
        /// </param>
        protected override void SolveInstance(IGH_DataAccess dataAccess)
        {
            SAMObject sAMObject = null;

            if (!dataAccess.GetData(0, ref sAMObject))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data");
                return;
            }

            if (sAMObject is Panel)
            {
                dataAccess.SetDataList(0, new List <global::Topologic.Face> {
                    Analytical.Topologic.Convert.ToTopologic((Panel)sAMObject)
                });
                return;
            }
            else if (sAMObject is AdjacencyCluster)
            {
                dataAccess.SetDataList(0, null);

                AdjacencyCluster adjacencyCluster    = sAMObject as AdjacencyCluster;
                List <Geometry.Spatial.Shell> shells = adjacencyCluster.GetShells();
                if (shells != null)
                {
                    dataAccess.SetDataList(0, shells.ConvertAll(x => Geometry.Topologic.Convert.ToTopologic_Cell(x)));
                }

                return;
            }
            else if (sAMObject is AnalyticalModel)
            {
                dataAccess.SetDataList(0, null);

                AdjacencyCluster adjacencyCluster    = (sAMObject as AnalyticalModel).AdjacencyCluster;
                List <Geometry.Spatial.Shell> shells = adjacencyCluster.GetShells();
                if (shells != null)
                {
                    dataAccess.SetDataList(0, shells.ConvertAll(x => Geometry.Topologic.Convert.ToTopologic_Cell(x)));
                }

                return;
            }

            AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data");
        }