def generate(self, bounds, blocktypes): # self.systemsBox.value() schematic = createSchematic(bounds.size, blocktypes) dim = schematic.getDimension() system = koch.Snowflake(dim.bounds, blocktype=self.blocktypeButton.block) symbol_list = [system] max_iterations = self.iterationsSlider.value() def process(_symbol_list): for iteration, _symbol_list in applyReplacementsIterated(_symbol_list, max_iterations): yield iteration, max_iterations yield _symbol_list symbol_list = showProgress("Generating...", process(symbol_list), cancel=True) if symbol_list is False: return import pprint pprint.pprint(symbol_list) rendering = renderBlocks(symbol_list) print("Rendering %d blocks" % len(rendering)) for x, y, z, blockType in rendering: dim.setBlock(x, y, z, blockType) return schematic
def generateInSchematic(self, dimension, originalBounds): symbol_list = self.createSymbolList(originalBounds) if symbol_list is None: return None log.info("Rendering symbols to blocks") rendering = renderBlocks(symbol_list) log.info("Editing %d blocks" % len(rendering)) for x, y, z, blockType in rendering: x -= originalBounds.minx y -= originalBounds.miny z -= originalBounds.minz dimension.setBlock(x, y, z, blockType)
def renderBlocks(self, symbol_list): return renderBlocks(symbol_list)