Example #1
0
        static void Main(string[] args)
        {
            /*
             * Konstanten
             */
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            string inputFile                 = @"Galgen.txt";
            int    randBreite                = 3;
            string currentPath               = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
            string path                      = currentPath + "\\";
            string fileName                  = @"Bahnplanung.txt";
            int    infillDensity             = 10;         //actual Infill Percentage might differ up to 5%
            string infillType                = "3DInfill"; //3DInfill oder HexInfill oder LineInfill oder Line3DInfill
            int    offset                    = 0;          //shifts axis aligned infill along the z axis
            double robotGeschwindigkeit      = 30.0;
            double extrusionsGeschwindigkeit = 36.0;

            /*
             * Konstanten
             */

            Console.WriteLine("Lese Modell ein...");
            Voxelmodell v = Input(path + inputFile);

            Console.WriteLine("Modell eingelesen!");

            Console.WriteLine("Verbreitere Rand...");
            v.randVerbreiterung(randBreite);
            Console.WriteLine("Rand verbreitert!");

            Console.WriteLine("Füge das Infill ein...");
            v.InsertInfill(infillDensity, infillType, offset);
            Console.WriteLine("Infill eingefügt!");

            Console.WriteLine("Plane die Bahn...");
            List <Bahn> bahn = new List <Bahn>();

            if (File.Exists(path + fileName))
            {
                File.Delete(path + fileName);
            }

            for (int i = 0; i < v.getSchichtenAnzahl(); i++)
            {
                bahn.Add(new Bahn());
            }

            Parallel.For(0, v.getSchichtenAnzahl(), j =>
            {
                Console.WriteLine("Processing Tool path for layer:" + j);
                bahn[j].SetBahn(bahn[j].Bahnplanung((v.getListeAtIndex(j)), j + 1));
            });
            bahn.Sort((x, y) => x.GetLayerIndex().CompareTo(y.GetLayerIndex()));
            for (int i = 1; i < bahn.Count + 1; i++)
            {
                bahn[i - 1].Textoutput(robotGeschwindigkeit, extrusionsGeschwindigkeit, path, fileName);
            }
            Console.WriteLine("Bahn geplant!");
        }
Example #2
0
        /// <summary>
        /// Testet Die Mustereinprägung in das Modell. Eingestellt auf 5*5*5 Muster.
        /// </summary>
        /// <param name="voxelmodell"></param>
        public static void testeMuster(int infillDensity, String infillType, int offset)
        {
            int x = 20, y = 20, z = 5;//Skaliert Linear ~14Sek für 1000000 Voxel;
            List <List <Voxel> > schichten = new List <List <Voxel> >();

            Voxel[,,] bb = new Voxel[x, y, z];
            for (ushort i = 0; i < x; i++)
            {
                schichten.Add(new List <Voxel>());
            }
            for (ushort i = 0; i < x; i++)
            {
                for (ushort j = 0; j < y; j++)
                {
                    for (ushort k = 0; k < z; k++)
                    {
                        Voxel v = new Voxel(false, false, i, j, k);
                        bb[i, j, k] = v;
                        schichten[i].Add(v);
                    }
                }
            }
            double      infill = x * y * z;
            double      counter = 0;
            Voxelmodell voxelmodell1 = new Voxelmodell(0, bb, schichten);;

            voxelmodell1.InsertInfill(infillDensity, infillType, offset);
            Voxel[,,] matrix = voxelmodell1.getVoxelmatrix();
            using (StreamWriter file = new StreamWriter(Path.Combine(Directory.GetCurrentDirectory(), "mustererzeugung.txt")))
            {
                file.WriteLine("#Muster mit %2 test");
                for (int i = 0; i < x; i++)
                {
                    for (int j = 0; j < y; j++)
                    {
                        for (int k = 0; k < z; k++)
                        {
                            string c;
                            if (matrix[i, j, k] == null)
                            {
                                c = "0"; //markiert leerer voxel
                            }
                            else
                            {
                                c = "1"; //voxel
                                file.WriteLine(i + " " + j + " " + k + " " + c);
                                counter++;
                            }
                        }
                    }
                }
                Console.WriteLine((counter / infill));
                Console.ReadKey();
            }
        }
        static void Main(string[] args)
        {
            /*
             * Konstanten
             */
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            string inputFile                 = @"Galgen.txt";
            int    randBreite                = 3;
            string currentPath               = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
            string path                      = currentPath + "\\";
            string fileName                  = @"Bahnplanung.txt";
            int    infillDensity             = 20;
            string infillType                = "3DInfill"; //3DInfill oder HexInfill oder LineInfill oder Line3DInfill
            int    offset                    = 0;          //für LineInfill
            double robotGeschwindigkeit      = 30.0;
            double extrusionsGeschwindigkeit = 36.0;

            /*
             * Konstanten
             */

            Console.WriteLine("Lese Modell ein...");
            Voxelmodell v = Input(path + inputFile);

            Console.WriteLine("Modell eingelesen!");

            Console.WriteLine("Verbreitere Rand...");
            v.randVerbreiterung(randBreite);
            Console.WriteLine("Rand verbreitert!");

            Console.WriteLine("Füge das Infill ein...");
            v.InsertInfill(infillDensity, infillType, offset);
            Console.WriteLine("Infill eingefügt!");

            Console.WriteLine("Plane die Bahn...");
            Bahn bahn = new Bahn();

            if (File.Exists(path + fileName))
            {
                File.Delete(path + fileName);
            }
            for (int i = 0; i < v.getSchichtenAnzahl(); i++)
            {
                Console.WriteLine("Plane die Bahn für Schicht " + i + "/" + v.getSchichtenAnzahl());
                bahn.Bahnplanung(v.getListeAtIndex(i), robotGeschwindigkeit, extrusionsGeschwindigkeit, path, fileName, (i + 1));
            }
            Console.WriteLine("Bahn geplant!");
        }
        /// <summary>
        /// Testet Die Mustereinprägung in das Modell. Eingestellt auf 5*5*5 Muster.
        /// </summary>
        /// <param name="voxelmodell"></param>
        public static void testeMuster()
        {
            int x = 30, y = 30, z = 30;
            List <List <Voxel> > schichten = new List <List <Voxel> >();

            schichten.Add(new List <Voxel>());
            Voxel[,,] bb = new Voxel[x, y, z];
            for (ushort i = 0; i < x; i++)
            {
                for (ushort j = 0; j < x; j++)
                {
                    for (ushort k = 0; k < x; k++)
                    {
                        Voxel v = new Voxel(false, false, i, j, k);
                        bb[i, j, k] = v;
                        schichten[0].Add(v);
                    }
                }
            }
            Voxelmodell voxelmodell1 = new Voxelmodell(0, bb, schichten);;

            voxelmodell1.InsertInfill();
            Voxel[,,] matrix = voxelmodell1.getVoxelmatrix();
            using (StreamWriter file = new StreamWriter(Path.Combine(Directory.GetCurrentDirectory(), "mustererzeugung.txt")))
            {
                file.WriteLine("#Muster mit %2 test");
                for (int i = 0; i < x; i++)
                {
                    for (int j = 0; j < y; j++)
                    {
                        for (int k = 0; k < z; k++)
                        {
                            string c;
                            if (matrix[i, j, k] == null)
                            {
                                c = "0"; //markiert leerer voxel
                            }
                            else
                            {
                                c = "1"; //leerer voxel
                                file.WriteLine(i + " " + j + " " + k + " " + c);
                            }
                        }
                    }
                }
            }
        }