public void Dispose() { DynaShapeViewExtension.ViewModel.RequestViewRefresh -= RequestViewRefreshHandler; DynaShapeViewExtension.DynamoWindow.Dispatcher.Invoke(() => { List <Model3D> sceneItems = DynaShapeViewExtension.GetViewport().ItemsSource as List <Model3D>; if (sceneItems.Contains(pointModel)) { sceneItems.Remove(pointModel); } pointModel.Detach(); pointModel.Dispose(); if (sceneItems.Contains(lineModel)) { sceneItems.Remove(lineModel); } lineModel.Detach(); lineModel.Dispose(); foreach (MeshGeometryModel3D meshModel in meshModels) { if (sceneItems.Contains(meshModel)) { sceneItems.Remove(meshModel); } meshModel.Detach(); meshModel.Dispose(); } }); }
internal void ClearRender() { DynaShapeViewExtension.ViewModel.RequestViewRefresh -= RequestViewRefreshHandler; DynaShapeViewExtension.DynamoWindow.Dispatcher.Invoke(() => { List <Model3D> sceneItems = DynaShapeViewExtension.GetSceneItems(); if (sceneItems.Contains(pointModel)) { sceneItems.Remove(pointModel); } pointModel.Detach(); pointModel.Dispose(); if (sceneItems.Contains(lineModel)) { sceneItems.Remove(lineModel); } lineModel.Detach(); lineModel.Dispose(); if (sceneItems.Contains(billboardTextModel)) { sceneItems.Remove(billboardTextModel); } billboardTextModel.Detach(); billboardTextModel.Dispose(); foreach (MeshGeometryModel3D meshModel in meshModels) { if (sceneItems.Contains(meshModel)) { sceneItems.Remove(meshModel); } meshModel.Detach(); meshModel.Dispose(); } }); }