Example #1
0
        public void LocatedWire()
        {
            var source = TestData.GetBodyFromBRep(@"SourceData\Brep\ContourLocatedWire.brep");

            Assume.That(source?.GetBRep() != null);

            var template = new SliceContourComponent()
            {
                Owner         = source,
                LayerCount    = 1,
                ReferenceFace = source.Shape.GetSubshapeReference(SubshapeType.Face, 2)
            };

            Assert.IsTrue(template.Make());
            var path = Path.Combine(TestData.TestDataDirectory, Path.Combine(_BasePath, "LocatedWire_TestResult.dxf"));

            try
            {
                Assert.IsTrue(template.Export(path, new DxfExchanger()));
            }
            catch (SEHException)
            {
                var info = ExceptionHelper.GetNativeExceptionInfo(Marshal.GetExceptionCode(), Marshal.GetExceptionPointers());
                TestContext.WriteLine(info.Message);
                throw;
            }

            AssertHelper.IsSameTextFile(Path.Combine(_BasePath, "LocatedWire.dxf"), path, AssertHelper.TextCompareFlags.IgnoreFloatPrecision);
        }
Example #2
0
        public void MultipleHoles()
        {
            var source = TestData.GetBodyFromBRep(@"SourceData\Brep\ContourMultipleHoles.brep");

            Assume.That(source?.GetBRep() != null);

            var template = new SliceContourComponent()
            {
                Owner      = source,
                LayerCount = 2,
            };

            Assert.IsTrue(template.Make());
            var path = Path.Combine(TestData.TestDataDirectory, Path.Combine(_BasePath, "MultipleHoles_TestResult.dxf"));

            Assert.IsTrue(template.Export(path, new DxfExchanger()));

            AssertHelper.IsSameTextFile(Path.Combine(_BasePath, "MultipleHoles.dxf"), path, AssertHelper.TextCompareFlags.IgnoreFloatPrecision);
        }
        public void BoundaryIsClosed()
        {
            var source = TestData.GetBodyFromBRep(Path.Combine(_BasePath, "BoundaryIsClosed_Source.brep"));

            Assume.That(source?.GetBRep() != null);

            var template = new SliceContourComponent()
            {
                Owner      = source,
                LayerCount = 1,
            };

            Assert.IsTrue(template.Make());
            var path = Path.Combine(TestData.TestDataDirectory, Path.Combine(_BasePath, "BoundaryIsClosed_TestResult.svg"));

            Assert.IsTrue(template.Export(path, new SvgExchanger()));

            AssertHelper.IsSameFile(Path.Combine(_BasePath, "BoundaryIsClosed.svg"), path);
        }
        public void TwoLayerCutout()
        {
            var source = TestData.GetBodyFromBRep(@"SourceData\Brep\SheetWithTwoLayers.brep");

            Assume.That(source?.GetBRep() != null);

            var template = new SliceContourComponent
            {
                Owner      = source,
                LayerCount = 2,
            };

            Assert.IsTrue(template.Make());
            var path = Path.Combine(TestData.TestDataDirectory, Path.Combine(_BasePath, "TwoLayerContour_TestResult.svg"));

            Assert.IsTrue(template.Export(path, new SvgExchanger()));

            AssertHelper.IsSameFile(Path.Combine(_BasePath, "TwoLayerContour.svg"), path);
        }
        public void SimpleContour()
        {
            var source = TestData.GetBodyFromBRep(@"SourceData\Brep\SheetWithOneLayer.brep");

            Assume.That(source?.GetBRep() != null);

            var template = new SliceContourComponent
            {
                Owner      = source,
                LayerCount = 1,
            };

            Assert.IsTrue(template.Make());
            var path = Path.Combine(TestData.TestDataDirectory, Path.Combine(_BasePath, "SimpleContour_TestResult.svg"));

            Assert.IsTrue(template.Export(path, new SvgExchanger()));

            AssertHelper.IsSameTextFile(Path.Combine(_BasePath, "SimpleContour.svg"), path, AssertHelper.TextCompareFlags.IgnoreFloatPrecision);
        }