/* * GNU AFFERO GENERAL PUBLIC LICENSE * Version 3, 19 November 2007 * Copyright (C) 2007 Free Software Foundation, Inc. * 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 { /// /// Change layer properties to random values /// public class ScriptSetLiftHeightSample : ScriptGlobals { ScriptNumericalInput BottomLiftHeight = new() { Label = "Bottom lift height", Unit = "mm", Minimum = 0, Maximum = 300, Increment = 0.5f, Value = 0.5f, DecimalPlates = 2 }; ScriptNumericalInput LiftHeight = new() { Label = "Lift height", Unit = "mm", Minimum = 0, Maximum = 300, Increment = 0.5f, Value = 0.5f, DecimalPlates = 2 }; /// /// Set configurations here, this function trigger just after load a script /// 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}); } /// /// Validate user inputs here, this function trigger when user click on execute /// /// A error message, empty or null if validation passes. public string ScriptValidate() { return null; } /// /// Execute the script, this function trigger when when user click on execute and validation passes /// /// True if executes successfully to the end, otherwise false. public bool ScriptExecute() { SlicerFile.BottomLiftHeight = BottomLiftHeight.Value; SlicerFile.LiftHeight = LiftHeight.Value; // return true if not cancelled by user return !Progress.Token.IsCancellationRequested; } } }