예제 #1
0
        void update_toolpaths(bool immediate = false)
        {
            if (immediate == false && time_to_start_new_compute() == false)
            {
                return;
            }

            // have to wait for valid slice stack
            PrintMeshAssembly meshes;
            PlanarSliceStack  slices;
            bool valid = CC.Slicer.ExtractResultsIfValid(out meshes, out slices);

            if (valid == false)
            {
                return;
            }
            if (slices == null)
            {
                ToolpathsProgressEvent?.Invoke(ToolpathProgressStatus.Failed);
                return;
            }

            BackgroundThreadData d = new BackgroundThreadData();

            d.PrintSettings       = CC.Settings.CloneCurrentSettings();
            d.Meshes              = meshes;
            d.SliceSet            = slices;
            d.InterpretGCodePaths = ShowActualGCodePaths;

            mark_spawn_time();
            spawn_new_compute(d);
        }
예제 #2
0
 void do_progress()
 {
     if (ToolpathsProgressEvent != null && active_compute != null)
     {
         if (active_compute.Finished && active_compute.Success == false)
         {
             ToolpathsProgressEvent?.Invoke(ToolpathProgressStatus.Failed);
         }
         else
         {
             int total = 1, progress = 0;
             active_compute.SafeProgressQuery(ref total, ref progress);
             ToolpathsProgressEvent?.Invoke(new ToolpathProgressStatus(progress, total));
         }
     }
 }
예제 #3
0
        bool process_completed_compute()
        {
            if (active_compute != null)
            {
                if (active_compute.Finished)
                {
                    lock (active_compute_lock) {
                        if (active_compute.Success)
                        {
                            CurrentGCode    = active_compute.gcode;
                            Toolpaths       = active_compute.paths;
                            LayerInfo       = active_compute.layerInfo;
                            Settings        = active_compute.PrintSettings;
                            Slices          = active_compute.SliceSet;
                            ToolpathsValid  = true;
                            ToolpathsFailed = false;

                            ToolpathsProgressEvent?.Invoke(new ToolpathProgressStatus(1, 1));

                            CC.Objects.SetToolpaths(this);
                        }
                        else
                        {
                            CurrentGCode    = null;
                            Toolpaths       = null;
                            LayerInfo       = null;
                            Settings        = null;
                            Slices          = null;
                            ToolpathsValid  = false;
                            ToolpathsFailed = true;

                            // notify of failure here?
                            ToolpathsProgressEvent?.Invoke(ToolpathProgressStatus.Failed);
                        }

                        active_compute        = null;
                        active_compute_thread = null;
                        return(true);
                    }
                }
            }
            return(false);
        }