Task sin840_calculate_mill(System.Threading.CancellationToken cancellationToken) { StringBuilder strb1 = new StringBuilder(Document.Text); string _fullPath = FileDirectoryName + FileNameExceptExtension + "_S840D_Mill.cls"; string _fileNameAddPrefix = FileNameExceptExtension + "_S840D_Mill"; // File.WriteAllText("Program_S840_Text.txt", strb1.ToString()) ; StringBuilder paramprog = new StringBuilder(); return(Task.Run(() => { SinumerikMillControl_CLS mcontrolCLS = new SinumerikMillControl_CLS(); GCodeParser parser = new GCodeParser(null, strb1, "Sinumerik", mcontrolCLS); File.WriteAllText(_fullPath, mcontrolCLS.SCM_CW.ToString().Replace(';', ',')); NXSessionManager.Instance.ExportClsfToNX(_fullPath, _fileNameAddPrefix, false); }, cancellationToken )); }
Task sin840_calculate_mill_adv(System.Threading.CancellationToken cancellationToken, TextWriter errorLog) { string _fullPath = FileDirectoryName + FileNameExceptExtension + "_S840D_Mill_Adv.cls"; string _fileNameAddPrefix = FileNameExceptExtension + "_S840D_Mill_Adv"; SinumerikCompiler compiler = new SinumerikCompiler(Document, errorLog, MachineType.Mill); StringBuilder gcodeOutput = new StringBuilder(); return(Task.Run(() => { cancellationToken.ThrowIfCancellationRequested(); gcodeOutput = compiler.Compile(); SinumerikMillControl_CLS mcontrolCLS = new SinumerikMillControl_CLS(); GCodeParser parser = new GCodeParser(null, gcodeOutput, "Sinumerik", mcontrolCLS); File.WriteAllText(_fullPath, mcontrolCLS.SCM_CW.ToString().Replace(';', ',')); NXSessionManager.Instance.ExportClsfToNX(_fullPath, _fileNameAddPrefix, false); }, cancellationToken )); }