Пример #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)
        {
            MeshGhData hE_MeshData = new MeshGhData();

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

            Paramdigma.Core.HalfEdgeMesh.Mesh hE_Mesh = hE_MeshData.Value;


            if (!hE_Mesh.IsTriangularMesh())
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Mesh is not triangular!");
                return;
            }

            List <Vector3d> meshE1 = new List <Vector3d>();
            List <Vector3d> meshE2 = new List <Vector3d>();

            foreach (Paramdigma.Core.HalfEdgeMesh.MeshFace face in hE_Mesh.Faces)
            {
                List <Vector3d> rhinoV = new List <Vector3d>();
                Paramdigma.Core.Geometry.Vector3d[] vects = PG.MeshGeometry.OrthonormalBases(face);
                meshE1.Add(new Vector3d(vects[0].X, vects[0].Y, vects[0].Z));
                meshE2.Add(new Vector3d(vects[1].X, vects[1].Y, vects[1].Z));
            }

            DA.SetDataList(0, meshE1);
            DA.SetDataList(1, meshE2);
        }
Пример #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)
        {
            MeshGhData hE_MeshData = new MeshGhData();

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

            Paramdigma.Core.HalfEdgeMesh.Mesh hE_Mesh = hE_MeshData.Value;

            if (!hE_Mesh.IsTriangularMesh())
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Mesh is not triangular!");
                return;
            }
        }
        /// <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)
        {
            MeshGhData hE_MeshData = new MeshGhData();

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

            Paramdigma.Core.HalfEdgeMesh.Mesh hE_Mesh = hE_MeshData.Value;

            Paramdigma.Core.HalfEdgeMesh.MeshTopology topo = new Paramdigma.Core.HalfEdgeMesh.MeshTopology(hE_Mesh);

            topo.ComputeEdgeAdjacency();

            GH.DataTree <int> evTopo = new GH.DataTree <int>();
            GH.DataTree <int> efTopo = new GH.DataTree <int>();
            GH.DataTree <int> eeTopo = new GH.DataTree <int>();

            foreach (int key in topo.EdgeVertex.Keys)
            {
                evTopo.AddRange(topo.EdgeVertex[key], new GH.Kernel.Data.GH_Path(key));
            }

            foreach (int key in topo.EdgeEdge.Keys)
            {
                eeTopo.AddRange(topo.EdgeEdge[key], new GH.Kernel.Data.GH_Path(key));
            }

            foreach (int key in topo.EdgeFace.Keys)
            {
                efTopo.AddRange(topo.EdgeFace[key], new GH.Kernel.Data.GH_Path(key));
            }

            DA.SetDataTree(0, evTopo);
            DA.SetDataTree(1, eeTopo);
            DA.SetDataTree(2, efTopo);
        }