Пример #1
0
        public void ExtrudCurveTest()
        {
            var model = dynSettings.Controller.DynamoModel;

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

            model.Open(openPath);

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

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

            // Verification for Surface.
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <ExtrudeNode>("5c61d60b-23d8-444b-98b8-5f7bf75d5694");

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

            Autodesk.LibG.Surface surface = geometry1 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, surface);
            Assert.AreEqual(1.280984238447507, surface.area());
            Assert.IsFalse(surface.closed_u());
            Assert.IsFalse(surface.closed_v());
        }
Пример #2
0
        public void TrimTest_UsingTwoSurface()
        {
            var model = dynSettings.Controller.DynamoModel;

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

            model.Open(openPath);

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

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

            // Verification for Surface created using "Trim" node.
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <TrimNode>("97ba959c-ad9f-4358-84db-8bedd9020069");

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

            Autodesk.LibG.Surface sweptSurface = geometry1 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, sweptSurface);
            Assert.AreEqual(88.30416734641004, sweptSurface.area());
            Assert.IsFalse(sweptSurface.closed_u());
            Assert.IsFalse(sweptSurface.closed_v());
        }
Пример #3
0
        public void SweeAsSurface_AnotherTest()
        {
            var model = dynSettings.Controller.DynamoModel;

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

            model.Open(openPath);

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

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

            // Verification for Surface.
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <SweepAsSurfaceNode>("a19f5539-3397-4975-ae4b-a0a2c45a3489");

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

            Autodesk.LibG.Surface surface = geometry1 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, surface);
            Assert.AreEqual(66.591667947439021, surface.area());
            Assert.IsFalse(surface.closed_u());
            Assert.IsTrue(surface.closed_v());
        }
Пример #4
0
        public void PatchSurfaceTest()
        {
            var model = dynSettings.Controller.DynamoModel;

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

            model.Open(openPath);

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

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

            // Verification for Surface created using two planar curve
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <PatchNode>("ac0450a7-e71d-490d-a07a-55fb28c01596");

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

            Autodesk.LibG.Surface patchedsurface = geometry1 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, patchedsurface);
            Assert.AreEqual(2.0321279999999815, patchedsurface.area());
            Assert.IsFalse(patchedsurface.closed_u());
            Assert.IsFalse(patchedsurface.closed_v());
        }
Пример #5
0
        public void SweepAsSurfaceTest()
        {
            var model = dynSettings.Controller.DynamoModel;

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

            model.Open(openPath);

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

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

            // Verification for Surface created using "Sweep as Surface" node.
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <SweepAsSurfaceNode>("a61da19c-b8cc-429d-867f-46e38c89829a");

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

            Autodesk.LibG.Surface sweptSurface = geometry1 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, sweptSurface);
            Assert.AreEqual(182.24579120015983, sweptSurface.area());
            Assert.IsTrue(sweptSurface.closed_u());
            Assert.IsFalse(sweptSurface.closed_v());
        }
Пример #6
0
        public void Surface_UsingBSplineCurve()
        {
            var model = dynSettings.Controller.DynamoModel;

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

            model.Open(openPath);

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

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

            // Verification for Surface created using BSpline curve.
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <SweepAsSurfaceNode>("de19856b-cb60-4cc4-b616-c8cf38b0efd0");

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

            Autodesk.LibG.Surface patchedsurface = geometry1 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, patchedsurface);
            Assert.AreEqual(975.75638786954767, patchedsurface.area());
            Assert.IsFalse(patchedsurface.closed_u());
            Assert.IsTrue(patchedsurface.closed_v());
        }
Пример #7
0
        public void ExtrudeArrayOfOpenCurves()
        {
            var model = dynSettings.Controller.DynamoModel;

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

            model.Open(openPath);

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

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

            // Verification for Surface.
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <ExtrudeNode>("d6c89a2b-d91b-49ce-a57f-8c33c34c29b5");

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

            Autodesk.LibG.Surface surface = geometry1 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, surface);
            Assert.AreEqual(11.188272457045143, surface.area());
            Assert.IsFalse(surface.closed_u());
            Assert.IsFalse(surface.closed_v());
        }
Пример #8
0
        public void ExtrudeArrayOfClosedCurves()
        {
            var model = dynSettings.Controller.DynamoModel;

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

            model.Open(openPath);

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

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

            // Verification for Surface.
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <GetFromList>("d0aabae2-386f-4757-9fcb-124b36c82b69");

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

            Autodesk.LibG.Surface surface = geometry1 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, surface);
            Assert.AreEqual(125.66370614359172, surface.area());
            Assert.IsFalse(surface.closed_u());
            Assert.IsTrue(surface.closed_v());
        }
