예제 #1
0
 public void ShouldCreateCalculator()
 {
     DwgTest.ExecuteActionsInDwg(KnownValues.Notches1.DrawingPath, (db, tx) =>
     {
         var calculator = KnownValues.Notches1.ToProjector(db, tx);
         calculator.ShouldNotBeNull();
     });
 }
예제 #2
0
 public void LengthsAreEqual()
 {
     DwgTest.ExecuteActionsInDwg(KnownValues.Notches1.DrawingPath, (db, trans) =>
     {
         var(sourceCurve, sourceNotches, targetCurve) = KnownValues.Notches1.ToObjects(db, trans);
         var sourceLength     = (sourceCurve as Polyline).Length;
         var distSourceLength = AcadHelpers.GetCurveLength(sourceCurve);
         sourceLength.ShouldBe(distSourceLength);
     });
 }
예제 #3
0
 public void InvalidInputsShouldNotExist()
 {
     DwgTest.ExecuteActionsInDwg(KnownValues.Notches1.DrawingPath, (db, trans) =>
     {
         var invalidHandle = new Handle(0xfffff); // let's just assume it does not exist
         db.TryGetObjectId(invalidHandle, out var objectId).ShouldBeFalse();
         objectId.IsNull.ShouldBeTrue();
         objectId.IsValid.ShouldBeFalse();
     });
 }
예제 #4
0
 public void TestInputsShouldExist()
 {
     DwgTest.ExecuteActionsInDwg(KnownValues.Notches1.DrawingPath, (db, trans) =>
     {
         KnownValues.Notches1.SourceCurveHandle.ShouldExistIn(db, trans);
         KnownValues.Notches1.TargetCurveHandle.ShouldExistIn(db, trans);
         foreach (var lineHandle in KnownValues.Notches1.SourceNotchLines)
         {
             lineHandle.ShouldExistIn(db, trans);
         }
     });
 }
예제 #5
0
        public void ShouldProject()
        {
            DwgTest.ExecuteActionsInDwg(KnownValues.Notches1.DrawingPath, (db, tx) =>
            {
                var projector     = KnownValues.Notches1.ToProjector(db, tx);
                var targetNotches = projector.Project();

                AcadHelpers.GeneratePoints(db, tx, targetNotches);
                AcadHelpers.ConfigurePointsToBeVisible(db);

                return(KnownValues.Notches1.GenerateSnapshotDrawingPath());
            });
        }
예제 #6
0
        public void ShouldFindNotchPointsByLinesOnCurve()
        {
            DwgTest.ExecuteActionsInDwg(KnownValues.Notches1.DrawingPath, (db, trans) =>
            {
                var sourceCurve = AcadHelpers.GetObject <Polyline>(KnownValues.Notches1.SourceCurveHandle, db, trans);

                foreach (var lineHandle in KnownValues.Notches1.SourceNotchLines)
                {
                    var line = AcadHelpers.GetObject <Line>(lineHandle, db, trans);
                    AcadHelpers.GetSingleIntersection(sourceCurve, line);
                }
            });
        }
예제 #7
0
        public void Props()
        {
            DwgTest.ExecuteActionsInDwg(KnownValues.Notches1.DrawingPath, (db, trans) =>
            {
                var(sourceCurve, sourceNotches, targetCurve) = KnownValues.Notches1.ToObjects(db, trans);

                var notchCollection = new Point3dCollection(sourceNotches.ToArray());
                var notchSegments   = sourceCurve.GetSplitCurves(notchCollection);

                var sourceLength = AcadHelpers.GetCurveLength(sourceCurve);

                var facet1 = notchSegments[0] as Curve;

                var facet1Length         = AcadHelpers.GetCurveLength(facet1);
                var facet1RatioByLengths = facet1Length / sourceLength;

                //var facet1RatioByParams = sourceCurve.GetParameterAtPoint(notchCollection[0]) / (sourceCurve.EndParam - sourceCurve.StartParam);
                //facet1RatioByLengths.ShouldBe(facet1RatioByParams);
            });
        }