public void EdgeSelectionFailure()
        {
            // This test shall show that two edges which differ only in location
            // are properly selectable
            var ctx = Context.Current;

            var box         = Box.Create(10.0, 10.0, 5.0);
            var body        = Body.Create(box);
            var flangeSheet = FlangeSheet.Create(body, new SubshapeReference(SubshapeType.Face, box.Guid, 1), 45.0, 10.0, 5.0);

            flangeSheet.Relief = FlangeSheet.ReliefFlags.Rectangular;

            ctx.ViewportController.ZoomFitAll();

            var shape = Fillet.Create(body);

            shape.Radius = 2.0;
            var tool = new EdgeModifierTool(shape);

            ctx.WorkspaceController.StartTool(tool);

            Assert.Multiple(() =>
            {
                ctx.ViewportController.MouseMove(new Point(120, 200));
                AssertHelper.IsSameViewport(Path.Combine(_BasePath, "EdgeSelectionFailure1"));

                ctx.ViewportController.MouseDown();
                ctx.ViewportController.MouseUp(false);
                ctx.ViewportController.MouseMove(new Point(0, 0));
                AssertHelper.IsSameViewport(Path.Combine(_BasePath, "EdgeSelectionFailure2"));
            });
        }
        public void EdgeSelection()
        {
            var ctx = Context.Current;

            var box  = Box.Create(10.0, 10.0, 5.0);
            var body = Body.Create(box);

            ctx.ViewportController.ZoomFitAll();

            var shape = Fillet.Create(body);

            shape.Radius = 2.0;
            var tool = new EdgeModifierTool(shape);

            ctx.WorkspaceController.StartTool(tool);

            Assert.Multiple(() =>
            {
                ctx.MoveTo(139, 252);
                AssertHelper.IsSameViewport(Path.Combine(_BasePath, "EdgeSelection1"));

                ctx.SelectAt(139, 252);
                AssertHelper.IsSameViewport(Path.Combine(_BasePath, "EdgeSelection2"));

                tool.Stop();
                AssertHelper.IsSameViewport(Path.Combine(_BasePath, "EdgeSelection3"));
            });
        }
Beispiel #3
0
        public void DoubleKeysInContourDict()
        {
            var body = TestData.GetBodyFromBRep(Path.Combine(_BasePath, "DoubleKeysInContourDict_Source.brep"));

            var edge = body.Shape.GetSubshapeReference(SubshapeType.Edge, 40);

            Assume.That(edge, Is.Not.Null);

            var shape = Fillet.Create(body);

            shape.Edges = new[] { edge, edge };
            Assert.IsTrue(shape.Make(Shape.MakeFlags.None));
        }
Beispiel #4
0
        public void EdgeSelectionFailure()
        {
            var body = TestData.GetBodyFromBRep(Path.Combine(_BasePath, "EdgeSelectionFailure_Source.brep"));

            var edge1 = body.Shape.GetSubshapeReference(SubshapeType.Edge, 20);
            var edge2 = body.Shape.GetSubshapeReference(SubshapeType.Edge, 25);

            Assert.That(edge1, Is.Not.EqualTo(edge2));

            var shape = Fillet.Create(body);

            shape.Edges = new[] { edge1, edge2 };
            Assert.That(shape.Make(Shape.MakeFlags.None));
            Assert.That(ModelCompare.CompareShape(shape.GetBRep(), Path.Combine(_BasePath, "EdgeSelectionFailure")));
        }
Beispiel #5
0
        public void Cylinder()
        {
            var baseshape = new Cylinder()
            {
                Radius = 10,
                Height = 10,
            };
            var body = Body.Create(baseshape);

            var shape = Fillet.Create(body);

            shape.AddAllEdges();
            shape.Radius = 3;

            Assert.IsTrue(shape.Make(Shape.MakeFlags.None));
            Assert.IsTrue(ModelCompare.CompareShape(shape, Path.Combine(_BasePath, "Cylinder")));
        }
