@@ -139,12 +139,18 @@ private int opToIndex(CaDoodleOperation op) {
139139 }
140140 throw new IndexOutOfBoundsException ();
141141 }
142+ private boolean inCache (CaDoodleOperation op ) {
143+ int opIndex = opToIndex (op );
144+ File cacheFile = new File (objectDir .getAbsolutePath ()+delim ()+opIndex );
145+ return cacheFile .exists ();
146+ }
142147 private List <CSG > getCachedCSGs (CaDoodleOperation op ) {
143148
144149 if (cache .get (op )==null ) {
145150 int opIndex = opToIndex (op );
146151 File cacheFile = new File (objectDir .getAbsolutePath ()+delim ()+opIndex );
147152 Log .debug ("Loading Cached Objects from file: " +cacheFile .getAbsolutePath ());
153+ //Log.error(new Exception());
148154 try (ObjectInputStream ois = new ObjectInputStream (new FileInputStream (cacheFile ))) {
149155 if (getFreeMemory ()>50 ) {
150156 com .neuronrobotics .sdk .common .Log .error ("\n \n Updated Memory use: " + getFreeMemory () + "\n \n " );
@@ -240,14 +246,15 @@ public void initialize() {
240246 if (op == null )
241247 continue ;
242248 setPercentInitialized (((double ) i ) / (double ) getOpperations ().size ());
243- try {
244- process (op );
245- } catch (Throwable t ) {
246- com .neuronrobotics .sdk .common .Log .error (t );
247- indexStarting = i + 1 ;
248- break ;
249- // opperations.remove(op);
250- }
249+ if (!inCache (op ))
250+ try {
251+ process (op );
252+ } catch (Throwable t ) {
253+ com .neuronrobotics .sdk .common .Log .error (t );
254+ indexStarting = i + 1 ;
255+ break ;
256+ // opperations.remove(op);
257+ }
251258 }
252259 setCurrentIndex (indexStarting );
253260 updateCurrentFromCache ();
0 commit comments