Ejemplo 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)
        {
            Topologic.Topology topology = null;
            Topologic.Topology tool     = null;
            bool transferDictionary     = false;

            if (!DA.GetData(0, ref topology))
            {
                return;
            }
            if (!DA.GetData(1, ref tool))
            {
                return;
            }
            if (!DA.GetData(2, ref transferDictionary))
            {
                return;
            }

            if (topology == null)
            {
                return;
            }

            Topologic.Topology newTopology = topology.Imprint(tool, transferDictionary);

            DA.SetData(0, newTopology);
        }
Ejemplo 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;

            // 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 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();


            List <Topologic.Wire> wires = topology.Wires;

            // Use the DA object to assign a new String to the first output parameter.
            DA.SetDataList(0, wires);
        }
Ejemplo n.º 3
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;

            // 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 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();

            Dictionary <String, Object> dictionary = topology.Dictionary;

            IGH_Goo dictionaryGoo = new GH_ObjectWrapper(dictionary);

            DA.SetData(0, dictionaryGoo);
        }
Ejemplo n.º 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)
        {
            Topologic.Topology topology      = null;
            Topologic.Topology otherTopology = null;
            bool transferDictionary          = false;

            if (!DA.GetData(0, ref topology))
            {
                return;
            }
            if (!DA.GetData(1, ref otherTopology))
            {
                return;
            }
            if (!DA.GetData(2, ref transferDictionary))
            {
                return;
            }

            if (topology == null)
            {
                return;
            }

            Topologic.Topology newTopology = topology.Intersect(otherTopology, transferDictionary);

            // Use the DA object to assign a new String to the first output parameter.
            DA.SetData(0, newTopology);
        }
Ejemplo n.º 5
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;
            Topologic.Vertex   origin   = null;
            double             xVector  = 0.0;
            double             yVector  = 0.0;
            double             zVector  = 0.0;
            double             degree   = 0.0;

            // 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 origin))
            {
                return;
            }
            if (!DA.GetData(2, ref xVector))
            {
                return;
            }
            if (!DA.GetData(3, ref yVector))
            {
                return;
            }
            if (!DA.GetData(4, ref zVector))
            {
                return;
            }
            if (!DA.GetData(5, ref degree))
            {
                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 (origin == null)
            {
                return;
            }
            //if (endVertex == null) { return; }
            //if (data.Length == 0) { return; }

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


            Topologic.Topology rotatedTopology = Topologic.Utilities.TopologyUtility.Rotate(topology, origin, xVector, yVector, zVector, degree);

            // Use the DA object to assign a new String to the first output parameter.
            DA.SetData(0, rotatedTopology);
        }
Ejemplo n.º 6
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;
            GH_ObjectWrapper   dictionaryGoo = 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 topology))
            {
                return;
            }
            if (!DA.GetData(1, ref dictionaryGoo))
            {
                return;
            }

            Dictionary <String, Object> dictionary = dictionaryGoo.Value as Dictionary <String, Object>;

            if (dictionary != null)
            {
                dictionary = GhToNetConverter.ConvertDictionary(dictionary);
            }
            else
            {
                Dictionary <Object, Object> ooDictionary = dictionaryGoo.Value as Dictionary <Object, Object>;

                dictionary = GhToNetConverter.ConvertDictionary(ooDictionary);
            }


            // 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 (dictionary == null)
            {
                return;
            }
            //if (data.Length == 0) { return; }

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


            Topologic.Topology topologyWithDictionary = topology.SetDictionary(dictionary);

            // Use the DA object to assign a new String to the first output parameter.
            DA.SetData(0, topologyWithDictionary);
        }
Ejemplo n.º 7
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;
            List <Topologic.Vertex>             selectors    = new List <Topologic.Vertex>();
            List <Dictionary <String, Object> > dictionaries = new List <Dictionary <String, Object> >();
            int typeFilter = 255;

            // 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.GetDataList(1, selectors))
            {
                return;
            }
            if (!DA.GetDataList(2, dictionaries))
            {
                return;
            }
            if (!DA.GetData(3, ref typeFilter))
            {
                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 (selectors == null)
            {
                return;
            }
            if (dictionaries == null)
            {
                return;
            }
            //if (data.Length == 0) { return; }

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


            Topologic.Topology topologyWithDictionary = topology.SetDictionaries(selectors, dictionaries, typeFilter);

            // Use the DA object to assign a new String to the first output parameter.
            DA.SetData(0, topologyWithDictionary);
        }
Ejemplo n.º 8
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;
            Topologic.Topology content  = null;
            int typeFilter = 0;

            // 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 content))
            {
                return;
            }
            if (!DA.GetData(2, ref typeFilter))
            {
                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 (content == null)
            {
                return;
            }
            //if (data.Length == 0) { return; }

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


            Topologic.Topology topologyWithContents = topology.AddContent(content, typeFilter);

            // Use the DA object to assign a new String to the first output parameter.
            DA.SetData(0, topologyWithContents);
        }
Ejemplo n.º 9
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.Vertex   vertex        = null;
            Topologic.Topology otherTopology = 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 vertex))
            {
                return;
            }
            if (!DA.GetData(1, ref otherTopology))
            {
                return;
            }

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

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


            double distance = Topologic.Utilities.VertexUtility.Distance(vertex, otherTopology);

            // Use the DA object to assign a new String to the first output parameter.
            DA.SetData(0, distance);
        }
Ejemplo n.º 10
0
 public static List <global::Topologic.Vertex> ToVertices(Topologic.Topology topology)
 {
     return(topology?.Vertices?.ToList());
 }
Ejemplo n.º 11
0
 public static List <global::Topologic.Wire> ToWires(Topologic.Topology topology)
 {
     return(topology?.Wires?.ToList());
 }
Ejemplo n.º 12
0
 public static SAM.Geometry.Spatial.ISAMGeometry3D ToSAMGeometry(Topologic.Topology topology)
 {
     return(SAM.Geometry.Topologic.Convert.ToSAM(topology as dynamic));
 }
Ejemplo n.º 13
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);
        }