diff --git a/OSCADSharp/OSCADSharp/Bindings.cs b/OSCADSharp/OSCADSharp/Bindings.cs index 5ef09e2..888a052 100644 --- a/OSCADSharp/OSCADSharp/Bindings.cs +++ b/OSCADSharp/OSCADSharp/Bindings.cs @@ -21,7 +21,7 @@ namespace OSCADSharp this.propertyNametoOpenSCADFieldMappings = new Dictionary(); } - public Bindings(Dictionary mappings) + internal Bindings(Dictionary mappings) { this.propertyNametoOpenSCADFieldMappings = mappings; } diff --git a/OSCADSharp/OSCADSharp/CubeBindings.cs b/OSCADSharp/OSCADSharp/CubeBindings.cs index dfe0bf9..eb597c5 100644 --- a/OSCADSharp/OSCADSharp/CubeBindings.cs +++ b/OSCADSharp/OSCADSharp/CubeBindings.cs @@ -19,8 +19,8 @@ namespace OSCADSharp {"height", "z" } }; - public BindableVector SizeBinding = new BindableVector(new Vector3(), sizeSynonyms); - public BindableBoolean CenterBinding = new BindableBoolean("center"); + public BindableVector SizeBinding { get; set; } = new BindableVector(new Vector3(), sizeSynonyms); + public BindableBoolean CenterBinding { get; set; } = new BindableBoolean("center"); public void Bind(T obj, string property, Variable variable) { diff --git a/OSCADSharp/OSCADSharp/IO/OutputSettings.cs b/OSCADSharp/OSCADSharp/IO/OutputSettings.cs index 2027e6d..a5e0c2b 100644 --- a/OSCADSharp/OSCADSharp/IO/OutputSettings.cs +++ b/OSCADSharp/OSCADSharp/IO/OutputSettings.cs @@ -23,6 +23,6 @@ namespace OSCADSharp.IO /// Path to the OpenSCAD executable for file invocation /// (Default value is set the default install directory on Windows) /// - public static string OpenSCADPath = new OpenSCADPathFinder().GetPath(); + public static string OpenSCADPath { get; set; } = new OpenSCADPathFinder().GetPath(); } } diff --git a/OSCADSharp/OSCADSharp/Matrix.cs b/OSCADSharp/OSCADSharp/Matrix.cs index 61d558e..d152869 100644 --- a/OSCADSharp/OSCADSharp/Matrix.cs +++ b/OSCADSharp/OSCADSharp/Matrix.cs @@ -78,13 +78,14 @@ namespace OSCADSharp return piOver180 * degrees; } - private static readonly Matrix identity = new Matrix(new double[] { - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - }, 4, 4); - internal static Matrix Identity { get { return identity; } } + internal static Matrix Identity() + { + return new Matrix(new double[] { + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1}, 4, 4); ; + } /// /// Gets a transformation matrix for performing rotations on the X-Axis @@ -95,7 +96,7 @@ namespace OSCADSharp internal static Matrix XRotation(double angle) { if (angle == 0) - return Identity; + return Identity(); double radAngle = toRadians(angle); double[] rotationArr = new double[] { @@ -117,7 +118,7 @@ namespace OSCADSharp internal static Matrix YRotation(double angle) { if (angle == 0) - return Identity; + return Identity(); double radAngle = toRadians(angle); double[] rotationArr = new double[] { @@ -139,7 +140,7 @@ namespace OSCADSharp internal static Matrix ZRotation(double angle) { if (angle == 0) - return Identity; + return Identity(); double radAngle = toRadians(angle); double[] rotationArr = new double[] { diff --git a/OSCADSharp/OSCADSharp/OSCADObject.cs b/OSCADSharp/OSCADSharp/OSCADObject.cs index 71dc457..b94adb8 100644 --- a/OSCADSharp/OSCADSharp/OSCADObject.cs +++ b/OSCADSharp/OSCADSharp/OSCADObject.cs @@ -779,7 +779,7 @@ namespace OSCADSharp /// /// Internal collection of children for this object /// - protected List m_children = new List(); + protected List m_children { get; set; } = new List(); /// /// Returns all chidren of this OSCADObject diff --git a/OSCADSharp/OSCADSharp/SingleStatementObject.cs b/OSCADSharp/OSCADSharp/SingleStatementObject.cs index 6826a97..bd6aa56 100644 --- a/OSCADSharp/OSCADSharp/SingleStatementObject.cs +++ b/OSCADSharp/OSCADSharp/SingleStatementObject.cs @@ -11,7 +11,7 @@ namespace OSCADSharp /// internal abstract class SingleStatementObject : OSCADObject { - protected OSCADObject obj; + protected OSCADObject obj { get; set; } protected SingleStatementObject(OSCADObject obj) { diff --git a/OSCADSharp/OSCADSharp/SphereScriptBuilder.cs b/OSCADSharp/OSCADSharp/SphereScriptBuilder.cs index 2c779a1..89dbe6c 100644 --- a/OSCADSharp/OSCADSharp/SphereScriptBuilder.cs +++ b/OSCADSharp/OSCADSharp/SphereScriptBuilder.cs @@ -8,8 +8,8 @@ namespace OSCADSharp { internal class SphereScriptBuilder { - private IBindings bindings; - private Sphere sphere; + private readonly IBindings bindings; + private readonly Sphere sphere; internal SphereScriptBuilder(IBindings bindings, Sphere sphere) { diff --git a/OSCADSharp/OSCADSharp/Utility/Inches.cs b/OSCADSharp/OSCADSharp/Utility/Inches.cs index 253d84f..bc33f3a 100644 --- a/OSCADSharp/OSCADSharp/Utility/Inches.cs +++ b/OSCADSharp/OSCADSharp/Utility/Inches.cs @@ -14,27 +14,27 @@ namespace OSCADSharp.Utility /// /// One imperial inch /// - public const double One = 25.4; + public static double One { get; private set; } = 25.4; /// /// Half of an imperial inch /// - public const double Half = One / 2; + public static double Half { get; private set; } = One / 2; /// /// Quarter of an imperial inch /// - public const double Quarter = Half / 2; + public static double Quarter { get; private set; } = Half / 2; /// /// Eigth of an imperial inch /// - public const double Eigth = Quarter / 2; + public static double Eigth { get; private set; } = Quarter / 2; /// /// Sixteenth of an imperial inch /// - public const double Sixteenth = Eigth / 2; + public static double Sixteenth { get; private set; } = Eigth / 2; /// /// Converts inches to millimeters diff --git a/OSCADSharp/OSCADSharp/Variables.cs b/OSCADSharp/OSCADSharp/Variables.cs index fd1b34a..d343d39 100644 --- a/OSCADSharp/OSCADSharp/Variables.cs +++ b/OSCADSharp/OSCADSharp/Variables.cs @@ -16,7 +16,7 @@ namespace OSCADSharp /// Global variables that can be assigned for output at the /// top of OpenSCAD scripts /// - public static Variables Global = new Variables(); + public static Variables Global { get; set; } = new Variables(); private ConcurrentDictionary variables = new ConcurrentDictionary(); ///