public void ShouldCreateCalculator() { DwgTest.ExecuteActionsInDwg(KnownValues.Notches1.DrawingPath, (db, tx) => { var calculator = KnownValues.Notches1.ToProjector(db, tx); calculator.ShouldNotBeNull(); }); }
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); }); }
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(); }); }
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); } }); }
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()); }); }
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); } }); }
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); }); }