This seems like it should be something extremely straight forward but I don't think I've ever been able to get it to work correctly. Trying to remove all primitives using the removeAll() function always results in the following error message:
DeveloperError: This object was destroyed, i.e., destroy() was called. Error at new t (http://bgb/js/lib/Cesium/Cesium.js:378:6242) at o (http://bgb/js/lib/Cesium/Cesium.js:379:4905) at lt.destroy (http://bgb/js/lib/Cesium/Cesium.js:393:12373) at a.removeAll (http://bgb/js/lib/Cesium/Cesium.js:410:14862) at <anonymous>:2:15 at Object.InjectedScript._evaluateOn (<anonymous>:668:39) at Object.InjectedScript._evaluateAndWrap (<anonymous>:607:52) at Object.InjectedScript.evaluate (<anonymous>:519:21)
and then the globe locks up and the page has to be refreshed. Am I missing something? Looking in the SandCastle, I see examples where primitives.removeAll() is called and it seems to work normally.