diff --git a/tests/javascript/extrusion.test.js b/tests/javascript/extrusion.test.js new file mode 100644 index 00000000..aa5131f9 --- /dev/null +++ b/tests/javascript/extrusion.test.js @@ -0,0 +1,25 @@ +const rhino3dm = require('rhino3dm') + +let rhino +beforeEach( async() => { + rhino = await rhino3dm() + }) + +// objective: to test that creating and extrusion vs creating an extrusion with a place yield similar extrusions in different places +test('createExtrusion', async () => { + + const circle1 = new rhino.Circle(1.0); + const extrusion1 = rhino.Extrusion.create(circle1.toNurbsCurve(), 10.0, true) + const plane = new rhino.Plane.worldXY() + plane.origin = [10,10,10] + const circle2 = new rhino.Circle(1.0); + circle2.plane = plane + const extrusion2 = rhino.Extrusion.createWithPlane(circle2.toNurbsCurve(), plane, 10.0, true) + + const bb1 = extrusion1.getBoundingBox() + const bb2 = extrusion2.getBoundingBox() + + expect(bb1.volume).toBeCloseTo(bb2.volume, 5) + expect(bb1.center === bb2.center).toBe(false) + +}) \ No newline at end of file diff --git a/tests/python/test_Extrusion.py b/tests/python/test_Extrusion.py new file mode 100644 index 00000000..ea1a9fb6 --- /dev/null +++ b/tests/python/test_Extrusion.py @@ -0,0 +1,25 @@ +import rhino3dm +import unittest + +#objective: to test that creating and extrusion vs creating an extrusion with a place yield similar extrusions in different places +class TestExtrusion(unittest.TestCase): + def test_createExtrusion(self): + + circle1 = rhino3dm.Circle( 1 ) + extrusion1 = rhino3dm.Extrusion.Create(circle1.ToNurbsCurve(), 10, True) + plane = rhino3dm.Plane.WorldXY() + plane.Origin = rhino3dm.Point3d(10, 10, 10) + circle2 = rhino3dm.Circle( 1 ) + circle2.Plane = plane + extrusion2 = rhino3dm.Extrusion.CreateWithPlane(circle2.ToNurbsCurve(), plane, 10, True) + + bb1 = extrusion1.GetBoundingBox() + bb2 = extrusion2.GetBoundingBox() + + self.assertAlmostEqual( bb1.Volume, bb2.Volume, 5 ) + self.assertFalse( bb1.Center == bb2.Center ) + +if __name__ == '__main__': + print("running tests") + unittest.main() + print("tests complete") \ No newline at end of file