예제 #1
0
    static bool IsValidMesh(Mesh?mesh)
    {
        if (mesh is null)
        {
            return(true);
        }

        var p = MeshCheckParameters.Defaults();

        using var textLog = new TextLog();
        var isValid = mesh.Check(textLog, ref p);

        bool isReallyValid =
            // p.DuplicateFaceCount == 0;
            // p.DegenerateFaceCount == 0
            p.ExtremelyShortEdgeCount == 0;

        return(isReallyValid);
    }
예제 #2
0
        /// <summary>
        /// Examines mesh objects and logs a description of what it finds right or wrong.
        /// The various properties the function checks for are described in MeshCheckParameters.
        /// </summary>
        /// <param name="meshObjects">A collection of mesh objects.</param>
        /// <param name="textLog">The text log.</param>
        /// <param name="parameters">The mesh checking parameter and results.</param>
        /// <returns>true if successful, false otherwise.</returns>
        /// <since>7.0</since>
        public static bool CheckMeshes(IEnumerable <MeshObject> meshObjects, Rhino.FileIO.TextLog textLog, ref MeshCheckParameters parameters)
        {
            if (null == textLog)
            {
                throw new ArgumentNullException(nameof(textLog));
            }
            var    rharray         = new Runtime.InternalRhinoObjectArray(meshObjects);
            IntPtr ptr_const_array = rharray.NonConstPointer();
            IntPtr ptr_textlog     = textLog.NonConstPointer();

            return(UnsafeNativeMethods.RHC_RhinoCheckMesh2(ptr_const_array, ptr_textlog, ref parameters));
        }