diff options
-rw-r--r-- | CHANGELOG.md | 5 | ||||
-rw-r--r-- | UVtools.GUI/Properties/AssemblyInfo.cs | 4 | ||||
-rw-r--r-- | UVtools.Parser/ChituboxFile.cs | 106 | ||||
-rw-r--r-- | UVtools.Parser/PHZFile.cs | 65 | ||||
-rw-r--r-- | UVtools.Parser/PWSFile.cs | 1 | ||||
-rw-r--r-- | UVtools.Parser/SL1File.cs | 6 | ||||
-rw-r--r-- | UVtools.Parser/UVtools.Parser.csproj | 6 |
7 files changed, 153 insertions, 40 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a27ca6..828b363 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 16/06/2020 - v0.5.1.1 + +* (Add) photon, cbddlp, ctb and phz can be converted to Zip +* (Fix) CTB: When AntiAliasing is on it saves a bad file + ## 16/06/2020 - v0.5.1 * (Add) Zip file format compatible with chitubox zip diff --git a/UVtools.GUI/Properties/AssemblyInfo.cs b/UVtools.GUI/Properties/AssemblyInfo.cs index 3b5069b..397dc50 100644 --- a/UVtools.GUI/Properties/AssemblyInfo.cs +++ b/UVtools.GUI/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.5.1.0")] -[assembly: AssemblyFileVersion("0.5.1.0")] +[assembly: AssemblyVersion("0.5.1.1")] +[assembly: AssemblyFileVersion("0.5.1.1")] diff --git a/UVtools.Parser/ChituboxFile.cs b/UVtools.Parser/ChituboxFile.cs index f640d99..6c88700 100644 --- a/UVtools.Parser/ChituboxFile.cs +++ b/UVtools.Parser/ChituboxFile.cs @@ -210,7 +210,7 @@ namespace UVtools.Parser /// <summary> /// Gets the speed at which to lift the build platform away from the vat after normal layers, in millimeters per minute. /// </summary> - [FieldOrder(3)] public float LiftingSpeed { get; set; } = 300; + [FieldOrder(3)] public float LiftSpeed { get; set; } = 300; /// <summary> /// Gets the speed to use when the build platform re-approaches the vat after lift, in millimeters per minute. @@ -253,7 +253,7 @@ namespace UVtools.Parser public override string ToString() { - return $"{nameof(BottomLiftHeight)}: {BottomLiftHeight}, {nameof(BottomLiftSpeed)}: {BottomLiftSpeed}, {nameof(LiftHeight)}: {LiftHeight}, {nameof(LiftingSpeed)}: {LiftingSpeed}, {nameof(RetractSpeed)}: {RetractSpeed}, {nameof(VolumeMl)}: {VolumeMl}, {nameof(WeightG)}: {WeightG}, {nameof(CostDollars)}: {CostDollars}, {nameof(BottomLightOffDelay)}: {BottomLightOffDelay}, {nameof(LightOffDelay)}: {LightOffDelay}, {nameof(BottomLayerCount)}: {BottomLayerCount}, {nameof(Padding1)}: {Padding1}, {nameof(Padding2)}: {Padding2}, {nameof(Padding3)}: {Padding3}, {nameof(Padding4)}: {Padding4}"; + return $"{nameof(BottomLiftHeight)}: {BottomLiftHeight}, {nameof(BottomLiftSpeed)}: {BottomLiftSpeed}, {nameof(LiftHeight)}: {LiftHeight}, {nameof(LiftSpeed)}: {LiftSpeed}, {nameof(RetractSpeed)}: {RetractSpeed}, {nameof(VolumeMl)}: {VolumeMl}, {nameof(WeightG)}: {WeightG}, {nameof(CostDollars)}: {CostDollars}, {nameof(BottomLightOffDelay)}: {BottomLightOffDelay}, {nameof(LightOffDelay)}: {LightOffDelay}, {nameof(BottomLayerCount)}: {BottomLayerCount}, {nameof(Padding1)}: {Padding1}, {nameof(Padding2)}: {Padding2}, {nameof(Padding3)}: {Padding3}, {nameof(Padding4)}: {Padding4}"; } } #endregion @@ -294,7 +294,7 @@ namespace UVtools.Parser /// <summary> /// Gets the user-selected antialiasing level. For cbddlp files this will match the level_set_count. For ctb files, this number is essentially arbitrary. /// </summary> - [FieldOrder(11)] public uint AntialiasLevel { get; set; } = 1; + [FieldOrder(11)] public uint AntiAliasLevel { get; set; } = 1; /// <summary> /// Gets a version of software that generated this file, encoded with major, minor, and patch release in bytes starting from the MSB down. @@ -319,7 +319,7 @@ namespace UVtools.Parser public override string ToString() { - return $"{nameof(Padding1)}: {Padding1}, {nameof(Padding2)}: {Padding2}, {nameof(Padding3)}: {Padding3}, {nameof(Padding4)}: {Padding4}, {nameof(Padding5)}: {Padding5}, {nameof(Padding6)}: {Padding6}, {nameof(Padding7)}: {Padding7}, {nameof(MachineNameAddress)}: {MachineNameAddress}, {nameof(MachineNameSize)}: {MachineNameSize}, {nameof(EncryptionMode)}: {EncryptionMode}, {nameof(MysteriousId)}: {MysteriousId}, {nameof(AntialiasLevel)}: {AntialiasLevel}, {nameof(SoftwareVersion)}: {SoftwareVersion}, {nameof(Unknown1)}: {Unknown1}, {nameof(Padding8)}: {Padding8}, {nameof(Padding9)}: {Padding9}, {nameof(Padding10)}: {Padding10}, {nameof(Padding11)}: {Padding11}, {nameof(Padding12)}: {Padding12}, {nameof(MachineName)}: {MachineName}"; + return $"{nameof(Padding1)}: {Padding1}, {nameof(Padding2)}: {Padding2}, {nameof(Padding3)}: {Padding3}, {nameof(Padding4)}: {Padding4}, {nameof(Padding5)}: {Padding5}, {nameof(Padding6)}: {Padding6}, {nameof(Padding7)}: {Padding7}, {nameof(MachineNameAddress)}: {MachineNameAddress}, {nameof(MachineNameSize)}: {MachineNameSize}, {nameof(EncryptionMode)}: {EncryptionMode}, {nameof(MysteriousId)}: {MysteriousId}, {nameof(AntiAliasLevel)}: {AntiAliasLevel}, {nameof(SoftwareVersion)}: {SoftwareVersion}, {nameof(Unknown1)}: {Unknown1}, {nameof(Padding8)}: {Padding8}, {nameof(Padding9)}: {Padding9}, {nameof(Padding10)}: {Padding10}, {nameof(Padding11)}: {Padding11}, {nameof(Padding12)}: {Padding12}, {nameof(MachineName)}: {MachineName}"; } } @@ -789,7 +789,7 @@ namespace UVtools.Parser if (Parent.HeaderSettings.EncryptionKey > 0) { KeyRing kr = new KeyRing(Parent.HeaderSettings.EncryptionKey, layerIndex); - EncodedRle = kr.Read(rawData).ToArray(); + EncodedRle = kr.Read(rawData.ToArray()); } else { @@ -814,8 +814,8 @@ namespace UVtools.Parser public class KeyRing { - public ulong Init { get; } - public ulong Key { get; private set; } + public uint Init { get; } + public uint Key { get; private set; } public uint Index { get; private set; } public KeyRing(uint seed, uint layerIndex) @@ -885,6 +885,7 @@ namespace UVtools.Parser public override Type[] ConvertToFormats { get; } = { + typeof(ChituboxZipFile), typeof(PWSFile), typeof(PHZFile), typeof(ZCodexFile), @@ -915,7 +916,7 @@ namespace UVtools.Parser public override uint ResolutionX => HeaderSettings.ResolutionX; public override uint ResolutionY => HeaderSettings.ResolutionY; - public override byte AntiAliasing => (byte) HeaderSettings.AntiAliasLevel; + public override byte AntiAliasing => (byte) (IsCbtFile ? SlicerInfoSettings.AntiAliasLevel : HeaderSettings.AntiAliasLevel); public override float LayerHeight => HeaderSettings.LayerHeightMilimeter; @@ -925,7 +926,7 @@ namespace UVtools.Parser public override float LayerExposureTime => HeaderSettings.LayerExposureSeconds; public override float LiftHeight => PrintParametersSettings.LiftHeight; - public override float LiftSpeed => PrintParametersSettings.LiftingSpeed; + public override float LiftSpeed => PrintParametersSettings.LiftSpeed; public override float RetractSpeed => PrintParametersSettings.RetractSpeed; public override float PrintTime => HeaderSettings.PrintTime; @@ -939,8 +940,6 @@ namespace UVtools.Parser public override object[] Configs => new[] { (object)HeaderSettings, PrintParametersSettings, SlicerInfoSettings }; - public byte AntiAliasingSize => (byte) (IsCbddlpFile ? HeaderSettings.AntiAliasLevel : 1); - public bool IsCbddlpFile => HeaderSettings.Magic == MAGIC_CBDDLP; public bool IsCbtFile => HeaderSettings.Magic == MAGIC_CBT; #endregion @@ -976,20 +975,23 @@ namespace UVtools.Parser if (IsCbtFile) { + SlicerInfoSettings.AntiAliasLevel = HeaderSettings.AntiAliasLevel; + HeaderSettings.AntiAliasLevel = 1; PrintParametersSettings.Padding4 = 0x1234; //SlicerInfoSettings.EncryptionMode = 0xf; SlicerInfoSettings.EncryptionMode = 7; + SlicerInfoSettings.MysteriousId = 0x12345678; SlicerInfoSettings.Unknown1 = 0x200; if (HeaderSettings.EncryptionKey == 0) { Random rnd = new Random(); - HeaderSettings.EncryptionKey = (uint)rnd.Next(short.MaxValue, int.MaxValue); + HeaderSettings.EncryptionKey = (uint)rnd.Next(byte.MaxValue, int.MaxValue); } } uint currentOffset = (uint)Helpers.Serializer.SizeOf(HeaderSettings); - LayersDefinitions = new LayerData[AntiAliasingSize, HeaderSettings.LayerCount]; + LayersDefinitions = new LayerData[HeaderSettings.AntiAliasLevel, HeaderSettings.LayerCount]; using (var outputFile = new FileStream(fileFullPath, FileMode.Create, FileAccess.Write)) { @@ -1044,16 +1046,16 @@ namespace UVtools.Parser } HeaderSettings.LayersDefinitionOffsetAddress = currentOffset; - uint layerDataCurrentOffset = currentOffset + (uint)Helpers.Serializer.SizeOf(new LayerData()) * HeaderSettings.LayerCount * AntiAliasingSize; + uint layerDataCurrentOffset = currentOffset + (uint)Helpers.Serializer.SizeOf(new LayerData()) * HeaderSettings.LayerCount * HeaderSettings.AntiAliasLevel; - for (byte aaIndex = 0; aaIndex < AntiAliasingSize; aaIndex++) + for (byte aaIndex = 0; aaIndex < HeaderSettings.AntiAliasLevel; aaIndex++) { - Parallel.For(0, LayerCount, layerIndex => + Parallel.For(0, LayerCount, /*new ParallelOptions{MaxDegreeOfParallelism = 1},*/ layerIndex => { LayerData layerData = new LayerData(this, (uint) layerIndex); - LayersDefinitions[aaIndex, layerIndex] = layerData; var image = this[layerIndex].Image; layerData.Encode(image, aaIndex, (uint) layerIndex); + LayersDefinitions[aaIndex, layerIndex] = layerData; }); for (uint layerIndex = 0; layerIndex < LayerCount; layerIndex++) @@ -1061,7 +1063,7 @@ namespace UVtools.Parser var layerData = LayersDefinitions[aaIndex, layerIndex]; LayerData layerDataHash = null; - if (HeaderSettings.EncryptionKey == 0) + if (!IsCbtFile && HeaderSettings.EncryptionKey == 0) { string hash = Helpers.ComputeSHA1Hash(layerData.EncodedRle); if (LayersHash.TryGetValue(hash, out layerDataHash)) @@ -1176,12 +1178,12 @@ namespace UVtools.Parser Debug.WriteLine($"{nameof(MachineName)}: {MachineName}");*/ //} - LayersDefinitions = new LayerData[AntiAliasingSize, HeaderSettings.LayerCount]; + LayersDefinitions = new LayerData[HeaderSettings.AntiAliasLevel, HeaderSettings.LayerCount]; uint layerOffset = HeaderSettings.LayersDefinitionOffsetAddress; - for (byte aaIndex = 0; aaIndex < AntiAliasingSize; aaIndex++) + for (byte aaIndex = 0; aaIndex < HeaderSettings.AntiAliasLevel; aaIndex++) { Debug.WriteLine($"-Image GROUP {aaIndex}-"); for (uint layerIndex = 0; layerIndex < HeaderSettings.LayerCount; layerIndex++) @@ -1234,7 +1236,7 @@ namespace UVtools.Parser { void UpdateLayers() { - for (byte aaIndex = 0; aaIndex < AntiAliasingSize; aaIndex++) + for (byte aaIndex = 0; aaIndex < HeaderSettings.AntiAliasLevel; aaIndex++) { for (uint layerIndex = 0; layerIndex < HeaderSettings.LayerCount; layerIndex++) { @@ -1296,7 +1298,7 @@ namespace UVtools.Parser } if (ReferenceEquals(modifier, PrintParameterModifier.LiftSpeed)) { - PrintParametersSettings.LiftingSpeed = value.Convert<float>(); + PrintParametersSettings.LiftSpeed = value.Convert<float>(); return true; } if (ReferenceEquals(modifier, PrintParameterModifier.RetractSpeed)) @@ -1352,7 +1354,7 @@ namespace UVtools.Parser } uint layerOffset = HeaderSettings.LayersDefinitionOffsetAddress; - for (byte aaIndex = 0; aaIndex < AntiAliasingSize; aaIndex++) + for (byte aaIndex = 0; aaIndex < HeaderSettings.AntiAliasLevel; aaIndex++) { for (uint layerIndex = 0; layerIndex < HeaderSettings.LayerCount; layerIndex++) { @@ -1368,6 +1370,58 @@ namespace UVtools.Parser public override bool Convert(Type to, string fileFullPath) { + if (to == typeof(ChituboxZipFile)) + { + ChituboxZipFile file = new ChituboxZipFile + { + LayerManager = LayerManager, + HeaderSettings = + { + Filename = Path.GetFileName(FileFullPath), + + ResolutionX = ResolutionX, + ResolutionY = ResolutionY, + MachineX = HeaderSettings.BedSizeX, + MachineY = HeaderSettings.BedSizeY, + MachineZ = HeaderSettings.BedSizeZ, + MachineType = MachineName, + ProjectType = HeaderSettings.ProjectorType == 0 ? "Normal" : "LCD_mirror", + + Resin = MaterialName, + Price = MaterialCost, + Weight = PrintParametersSettings.WeightG, + Volume = UsedMaterial, + Mirror = (byte) (HeaderSettings.ProjectorType == 0 ? 0 : 1), + + + BottomLayerLiftHeight = PrintParametersSettings.BottomLiftHeight, + LayerLiftHeight = PrintParametersSettings.LiftHeight, + BottomLayerLiftSpeed = PrintParametersSettings.BottomLiftSpeed, + LayerLiftSpeed = PrintParametersSettings.LiftSpeed, + RetractSpeed = PrintParametersSettings.RetractSpeed, + BottomLayCount = InitialLayerCount, + BottomLayerCount = InitialLayerCount, + BottomLightOffTime = PrintParametersSettings.BottomLightOffDelay, + LayerLightOffTime = PrintParametersSettings.LightOffDelay, + BottomLayExposureTime = InitialExposureTime, + BottomLayerExposureTime = InitialExposureTime, + LayerExposureTime = LayerExposureTime, + LayerHeight = LayerHeight, + LayerCount = LayerCount, + AntiAliasing = ValidateAntiAliasingLevel(), + BottomLightPWM = (byte) HeaderSettings.BottomLightPWM, + LayerLightPWM = (byte) HeaderSettings.LightPWM, + + EstimatedPrintTime = PrintTime + }, + }; + + file.SetThumbnails(Thumbnails); + file.Encode(fileFullPath); + + return true; + } + if (to == typeof(PWSFile)) { PWSFile file = new PWSFile @@ -1428,7 +1482,7 @@ namespace UVtools.Parser BottomLightOffDelay = PrintParametersSettings.BottomLightOffDelay, CostDollars = MaterialCost, LiftHeight = PrintParametersSettings.LiftHeight, - LiftingSpeed = PrintParametersSettings.LiftingSpeed, + LiftSpeed = PrintParametersSettings.LiftSpeed, RetractSpeed = PrintParametersSettings.RetractSpeed, VolumeMl = UsedMaterial, AntiAliasLevelInfo = ValidateAntiAliasingLevel(), @@ -1475,7 +1529,7 @@ namespace UVtools.Parser BottomLayerExposureTime = (uint)(InitialExposureTime * 1000), MaterialId = 2, LayerThickness = $"{LayerHeight} mm", - AntiAliasing = (byte)(AntiAliasing > 1 ? 1 : 0), + AntiAliasing = (byte)(ValidateAntiAliasingLevel() > 1 ? 1 : 0), CrossSupportEnabled = 1, ExposureOffTime = (uint) HeaderSettings.LayerOffTime, HollowEnabled = 0, @@ -1495,7 +1549,7 @@ namespace UVtools.Parser XCorrection = 0, YCorrection = 0, ZLiftDistance = PrintParametersSettings.LiftHeight, - ZLiftFeedRate = PrintParametersSettings.LiftingSpeed, + ZLiftFeedRate = PrintParametersSettings.LiftSpeed, ZLiftRetractRate = PrintParametersSettings.RetractSpeed, }, ZCodeMetadataSettings = new ZCodexFile.ZCodeMetadata diff --git a/UVtools.Parser/PHZFile.cs b/UVtools.Parser/PHZFile.cs index d3a7f5b..cdab3f2 100644 --- a/UVtools.Parser/PHZFile.cs +++ b/UVtools.Parser/PHZFile.cs @@ -192,7 +192,7 @@ namespace UVtools.Parser /// <summary> /// Gets the speed at which to lift the build platform away from the vat after normal layers, in millimeters per minute. /// </summary> - [FieldOrder(31)] public float LiftingSpeed { get; set; } = 300; + [FieldOrder(31)] public float LiftSpeed { get; set; } = 300; /// <summary> /// Gets the speed to use when the build platform re-approaches the vat after lift, in millimeters per minute. @@ -267,7 +267,7 @@ namespace UVtools.Parser public override string ToString() { - return $"{nameof(Magic)}: {Magic}, {nameof(Version)}: {Version}, {nameof(LayerHeightMilimeter)}: {LayerHeightMilimeter}, {nameof(LayerExposureSeconds)}: {LayerExposureSeconds}, {nameof(BottomExposureSeconds)}: {BottomExposureSeconds}, {nameof(BottomLayersCount)}: {BottomLayersCount}, {nameof(ResolutionX)}: {ResolutionX}, {nameof(ResolutionY)}: {ResolutionY}, {nameof(PreviewLargeOffsetAddress)}: {PreviewLargeOffsetAddress}, {nameof(LayersDefinitionOffsetAddress)}: {LayersDefinitionOffsetAddress}, {nameof(LayerCount)}: {LayerCount}, {nameof(PreviewSmallOffsetAddress)}: {PreviewSmallOffsetAddress}, {nameof(PrintTime)}: {PrintTime}, {nameof(ProjectorType)}: {ProjectorType}, {nameof(AntiAliasLevel)}: {AntiAliasLevel}, {nameof(LightPWM)}: {LightPWM}, {nameof(BottomLightPWM)}: {BottomLightPWM}, {nameof(Padding1)}: {Padding1}, {nameof(Padding2)}: {Padding2}, {nameof(OverallHeightMilimeter)}: {OverallHeightMilimeter}, {nameof(BedSizeX)}: {BedSizeX}, {nameof(BedSizeY)}: {BedSizeY}, {nameof(BedSizeZ)}: {BedSizeZ}, {nameof(EncryptionKey)}: {EncryptionKey}, {nameof(BottomLightOffDelay)}: {BottomLightOffDelay}, {nameof(LayerOffTime)}: {LayerOffTime}, {nameof(BottomLayerCount)}: {BottomLayerCount}, {nameof(Padding3)}: {Padding3}, {nameof(BottomLiftHeight)}: {BottomLiftHeight}, {nameof(BottomLiftSpeed)}: {BottomLiftSpeed}, {nameof(LiftHeight)}: {LiftHeight}, {nameof(LiftingSpeed)}: {LiftingSpeed}, {nameof(RetractSpeed)}: {RetractSpeed}, {nameof(VolumeMl)}: {VolumeMl}, {nameof(WeightG)}: {WeightG}, {nameof(CostDollars)}: {CostDollars}, {nameof(Padding4)}: {Padding4}, {nameof(MachineNameAddress)}: {MachineNameAddress}, {nameof(MachineNameSize)}: {MachineNameSize}, {nameof(MachineName)}: {MachineName}, {nameof(Padding5)}: {Padding5}, {nameof(Padding6)}: {Padding6}, {nameof(Padding7)}: {Padding7}, {nameof(Padding8)}: {Padding8}, {nameof(Padding9)}: {Padding9}, {nameof(Padding10)}: {Padding10}, {nameof(EncryptionMode)}: {EncryptionMode}, {nameof(MysteriousId)}: {MysteriousId}, {nameof(AntiAliasLevelInfo)}: {AntiAliasLevelInfo}, {nameof(SoftwareVersion)}: {SoftwareVersion}, {nameof(Padding11)}: {Padding11}, {nameof(Padding12)}: {Padding12}, {nameof(Padding13)}: {Padding13}, {nameof(Padding14)}: {Padding14}, {nameof(Padding15)}: {Padding15}, {nameof(Padding16)}: {Padding16}"; + return $"{nameof(Magic)}: {Magic}, {nameof(Version)}: {Version}, {nameof(LayerHeightMilimeter)}: {LayerHeightMilimeter}, {nameof(LayerExposureSeconds)}: {LayerExposureSeconds}, {nameof(BottomExposureSeconds)}: {BottomExposureSeconds}, {nameof(BottomLayersCount)}: {BottomLayersCount}, {nameof(ResolutionX)}: {ResolutionX}, {nameof(ResolutionY)}: {ResolutionY}, {nameof(PreviewLargeOffsetAddress)}: {PreviewLargeOffsetAddress}, {nameof(LayersDefinitionOffsetAddress)}: {LayersDefinitionOffsetAddress}, {nameof(LayerCount)}: {LayerCount}, {nameof(PreviewSmallOffsetAddress)}: {PreviewSmallOffsetAddress}, {nameof(PrintTime)}: {PrintTime}, {nameof(ProjectorType)}: {ProjectorType}, {nameof(AntiAliasLevel)}: {AntiAliasLevel}, {nameof(LightPWM)}: {LightPWM}, {nameof(BottomLightPWM)}: {BottomLightPWM}, {nameof(Padding1)}: {Padding1}, {nameof(Padding2)}: {Padding2}, {nameof(OverallHeightMilimeter)}: {OverallHeightMilimeter}, {nameof(BedSizeX)}: {BedSizeX}, {nameof(BedSizeY)}: {BedSizeY}, {nameof(BedSizeZ)}: {BedSizeZ}, {nameof(EncryptionKey)}: {EncryptionKey}, {nameof(BottomLightOffDelay)}: {BottomLightOffDelay}, {nameof(LayerOffTime)}: {LayerOffTime}, {nameof(BottomLayerCount)}: {BottomLayerCount}, {nameof(Padding3)}: {Padding3}, {nameof(BottomLiftHeight)}: {BottomLiftHeight}, {nameof(BottomLiftSpeed)}: {BottomLiftSpeed}, {nameof(LiftHeight)}: {LiftHeight}, {nameof(LiftSpeed)}: {LiftSpeed}, {nameof(RetractSpeed)}: {RetractSpeed}, {nameof(VolumeMl)}: {VolumeMl}, {nameof(WeightG)}: {WeightG}, {nameof(CostDollars)}: {CostDollars}, {nameof(Padding4)}: {Padding4}, {nameof(MachineNameAddress)}: {MachineNameAddress}, {nameof(MachineNameSize)}: {MachineNameSize}, {nameof(MachineName)}: {MachineName}, {nameof(Padding5)}: {Padding5}, {nameof(Padding6)}: {Padding6}, {nameof(Padding7)}: {Padding7}, {nameof(Padding8)}: {Padding8}, {nameof(Padding9)}: {Padding9}, {nameof(Padding10)}: {Padding10}, {nameof(EncryptionMode)}: {EncryptionMode}, {nameof(MysteriousId)}: {MysteriousId}, {nameof(AntiAliasLevelInfo)}: {AntiAliasLevelInfo}, {nameof(SoftwareVersion)}: {SoftwareVersion}, {nameof(Padding11)}: {Padding11}, {nameof(Padding12)}: {Padding12}, {nameof(Padding13)}: {Padding13}, {nameof(Padding14)}: {Padding14}, {nameof(Padding15)}: {Padding15}, {nameof(Padding16)}: {Padding16}"; } } #endregion @@ -670,6 +670,7 @@ namespace UVtools.Parser public override Type[] ConvertToFormats { get; } = { typeof(ChituboxFile), + typeof(ChituboxZipFile), typeof(PWSFile), typeof(ZCodexFile), }; @@ -709,7 +710,7 @@ namespace UVtools.Parser public override float LayerExposureTime => HeaderSettings.LayerExposureSeconds; public override float LiftHeight => HeaderSettings.LiftHeight; - public override float LiftSpeed => HeaderSettings.LiftingSpeed; + public override float LiftSpeed => HeaderSettings.LiftSpeed; public override float RetractSpeed => HeaderSettings.RetractSpeed; public override float PrintTime => HeaderSettings.PrintTime; @@ -1023,7 +1024,7 @@ namespace UVtools.Parser } if (ReferenceEquals(modifier, PrintParameterModifier.LiftSpeed)) { - HeaderSettings.LiftingSpeed = value.Convert<float>(); + HeaderSettings.LiftSpeed = value.Convert<float>(); return true; } if (ReferenceEquals(modifier, PrintParameterModifier.RetractSpeed)) @@ -1127,7 +1128,7 @@ namespace UVtools.Parser BottomLightOffDelay = HeaderSettings.BottomLightOffDelay, CostDollars = MaterialCost, LiftHeight = HeaderSettings.LiftHeight, - LiftingSpeed = HeaderSettings.LiftingSpeed, + LiftSpeed = HeaderSettings.LiftSpeed, LightOffDelay = HeaderSettings.LayerOffTime, RetractSpeed = HeaderSettings.RetractSpeed, VolumeMl = UsedMaterial, @@ -1146,6 +1147,58 @@ namespace UVtools.Parser return true; } + if (to == typeof(ChituboxZipFile)) + { + ChituboxZipFile file = new ChituboxZipFile + { + LayerManager = LayerManager, + HeaderSettings = + { + Filename = Path.GetFileName(FileFullPath), + + ResolutionX = ResolutionX, + ResolutionY = ResolutionY, + MachineX = HeaderSettings.BedSizeX, + MachineY = HeaderSettings.BedSizeY, + MachineZ = HeaderSettings.BedSizeZ, + MachineType = MachineName, + ProjectType = HeaderSettings.ProjectorType == 0 ? "Normal" : "LCD_mirror", + + Resin = MaterialName, + Price = MaterialCost, + Weight = HeaderSettings.WeightG, + Volume = UsedMaterial, + Mirror = (byte) (HeaderSettings.ProjectorType == 0 ? 0 : 1), + + + BottomLayerLiftHeight = HeaderSettings.BottomLiftHeight, + LayerLiftHeight = HeaderSettings.LiftHeight, + BottomLayerLiftSpeed = HeaderSettings.BottomLiftSpeed, + LayerLiftSpeed = HeaderSettings.LiftSpeed, + RetractSpeed = HeaderSettings.RetractSpeed, + BottomLayCount = InitialLayerCount, + BottomLayerCount = InitialLayerCount, + BottomLightOffTime = HeaderSettings.BottomLightOffDelay, + LayerLightOffTime = HeaderSettings.LayerOffTime, + BottomLayExposureTime = InitialExposureTime, + BottomLayerExposureTime = InitialExposureTime, + LayerExposureTime = LayerExposureTime, + LayerHeight = LayerHeight, + LayerCount = LayerCount, + AntiAliasing = ValidateAntiAliasingLevel(), + BottomLightPWM = (byte) HeaderSettings.BottomLightPWM, + LayerLightPWM = (byte) HeaderSettings.LightPWM, + + EstimatedPrintTime = PrintTime + }, + }; + + file.SetThumbnails(Thumbnails); + file.Encode(fileFullPath); + + return true; + } + if (to == typeof(PWSFile)) { PWSFile file = new PWSFile @@ -1225,7 +1278,7 @@ namespace UVtools.Parser XCorrection = 0, YCorrection = 0, ZLiftDistance = HeaderSettings.LiftHeight, - ZLiftFeedRate = HeaderSettings.LiftingSpeed, + ZLiftFeedRate = HeaderSettings.LiftSpeed, ZLiftRetractRate = HeaderSettings.RetractSpeed, }, ZCodeMetadataSettings = new ZCodexFile.ZCodeMetadata diff --git a/UVtools.Parser/PWSFile.cs b/UVtools.Parser/PWSFile.cs index 3d42e62..7cbe7da 100644 --- a/UVtools.Parser/PWSFile.cs +++ b/UVtools.Parser/PWSFile.cs @@ -745,6 +745,7 @@ namespace UVtools.Parser public override Type[] ConvertToFormats { get; } = { + //typeof(ChituboxZipFile) //typeof(PHZFile), //typeof(ZCodexFile), }; diff --git a/UVtools.Parser/SL1File.cs b/UVtools.Parser/SL1File.cs index c6f1aba..a647308 100644 --- a/UVtools.Parser/SL1File.cs +++ b/UVtools.Parser/SL1File.cs @@ -620,8 +620,8 @@ namespace UVtools.Parser CostDollars = MaterialCost, LiftHeight = LookupCustomValue<float>(Keyword_LiftHeight, defaultFormat.PrintParametersSettings.LiftHeight), - LiftingSpeed = LookupCustomValue<float>(Keyword_LiftSpeed, - defaultFormat.PrintParametersSettings.LiftingSpeed), + LiftSpeed = LookupCustomValue<float>(Keyword_LiftSpeed, + defaultFormat.PrintParametersSettings.LiftSpeed), LightOffDelay = LookupCustomValue<float>(Keyword_LightOffDelay, defaultFormat.PrintParametersSettings.LightOffDelay), RetractSpeed = LookupCustomValue<float>(Keyword_RetractSpeed, @@ -775,7 +775,7 @@ namespace UVtools.Parser BottomLightOffDelay = LookupCustomValue<float>(Keyword_BottomLightOffDelay, defaultFormat.HeaderSettings.BottomLightOffDelay), CostDollars = MaterialCost, LiftHeight = LookupCustomValue<float>(Keyword_LiftHeight, defaultFormat.HeaderSettings.LiftHeight), - LiftingSpeed = LookupCustomValue<float>(Keyword_LiftSpeed, defaultFormat.HeaderSettings.LiftingSpeed), + LiftSpeed = LookupCustomValue<float>(Keyword_LiftSpeed, defaultFormat.HeaderSettings.LiftSpeed), RetractSpeed = LookupCustomValue<float>(Keyword_RetractSpeed, defaultFormat.HeaderSettings.RetractSpeed), VolumeMl = OutputConfigSettings.UsedMaterial, WeightG = (float)Math.Round(OutputConfigSettings.UsedMaterial * MaterialSettings.MaterialDensity, 2), diff --git a/UVtools.Parser/UVtools.Parser.csproj b/UVtools.Parser/UVtools.Parser.csproj index 84af844..7b52af3 100644 --- a/UVtools.Parser/UVtools.Parser.csproj +++ b/UVtools.Parser/UVtools.Parser.csproj @@ -7,9 +7,9 @@ <PackageProjectUrl>https://github.com/sn4k3/UVtools</PackageProjectUrl> <PackageIcon></PackageIcon> <RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl> - <AssemblyVersion>0.5.1.0</AssemblyVersion> - <FileVersion>0.5.1.0</FileVersion> - <Version>0.5.1</Version> + <AssemblyVersion>0.5.1.1</AssemblyVersion> + <FileVersion>0.5.1.1</FileVersion> + <Version>0.5.1.1</Version> <Description>MSLA/DLP, file analysis, repair, conversion and manipulation</Description> <PackageId>UVtoolsParser</PackageId> <PackageLicenseFile>LICENSE</PackageLicenseFile> |