List <MachinePreset> populate_defaults()
        {
            List <MachinePreset> new_defaults = new List <MachinePreset>();

            register_new_mfg_machines("Makerbot", Makerbot.UUID, MakerbotSettings.EnumerateDefaults(), new_defaults);
            register_new_mfg_machines("Monoprice", Monoprice.UUID, MonopriceSettings.EnumerateDefaults(), new_defaults);
            register_new_mfg_machines("Printrbot", Printrbot.UUID, PrintrbotSettings.EnumerateDefaults(), new_defaults);
            register_new_mfg_machines("RepRap", RepRap.UUID, RepRapSettings.EnumerateDefaults(), new_defaults);
            register_new_mfg_machines("Flashforge", Flashforge.UUID, FlashforgeSettings.EnumerateDefaults(), new_defaults);
            register_new_mfg_machines("Prusa", Prusa.UUID, PrusaSettings.EnumerateDefaults(), new_defaults);

            return(new_defaults);
        }
Exemple #2
0
        static string GenerateGCodeForMeshes(PrintMeshAssembly meshes)
        {
            bool ENABLE_SUPPORT_ZSHIFT = true;

            // configure settings
            //MakerbotSettings settings = new MakerbotSettings(Makerbot.Models.Replicator2);
            //FlashforgeSettings settings = new FlashforgeSettings(Flashforge.Models.CreatorPro);
            //MonopriceSettings settings = new MonopriceSettings(Monoprice.Models.MP_Select_Mini_V2);
            PrintrbotSettings settings = new PrintrbotSettings(Printrbot.Models.Plus);

            //PrusaSettings settings = new PrusaSettings(Prusa.Models.i3_MK3);

            //settings.ExtruderTempC = 215;
            //settings.Machine.NozzleDiamMM = 0.4;
            settings.Shells = 2;
            settings.InteriorSolidRegionShells = 0;
            settings.SparseLinearInfillStepX   = 5;
            //settings.SolidFillNozzleDiamStepX = 0;
            //settings.SolidFillBorderOverlapX = 0;
            //settings.SparseFillBorderOverlapX = 0;
            settings.ClipSelfOverlaps = false;
            //settings.RoofLayers = settings.FloorLayers = 0;
            //settings.LayerRangeFilter = new Interval1i(245, 255);
            //settings.LayerRangeFilter = new Interval1i(0, 0);

            settings.EnableBridging = true;

            settings.GenerateSupport         = false;
            settings.EnableSupportShell      = true;
            settings.SupportMinZTips         = false;
            settings.SupportSolidSpace       = 0.35;
            settings.SupportOverhangAngleDeg = 25;

            //settings.OuterShellLast = true;
            //settings.Shells = 0;

            //settings.Machine.NozzleDiamMM = 0.75;
            //settings.Machine.MaxLayerHeightMM = 0.5;
            //settings.FillPathSpacingMM = settings.Machine.NozzleDiamMM;
            //settings.LayerHeightMM = 0.5;

            settings.StartLayers        = 0;
            settings.StartLayerHeightMM = 0.3;


            //settings.LayerRangeFilter = new Interval1i(130, 140);

            LastSettings = settings.CloneAs <SingleMaterialFFFSettings>();

            System.Console.WriteLine("Slicing...");

            // slice meshes
            MeshPlanarSlicer slicer = new MeshPlanarSlicer()
            {
                LayerHeightMM = settings.LayerHeightMM
            };

            if (settings.StartLayers > 0)
            {
                int    start_layers       = settings.StartLayers;
                double std_layer_height   = settings.LayerHeightMM;
                double start_layer_height = settings.StartLayerHeightMM;
                slicer.LayerHeightF = (layer_i) => {
                    return((layer_i < start_layers) ? start_layer_height : std_layer_height);
                };
            }

            slicer.Add(meshes);
            PlanarSliceStack slices = slicer.Compute();

            System.Console.WriteLine("Generating GCode...");

            // run print generator
            SingleMaterialFFFPrintGenerator printGen =
                new SingleMaterialFFFPrintGenerator(meshes, slices, settings);

            if (ENABLE_SUPPORT_ZSHIFT)
            {
                printGen.LayerPostProcessor = new SupportConnectionPostProcessor()
                {
                    ZOffsetMM = 0.2f
                }
            }
            ;
            printGen.AccumulatePathSet = (SHOW_RELOADED_GCODE_PATHS == false);

            printGen.Generate();
            GCodeFile genGCode = printGen.Result;

            System.Console.WriteLine("Writing GCode...");

            string sWritePath          = "../../../sample_output/generated.gcode";
            StandardGCodeWriter writer = new StandardGCodeWriter();

            using (StreamWriter w = new StreamWriter(sWritePath)) {
                writer.WriteFile(genGCode, w);
            }

            if (settings is ISailfishSettings)
            {
                System.Diagnostics.Process.Start(GPX_PATH, (settings as ISailfishSettings).GPXModelFlag + " -p " + sWritePath);
            }

            View.PathDiameterMM = (float)settings.Machine.NozzleDiamMM - 0.005f;

            if (SHOW_RELOADED_GCODE_PATHS == false)
            {
                View.SetPaths(printGen.AccumulatedPaths, settings);
                View.SetSlices(slices);
            }

            return(sWritePath);
        }