public void RemoveToolpaths(ToolpathSO sourceSO) { List <AnalysisViz> found; lock (SOToAnalysis) { if (SOToAnalysis.TryGetValue(sourceSO, out found)) { foreach (var analysis in found) { analysis.OnComputeUpdateRequired -= OnVisualizationRequestedUpdate; analysis.OnGeometryUpdateRequired -= OnVisualizationHasGeometryUpdate; analysis.Disconnect(); } SOToAnalysis.Remove(sourceSO); } } lock (DirtyList) { if (found != null) { foreach (var analysis in found) { DirtyList.Remove(analysis); } } } }
public ToolpathDeviationViz(ToolpathSO so) { SO = so; //SO.OnMeshModified += OnInputModified; HighDeviationMaterial = MaterialUtil.CreateTransparentMaterialF(Colorf.VideoRed); MedDeviationMaterial = MaterialUtil.CreateTransparentMaterialF(Colorf.Orange); LowDeviationMaterial = MaterialUtil.CreateTransparentMaterialF(Colorf.Yellow); }
public void DiscardToolpaths() { if (CurrentToolpaths != null) { CC.GCodeAnalysis.RemoveToolpaths(CurrentToolpaths); CC.ActiveScene.RemoveSceneObject(CurrentToolpaths, true); CurrentToolpaths = null; } slice_gizmo_valid = false; }
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); }
private void OnInputModified(ToolpathSO so) { OnComputeUpdateRequired?.Invoke(this); }
public void AddToolpaths(ToolpathSO sourceSO) { AnalysisViz boundaries = new ToolpathDeviationViz(sourceSO); add_new_so_analysis(sourceSO, boundaries); }