/// <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)
        {
            Mesh mesh = null;

            if (!DA.GetData(0, ref mesh))
            {
                return;
            }

            int i = 0; // null?

            if (!DA.GetData <int>(1, ref i))
            {
                return;
            }
            if (i >= mesh.Vertices.Count)
            {
                return;
            }

            List <Polyline> polylines = new List <Polyline>();

            foreach (Face f in mesh.Vertices[i].GetVertexFaces())
            {
                polylines.Add(f.ToClosedPolyline());
            }

            DA.SetDataList(0, polylines);
        }
        /// <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)
        {
            Mesh   mesh         = null;
            double max_distance = Rhino.RhinoMath.UnsetValue;

            if (!DA.GetData <Mesh>(0, ref mesh))
            {
                return;
            }
            if (!DA.GetData <double>(1, ref max_distance))
            {
                return;
            }

            int n = mesh.Vertices.Count;

            var molecular = new Molecular(n);
            var points    = mesh.Vertices.Select(v => (Point3d)v.Position);

            foreach (var pt in points)
            {
                molecular.Add(pt.X, pt.Y, pt.Z);
            }

            var       node3List = new Node3List(points);
            Node3Tree node3Tree = node3List.CreateTree(0.0, false, 10);

            if (node3Tree == null)
            {
                return;
            }

            int    max_results  = n - 1;
            double min_distance = 0;

            for (int i = 0; i < n; i++)
            {
                Node3Proximity node3Proximity = new Node3Proximity(node3List[i], i, max_results, min_distance, max_distance);
                node3Tree.SolveProximity(node3Proximity);
                foreach (var j in node3Proximity.IndexList)
                {
                    molecular.Add(i, j);
                }
            }

            DA.SetData(0, molecular);
            DA.SetDataList(1, points);
        }
        /// <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)
        {
            Mesh mesh = null;

            if (!DA.GetData(0, ref mesh))
            {
                return;
            }

            List <Point3d> points = new List <Point3d>();

            foreach (Vertex v in mesh.Vertices)
            {
                points.Add(v.Position);
            }

            DA.SetDataList(0, points);
        }
Esempio 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)
        {
            Mesh mesh = null;

            if (!DA.GetData(0, ref mesh))
            {
                return;
            }

            mesh = mesh.Duplicate();

            List <Point3f> hp = new List <Point3f>();

            foreach (Halfedge h in mesh.Halfedges)
            {
                if (h.Pair.Pair == h)
                {
                    hp.Add(h.Midpoint);
                }
            }

            DA.SetData(0, mesh);
            DA.SetDataList(1, hp);
        }