public static void generateRaft()
        {
            Logger.logProgress("Generating raft");

            if (!Global.Values.shouldRaft || Global.Values.raftCount < 1)
            {
                return;
            }

            Polygons raftOutlines = generateRaftOutline();

            //Global.Values.layerComponentList = newLayerList;
            Global.Values.layerCount += Global.Values.raftCount;

            //To calculate the raft we will trim the vertical and horisontal grids with the raft density using a calculated raft outline

            var raftGrid = generateRaftGrid(raftOutlines, Global.Values.raftDensity);//Global.Values.infillGrids[0.3f];

            var lLines = InfillGenerator.clipLinesInPolygons(raftGrid.leftLines, raftOutlines);
            var rLines = InfillGenerator.clipLinesInPolygons(raftGrid.rightLines, raftOutlines);

            for (ushort i = 0; i < Global.Values.raftCount; i++)
            {
                LayerComponent raftLayer   = new LayerComponent(i);
                Island         raftIsland  = new Island();
                LayerSegment   raftSegment = new LayerSegment(SegmentType.RaftSegment);
                raftSegment.segmentSpeed = (i == 0) ? Global.Values.initialLayerSpeed : Global.Values.raftSpeed;
                raftSegment.fillLines    = new List <LineSegment>();
                raftSegment.fillLines.AddRange(lLines);
                raftSegment.fillLines.AddRange(rLines);
                raftSegment.outlinePolygons = raftOutlines;
                raftIsland.segmentList.Add(raftSegment);
                raftIsland.outlinePolygons = raftOutlines; //This is so that the skirt can still be calculated
                raftLayer.islandList.Add(raftIsland);

                Global.Values.layerComponentList.Insert(i, raftLayer);
            }
        }
Beispiel #2
0
        public void sliceFile(string inputFile, string outputFile, string settingsFile)
#endif
        {
            //Logger.logEvent += Logger_logEvent;

            Global.Values = new GlobalValues();

            SettingsImporter.importSettingsFromFile(settingsFile);

            ModelImporter.importModelFile(inputFile);

            ModelImporter.calculateModelSize();

            ModelImporter.optimiseOriginalTriangles();

            Global.Values.layerCount = ModelImporter.calculateAmountOfLayer();

            SettingsImporter.setupLayerValues();

            LayerSlicer.sliceTrianglesIntoLayers();            //Werk kosher

            LayerAnaliser.calculateIslandsFromOriginalLines(); //Werk kosher

            Global.Values.initialTriangleList = null;

            PolygonOptimiser.optimiseOutlinePolygons(); //Werk kosher ma kan dalk optimize

            LayerAnaliser.generateOutlineSegments();

            InfillGenerator.generateInfillGrids();

            //The top and bottom segments need to calculated before the infill outlines otherwise the infill will be seen as top or bottom

            LayerAnaliser.calculateToBottomSegments();

            LayerAnaliser.calculateInfillSegments();

            LayerAnaliser.calculateSupportSegments();

            LayerAnaliser.combineInfillSegments();

            InfillGenerator.trimInfillGridsToFillSegments();

            RaftGenerator.generateRaft();

            //Calculate skirt here sothat it does not affect the above operations
            SkirtCreator.generateSkirt();

            ToolpathGenerator.calculateToolPath();

            AccelerationCalculator.calculateAcceleration();

            //GcodeWriter.writeGCode(outputFile);

            DTPWriter.writeDTPFile(outputFile);

            /*GcodeGenerator.calculateMoveSegments();
             *
             * ValueEstimator.estimateLayerTimesAndFix();
             *
             * ValueEstimator.estimateValues();
             *
             * GcodeWriter gcodeWriter = new GcodeWriter(outputFile);
             *
             * gcodeWriter.writeStartCode();
             *
             * gcodeWriter.writeMoveSegments();
             *
             * gcodeWriter.writeEndCode();*/

            Logger.logProgress("Finished");
        }