Пример #9
0
        public void PropertycheckTest()
        {
            var model = dynSettings.Controller.DynamoModel;

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

            model.Open(openPath);

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

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

            // Verification for Area Node
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <SweepAsSurfaceNode>("a61da19c-b8cc-429d-867f-46e38c89829a");

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

            Autodesk.LibG.Surface sweptSurface = geometry1 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, sweptSurface);

            double sweptSurfaceArea = sweptSurface.area();

            Assert.AreEqual(182.24579120015983, sweptSurfaceArea);

            var areFromNode = model.CurrentWorkspace.NodeFromWorkspace <AreaNode>("9ef163dd-e0e0-4acc-a07b-b901e41f1512");

            Assert.AreEqual(sweptSurfaceArea, areFromNode.GetValue(0).GetDoubleFromFSchemeValue());

            Autodesk.LibG.Geometry geometry2 = null;
            var getGeometry2 = model.CurrentWorkspace.NodeFromWorkspace <BSplineCurveNode>("064e5f0a-62a4-405c-ba3f-cde337afaa9c");

            Assert.IsTrue(Utils.Convert(getGeometry2.GetValue(0), ref geometry2));

            //Verification for Length Node.
            Autodesk.LibG.BSplineCurve bSCurve = geometry2 as Autodesk.LibG.BSplineCurve;
            Assert.AreNotEqual(null, bSCurve);

            double curveLength = bSCurve.length();

            var lengthNode = model.CurrentWorkspace.NodeFromWorkspace <LengthNode>("f3d354ad-7e1e-4b2e-8401-3f534ee4e2f0");

            Assert.AreEqual(curveLength, lengthNode.GetValue(0).GetDoubleFromFSchemeValue());
        }
Пример #10
0
        public void SurfaceTest()
        {
            var model = dynSettings.Controller.DynamoModel;

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

            model.Open(openPath);

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

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

            // Verification for Surface.
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <GetFromList>("da3de021-8b3d-4430-8801-b8191d27f50e");

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

            Autodesk.LibG.Surface bSplineSurface1 = geometry1 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, bSplineSurface1);
            Assert.AreEqual(38.202015536467101, bSplineSurface1.area());
            Assert.IsFalse(bSplineSurface1.closed_u());
            Assert.IsTrue(bSplineSurface1.closed_v());


            Autodesk.LibG.Geometry geometry2 = null;
            var getGeometry2 = model.CurrentWorkspace.NodeFromWorkspace <GetFromList>("da0f72f7-6719-44e9-8708-5ad817c0747f");

            Assert.IsTrue(Utils.Convert(getGeometry2.GetValue(0), ref geometry2));

            Autodesk.LibG.Surface bSplineSurface2 = geometry1 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, bSplineSurface2);
            Assert.AreEqual(38.202015536467101, bSplineSurface2.area());
            Assert.IsFalse(bSplineSurface2.closed_u());
            Assert.IsTrue(bSplineSurface2.closed_v());
        }
Пример #11
0
        public void PatchSurface_AnotherTest()
        {
            var model = dynSettings.Controller.DynamoModel;

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

            model.Open(openPath);

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

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

            // Verification for Surface created using two planar curve
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <PatchNode>("d2b074a2-c7a9-46be-8a89-cd01ae00368a");

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

            Autodesk.LibG.Surface patchedsurface = geometry1 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, patchedsurface);
            Assert.AreEqual(16.290817227238776, patchedsurface.area());
            Assert.IsFalse(patchedsurface.closed_u());
            Assert.IsFalse(patchedsurface.closed_v());

            // Verification for loft created using OpenCurves.
            Autodesk.LibG.Geometry geometry2 = null;
            var getGeometry2 = model.CurrentWorkspace.NodeFromWorkspace <PatchNode>("6ff8ce0d-7cd4-4414-b575-044a6b5c54bc");

            Assert.IsTrue(Utils.Convert(getGeometry2.GetValue(0), ref geometry2));

            Autodesk.LibG.Surface patchedSurface1 = geometry2 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, patchedSurface1);
            Assert.AreEqual(113.4724961861788, patchedSurface1.area());
            Assert.IsFalse(patchedSurface1.closed_u());
            Assert.IsFalse(patchedSurface1.closed_v());
        }
Пример #12
0
        public void LoftTest()
        {
            var model = dynSettings.Controller.DynamoModel;

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

            model.Open(openPath);

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

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

            // Verification for loft created using ClosedCurves.
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <LoftNode>("b381dd87-683a-4452-9fe2-522cfbc92179");

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

            Autodesk.LibG.Surface loftedSruface = geometry1 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, loftedSruface);
            Assert.AreEqual(35.391268214374563, loftedSruface.area());
            Assert.IsTrue(loftedSruface.closed_u());
            Assert.IsFalse(loftedSruface.closed_v());

            // Verification for loft created using OpenCurves.
            Autodesk.LibG.Geometry geometry2 = null;
            var getGeometry2 = model.CurrentWorkspace.NodeFromWorkspace <LoftNode>("033bb339-bc85-4d1a-ac32-1b1ddf954fe1");

            Assert.IsTrue(Utils.Convert(getGeometry2.GetValue(0), ref geometry2));

            Autodesk.LibG.Surface loftedSruface1 = geometry2 as Autodesk.LibG.Surface;
            Assert.AreNotEqual(null, loftedSruface1);
            Assert.AreEqual(16.887305503979327, loftedSruface1.area());
            Assert.IsFalse(loftedSruface1.closed_u());
            Assert.IsFalse(loftedSruface1.closed_v());
        }