Beispiel #1
0
        public void SweepAsSolidTest()
        {
            var model = dynSettings.Controller.DynamoModel;

            string openPath = Path.Combine(GetTestDirectory(), @"core\GeometryTestFiles\SweepAsSolidTest.dyn");

            model.Open(openPath);

            // check all the nodes and connectors are loaded
            Assert.AreEqual(21, model.CurrentWorkspace.Nodes.Count);
            Assert.AreEqual(33, model.CurrentWorkspace.Connectors.Count);

            // run the expression
            dynSettings.Controller.RunExpression(null);

            // Verification for Solid created using "Sweep as Solid" node.
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <SweepAsSolidNode>("398d1047-da7d-4ab4-a661-4e686a7949a2");

            Assert.IsTrue(Utils.Convert(getGeometry1.GetValue(0), ref geometry1));

            Autodesk.LibG.Solid sweepedSolid = geometry1 as Autodesk.LibG.Solid;
            Assert.AreNotEqual(null, sweepedSolid);
            Assert.AreEqual(194.26617152241661, sweepedSolid.area(), 0.000000001);
            Assert.AreEqual(93.991683898354964, sweepedSolid.volume(), 0.000000001);
            Assert.AreEqual(10.000000000000005, sweepedSolid.center_of_gravity().x());
        }
Beispiel #2
0
        public void ThickenSurfaceTest()
        {
            var model = dynSettings.Controller.DynamoModel;

            string openPath = Path.Combine(GetTestDirectory(), @"core\GeometryTestFiles\ThickenSurfaceTest.dyn");

            model.Open(openPath);

            // check all the nodes and connectors are loaded
            Assert.AreEqual(22, model.CurrentWorkspace.Nodes.Count);
            Assert.AreEqual(24, model.CurrentWorkspace.Connectors.Count);

            // run the expression
            dynSettings.Controller.RunExpression(null);

            // Verification for Solid created using "Thicken" node.
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <ThickenSurfaceNode>("424090c9-f36c-4aaf-8f46-1fae5bb87f41");

            Assert.IsTrue(Utils.Convert(getGeometry1.GetValue(0), ref geometry1));

            Autodesk.LibG.Solid thickenSolid = geometry1 as Autodesk.LibG.Solid;
            Assert.AreNotEqual(null, thickenSolid);
            Assert.AreEqual(217.12607751804401, thickenSolid.area());
            Assert.AreEqual(42.74408242616218, thickenSolid.volume());
            Assert.AreEqual(-4.4489040318494073, thickenSolid.center_of_gravity().x());
        }
Beispiel #3
0
        public void LoftUsingCircles()
        {
            var model = dynSettings.Controller.DynamoModel;

            string openPath = Path.Combine(GetTestDirectory(), @"core\GeometryTestFiles\LoftUsingCircles.dyn");

            model.Open(openPath);

            // check all the nodes and connectors are loaded
            Assert.AreEqual(33, model.CurrentWorkspace.Nodes.Count);
            Assert.AreEqual(46, model.CurrentWorkspace.Connectors.Count);

            // run the expression
            dynSettings.Controller.RunExpression(null);

            // Verification for Solid created using Thinking Lofted surface.
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <ThickenSurfaceNode>("b6952095-fc70-4b11-b0b6-b399714c0460");

            Assert.IsTrue(Utils.Convert(getGeometry1.GetValue(0), ref geometry1));

            Autodesk.LibG.Solid thikenSolid = geometry1 as Autodesk.LibG.Solid;
            Assert.AreNotEqual(null, thikenSolid);
            Assert.AreEqual(5468.2219186769089, thikenSolid.area(), 0.000000001);
            Assert.AreEqual(24.601521194889756, thikenSolid.volume(), 0.000000001);
            Assert.AreEqual(9.4206816962888951, thikenSolid.center_of_gravity().x());
        }