//2d simple multislicing private unsafe void multislice_2dsimple(SI.ExternalSlicerManager external, SI.MultiSlicerHandler handler, bool alsoContours, Transaction tr, BlockTableRecord btr) { double zstep = handler.z_uniform_step; double[] zs = handler.use_z_base ? external.prepareSTLSimple(zstep, handler.z_base) : external.prepareSTLSimple(zstep); int numslices = zs.Length; for (int i = 0; i < numslices; ++i) { SI.IntPoint[][] rawslice = external.readSlice(); if (rawslice.Length == 0) { continue; } if (alsoContours) { showExternalSlice(rawslice, external.scalingFactor, zs[i], tr, btr); } void *slice = handler.feedRawSliceIntoDll(rawslice); rawslice = null; void *result = handler.computeSlice2D(slice); //the slice is freed in computeSlice2D() if (result == null) { throw new ApplicationException("Error in compute2D: " + dll.err); } try { const bool mode2D = true; int ntools = handler.numProcesses; for (int j = 0; j < ntools; ++j) { readOutputSlices(result, mode2D, alsoContours, zs[i], j, tr, btr); } } finally { if (result != null) { dll.freeResult(result); } } } }
//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; } } }); }