Exemple #1
0
 //multislicing boilerplate code
 public void multislice(string configname, bool getOnlyToolpaths, string arguments, string stlfile_arg)
 {
     doActionForFile(configname, stlfile_arg, (string stlfile) => {
         if (arguments.Length == 0)
         {
             throw new ApplicationException("Arguments must be provided!!!");
         }
         using (SI.ExternalSlicerManager external = createExternalSlicerManager(stlfile)) {
             try {
                 using (SI.MultiSlicerHandler handler = new SI.MultiSlicerHandler(dll, arguments)) {
                     bool alsoContours = !getOnlyToolpaths && (handler.alsoContours);
                     modifyAutoCADDocument((Transaction tr, BlockTableRecord btr) => {
                         if (handler.usingScheduler)
                         {
                             multislice_3dscheduler(external, handler, alsoContours, tr, btr);
                         }
                         else
                         {
                             multislice_2dsimple(external, handler, alsoContours, tr, btr);
                         }
                     });
                 }
             } catch {
                 external.terminate();
                 throw;
             }
         }
     });
 }
Exemple #2
0
 //use only external slice
 public void externalSlice(string configname, double zstep, string stlfile_arg)
 {
     doActionForFile(configname, stlfile_arg, (string stlfile) => {
         using (SI.ExternalSlicerManager external = createExternalSlicerManager(stlfile)) {
             try {
                 double[] zs          = external.prepareSTLSimple(zstep);
                 int numslices        = zs.Length;
                 double scalingFactor = external.scalingFactor;
                 modifyAutoCADDocument((Transaction tr, BlockTableRecord btr) => {
                     for (int i = 0; i < numslices; ++i)
                     {
                         SI.IntPoint[][] paths = external.readSlice();
                         showExternalSlice(paths, scalingFactor, zs[i], tr, btr);
                     }
                 });
             } catch {
                 external.terminate();
                 throw;
             }
         }
     });
 }