using Elekta.MonacoScripting.API; using Elekta.MonacoScripting.API.General; using Elekta.MonacoScripting.API.Planning; using Elekta.MonacoScripting.DataType; using Elekta.MonacoScripting.Log; using System; using System.Collections.Generic; using System.Configuration; using System.Windows.Forms; namespace SampleQAPlan { internal class Program { /* This is stating the variables to be used in this script. * These variables need to be added in App.config file before being used here. * * This is an example of how the variables can be used in a script. * You can change/add/delete variables in your own scirpt. * You can also use other approaches to use variables in your script. */ // Aquire settings from App.config. private static string Installation = ConfigurationManager.AppSettings["Installation"]; private static string Clinic = ConfigurationManager.AppSettings["Clinic"]; private static string DicomFolder = ConfigurationManager.AppSettings["DicomFolder"]; [STAThread] static void Main(string[] args) { try { // Optional: invoke DeactivateExitErrorHandler to deactivate terminating this application when any error information is logged. Logger.Instance.DeactivateExitErrorHandler(); // Optional: invoke ActivateScreenShot to activate screenshot capture when any error information is logged. Logger.Instance.DeactivateScreenShot(); // Monaco application instance. MonacoApplication app = MonacoApplication.Instance; // Get active plan var plan = app.GetActivePlan(); // New QAPLan var qaPlanCreator = app.GetNewQAPlanCreator(plan); qaPlanCreator.ResetBeamsToNominalAngles(NewQAPlanCreator.ResetBeamsAngle.Gantry, true); qaPlanCreator.ResetBeamsToNominalAngles(NewQAPlanCreator.ResetBeamsAngle.Collimator, true); qaPlanCreator.ResetBeamsToNominalAngles(NewQAPlanCreator.ResetBeamsAngle.Couch, true); qaPlanCreator.SetCalcVolGridSpacing(0.2); qaPlanCreator.CreateQAPlanOnPhantom("Delta4", "delta3mm", "Volume Isocenter"); // Calculation app.ExecuteCalculationForActiveRX(); // Save app.SavePatient(); // DICOM Export var destinationList = new List() { "EXPORT" }; var dcmExport = app.GetDicomExport(MonacoApplication.DicomExportOffsetOption.Continue); dcmExport.SelectDICOMExportModalities(ExportModality.TotalPlan); dcmExport.SelectDICOMExportModalities(ExportModality.TotalPlanDose); dcmExport.CheckMultiDestinations(destinationList); dcmExport.ClickExport(); // Exit Monac app.ExitMonaco(); } catch (Exception ex) { // Display an error dialog if any exception is catched during script execution MessageBox.Show(ex.Message, "Exception occurred", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } } } }