Task sin840_calculate_turn(System.Threading.CancellationToken cancellationToken)
        {
            StringBuilder strb1              = new StringBuilder(Document.Text);
            string        _fullPath          = FileDirectoryName + FileNameExceptExtension + "_S840D_Turn.cls";
            string        _fileNameAddPrefix = FileNameExceptExtension + "_S840D_Turn";

            StringBuilder paramprog = new StringBuilder();

            return(Task.Run(() => {
                SinumerikLatheControl_CLS lmcontrolCLS = new SinumerikLatheControl_CLS();
                GCodeParser parser = new GCodeParser(null, strb1, "Sinumerik", lmcontrolCLS);

                File.WriteAllText(_fullPath, lmcontrolCLS.SCM_CW.ToString().Replace(';', ','));

                NXSessionManager.Instance.ExportClsfToNX(_fullPath, _fileNameAddPrefix, true);
                //	StringBuffer = mcontrolCLS.SCM_CW ;
            }, cancellationToken
                            ));
        }
        Task sin840_calculate_turn_adv(System.Threading.CancellationToken cancellationToken, TextWriter errorLog)
        {
            StringBuilder gcodeOutput        = new StringBuilder();
            string        _fullPath          = FileDirectoryName + FileNameExceptExtension + "_S840D_Turn.cls";
            string        _fileNameAddPrefix = FileNameExceptExtension + "_S840D_Turn";

            SinumerikCompiler compiler  = new SinumerikCompiler(Document, errorLog, MachineType.Turn);
            StringBuilder     paramprog = new StringBuilder();

            return(Task.Run(() => {
                cancellationToken.ThrowIfCancellationRequested();
                gcodeOutput = compiler.Compile();
                SinumerikLatheControl_CLS lmcontrolCLS = new SinumerikLatheControl_CLS();
                GCodeParser parser = new GCodeParser(null, gcodeOutput, "Sinumerik", lmcontrolCLS);

                File.WriteAllText(_fullPath, lmcontrolCLS.SCM_CW.ToString().Replace(';', ','));

                NXSessionManager.Instance.ExportClsfToNX(_fullPath, _fileNameAddPrefix, true);
                //	StringBuffer = mcontrolCLS.SCM_CW ;
            }, cancellationToken
                            ));
        }