-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") |