예제 #1
0
        public void SetToolpaths(ToolpathGenerator generator)
        {
            DiscardToolpaths();

            ToolpathSO so = new ToolpathSO();

            so.Create(generator.Toolpaths, generator.Settings.CloneAs <SingleMaterialFFFSettings>(), CCMaterials.PreviewMeshMaterial);
            so.SetSlices(generator.Slices);

            CurrentLayersInfo = generator.LayerInfo;

            // make sure current layer value is valid
            current_layer = MathUtil.Clamp(current_layer, 0, CurrentLayersInfo.Count - 1);

            // update toolpaths
            CurrentToolpaths = so;
            CC.ActiveScene.AddSceneObject(CurrentToolpaths, false);
            CurrentToolpaths.ZInterval = CurrentLayersInfo.GetLayerZInterval(current_layer);

            CC.GCodeAnalysis.AddToolpaths(CurrentToolpaths);
        }
예제 #2
0
        public static void Initialize(FContext context)
        {
            ActiveContext = context;
            ActiveContext.Scene.SelectionChangedEvent += Scene_SelectionChangedEvent;
            ActiveContext.Scene.ChangedEvent          += Scene_ChangedEvent;

            PrinterDB = new SettingsDatabase();
            Settings  = new PrintSettings();

            PrinterDB.OnPrinterSelectionModified += PrinterDB_OnPrinterSelectionModified;
            PrinterDB.OnPresetSelectionModified  += PrinterDB_OnPresetSelectionModified;

            PrinterDB.Initialize();
            Settings.UpdateFromSettings(PrinterDB.ActivePreset.Settings);
            update_printer_bed();


            ObjSettings = new ObjectSettings();
            CCActions.UpdateObjectSettings();

            Objects = new PrintScene();

            Toolpather = new ToolpathGenerator();
            Toolpather.ToolpathsProgressEvent += (status) => {
                ToolpathProgressEvent?.Invoke(status);
            };

            Slicer = new GeometrySlicer();
            Slicer.SlicingProgressEvent += (status) => {
                SlicingProgressEvent?.Invoke(status);
            };
            Slicer.SlicingInvalidatedEvent += () => { InvalidateToolPaths(); };

            MeshAnalysis  = new MeshAnalysisManager();
            GCodeAnalysis = new GCodeAnalysisManager();
            GCodeAnalysis.EnableUpdates = false;

            FileMonitor = new ExternalFileMonitor();
        }