Hardware Reference
In-Depth Information
FIGURE 6-10 The contents of the scanned file
Cleaning the.Duplicator Room
Fancy a spring clean? Sometimes it is useful to have a fresh start and just clear the
room. You could do this by demolishing the room and rebuilding it, but it's really easy
to add a clean feature, as it is only the coordinates that differ from the demolish
Room() function.
1. Modify the cleanRoom() function so that it looks like this. Note how the start
coordinates are all bigger than the edge of the room, and the end coordinates are
not as far over as in the demolishRoom() function. This way, it clears the inner
space of the room without destroying its walls:
def cleanRoom():
mc.setBlocks(roomx+1, roomy+1, roomz+1,
roomx+SIZEX+1, roomy+SIZEY+1, roomz+SIZEZ+1,
block.AIR.id)
2. Save your program and run it again. Create something inside the room and then
choose option 6 to test whether you can clear the room quickly.
Printing from.the Duplicator Room
Printing (duplicating) the object that is in the room is really easy, because you have
already written the print3D.py program that does this, and it is identical. Here it is
again so you can see it all in one place:
def print3D(filename, originx, originy, originz):
f = open(filename, "r")
lines = f.readlines()
coords = lines[0].split(",")
sizex = int(coords[0])
 
Search WWH ::




Custom Search