# shift the old object in X for path in paths: path[:, 0] += shiftX sliced.setLayerFromClipperObject(nlayer, paths) # show the original and the modified objects if show3D: import pyslic3r.plot3d as p3 p3.mayaplotN([sliced, newsliced]) if show2D: import pyslic3r.plot2d as p2 p2.showSlices([sliced, newsliced], modeN=True, BB=[]) # write the objects to disk as sequences of ClipperPaths # and Z values, ready to be read by the patched version # of slic3r. The three Z values are required by slic3r's # internal logic, and are the height, the upper boundary # and the center of each slice, respectively. # note that, instead of adding the modified slices to 'newsliced', # we could have just made "aux2 = c.ClipperPaths()" instead of # "aux2 = c.ClipperPolyTree()", and collect copies of aux2 (made # with "aux2.copy()") in a list, so here we could just plug that # list, instead of having to use again the generator # newsliced.layersToClipperPaths() pathsAndZss = [(paths, (layerHeight, z + layerHeight / 2, z)) for paths, z in zip(newsliced.layersToClipperPaths(), zs)]
configurable render settings (colors, markers, transparencies, etc.). See the source code for details. With parameter modeN=False, showSlices() just shows one object. However, if modeN=True, it expects its first parameter to be a list of objects with many slices (for example a SlicedModel or a list of ClipperPaths), which are shown together. HOWEVER, these objects should have identical numbers of layers, otherwise the behaviour is undefined. """ mesh = p.TriangleMesh('test.stl') zs = n.array([0.1, 5.1]) sliced = mesh.doslice(zs) #use the up/down arrow keys to navigate the slices p2.showSlices(sliced, modeN=False) #Now, show two entities at the same time, the first #one a SlicedMode, the second a list of ClipperPaths: #displace in X a copy of slices pathss = list(sliced.layersToClipperPaths()) for paths in pathss: for path in paths: path[:,0] += 100000000 #use the up/down arrow keys to navigate the slices p2.showSlices([sliced, pathss], modeN=True, BB=[])