예제 #1
0
        public IActionResult Process(QuoteRequest quote)
        {
            ConfigSettings config    = new ConfigSettings();
            FffProcessor   processor = new FffProcessor(config);

            MemoryStream result = new MemoryStream();

            processor.SetTargetStream(result);

            var filePath = Path.Combine(_appOptionsAccessor.Value.GetUploadFolderLocation(), $"{quote.FileId}.stl");
            var stream   = new FileStream(filePath, FileMode.Open);

            using (new QuickTimer2("LoadStlFile"))
            {
                processor.LoadStlStream(stream);
            }

            using (new QuickTimer2("DoProcessing"))
            {
                processor.DoProcessing();
            }
            var data        = processor.Finalize();
            var quoteResult = _quoteService.ProcessQuote(data.TotalFilamentUsed, data.TotalPrintTime, quote);

            return(Ok(quoteResult));
        }
예제 #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");


            ConfigSettings config    = new ConfigSettings();
            FffProcessor   processor = new FffProcessor(config);

            MemoryStream result = new MemoryStream();

            processor.SetTargetStream(result);

            var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Replace("file:\\", "");

            path = $"{path}\\SampleSTLs\\AvoidCrossing9Holes.stl";
            var stream = new FileStream(path, FileMode.Open);

            using (new QuickTimer2("LoadStlFile"))
            {
                processor.LoadStlStream(stream);
            }

            using (new QuickTimer2("DoProcessing"))
            {
                processor.DoProcessing();
            }
            var data = processor.Finalize();


            //GenericGCodeParser parser = new GenericGCodeParser();


            //result.Position = 0;
            //TextReader tr = new StreamReader(result);
            //var gcode = parser.Parse(tr);
        }