diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-12-24 02:53:24 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-12-24 02:53:24 +0300 |
commit | a8deeae0f526833326ae3c7a322e0d05a7884365 (patch) | |
tree | 0edfaf19d5f18679db95f5f894ef127e62e377dc | |
parent | 275f41a492d8c3f524225816cfc02bbf61890ace (diff) |
v2.27.2v2.27.2
- **(Core) Layer:**
- (Add) Property: IsFirstLayer - Gets if is the first layer
- (Add) Property: IsIntermediateLayer - Gets if layer is between first and last layer, aka, not first nor last layer
- (Add) Property: IsLastLayer - Gets if is the last layer
- (Rename) Property: RelativeLayerHeight to RelativePositionZ
- **VDT:**
- (Add) Keyword 'FILEFORMAT_xxx' to allow set the file format to auto convertion on machine notes
- (Add) Keyword 'FILEVERSION_n' to allow set the file format version/revision on machine notes
-rw-r--r-- | CHANGELOG.md | 11 | ||||
-rw-r--r-- | UVtools.Core/FileFormats/PhotonWorkshopFile.cs | 2 | ||||
-rw-r--r-- | UVtools.Core/FileFormats/SL1File.cs | 3 | ||||
-rw-r--r-- | UVtools.Core/FileFormats/VDTFile.cs | 11 | ||||
-rw-r--r-- | UVtools.Core/Layers/Layer.cs | 90 | ||||
-rw-r--r-- | UVtools.Core/UVtools.Core.csproj | 4 | ||||
-rw-r--r-- | UVtools.WPF/MainWindow.axaml.cs | 17 | ||||
-rw-r--r-- | UVtools.WPF/UVtools.WPF.csproj | 2 | ||||
-rw-r--r-- | build/CompileWindows.bat | 1 | ||||
-rw-r--r-- | build/CreateRelease.WPF.ps1 | 9 |
10 files changed, 109 insertions, 41 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dcaf68..57cf7bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 23/12/2021 - v2.27.2 + +- **(Core) Layer:** + - (Add) Property: IsFirstLayer - Gets if is the first layer + - (Add) Property: IsIntermediateLayer - Gets if layer is between first and last layer, aka, not first nor last layer + - (Add) Property: IsLastLayer - Gets if is the last layer + - (Rename) Property: RelativeLayerHeight to RelativePositionZ +- **VDT:** + - (Add) Keyword 'FILEFORMAT_xxx' to allow set the file format to auto convertion on machine notes + - (Add) Keyword 'FILEVERSION_n' to allow set the file format version/revision on machine notes + ## 22/12/2021 - v2.27.1 - **PrusaSlicer:** diff --git a/UVtools.Core/FileFormats/PhotonWorkshopFile.cs b/UVtools.Core/FileFormats/PhotonWorkshopFile.cs index 669bcf6..7fdbb2a 100644 --- a/UVtools.Core/FileFormats/PhotonWorkshopFile.cs +++ b/UVtools.Core/FileFormats/PhotonWorkshopFile.cs @@ -554,7 +554,7 @@ namespace UVtools.Core.FileFormats public void SetFrom(Layer layer) { - LayerHeight = layer.RelativeLayerHeight; + LayerHeight = layer.RelativePositionZ; ExposureTime = layer.ExposureTime; LiftHeight = layer.LiftHeight; LiftSpeed = (float) Math.Round(layer.LiftSpeed / 60, 2); diff --git a/UVtools.Core/FileFormats/SL1File.cs b/UVtools.Core/FileFormats/SL1File.cs index 990c795..3a4159f 100644 --- a/UVtools.Core/FileFormats/SL1File.cs +++ b/UVtools.Core/FileFormats/SL1File.cs @@ -29,6 +29,7 @@ namespace UVtools.Core.FileFormats public const string IniPrusaslicer = "prusaslicer.ini"; public const string Keyword_FileFormat = "FILEFORMAT"; + public const string Keyword_FileVersion = "FILEVERSION"; public const string Keyword_BottomLightOffDelay = "BottomLightOffDelay"; public const string Keyword_LightOffDelay = "LightOffDelay"; @@ -535,7 +536,7 @@ namespace UVtools.Core.FileFormats protected override bool OnBeforeConvertTo(FileFormat output) { - int fileVersion = LookupCustomValue("FILEVERSION", int.MinValue); + int fileVersion = LookupCustomValue(Keyword_FileVersion, int.MinValue); if (fileVersion > 0) { output.Version = (uint)fileVersion; diff --git a/UVtools.Core/FileFormats/VDTFile.cs b/UVtools.Core/FileFormats/VDTFile.cs index 9e2b53b..1504a63 100644 --- a/UVtools.Core/FileFormats/VDTFile.cs +++ b/UVtools.Core/FileFormats/VDTFile.cs @@ -614,6 +614,17 @@ namespace UVtools.Core.FileFormats } } + protected override bool OnBeforeConvertTo(FileFormat output) + { + int fileVersion = LookupCustomValue(SL1File.Keyword_FileVersion, int.MinValue); + if (fileVersion > 0) + { + output.Version = (uint)fileVersion; + } + + return true; + } + protected override void EncodeInternally(OperationProgress progress) { // Redo layer data diff --git a/UVtools.Core/Layers/Layer.cs b/UVtools.Core/Layers/Layer.cs index 055d888..d355b0e 100644 --- a/UVtools.Core/Layers/Layer.cs +++ b/UVtools.Core/Layers/Layer.cs @@ -124,10 +124,57 @@ namespace UVtools.Core.Layers } } + /// <summary> + /// Gets if is the first layer + /// </summary> + public bool IsFirstLayer => _index == 0; + + /// <summary> + /// Gets if layer is between first and last layer, aka, not first nor last layer + /// </summary> + public bool IsIntermediateLayer => !IsFirstLayer && !IsLastLayer; + + /// <summary> + /// Gets if is the last layer + /// </summary> + public bool IsLastLayer => _index >= ParentLayerManager.LastLayerIndex; + + /// <summary> + /// Gets if is in the bottom layer group + /// </summary> public bool IsBottomLayer => (uint)(PositionZ / SlicerFile.LayerHeight) <= SlicerFile.BottomLayerCount; + + /// <summary> + /// Gets if is in the normal layer group + /// </summary> public bool IsNormalLayer => !IsBottomLayer; /// <summary> + /// Gets the previous layer, returns null if no previous layer + /// </summary> + public Layer PreviousLayer + { + get + { + if (ParentLayerManager is null || IsFirstLayer || _index > ParentLayerManager.Count) return null; + return ParentLayerManager[_index - 1]; + } + + } + + /// <summary> + /// Gets the next layer, returns null if no next layer + /// </summary> + public Layer NextLayer + { + get + { + if (ParentLayerManager is null || _index >= ParentLayerManager.LastLayerIndex) return null; + return ParentLayerManager[_index + 1]; + } + } + + /// <summary> /// Gets the layer index /// </summary> public uint Index @@ -146,7 +193,7 @@ namespace UVtools.Core.Layers public uint Number => _index + 1; /// <summary> - /// Gets or sets the layer position on Z in mm + /// Gets or sets the absolute layer position on Z in mm /// </summary> public float PositionZ { @@ -154,12 +201,25 @@ namespace UVtools.Core.Layers set { if (!RaiseAndSetIfChanged(ref _positionZ, RoundHeight(value))) return; + RaisePropertyChanged(nameof(RelativePositionZ)); RaisePropertyChanged(nameof(LayerHeight)); //MaterialMilliliters = -1; // Recalculate } } /// <summary> + /// Gets the relative layer position on Z in mm (Relative to the previous layer) + /// </summary> + public float RelativePositionZ + { + get + { + var previousLayer = PreviousLayer; + return previousLayer is null ? LayerHeight : RoundHeight(_positionZ - previousLayer.PositionZ); + } + } + + /// <summary> /// Gets or sets the wait time in seconds before cure the layer /// AKA: Light-off delay /// Chitubox: Rest time after retract @@ -393,10 +453,10 @@ namespace UVtools.Core.Layers { get { - if (_index == 0) return _positionZ; + if (IsFirstLayer) return _positionZ; var previousLayer = this; - while ((previousLayer = previousLayer.PreviousLayer()) is not null) // This cycle returns the correct layer height if two or more layers have the same position z + while ((previousLayer = previousLayer.PreviousLayer) is not null) // This cycle returns the correct layer height if two or more layers have the same position z { var layerHeight = RoundHeight(_positionZ - previousLayer.PositionZ); //Debug.WriteLine($"Layer {_index}-{previousLayer.Index}: {_positionZ} - {previousLayer.PositionZ}: {layerHeight}"); @@ -410,18 +470,6 @@ namespace UVtools.Core.Layers } /// <summary> - /// Gets the layer height in millimeters of this layer relative to the previous layer - /// </summary> - public float RelativeLayerHeight - { - get - { - var previousLayer = PreviousLayer(); - return previousLayer is null ? LayerHeight : RoundHeight(_positionZ - previousLayer.PositionZ); - } - } - - /// <summary> /// Gets the computed material milliliters spent on this layer /// </summary> public float MaterialMilliliters @@ -833,18 +881,6 @@ namespace UVtools.Core.Layers return BoundingRectangle; } - public Layer PreviousLayer() - { - if (ParentLayerManager is null || _index == 0 || _index > ParentLayerManager.Count) return null; - return ParentLayerManager[_index - 1]; - } - - public Layer NextLayer() - { - if (ParentLayerManager is null || _index >= ParentLayerManager.LayerCount - 1) return null; - return ParentLayerManager[_index + 1]; - } - public bool SetValueFromPrintParameterModifier(FileFormat.PrintParameterModifier modifier, decimal value) { if (ReferenceEquals(modifier, FileFormat.PrintParameterModifier.LightOffDelay)) diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj index 72b78de..601de06 100644 --- a/UVtools.Core/UVtools.Core.csproj +++ b/UVtools.Core/UVtools.Core.csproj @@ -10,7 +10,7 @@ <RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl> <PackageProjectUrl>https://github.com/sn4k3/UVtools</PackageProjectUrl> <Description>MSLA/DLP, file analysis, calibration, repair, conversion and manipulation</Description> - <Version>2.27.1</Version> + <Version>2.27.2</Version> <Copyright>Copyright © 2020 PTRTECH</Copyright> <PackageIcon>UVtools.png</PackageIcon> <Platforms>AnyCPU;x64</Platforms> @@ -59,7 +59,7 @@ <ItemGroup> <PackageReference Include="AnimatedGif" Version="1.0.5" /> - <PackageReference Include="BinarySerializer" Version="8.6.2" /> + <PackageReference Include="BinarySerializer" Version="8.6.2.2" /> <PackageReference Include="Emgu.CV" Version="4.5.4.4788" /> <PackageReference Include="KdTree" Version="1.4.1" /> <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.1.0-1.final" /> diff --git a/UVtools.WPF/MainWindow.axaml.cs b/UVtools.WPF/MainWindow.axaml.cs index 444d8ba..2b5d1ab 100644 --- a/UVtools.WPF/MainWindow.axaml.cs +++ b/UVtools.WPF/MainWindow.axaml.cs @@ -1602,12 +1602,19 @@ namespace UVtools.WPF if (Settings.Automations.AutoConvertFiles && SlicerFile.DecodeType == FileFormat.FileDecodeType.Full) { - string convertFileExtension = SlicerFile switch + string convertFileExtension = null; + switch (SlicerFile) { - SL1File sl1File => sl1File.LookupCustomValue<string>(SL1File.Keyword_FileFormat, null), - VDTFile vdtFile => vdtFile.ManifestFile.Machine.UVToolsConvertTo, - _ => null - }; + case SL1File sl1File: + convertFileExtension = sl1File.LookupCustomValue<string>(SL1File.Keyword_FileFormat, null); + break; + case VDTFile vdtFile: + if (string.IsNullOrWhiteSpace(vdtFile.ManifestFile.Machine.UVToolsConvertTo) || vdtFile.ManifestFile.Machine.UVToolsConvertTo == "None") + convertFileExtension = vdtFile.LookupCustomValue<string>(SL1File.Keyword_FileFormat, null); + else + convertFileExtension = vdtFile.ManifestFile.Machine.UVToolsConvertTo; + break; + } if (!string.IsNullOrWhiteSpace(convertFileExtension)) { diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj index ea5b223..ae6db37 100644 --- a/UVtools.WPF/UVtools.WPF.csproj +++ b/UVtools.WPF/UVtools.WPF.csproj @@ -12,7 +12,7 @@ <PackageLicenseFile>LICENSE</PackageLicenseFile> <RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl> <RepositoryType>Git</RepositoryType> - <Version>2.27.1</Version> + <Version>2.27.2</Version> <Platforms>AnyCPU;x64</Platforms> <PackageIcon>UVtools.png</PackageIcon> <PackageReadmeFile>README.md</PackageReadmeFile> diff --git a/build/CompileWindows.bat b/build/CompileWindows.bat index 350c372..5ce314c 100644 --- a/build/CompileWindows.bat +++ b/build/CompileWindows.bat @@ -5,6 +5,7 @@ cd .. REM if exist "%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" SET MSBUILD_PATH="%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" SET MSBUILD_PATH="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" SET MSBUILD_PATH="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" +if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe" SET MSBUILD_PATH="%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe" IF [%MSBUILD_PATH%] == [] GOTO noMSBuild diff --git a/build/CreateRelease.WPF.ps1 b/build/CreateRelease.WPF.ps1 index 6fa51c5..9cd4e88 100644 --- a/build/CreateRelease.WPF.ps1 +++ b/build/CreateRelease.WPF.ps1 @@ -26,7 +26,7 @@ class FixedEncoder : System.Text.UTF8Encoding { } } -function WriteXmlToScreen ([xml]$xml) +function WriteXmlToScreen([xml]$xml) { $StringWriter = New-Object System.IO.StringWriter; $XmlWriter = New-Object System.Xml.XmlTextWriter $StringWriter; @@ -212,8 +212,8 @@ foreach($element in $msiComponentsXml.Wix.Module.Directory.Directory) if($element.Id -eq 'MergeRedirectFolder') { wixCleanUpElement $element $msiSourceFiles - WriteXmlToScreen($msiComponentsXml); - $msiComponentsXml.Save("$publishFolder\test.xml") + #WriteXmlToScreen($msiComponentsXml); + #$msiComponentsXml.Save("$rootFolder\$publishFolder\test.xml") return break } @@ -313,6 +313,7 @@ foreach ($obj in $runtimes.GetEnumerator()) { Write-Output "################################ Building: $runtime" dotnet publish $project -o "$publishFolder/$runtime" -c $buildWith -r $runtime $extraCmd + New-Item "$publishFolder/$runtime/runtime_package.dat" -ItemType File -Value $runtime if(!$runtime.Equals('win-x64')) { @@ -429,7 +430,7 @@ if($null -ne $enableMSI -and $enableMSI) Invoke-Expression "& $msbuild $installer\$installer.wixproj" } - Write-Output "Coping $runtime MSI to: $msiTargetFile" + Write-Output "Copying $runtime MSI to: $msiTargetFile" Copy-Item $msiOutputFile $msiTargetFile Write-Output "Took: $($deployStopWatch.Elapsed) |