mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-11 13:38:33 +00:00
Added Cube binding constructor, test, corrected Sizes.InchesToMillimeters
This commit is contained in:
parent
421694559f
commit
5726b63dec
@ -158,5 +158,21 @@ namespace OSCADSharp.UnitTests
|
||||
Assert.AreEqual(centerVal.Value, obj.Center);
|
||||
Assert.IsTrue(script.Contains("center = isCentered"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Cube_ConstructorBindingsAppearInOutput()
|
||||
{
|
||||
var length = new Variable("deckBoxLength", Sizes.SixteenthInch * 32);
|
||||
var width = new Variable("deckBoxWidth", Sizes.SixteenthInch * 32);
|
||||
var height = new Variable("deckboxHeight", Sizes.InchesToMillimeters(2.5));
|
||||
var centered = new Variable("isCentered", true);
|
||||
|
||||
var cube = new Cube(length, width, height, centered);
|
||||
|
||||
string script = cube.ToString();
|
||||
|
||||
Assert.IsTrue(script.Contains("size = [deckBoxLength, deckBoxWidth, deckboxHeight]"));
|
||||
Assert.IsTrue(script.Contains("center = isCentered"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,9 +41,9 @@ namespace OSCADSharp
|
||||
/// </summary>
|
||||
/// <param name="inches">Number of inches</param>
|
||||
/// <returns>Equivalent value in milimeters</returns>
|
||||
public double InchesToMillimeters(double inches)
|
||||
public static double InchesToMillimeters(double inches)
|
||||
{
|
||||
return inches * 0.03937008;
|
||||
return inches * OneInch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,6 +78,21 @@ namespace OSCADSharp.Solids
|
||||
|
||||
this.Center = center;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Cube object with variable bindings
|
||||
/// </summary>
|
||||
/// <param name="length">Size on the X axis</param>
|
||||
/// <param name="width">Size on the Y axis</param>
|
||||
/// <param name="height">Size on the Z axis</param>
|
||||
/// <param name="center">Indicates whether the cube should be centered on the origin</param>
|
||||
public Cube(Variable length = null, Variable width = null, Variable height = null, Variable center = null)
|
||||
{
|
||||
this.BindIfVariableNotNull("length", length);
|
||||
this.BindIfVariableNotNull("width", width);
|
||||
this.BindIfVariableNotNull("height", height);
|
||||
this.BindIfVariableNotNull("center", center);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Overrides
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user