예제 #1
0
        private static void makeBracket()
        {
            OSCADObject cube = new Cube(new Vector3(Inches.ToMillimeters(2.75), Inches.One, Inches.ToMillimeters(1.25)), true);
            var outside = cube.Clone();
            ((Cube)outside).Size.X += Inches.Sixteenth;
            ((Cube)outside).Size.Z += Inches.Sixteenth;
            cube = cube.Scale(2, 1, 1).Translate(0, Inches.Sixteenth, 0);

            var obj = outside - cube;
            var bounds = obj.Bounds();

            obj = obj + getEndCover(outside).Translate(bounds.XMax, 0, 0);
            obj = obj + getEndCover(outside).Translate(-bounds.XMax, 0, 0);

            obj.ToFile("leftBracket").Open();
        }
예제 #2
0
        public void OSCADObject_ClonedObjectsRetainTheirNamesAfterBasicTransforms()
        {
            var obj = new Cube() { Name = "Cube" }
                            .Translate(1, 1, 1);
            obj.Name = "TranslatedCube";
            obj = obj.Rotate(0, 90, 0);
            obj.Name = "RotatedAndTranslatedCube";
            obj = obj.Scale(1, 1, 2);
            obj.Name = "ScaledAndRotatedAndTranslatedCube";

            var clone = obj.Clone();

            Assert.AreEqual("ScaledAndRotatedAndTranslatedCube", clone.Name);

            var children = clone.Children().ToList();
            Assert.AreEqual("RotatedAndTranslatedCube", children[0].Name);
            Assert.AreEqual("TranslatedCube", children[1].Name);
            Assert.AreEqual("Cube", children[2].Name);
        }