Example #1
0
        private void LoadLocal(LoadOptions loadInfo)
        {
            try
            {
                LoadBase load = LoadBase.Create(loadInfo);

                load.LoadOptions = loadInfo;
                load.Load();
                Commands.Clear();
                Commands.AddRange(load.Commands);
                if (!string.IsNullOrEmpty(loadInfo.GCodeWriteToFileName))
                {
                    string gcodeFileName = Environment.ExpandEnvironmentVariables(loadInfo.GCodeWriteToFileName);
                    using (var sw = File.CreateText(gcodeFileName))
                    {
                        load.WriteGCodeFile(sw);
                    }

                    using (var sw = File.CreateText(Path.GetDirectoryName(gcodeFileName) + @"\" + Path.GetFileNameWithoutExtension(gcodeFileName) + @".cb"))
                    {
                        load.WriteCamBamFile(sw);
                    }

                    using (var sw = File.CreateText(Path.GetDirectoryName(gcodeFileName) + @"\" + Path.GetFileNameWithoutExtension(gcodeFileName) + @".hpgl"))
                    {
                        load.WriteImportInfoFile(sw);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }