diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-05-11 21:10:36 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-05-11 21:10:36 +0300 |
commit | 3cd46728f1ca599d1f2211d9ff07273135d670af (patch) | |
tree | 0f322d5ae72f35be4a0b793d0f82c7825a2ceb4d /UVtools.ScriptSample | |
parent | dc0e90a61311b2d78104e46ac34c8faf382dcbd3 (diff) |
v2.11.1v2.11.1
- **Shortcuts:**
- (Add) (Ctrl + Shift + R) to turn on and cycle the Rotate modes
- (Add) (Ctrl + Shift + F) to turn on and cycle the Flip modes
- (Add) (Ctrl + Shift + B) to select the build volume as ROI
- **GUI:**
- (Add) Allow to drag and drop '.uvtop' files into UVtools to sequential show and load operations from files
- (Change) Rotate icon on layer preview
- (Upgrade) AvaloniaUI from 0.10.3 to 0.10.4
- **Tools:**
- (Add) 'Reset to defaults' button on every dialog
- (Improvement) Window size and position handling
- (Improvement) Constrain profile box width to not stretch the window
- (Improvement) ROI section design
- **Dynamic lift:**
- (Add) View buttons to show the largest/smallest layers
- (Add) Light-off mode: Set the light-off with an extra delay
- (Add) Light-off mode: Set the light-off without an extra delay
- (Add) Light-off mode: Set the light-off to zero
- (Improvement) Disable bottom and/or normal layer fields when the selected range is outside
- (Add) Settings - Automations: Light-off delay set modes
- (Fix) Exposure time finder: Add staircase, bullseye and counter triangles to feature count at thumbnail
Diffstat (limited to 'UVtools.ScriptSample')
-rw-r--r-- | UVtools.ScriptSample/ScriptSetLiftHeightSample.cs | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/UVtools.ScriptSample/ScriptSetLiftHeightSample.cs b/UVtools.ScriptSample/ScriptSetLiftHeightSample.cs new file mode 100644 index 0000000..b5a8c84 --- /dev/null +++ b/UVtools.ScriptSample/ScriptSetLiftHeightSample.cs @@ -0,0 +1,76 @@ +/* + * GNU AFFERO GENERAL PUBLIC LICENSE + * Version 3, 19 November 2007 + * Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> + * Everyone is permitted to copy and distribute verbatim copies + * of this license document, but changing it is not allowed. + */ + +using System; +using UVtools.Core.Scripting; + +namespace UVtools.ScriptSample +{ + /// <summary> + /// Change layer properties to random values + /// </summary> + public class ScriptSetLiftHeightSample : ScriptGlobals + { + ScriptNumericalInput<float> BottomLiftHeight = new() + { + Label = "Bottom lift height", + Unit = "mm", + Minimum = 0, + Maximum = 300, + Increment = 0.5f, + Value = 0.5f, + DecimalPlates = 2 + }; + + ScriptNumericalInput<float> LiftHeight = new() + { + Label = "Lift height", + Unit = "mm", + Minimum = 0, + Maximum = 300, + Increment = 0.5f, + Value = 0.5f, + DecimalPlates = 2 + }; + + /// <summary> + /// Set configurations here, this function trigger just after load a script + /// </summary> + public void ScriptInit() + { + Script.Name = "Change lift height properties"; + Script.Description = "Change file lift height"; + Script.Author = "Tiago Conceição"; + Script.Version = new Version(0, 1); + + Script.UserInputs.AddRange(new []{ BottomLiftHeight , LiftHeight}); + } + + /// <summary> + /// Validate user inputs here, this function trigger when user click on execute + /// </summary> + /// <returns>A error message, empty or null if validation passes.</returns> + public string ScriptValidate() + { + return null; + } + + /// <summary> + /// Execute the script, this function trigger when when user click on execute and validation passes + /// </summary> + /// <returns>True if executes successfully to the end, otherwise false.</returns> + public bool ScriptExecute() + { + SlicerFile.BottomLiftHeight = BottomLiftHeight.Value; + SlicerFile.LiftHeight = LiftHeight.Value; + + // return true if not cancelled by user + return !Progress.Token.IsCancellationRequested; + } + } +} |