コード例 #1
0
            public void EndSection()
            {
                writer.WriteLine("  0\nENDSEC\n  0\nEOF");
                writer.Flush();
                writer.Close();



                //if (MainParameter.generating_dxf)
                //{
                //Main.main.Add_logo_time = new System.Diagnostics.Stopwatch();
                //Main.main.Add_logo_time.Start();
                //Main.main.LoadDXF(true, dxfFilePath);
                //}
                //Calculate the DXF File Size in KB
                double size = new System.IO.FileInfo(dxfFilePath).Length;

                MainParameter.TotalDXFFileSize += Math.Round(size / 1024.0, 2);
                //<><><>

                if (encrypt)
                {
                    Encrypt();
                }
            }
コード例 #2
0
        public bool GenerateHeaderFile()
        {
            //string headerFile = Application.CommonAppDataPath + "\\composition\\Header.txt";
            string               headerFile = MainParameter.AppdataPath + MainParameter.AssemblyFileVersion + "\\composition\\Header.txt";
            FileStream           fs         = File.Open(headerFile, FileMode.Create);
            EnglishStreamWriter2 writer     = new EnglishStreamWriter2(fs);

            try
            {
                writer.WriteLine("; total dxf file size (kb): " + Math.Round(MainParameter.TotalDXFFileSize, 2));
                writer.Write("; total Estimated Marking time (secs): " + Math.Round(MainParameter.totalEstimatedTime, 4));
                writer.Flush();
                writer.Close();
                return(true);
            }
            catch (Exception ex)
            {
                SVGTo3WL.logFile.writer.WriteLine("3WL Data, Error encountered: GenerateHeaderFile.");
                SVGTo3WL.logFile.writer.WriteLine("3WL Data exception: {0}", ex.ToString());
                SVGTo3WL.logFile.writer.Flush();
                Console.WriteLine("3WL Data, Error encountered: GenerateHeaderFile");
                Console.WriteLine("3WL Data exception: {0}", ex.ToString());
                gCode.Release();
                return(false);
            }
        }
コード例 #3
0
        public bool GenerateDefineFile()
        {
            //string headerFile = Application.CommonAppDataPath + "\\composition\\Header.txt";
            string headerFile = MainParameter.AppdataPath + MainParameter.AssemblyFileVersion + "\\composition\\Autodesk.txt";

            MainParameter.DefineFile = headerFile;
            FileStream           fs     = File.Open(headerFile, FileMode.Create);
            EnglishStreamWriter2 writer = new EnglishStreamWriter2(fs);

            try
            {
                writer.WriteLine("This file generate by XYZSDK for Autodesk.");
                writer.Flush();
                writer.Close();
                return(true);
            }
            catch (Exception ex)
            {
                SVGTo3WL.logFile.writer.WriteLine("3WL Data, Error encountered: GenerateDefineFile.");
                SVGTo3WL.logFile.writer.WriteLine("3WL Data exception: {0}", ex.ToString());
                SVGTo3WL.logFile.writer.Flush();
                Console.WriteLine("3WL Data, Error encountered: GenerateDefineFile");
                Console.WriteLine("3WL Data exception: {0}", ex.ToString());
                gCode.Release();
                return(false);
            }
        }
コード例 #4
0
        public bool EditGcodeContent()
        {
            string temp_gcodePath = MainParameter.AppdataPath + MainParameter.AssemblyFileVersion + "\\composition\\tempgcode.gcode";
            //string temp_gcodePath = Application.CommonAppDataPath + "\\composition\\tempgcode.gcode";
            string               content = "";
            string               checker = "non-sintered powder";
            FileStream           fs      = File.Open(temp_gcodePath, FileMode.Create);
            EnglishStreamWriter2 writer  = new EnglishStreamWriter2(fs);

            if (!File.Exists(gcodePath))
            {
                return(false);
            }
            try
            {
                using (StreamReader streamReader = new StreamReader(gcodePath /*, Encoding.UTF8*/))
                {
                    //var est_factor = Main.main.threedview.ui.ProfileSettings_UI.EstimatedTime_Factor;
                    //asd
                    double est_time = 0;// Main.main.totalEstimatedTime;
                    //if (!Main.main.IsComputeMarkingTime)
                    //    est_time = 0.00;
                    while (!streamReader.EndOfStream)
                    {
                        content = streamReader.ReadLine();
                        writer.Write(content + "\n");
                        if (content.Contains(checker))
                        {
                            writer.Write("; total dxf file size (kb): " + Convert.ToInt64(MainParameter.TotalDXFFileSize) + "\n");
                            writer.Write("; total Estimated Marking time (ms): " + est_time.ToString("0.00") + "\n");
                            //writer.WriteLine("; total dxf file size (kb): " + Math.Round(Main.main.TotalDXFFileSize, 2) + "\n");
                            //writer.Write("; total Estimated Marking time (ms): " + est_time.ToString("0.00") + "\n");
                        }
                    }
                    writer.Flush();
                    writer.Close();
                }

                File.Delete(gcodePath);
                File.Move(temp_gcodePath, gcodePath);

                return(true);
            }
            catch (Exception ex)
            {
                SVGTo3WL.logFile.writer.WriteLine("3WL Data, Error encountered: EditGcodeContent.");
                SVGTo3WL.logFile.writer.WriteLine("3WL Data exception: {0}", ex.ToString());
                SVGTo3WL.logFile.writer.Flush();
                Console.WriteLine("3WL Data, Error encountered: EditGcodeContent");
                Console.WriteLine("3WL Data exception: {0}", ex.ToString());
                gCode.Release();
                return(false);
            }
        }