Exemplo n.º 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)
        {
            // Declare a variable for the input String
            Topologic.Graph  graph       = null;
            Topologic.Vertex startVertex = null;
            Topologic.Vertex endVertex   = null;
            String           vertexKey   = null;
            String           edgeKey     = null;

            // Use the DA object to retrieve the data inside the first input parameter.
            // If the retieval fails (for example if there is no data) we need to abort.
            if (!DA.GetData(0, ref graph))
            {
                return;
            }
            if (!DA.GetData(1, ref startVertex))
            {
                return;
            }
            if (!DA.GetData(2, ref endVertex))
            {
                return;
            }
            if (!DA.GetData(3, ref vertexKey))
            {
                return;
            }
            if (!DA.GetData(4, ref edgeKey))
            {
                return;
            }

            // If the retrieved data is Nothing, we need to abort.
            // We're also going to abort on a zero-length String.
            if (graph == null)
            {
                return;
            }
            if (startVertex == null)
            {
                return;
            }
            if (endVertex == null)
            {
                return;
            }
            if (vertexKey == null)
            {
                return;
            }
            if (edgeKey == null)
            {
                return;
            }
            //if (data.Length == 0) { return; }

            // Convert the String to a character array.
            //char[] chars = data.ToCharArray();


            Topologic.Wire shortestPath = graph.ShortestPath(startVertex, endVertex, vertexKey, edgeKey);

            // Use the DA object to assign a new String to the first output parameter.
            DA.SetData(0, shortestPath);
        }
Exemplo n.º 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)
        {
            // Declare a variable for the input String
            Topologic.Topology topology = null;
            bool   direct = false;
            bool   viaSharedTopologies   = false;
            bool   viaSharedApertures    = false;
            bool   toExteriorTopologies  = false;
            bool   toExteriorApertures   = false;
            bool   useFaceInternalVertex = false;
            double tolerance             = 0.0001;

            // Use the DA object to retrieve the data inside the first input parameter.
            // If the retieval fails (for example if there is no data) we need to abort.
            if (!DA.GetData(0, ref topology))
            {
                return;
            }
            if (!DA.GetData(1, ref direct))
            {
                return;
            }
            if (!DA.GetData(2, ref viaSharedTopologies))
            {
                return;
            }
            if (!DA.GetData(3, ref viaSharedApertures))
            {
                return;
            }
            if (!DA.GetData(4, ref toExteriorTopologies))
            {
                return;
            }
            if (!DA.GetData(5, ref toExteriorApertures))
            {
                return;
            }
            if (!DA.GetData(6, ref useFaceInternalVertex))
            {
                return;
            }
            if (!DA.GetData(7, ref tolerance))
            {
                return;
            }

            // If the retrieved data is Nothing, we need to abort.
            // We're also going to abort on a zero-length String.
            if (topology == null)
            {
                return;
            }
            //if (data.Length == 0) { return; }

            // Convert the String to a character array.
            //char[] chars = data.ToCharArray();


            Topologic.Graph graph = Topologic.Graph.ByTopology(topology, direct, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, useFaceInternalVertex, tolerance);

            // Use the DA object to assign a new String to the first output parameter.
            DA.SetData(0, graph);
        }