Exemple #1
0
        public void WindingDirectionDoesNotMatter()
        {
            string manifoldFile     = TestUtlities.GetStlPath("20mm-box");
            string manifoldGCode    = TestUtlities.GetTempGCodePath("20mm-box");
            string nonManifoldFile  = TestUtlities.GetStlPath("20mm-box bad winding");
            string nonManifoldGCode = TestUtlities.GetTempGCodePath("20mm-box bad winding");

            {
                // load a model that is correctly manifold
                ConfigSettings config    = new ConfigSettings();
                fffProcessor   processor = new fffProcessor(config);
                processor.setTargetFile(manifoldGCode);
                processor.LoadStlFile(manifoldFile);
                // slice and save it
                processor.DoProcessing();
                processor.finalize();
            }

            {
                // load a model that has some faces pointing the wroing way
                ConfigSettings config    = new ConfigSettings();
                fffProcessor   processor = new fffProcessor(config);
                processor.setTargetFile(nonManifoldGCode);
                processor.LoadStlFile(nonManifoldFile);
                // slice and save it
                processor.DoProcessing();
                processor.finalize();
            }

            // load both gcode files and check that they are the same
            string manifoldGCodeContent    = File.ReadAllText(manifoldGCode);
            string nonManifoldGCodeContent = File.ReadAllText(nonManifoldGCode);

            Assert.AreEqual(manifoldGCodeContent, nonManifoldGCodeContent);
        }
Exemple #2
0
        public void AlwaysRetractOnIslandChange()
        {
            string meshWithIslands  = TestUtlities.GetStlPath("comb");
            string gCodeWithIslands = TestUtlities.GetTempGCodePath("comb-box");

            {
                // load a model that has 3 islands
                ConfigSettings config = new ConfigSettings();
                // make sure no retractions are going to occure that are island crossing
                config.minimumTravelToCauseRetraction = 2000;
                fffProcessor processor = new fffProcessor(config);
                processor.setTargetFile(gCodeWithIslands);
                processor.LoadStlFile(meshWithIslands);
                // slice and save it
                processor.DoProcessing();
                processor.finalize();

                string[] gcodeContents = TestUtlities.LoadGCodeFile(gCodeWithIslands);
                int      numLayers     = TestUtlities.CountLayers(gcodeContents);
                for (int i = 1; i < numLayers - 1; i++)
                {
                    string[] layer          = TestUtlities.GetGCodeForLayer(gcodeContents, i);
                    int      numRetractions = TestUtlities.CountRetractions(layer);
                    Assert.IsTrue(numRetractions == 4);
                }
            }
        }
Exemple #3
0
        string CreateGcodeWithoutRaft(bool hasRaft)
        {
            string box20MmStlFile = TestUtlities.GetStlPath("20mm-box");
            string boxGCodeFile   = TestUtlities.GetTempGCodePath("20mm-box-f{0}.gcode".FormatWith(hasRaft));

            ConfigSettings config = new ConfigSettings();

            config.enableRaft = hasRaft;
            fffProcessor processor = new fffProcessor(config);

            processor.setTargetFile(boxGCodeFile);
            processor.LoadStlFile(box20MmStlFile);
            // slice and save it
            processor.DoProcessing();
            processor.finalize();

            return(boxGCodeFile);
        }
Exemple #4
0
        string CreateGCodeForLayerHeights(double firstLayerHeight, double otherLayerHeight, double bottomClip = 0)
        {
            string box20MmStlFile = TestUtlities.GetStlPath("20mm-box");
            string boxGCodeFile   = TestUtlities.GetTempGCodePath("20mm-box-f{0}_o{1}_c{2}.gcode".FormatWith(firstLayerHeight, otherLayerHeight, bottomClip));

            ConfigSettings config = new ConfigSettings();

            config.firstLayerThickness = firstLayerHeight;
            config.layerThickness      = otherLayerHeight;
            config.bottomClipAmount    = bottomClip;
            fffProcessor processor = new fffProcessor(config);

            processor.setTargetFile(boxGCodeFile);
            processor.LoadStlFile(box20MmStlFile);
            // slice and save it
            processor.DoProcessing();
            processor.finalize();

            return(boxGCodeFile);
        }