Пример #1
0
        public static global::Topologic.Shell ToTopologic(this Spatial.Shell shell, double tolerance = Core.Tolerance.Distance)
        {
            List <Face3D> face3Ds = shell?.Face3Ds;

            if (face3Ds == null || face3Ds.Count == 0)
            {
                return(null);
            }

            global::Topologic.Shell result = global::Topologic.Shell.ByFaces(face3Ds.ConvertAll(x => x.ToTopologic()), tolerance);

            return(result);
        }
Пример #2
0
        public static Cell ToTopologic_Cell(this Spatial.Shell shell, double tolerance = Core.Tolerance.Distance)
        {
            List <Face3D> face3Ds = shell?.Face3Ds;

            if (face3Ds == null || face3Ds.Count == 0)
            {
                return(null);
            }

            Cell result = null;

            try
            {
                result = Cell.ByFaces(face3Ds.ConvertAll(x => x.ToTopologic()), tolerance);
            }
            catch
            {
                result = null;
            }

            if (result != null)
            {
                return(result);
            }

            global::Topologic.Shell shell_Topologic = shell.ToTopologic(tolerance);
            if (shell_Topologic == null)
            {
                return(result);
            }

            try
            {
                result = Cell.ByShell(shell_Topologic);
            }
            catch
            {
                result = null;
            }

            return(result);
        }
Пример #3
0
        public static List <Spatial.Shell> ToSAM(this IEnumerable <Cell> cells)
        {
            if (cells == null)
            {
                return(null);
            }

            List <Spatial.Shell> result = new List <Spatial.Shell>();

            foreach (Cell cell in cells)
            {
                Spatial.Shell shell = cell.ToSAM();
                if (shell == null)
                {
                    continue;
                }

                result.Add(shell);
            }
            return(result);
        }