diff --git a/OSCADSharp/OSCADSharp.UnitTests/Solids/Text3DTests.cs b/OSCADSharp/OSCADSharp.UnitTests/Solids/Text3DTests.cs index 6e59477..cd1c6c9 100644 --- a/OSCADSharp/OSCADSharp.UnitTests/Solids/Text3DTests.cs +++ b/OSCADSharp/OSCADSharp.UnitTests/Solids/Text3DTests.cs @@ -83,5 +83,19 @@ namespace OSCADSharp.UnitTests Assert.IsTrue(script.Contains(String.Format("direction = {0}", direction.Name))); Assert.IsTrue(script.Contains(String.Format("language = {0}", language.Name))); } + + [TestMethod] + public void Text_BindingConstructorAffectsOutput() + { + var text = new Variable("txt", "Greetings, Earthlings"); + var size = new Variable("txtSize", 82); + + var txt = new Text3D(text, size); + + string script = txt.ToString(); + + Assert.IsTrue(script.Contains(String.Format("text(\"{0}\"", text.Name))); + Assert.IsTrue(script.Contains(String.Format("size = {0}", size.Name))); + } } } diff --git a/OSCADSharp/OSCADSharp/Solids/Text3D.cs b/OSCADSharp/OSCADSharp/Solids/Text3D.cs index 95afe7d..590c821 100644 --- a/OSCADSharp/OSCADSharp/Solids/Text3D.cs +++ b/OSCADSharp/OSCADSharp/Solids/Text3D.cs @@ -69,6 +69,26 @@ namespace OSCADSharp.Solids this.Text = text; this.Size = size; } + + /// + /// Creates a 3d text object with pre-bound variables + /// + /// + /// + /// + /// + /// + /// + public Text3D(Variable text = null, Variable size = null, Variable font = null, + Variable spacing = null, Variable language = null, Variable textdirection = null) + { + this.BindIfVariableNotNull("text", text); + this.BindIfVariableNotNull("size", size); + this.BindIfVariableNotNull("font", font); + this.BindIfVariableNotNull("spacing", spacing); + this.BindIfVariableNotNull("language", language); + this.BindIfVariableNotNull("textdirection", textdirection); + } #endregion #region Overrides