mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-14 15:08:35 +00:00
+ Added NotSupportedExceptions on all block statements except Hull and Union when Position() is called on them
This commit is contained in:
parent
2bbe452da6
commit
b6a454e8b9
@ -13,7 +13,10 @@ namespace OSCADSharp.ConsoleTests
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var obj = new Cube(5, 10, 20).Mirror(0, 0, 1);
|
||||
var obj = new Cube(5, 10, 20).Mirror(0, 0, 1).Mirror(0, 1, 0)
|
||||
.Rotate(15, -45, 120).Translate(-20, 10, 15).Rotate(90, 15, 25)
|
||||
.Translate(-10, -20, -20).Rotate(-90, -90, -45);
|
||||
obj = obj.Minkowski(new Cube(1, 1, 5));
|
||||
|
||||
var pos = obj.Position();
|
||||
var cyl1 = new Cylinder(1, 100, true).Translate(pos);
|
||||
|
||||
19
OSCADSharp/OSCADSharp.UnitTests/DifferenceTests.cs
Normal file
19
OSCADSharp/OSCADSharp.UnitTests/DifferenceTests.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using OSCADSharp.Solids;
|
||||
|
||||
namespace OSCADSharp.UnitTests
|
||||
{
|
||||
[TestClass]
|
||||
public class DifferenceTests
|
||||
{
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(NotSupportedException))]
|
||||
public void Difference_PositionThrowsNotSupportedException()
|
||||
{
|
||||
var diff = new Sphere().Difference(new Cube());
|
||||
|
||||
var pos = diff.Position();
|
||||
}
|
||||
}
|
||||
}
|
||||
19
OSCADSharp/OSCADSharp.UnitTests/IntersectionTests.cs
Normal file
19
OSCADSharp/OSCADSharp.UnitTests/IntersectionTests.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using OSCADSharp.Solids;
|
||||
|
||||
namespace OSCADSharp.UnitTests
|
||||
{
|
||||
[TestClass]
|
||||
public class IntersectionTests
|
||||
{
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(NotSupportedException))]
|
||||
public void Intersection_PositionThrowsNotSupportedException()
|
||||
{
|
||||
var obj = new Sphere().Intersection(new Text3D("Sup"));
|
||||
|
||||
var pos = obj.Position();
|
||||
}
|
||||
}
|
||||
}
|
||||
19
OSCADSharp/OSCADSharp.UnitTests/MinkowskiTests.cs
Normal file
19
OSCADSharp/OSCADSharp.UnitTests/MinkowskiTests.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using OSCADSharp.Solids;
|
||||
|
||||
namespace OSCADSharp.UnitTests
|
||||
{
|
||||
[TestClass]
|
||||
public class MinkowskiTests
|
||||
{
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(NotSupportedException))]
|
||||
public void Minkowski_PositionThrowsNotSupportedException()
|
||||
{
|
||||
var obj = new Cylinder().Intersection(new Sphere()).Translate(0, 5, 5);
|
||||
|
||||
var pos = obj.Position();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -62,6 +62,9 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Text3DTests.cs" />
|
||||
<Compile Include="UnionTests.cs" />
|
||||
<Compile Include="DifferenceTests.cs" />
|
||||
<Compile Include="IntersectionTests.cs" />
|
||||
<Compile Include="MinkowskiTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OSCADSharp\OSCADSharp.csproj">
|
||||
|
||||
@ -18,6 +18,11 @@ namespace OSCADSharp.Booleans
|
||||
/// <param name="children"></param>
|
||||
public Difference(IEnumerable<OSCADObject> children) : base("difference()", children)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public override Vector3 Position()
|
||||
{
|
||||
throw new NotSupportedException("Position is not supported on Differenced objects.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,5 +19,10 @@ namespace OSCADSharp.Booleans
|
||||
public Intersection(IEnumerable<OSCADObject> children) : base("intersection()", children)
|
||||
{
|
||||
}
|
||||
|
||||
public override Vector3 Position()
|
||||
{
|
||||
throw new NotSupportedException("Position is not supported on Intersected objects.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,11 @@ namespace OSCADSharp.Transforms
|
||||
|
||||
public MinkowskiedObject(IEnumerable<OSCADObject> children) : base("minkowski()", children)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public override Vector3 Position()
|
||||
{
|
||||
throw new NotSupportedException("Position is not supported on Minkowskied objects.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user