From 4f0d3ed1be14a7e4b13c76565a5015b7c0a52c7f Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Thu, 25 Feb 2016 22:51:39 -0800 Subject: [PATCH] +Added Variable class, Bind method to OSCADObject --- OSCADSharp/OSCADSharp/OSCADObject.cs | 11 +++++++++ OSCADSharp/OSCADSharp/OSCADSharp.csproj | 1 + OSCADSharp/OSCADSharp/Scripting/Variable.cs | 27 +++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 OSCADSharp/OSCADSharp/Scripting/Variable.cs diff --git a/OSCADSharp/OSCADSharp/OSCADObject.cs b/OSCADSharp/OSCADSharp/OSCADObject.cs index 6a62825..7015e09 100644 --- a/OSCADSharp/OSCADSharp/OSCADObject.cs +++ b/OSCADSharp/OSCADSharp/OSCADObject.cs @@ -227,6 +227,17 @@ namespace OSCADSharp #endregion #region Utility Methods + private Dictionary bindings = new Dictionary(); + /// + /// Binds a variable to property of this object + /// + /// + /// + public void Bind(string property, Variable variable) + { + bindings[property] = variable; + } + /// /// Returns the computed position of this object. /// diff --git a/OSCADSharp/OSCADSharp/OSCADSharp.csproj b/OSCADSharp/OSCADSharp/OSCADSharp.csproj index 0e43fd2..194417c 100644 --- a/OSCADSharp/OSCADSharp/OSCADSharp.csproj +++ b/OSCADSharp/OSCADSharp/OSCADSharp.csproj @@ -50,6 +50,7 @@ + diff --git a/OSCADSharp/OSCADSharp/Scripting/Variable.cs b/OSCADSharp/OSCADSharp/Scripting/Variable.cs new file mode 100644 index 0000000..22682ae --- /dev/null +++ b/OSCADSharp/OSCADSharp/Scripting/Variable.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OSCADSharp.Scripting +{ + /// + /// A value for setting object properties in script output to + /// a specific variable + /// + public class Variable + { + /// + /// Name of the variable + /// + public string Name { get; set; } + + /// + /// Value of the variable. + /// + /// Must be compatible with the data type being assigned to. + /// + public object Value { get; set; } + } +}