Beispiel #6
0
        public void LostEdge()
        {
            var extrude = TestGeomGenerator.CreateExtrude(TestSketchGenerator.SketchType.Rectangle);
            var fillet  = Fillet.Create(extrude.Body);

            fillet.AddEdge(extrude.GetSubshapeReference(SubshapeType.Edge, 11));
            Assert.IsTrue(fillet.Make(Shape.MakeFlags.None));

            // Remove segment by merging points
            var sketch = extrude.Predecessor as Sketch;

            sketch.Constraints.Clear();
            sketch.DeleteSegment(sketch.Segments[1]);
            sketch.MergePoints(1, 2);

            // It is ok to fail, it just should not crash
            Assert.IsFalse(fillet.Make(Shape.MakeFlags.None));
        }
Beispiel #7
0
        public void Box()
        {
            var baseshape = new Box()
            {
                DimensionX = 10,
                DimensionY = 10,
                DimensionZ = 10,
            };
            var body = Body.Create(baseshape);

            var shape = Fillet.Create(body);

            shape.AddAllEdges();
            shape.Radius = 3;

            Assert.IsTrue(shape.Make(Shape.MakeFlags.None));
            Assert.IsTrue(ModelCompare.CompareShape(shape, Path.Combine(_BasePath, "Box")));
        }
 void ExecuteSelectNone()
 {
     Fillet.RemoveAllEdges();
     CommmitChange();
 }
 void ExecuteSelectAll()
 {
     Fillet.AddAllEdges();
     CommmitChange();
 }
Beispiel #10
0
        public void BodyTopologyUndo()
        {
            // Create object and body, -> State1
            var box  = TestGeomGenerator.CreateBox();
            var body = box.Body;
            var box2 = TestGeomGenerator.CreateBox();

            Assert.IsFalse(Context.Current.UndoHandler.CanUndo);
            Assert.IsFalse(Context.Current.UndoHandler.CanRedo);
            var state1 = Serializer.Serialize(body, new SerializationContext());

            // Change topology -> State2
            body.SaveTopologyUndo();
            var fillet = Fillet.Create(body);

            fillet.Radius = 1;
            Context.Current.UndoHandler.Commit();
            Assert.IsTrue(Context.Current.UndoHandler.CanUndo);
            Assert.IsFalse(Context.Current.UndoHandler.CanRedo);
            var state2 = Serializer.Serialize(body, new SerializationContext());

            // Change toplogy -> State3
            box.DimensionZ = 8;
            body.SaveTopologyUndo();
            var boolean = BooleanCut.Create(body, box2);

            Context.Current.UndoHandler.Commit();
            Assert.IsTrue(Context.Current.UndoHandler.CanUndo);
            Assert.IsFalse(Context.Current.UndoHandler.CanRedo);
            var state3 = Serializer.Serialize(body, new SerializationContext());

            // Undo -> State2
            Context.Current.UndoHandler.DoUndo(1);
            Assert.IsTrue(Context.Current.UndoHandler.CanUndo);
            Assert.IsTrue(Context.Current.UndoHandler.CanRedo);
            var state2a = Serializer.Serialize(body, new SerializationContext());

            Assert.AreEqual(state2, state2a);

            // Redo -> State3
            Context.Current.UndoHandler.DoRedo(1);
            Assert.IsTrue(Context.Current.UndoHandler.CanUndo);
            Assert.IsFalse(Context.Current.UndoHandler.CanRedo);
            var state3a = Serializer.Serialize(body, new SerializationContext());

            Assert.AreEqual(state3, state3a);

            // Undo, Undo -> State 1
            Context.Current.UndoHandler.DoUndo(2);
            Assert.IsFalse(Context.Current.UndoHandler.CanUndo);
            Assert.IsTrue(Context.Current.UndoHandler.CanRedo);
            var state1a = Serializer.Serialize(body, new SerializationContext());

            Assert.AreEqual(state1, state1a);

            // Redo, Redo -> State 3
            Context.Current.UndoHandler.DoRedo(2);
            Assert.IsTrue(Context.Current.UndoHandler.CanUndo);
            Assert.IsFalse(Context.Current.UndoHandler.CanRedo);
            var state3b = Serializer.Serialize(body, new SerializationContext());

            Assert.AreEqual(state3, state3b);
        }