From e428f272250a212ade71f6ba2d22ea8fa55da095 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Sun, 25 Dec 2022 16:54:47 +0200 Subject: PPC. CMYK - disable OK when entering a value below approximate 0.5 ( calculated). Related Work Items: #7546 --- .../Dialogs/ColorSelectionView.xaml | 35 +++++++-- .../Dialogs/ColorSelectionViewVM.cs | 2 +- .../Tango.PPC.JobsV2/Models/BrushStopModel.cs | 87 +++++++++++++++++++++- .../TouchColorPickerCMYKControl.xaml | 4 +- .../TouchColorPickerHSBControl.xaml | 4 +- .../TouchColorPickerLABControl.xaml | 4 +- .../TouchColorPickerRGBControl.xaml | 4 +- 7 files changed, 123 insertions(+), 17 deletions(-) (limited to 'Software/Visual_Studio') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml index 745455ca3..be3e0adc0 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml @@ -149,9 +149,20 @@ - - + + + + @@ -162,7 +173,10 @@ - + + + + @@ -427,8 +441,17 @@ - + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs index 5365cb198..94511fb51 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs @@ -738,7 +738,7 @@ namespace Tango.PPC.Jobs.Dialogs protected override bool CanOK() { - return SelectedBrushStop != null && !SelectedBrushStop.IsLiquidVolumesOutOfRange; + return SelectedBrushStop != null && !SelectedBrushStop.IsLiquidVolumesOutOfRange && !SelectedBrushStop.IsLiquidVolumeBelowMinLimit; } #endregion diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs index dd2a20b21..dc4db9b8a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs @@ -659,6 +659,59 @@ namespace Tango.PPC.Jobs.Models } } } + + [JsonIgnore] + public bool IsLiquidVolumeBelowMinLimit + { + get + { + if ( ColorSpace == ColorSpaces.Volume || ColorSpace == ColorSpaces.CMYK) + { + var minCyan = GetMinLimitLiquid(LiquidTypes.Cyan); + if(Cyan > 0 && Cyan < minCyan) + { + LiquidVolumeBelowMinLimit = true; + return LiquidVolumeBelowMinLimit; + } + var minMagenta = GetMinLimitLiquid(LiquidTypes.Magenta); + if (Magenta > 0 && Magenta < minMagenta) + { + LiquidVolumeBelowMinLimit = true; + return LiquidVolumeBelowMinLimit; + } + var minYellow = GetMinLimitLiquid(LiquidTypes.Yellow); + if (Yellow > 0 && Yellow < minYellow) + { + LiquidVolumeBelowMinLimit = true; + return LiquidVolumeBelowMinLimit; + } + var minBlack = GetMinLimitLiquid(LiquidTypes.Black); + if (Black > 0 && Black < minBlack) + { + LiquidVolumeBelowMinLimit = true; + return LiquidVolumeBelowMinLimit; + } + LiquidVolumeBelowMinLimit = false; + return false; + } + else return false; + } + } + + private bool _liquidVolumeBelowMinLimit; + [JsonIgnore] + public bool LiquidVolumeBelowMinLimit + { + get { return _liquidVolumeBelowMinLimit; } + set + { + if (_liquidVolumeBelowMinLimit != value) + { + _liquidVolumeBelowMinLimit = value; + LiquidVolumesOutOfRangeChanged?.Invoke(this, new EventArgs()); + } + } + } [JsonIgnore] public ColorSpaces LastChangedColorSpace { get; set; } @@ -1034,6 +1087,7 @@ namespace Tango.PPC.Jobs.Models ColorSpace = ColorSpaces.Volume; RequiredMaxLiquidTest = true; RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); LastChangedColorSpace = ColorSpace; OnBrushStopFieldValueChanged(); @@ -1245,6 +1299,7 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChanged(nameof(Blue)); RequiredMaxLiquidTest = false; RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); } } @@ -1326,6 +1381,7 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChanged(nameof(B)); RequiredMaxLiquidTest = false; RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); } } @@ -1349,10 +1405,12 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChanged(nameof(Magenta)); RaisePropertyChanged(nameof(Black)); IsOutOfGamut = false; - RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + // RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + // RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); } ColorSpace = ColorSpaces.Volume; RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); return; } ColorSpaces colorSpace = LastChangedColorSpace; @@ -1390,6 +1448,7 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChanged(nameof(Magenta)); RaisePropertyChanged(nameof(Black)); RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); } catch (Exception ex) { @@ -1404,6 +1463,7 @@ namespace Tango.PPC.Jobs.Models } ColorSpace = ColorSpaces.Volume; RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); } } @@ -1549,6 +1609,29 @@ namespace Tango.PPC.Jobs.Models } } + private double GetMinLimitLiquid( LiquidTypes type) + { + try + { + var tables = SegmentModel.Job.Rml.GetActiveProcessGroup().ProcessParametersTables.OrderBy(x => x.TableIndex).ToList(); + + LiquidTypesRml liquidType = SegmentModel.Job.Rml.LiquidTypesRmls.FirstOrDefault(x => x.LiquidType.Type == type); + + if (tables.Count > 0 && liquidType != null && liquidType.MaxNlPerCm != 0) + { + return (0.5*tables[0].MinInkUptake)/ liquidType.MaxNlPerCm; + } + else + { + return 0; + } + } + catch + { + return 0; + } + } + public double GetColorNLPerCm(double color, LiquidTypes type) { StandardColorDispensingCalc calc = new StandardColorDispensingCalc(); @@ -1572,7 +1655,7 @@ namespace Tango.PPC.Jobs.Models if (ColorSpace == BL.Enumerations.ColorSpaces.Volume) { //RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); - if (IsLiquidVolumesOutOfRange) + if (IsLiquidVolumesOutOfRange || IsLiquidVolumeBelowMinLimit) { IsBusy = false; return; diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.xaml b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.xaml index 5821680de..57fe300bc 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.xaml +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.xaml @@ -9,9 +9,9 @@