Ejemplo n.º 1
0
        public static void makeHolder()
        {
            double innerSize = (Inches.One * 4);

            var cutout = new Cube(Inches.One * 10, Inches.Half, Inches.Half, true).Translate(0, innerSize/2, 0);

            cutout = cutout + cutout.Rotate(0, 0, 90) + cutout.Rotate(0, 0, 180) + cutout.Rotate(0, 0, 270);

            OSCADObject innerCyl = new Cylinder(innerSize, Inches.Eigth + Inches.Sixteenth, true) {
                Resolution = 60
            };
            var outerCyl = new Cylinder(innerSize + Inches.Eigth, Inches.Quarter + Inches.Sixteenth, true) {
                Resolution = 60
            };

            innerCyl = innerCyl.Translate(0, 0, outerCyl.Bounds().ZMax - (Inches.Eigth + Inches.Sixteenth)/2 + .1);
            var whole = (outerCyl - innerCyl) - cutout;
            whole.ToFile("coasterHolder-square").Open();
        }
Ejemplo n.º 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);
        }