def adaptive_path_drop_cutter(cls, surface, cutter, paths, sampling_size=0.04, min_sampling_size=0.01): apdc = ocl.AdaptivePathDropCutter() apdc.setSTL(surface) apdc.setCutter(cutter) # maximum sampling or "step-forward" distance # should be set so that we don't loose any detail of the STL model # i.e. this number should be similar or smaller than the smallest triangle apdc.setSampling(sampling_size) # minimum sampling or step-forward distance # the algorithm subdivides "steep" portions of the toolpath # until we reach this limit. # 0.0008 apdc.setMinSampling(min_sampling_size) cl_paths = [] n_points = 0 for path in paths: apdc.setPath(path) apdc.run() cl_points = apdc.getCLPoints() n_points += len(cl_points) cl_paths.append(apdc.getCLPoints()) return cl_paths
def adaptive_path_drop_cutter(s, cutter, path): apdc = ocl.AdaptivePathDropCutter() apdc.setSTL(s) apdc.setCutter(cutter) # set the minimum Z-coordinate, or "floor" for drop-cutter #apdc.minimumZ = -1 apdc.setSampling(0.04) apdc.setMinSampling(0.0008) apdc.setPath( path ) apdc.run() return apdc.getCLPoints()
def getPathsX(s, cutter, sampling, x): #apdc = ocl.PathDropCutter() apdc = ocl.AdaptivePathDropCutter() apdc.setSTL(s) apdc.setCutter(cutter) apdc.setZ(-20) apdc.setSampling(sampling) apdc.setMinSampling(sampling / 700) path = ocl.Path() p1 = ocl.Point(x, -1.52 * cutter.getDiameter(), -111) # start-point of line p2 = ocl.Point(x, +1.52 * cutter.getDiameter(), -111) # end-point of line l = ocl.Line(p1, p2) # line-object path.append(l) apdc.setPath(path) apdc.run() return apdc.getCLPoints()
#stl = camvtk.STLSurf("../stl/demo.stl") stl = camvtk.STLSurf("../stl/pycam-textbox.stl") print "STL surface read" myscreen.addActor(stl) stl.SetWireframe() polydata = stl.src.GetOutput() s= ocl.STLSurf() camvtk.vtkPolyData2OCLSTL(polydata, s) print "STLSurf with ", s.size(), " triangles" print s.getBounds() # define a cutter cutter = ocl.CylCutter(10, 50) # diameter, length #cutter = ocl.BullCutter(0.6, 0.01, 5) print cutter #pdc = ocl.PathDropCutter() # create a pdc apdc = ocl.AdaptivePathDropCutter() #pdc.setSTL(s) apdc.setSTL(s) #pdc.setCutter(cutter) # set the cutter apdc.setCutter(cutter) #print "set minimumZ" #pdc.minimumZ = -1 # set the minimum Z-coordinate, or "floor" for drop-cutter #apdc.minimumZ = -1 #print "set the sampling interval" #pdc.setSampling(0.4) apdc.setSampling(0.4) apdc.setMinSampling(0.0008) print " apdc sampling = ", apdc.getSampling()