Ejemplo n.º 1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IntPtr topoData = IntPtr.Zero;
            Mesh   refMesh  = new Mesh();

            if (!DA.GetData(0, ref topoData))
            {
                return;
            }
            if (!DA.GetData(1, ref refMesh))
            {
                return;
            }

            CMesh  crefMesh     = new CMesh();
            String errorMessage = "";

            if (TopoCreator.RhinoMeshToCMesh(refMesh, ref crefMesh, true, out errorMessage))
            {
                TopoCreator.setReferenceSurface(ref crefMesh, topoData);
            }
            else
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, errorMessage);
                return;
            }
            Marshal.FreeHGlobal(crefMesh.points);
            Marshal.FreeHGlobal(crefMesh.faces);
            DA.SetData(0, topoData);
        }
Ejemplo n.º 2
0
        private void addToContactGraph(Mesh mesh, bool atBoundary, IntPtr graphData)
        {
            CMesh  cmesh = new CMesh();
            String errorMessage;

            if (TopoCreator.RhinoMeshToCMesh(mesh, ref cmesh, false, out errorMessage))
            {
                TopoCreator.addMeshesToContactGraph(graphData, ref cmesh, atBoundary);
            }
            else
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, errorMessage);
                return;
            }
            Marshal.FreeHGlobal(cmesh.points);
            Marshal.FreeHGlobal(cmesh.faces);
        }