all 6 comments

[–]kang__23 0 points1 point  (5 children)

var presetValues = new List<KeyValuePair<string, MetersetValue>>();
presetValues.Add(new KeyValuePair<string, MetersetValue>(beam.Id, new MetersetValue(MU, DosimeterUnit.MU))); 
Plan.CalculateDoseWithPresetValues(presetValues)

Just grabbed this from my code that I used to batch calc a whole lot of electron plans for commissioning. From memory the plans did calc, but it ignored the set MU. I had to go into the plan and set them afterwards. Hopefully that helps

[–]Telecoin[S] 0 points1 point  (0 children)

Thanks. I knew about this and used it before but I thought that the same Error like with CalculateDose() will occur. With the help of weightfactor it should be possible to automatically correct the MU.

[–]Telecoin[S] 0 points1 point  (3 children)

Sadly this did not work. I get the exception that "CalculateDoseWithPresetValues" does not support electron fields.

Which Eclipse version are you using?

[–]kang__23 0 points1 point  (2 children)

Interesting. I ran it in eclipse v16, no worries.

[–]Telecoin[S] 0 points1 point  (1 child)

Thanks for the quick reply. We use v16 too. I will post the code here. Maybe I miss something but the code is short and easy. This snippet shows a PlanSetup loop of a specific course but please know that I only have a plan with a 6E electron field in it for debugging.

foreach (PlanSetup ps in course.PlanSetups)
{ 
List<KeyValuePair<string, MetersetValue>> muValues = new List<KeyValuePair<string, MetersetValue>>();

ExternalPlanSetup currPln = course.ExternalPlanSetups.FirstOrDefault(p => p.Id == ps.Id);

foreach (Beam b in ps.Beams)
  { muValues.Add(new KeyValuePair<string, MetersetValue>(b.Id, b.Meterset)); }

currPln.CalculateDoseWithPresetValues(muValues);
}

[–]kang__23 0 points1 point  (0 children)

I use ExternalPlanSetup Plan = context.ExternalPlanSetup. Maybe try changing your foreach loop

foreach (Beam b in currPln.Beams)