I'm trying to generate a .vox represantation of my Prison Architect save file. I'm using a library called voxelfuse to generate the voxels and for some reason the union() method gives me a can only concatenate str (not "int") to str
Here's my code:
cubes = []
for tile in tiles:
cubes.append(cuboid((6,18,6),(tile['x'],1,tile['y']),2))
finalmodel = cubes[0]
for cube in cubes:
if cube != cubes[0]:
finalmodel = finalmodel.union(cube)
mesh1 = Mesh.fromVoxelModel(finalmodel)
mesh1.export(filename + '.vox')
What confuses me the most is the fact that variables finalmodel
and cube
that are used as arguments in the method aren't ints or strings, but instead are VoxelModel
And just in case tile['x']
and tile['y']
are ints that come from the parsed savefile.
I can't figure out whether I have made a mistake while creating the Voxelmodels or there is something wrong somewhere else.
Considering tiles
is read from a file I believe the problem may be that tile['x']
and tile['y']
are strings and not integers. Try to transform them before passing them as arguments:
for tile in tiles:
cubes.append(cuboid((6,18,6),(int(tile['x']),1,int(tile['y'])),2))