Beispiel #1
0
        static ToolPath5Axis CreatePath(List <string> file, string filename)
        {
            try
            {
                ToolPath5Axis toolpath = new ToolPath5Axis();
                NCFileType    fileType = selectFileType(filename);
                if (file.Count > 0)
                {
                    switch (fileType)
                    {
                    case NCFileType.NCIFile:
                        NciFileParser ncifile = new NciFileParser();
                        toolpath = ncifile.ParsePath(file);
                        break;

                    case NCFileType.NCFile:

                        NcFileParser ncfile = new NcFileParser();
                        toolpath = ncfile.ParsePath(file);
                        break;
                    }
                }
                return(toolpath);
            }
            catch (Exception)
            {
                throw;
            }
        }
        private IToolpath CreatePath(List <string> file, string filename)
        {
            try
            {
                IToolpath  toolpath = new ToolPath();
                NCFileType fileType = selectFileType(filename);
                if (file.Count > 0)
                {
                    switch (fileType)
                    {
                    case NCFileType.NCIFile:
                        NciFileParser ncifile = new NciFileParser();
                        toolpath = ncifile.ParsePath(file);
                        break;

                    case NCFileType.NCMachiningFile:

                        NcFileParser ncfile = new NcFileParser();
                        toolpath = ncfile.ParsePath(file);
                        break;
                    }
                }
                else
                {
                    throw new Exception("NC file is empty");
                }
                return(toolpath);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public IToolpath CreatePath(string fileName)
        {
            try
            {
                var        file     = new List <string>();
                NCFileType fileType = NCFileType.NCMachiningFile;

                if (fileName != null && fileName != "" && System.IO.File.Exists(fileName))
                {
                    file     = FileIO.ReadTextFile(fileName);
                    fileType = selectFileType(fileName);
                }
                else
                {
                    throw new System.IO.FileNotFoundException("file cannot be found");
                }
                return(CreatePath(file, fileName));
            }
            catch
            {
                throw;
            }
        }
Beispiel #4
0
        static public ToolPath5Axis CreatePath(string fileName)
        {
            try
            {
                var        file     = new List <string>();
                NCFileType fileType = NCFileType.NCFile;

                if (fileName != null && fileName != "" && System.IO.File.Exists(fileName))
                {
                    file     = FileIO.ReadDataTextFile(fileName);
                    fileType = selectFileType(fileName);
                }
                else
                {
                    throw new Exception("File Not readable");
                }
                return(CreatePath(file, fileName));
            }
            catch
            {
                throw;
            }
        }