diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-12-05 06:04:18 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-12-05 06:04:18 +0200 |
| commit | 065e754c221e69b7c12b72c92a0d6168623449d4 (patch) | |
| tree | 9d7f1338a8267c4311bdc6a67ee2a466b6ce9d9c /Software | |
| parent | 6145633410ecac8d9847dfb4272a5ee11325c65f (diff) | |
| download | Tango-065e754c221e69b7c12b72c92a0d6168623449d4.tar.gz Tango-065e754c221e69b7c12b72c92a0d6168623449d4.zip | |
Fixed issues with missing c/m/y/k.
Diffstat (limited to 'Software')
| -rw-r--r-- | Software/DB/PPC/Tango.mdf | bin | 75497472 -> 75497472 bytes | |||
| -rw-r--r-- | Software/DB/PPC/Tango_log.ldf | bin | 53673984 -> 53673984 bytes | |||
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs | 2 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs | 4 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml | 5 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs | 3 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.BL/Entities/Cat.cs | 2 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.ColorConversion/ColorBlending/ColorBlender.cs | 2 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.ColorConversion/ColorConversionSettings.cs | 1 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs | 98 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.ColorConversion/ExtensionMethods/ConversionOutputExtensions.cs | 12 |
11 files changed, 106 insertions, 23 deletions
diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf Binary files differindex 560a590db..45b682378 100644 --- a/Software/DB/PPC/Tango.mdf +++ b/Software/DB/PPC/Tango.mdf diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf Binary files differindex 713117d57..d0e7974f3 100644 --- a/Software/DB/PPC/Tango_log.ldf +++ b/Software/DB/PPC/Tango_log.ldf 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 7f8c7d6b5..0ad143685 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 @@ -579,7 +579,7 @@ namespace Tango.PPC.Jobs.Models if (liquidVolume.Volume > 0 && liquidVolume.Volume < min) { LiquidVolumeBelowMinLimit = true; - LiquidVolumeBelowMinLimitmessage = $"{liquidVolume.IdsPack.LiquidType.Name} Cyan should be > {min.ToString("N3")}"; + LiquidVolumeBelowMinLimitmessage = $"{liquidVolume.IdsPack.LiquidType.Name} should be > {min.ToString("N3")}"; return LiquidVolumeBelowMinLimit; } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index ed855d7b0..7f145c1e3 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -313,6 +313,8 @@ namespace Tango.PPC.MachineSettings.ViewModels get { return SelectedIdleTime.Minutes != Common.PowerSavingModes.Never; } } + public ColorConversionSettings ColorConversionSettings { get; set; } + #endregion #region Commands @@ -348,6 +350,8 @@ namespace Tango.PPC.MachineSettings.ViewModels new PowerDownTime() { Minutes = Common.PowerSavingModes.Maximum }, new PowerDownTime() { Minutes = Common.PowerSavingModes.Never }, }; + + ColorConversionSettings = SettingsManager.Default.GetOrCreate<ColorConversionSettings>(); } private void Discard() diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index 5a08c5cd1..537d354fd 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -513,6 +513,11 @@ <touch:TouchNumericTextBox Minimum="0" Maximum="10" KeyboardContainer="{Binding ElementName=Container}" Value="{Binding Settings.FineTuningMinLimitdL}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90" HasDecimalPoint="True" ></touch:TouchNumericTextBox> </DockPanel> + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Force Process Parameters Index</TextBlock> + <touch:TouchTextBox KeyboardContainer="{Binding ElementName=Container}" Text="{Binding ColorConversionSettings.ForceProcessParametersTableIndex}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"></touch:TouchTextBox> + </DockPanel> + <DockPanel Margin="0 20 0 10"> <touch:TouchIcon VerticalAlignment="Top" Icon="InformationOutline" Foreground="{StaticResource TangoGrayTextBrush}"></touch:TouchIcon> <TextBlock Margin="10 0 0 0" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs index afb536c58..ff66130bb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -183,7 +183,6 @@ namespace Tango.PPC.UI.ViewModels OnUpdateCurrentBrush(); - RaisePropertyChangedAuto(); } } } @@ -918,6 +917,8 @@ namespace Tango.PPC.UI.ViewModels { CurrentBrushStop.SetLiquidVolumes(MachineProvider.Machine.Configuration, Job.Rml, MachineProvider.MachineOperator.CurrentProcessParameters); + RaisePropertyChanged(nameof(CurrentBrushStop)); + foreach (var output in LiquidOutputs) { output.Volume = GetVolumeLiquidType(output.LiquidType.Type); diff --git a/Software/Visual_Studio/Tango.BL/Entities/Cat.cs b/Software/Visual_Studio/Tango.BL/Entities/Cat.cs index a3517e0fe..691ff47bb 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Cat.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Cat.cs @@ -38,7 +38,7 @@ namespace Tango.BL.Entities CalibrationData data = new CalibrationData(); data.LiquidType = liquidType; - for (int i = 0; i < 101; i++) + for (int i = 0; i < 201; i+=10) { data.CalibrationPoints.Add(new CalibrationPoint() { diff --git a/Software/Visual_Studio/Tango.ColorConversion/ColorBlending/ColorBlender.cs b/Software/Visual_Studio/Tango.ColorConversion/ColorBlending/ColorBlender.cs index 91813b91f..a90316e11 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/ColorBlending/ColorBlender.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/ColorBlending/ColorBlender.cs @@ -11,7 +11,7 @@ namespace Tango.ColorConversion.ColorBlending { public static Color BlendColors(Color baseColor, List<BlendableColor> colorsToBlend) { - colorsToBlend.Where(x => x.CalibrationData == null || x.CalibrationData.CalibrationPoints.Count < 2).ToList().ForEach(x => x.Volume.Clamp(0, 100)); + colorsToBlend.Where(x => x.CalibrationData == null || x.CalibrationData.CalibrationPoints.Count < 2).ToList().ForEach(x => x.Volume = x.Volume.Clamp(0, 100)); // Convert base color to [0, 1] range double baseR = baseColor.R / 255.0; diff --git a/Software/Visual_Studio/Tango.ColorConversion/ColorConversionSettings.cs b/Software/Visual_Studio/Tango.ColorConversion/ColorConversionSettings.cs index 4fd29ebe9..e277f6e48 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/ColorConversionSettings.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/ColorConversionSettings.cs @@ -10,6 +10,7 @@ namespace Tango.ColorConversion public class ColorConversionSettings : SettingsBase { public bool UseLightInks { get; set; } + public int? ForceProcessParametersTableIndex { get; set; } public ColorConversionSettings() { diff --git a/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs b/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs index 053cf785f..7fc5d2deb 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs @@ -92,7 +92,7 @@ namespace Tango.ColorConversion { input.InputCoordinates.InputLiquids.Add(new InputLiquid() { - CalibrationData = new CalibrationData(), + CalibrationData = Cat.CreateDemoCalibrationData(ink), LiquidType = ink, MaxNanoliterPerCentimeter = 2.4, Volume = 0 @@ -186,6 +186,12 @@ namespace Tango.ColorConversion } } } + + var settings = SettingsManager.Default.GetOrCreate<ColorConversionSettings>(); + if (settings.ForceProcessParametersTableIndex != null && settings.ForceProcessParametersTableIndex > -1) + { + output.SingleCoordinates.ProcessParametersTableIndex = settings.ForceProcessParametersTableIndex.Value; + } } private void PerformLightInkShifting(PMR.ColorLab.LiquidType darkInk, PMR.ColorLab.LiquidType lightInk, ConversionInput input, ConversionOutput output) @@ -272,6 +278,58 @@ namespace Tango.ColorConversion return sumNlp; } + private void TransformOutOfGamutInput(OutOfGamutInput input) + { + //Make sure all liquid types exists in the conversion input before converting so the color engine won't fail. + List<PMR.ColorLab.LiquidType> checkInks = new List<PMR.ColorLab.LiquidType>() + { + PMR.ColorLab.LiquidType.Cyan, + PMR.ColorLab.LiquidType.Magenta, + PMR.ColorLab.LiquidType.Yellow, + PMR.ColorLab.LiquidType.Black, + }; + + foreach (var ink in checkInks) + { + if (!input.InputCoordinates.InputLiquids.Any(x => x.LiquidType == ink)) + { + input.InputCoordinates.InputLiquids.Add(new InputLiquid() + { + CalibrationData = Cat.CreateDemoCalibrationData(ink), + LiquidType = ink, + MaxNanoliterPerCentimeter = 2.4, + Volume = 0 + }); + } + } + } + + private void TransformRecommendedProcessTableInput(RecommendedProcessTableInput input) + { + //Make sure all liquid types exists in the conversion input before converting so the color engine won't fail. + List<PMR.ColorLab.LiquidType> checkInks = new List<PMR.ColorLab.LiquidType>() + { + PMR.ColorLab.LiquidType.Cyan, + PMR.ColorLab.LiquidType.Magenta, + PMR.ColorLab.LiquidType.Yellow, + PMR.ColorLab.LiquidType.Black, + }; + + foreach (var ink in checkInks) + { + if (!input.InputLiquids.Any(x => x.LiquidType == ink)) + { + input.InputLiquids.Add(new InputLiquid() + { + CalibrationData = Cat.CreateDemoCalibrationData(ink), + LiquidType = ink, + MaxNanoliterPerCentimeter = 2.4, + Volume = 0 + }); + } + } + } + #endregion public ConversionOutput Convert(BrushStop stop, Configuration configuration, Rml rml, bool generateHive, bool lightInksInstalled, bool useLightInks = false, ConversionType conversionType = ConversionType.Default) @@ -493,6 +551,8 @@ namespace Tango.ColorConversion throw new FileNotFoundException($"Could not find color conversion library '{fileName}'."); } + TransformOutOfGamutInput(input); + IntPtr pDll = NativeMethods.LoadLibrary(fileName); IntPtr pAddressOfFunctionToCall = NativeMethods.GetProcAddress(pDll, "CheckOutOfGamut"); NativeMethodDelegate convert = (NativeMethodDelegate)Marshal.GetDelegateForFunctionPointer( @@ -640,6 +700,12 @@ namespace Tango.ColorConversion public RecommendedProcessTableOutput GetRecommendedProcessParameters(RecommendedProcessTableInput input, int version) { + var settings = SettingsManager.Default.GetOrCreate<ColorConversionSettings>(); + if (settings.ForceProcessParametersTableIndex != null && settings.ForceProcessParametersTableIndex > -1) + { + return new RecommendedProcessTableOutput() { ProcessParametersTableIndex = settings.ForceProcessParametersTableIndex.Value }; + } + if (version < 4) version = 4; String fileName = $"{AssemblyHelper.GetCurrentAssemblyFolder()}\\Tango.ColorLib_v{version}.dll"; @@ -649,6 +715,8 @@ namespace Tango.ColorConversion throw new FileNotFoundException($"Could not find color conversion library '{fileName}'."); } + TransformRecommendedProcessTableInput(input); + IntPtr pDll = NativeMethods.LoadLibrary(fileName); IntPtr pAddressOfFunctionToCall = NativeMethods.GetProcAddress(pDll, "GetRecommendedProcessParameters"); NativeMethodDelegate convert = (NativeMethodDelegate)Marshal.GetDelegateForFunctionPointer( @@ -701,16 +769,18 @@ namespace Tango.ColorConversion throw new ArgumentNullException("Specified machine configuration is a null reference."); } - if (rml.ColorConversionVersion < 4) - { - return GetRecommendedProcessParametersByGamutRegion(job, group); - } - return GetRecommendedProcessParameters(rml, job.Machine, stops, group, useLightInks); } public ProcessParametersTable GetRecommendedProcessParameters(Rml rml, Machine machine, List<BrushStop> stops, ProcessParametersTablesGroup group, bool useLightInks = false) { + if (stops.Count == 0) return group.ProcessParametersTables.FirstOrDefault(); + + if (rml.ColorConversionVersion < 4 || machine.Configuration.IdsPacks.Any(x => x.LiquidType.IsExtraInk)) + { + return GetRecommendedProcessParametersByGamutRegion(stops, group, useLightInks); + } + var configuration = machine.Configuration; RecommendedProcessTableInput input = new RecommendedProcessTableInput(); @@ -806,6 +876,8 @@ namespace Tango.ColorConversion LiquidType = (PMR.ColorLab.LiquidType)ids_pack.LiquidType.Code, MaxNanoliterPerCentimeter = ids_pack.LiquidType.LiquidTypesRmls.Single(x => x.Rml == rml).MaxNlPerCm, CalibrationData = calibrationData, + Color = ids_pack.LiquidType.Color, + IsExtraInk = ids_pack.LiquidType.IsExtraInk, }); } @@ -823,7 +895,7 @@ namespace Tango.ColorConversion return processTable; } - private ProcessParametersTable GetRecommendedProcessParametersByProcessParameters(Job job, ProcessParametersTablesGroup group) + private ProcessParametersTable GetRecommendedProcessParametersByProcessParameters(Job job, ProcessParametersTablesGroup group, bool useLightInks = false) { if (group.ProcessParametersTables.Count == 0) { @@ -846,7 +918,7 @@ namespace Tango.ColorConversion if (stop.BrushColorSpace != ColorSpaces.Catalog && stop.BrushColorSpace != ColorSpaces.Volume) { - Convert(stop, false).ApplyOnBrushStopVolumesOnly(stop); + Convert(stop, false, useLightInks).ApplyOnBrushStopVolumesOnly(stop); } } @@ -862,9 +934,13 @@ namespace Tango.ColorConversion //Is MaxInkUptake a percentage ? because if not, i have to know what process parameters table to use to calculate the NlCm. } - private ProcessParametersTable GetRecommendedProcessParametersByGamutRegion(Job job, ProcessParametersTablesGroup group) + private ProcessParametersTable GetRecommendedProcessParametersByGamutRegion(List<BrushStop> stops, ProcessParametersTablesGroup group, bool useLightInks = false) { - var stops = job.OrderedSegmentsWithGroups.SelectMany(x => x.BrushStops).ToList(); + var settings = SettingsManager.Default.GetOrCreate<ColorConversionSettings>(); + if (settings.ForceProcessParametersTableIndex != null && settings.ForceProcessParametersTableIndex > -1) + { + return group.ProcessParametersTables[settings.ForceProcessParametersTableIndex.Value]; + } var standard_stops = stops.Where(x => x.BrushColorSpace != ColorSpaces.Catalog); var color_catalog_stops = stops.Where(x => x.BrushColorSpace == ColorSpaces.Catalog); @@ -874,7 +950,7 @@ namespace Tango.ColorConversion if (standard_stops.Count() > 0) { - max_standard = standard_stops.Select(x => Convert(x, false)).Select(x => x.SingleCoordinates).Max(x => x.ProcessParametersTableIndex); + max_standard = standard_stops.Select(x => Convert(x, false, useLightInks)).Select(x => x.SingleCoordinates).Max(x => x.ProcessParametersTableIndex); } if (color_catalog_stops.Where(x => x.ColorCatalogsItem != null).Count() > 0) diff --git a/Software/Visual_Studio/Tango.ColorConversion/ExtensionMethods/ConversionOutputExtensions.cs b/Software/Visual_Studio/Tango.ColorConversion/ExtensionMethods/ConversionOutputExtensions.cs index 259afcfda..fe330f5dd 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/ExtensionMethods/ConversionOutputExtensions.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/ExtensionMethods/ConversionOutputExtensions.cs @@ -90,12 +90,10 @@ public static class ConversionOutputExtensions { var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == outputLiquid.LiquidType.ToInt32()); - if (liquidVolume == null) + if (liquidVolume != null) { - throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + outputLiquid.LiquidType + "'."); + liquidVolume.Volume = outputLiquid.Volume; } - - liquidVolume.Volume = outputLiquid.Volume; } } @@ -114,12 +112,10 @@ public static class ConversionOutputExtensions { var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == outputLiquid.LiquidType.ToInt32()); - if (liquidVolume == null) + if (liquidVolume != null) { - throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + outputLiquid.LiquidType + "'."); + liquidVolume.Volume = outputLiquid.Volume; } - - liquidVolume.Volume = outputLiquid.Volume; } } } |
