/** * #Companion: Clean up unnecessary meshes and components. */ public void Cleanup() { // Clear ShapeDetection if (CompanionMR.ShapeDetection.Instance != null) { CompanionMR.ShapeDetection.Instance.ClearGeometry(); } if (CompanionMR.ShapeDefinition.IsInitialized) { CompanionMR.ShapeDefinition.Instance.Clear(); } // Clear PlacementSolver SpatialUnderstandingDllObjectPlacement.Solver_RemoveAllObjects(); if (CompanionMR.PlacementSolver.Instance != null) { CompanionMR.PlacementSolver.Instance.Clear(); } // Clear Meshes if (SpatialMappingManager.IsInitialized) { SpatialMappingManager.Instance.CleanupObserver(); } this.UnderstandingSourceMesh.Cleanup(); // cleanup mapping mesh copies this.UnderstandingDLL.UnpinAllObjects(); // cleanup intern meshes this.UnderstandingCustomMesh.Cleanup(); // cleanup understanding meshes // Clear DLL SpatialUnderstandingDll.Imports.SpatialUnderstanding_Term(); SpatialUnderstandingDll.Imports.SpatialUnderstanding_Init(); // Reset SpatialUnderstanding this.ScanState = ScanStates.None; }
/** * Remove all placement results. * * @param removeAllObjects indicates whether all instantiated placement results should also be removed */ public void ClearGeometry(bool removeAllObjects = false) { this.placementResults.Clear(); if (removeAllObjects && SpatialUnderstanding.IsInitialized && SpatialUnderstanding.Instance.AllowSpatialUnderstanding) { SUDLLOP.Solver_RemoveAllObjects(); } }