-1

I have an object that I used blenders "pixelate" (advanced) object function, this created what looked like a bunch (1000's) of duplications of a single cube.

having exported and then re-imported this resulted in a single object consisting of some 18,000 cubes.

This has had different materials added to many of the cubes.

The aim is to split the object into "layers" of all the cubes that are at the same height, while retaining their materials

I have tried a number of things like boolean operations, but that's been prohibitively slow and hasn't always kept the materials

In addition there are some 70+ layers, so manually creating the layers might be somewhat tedious....

ideally I'd like to write some kind of script that would filter out each layer at a time and export them (with materials) so they can be rendered as 2d images...

The python documentation for blender initially seems to be somewhat opaque probably due the the very large size of the API (where do you start!)

can anyone help with at least some of the steps I might need to write this script as I'm having problems gaining any kind of traction.

Chris Camacho
  • 1,164
  • 1
  • 9
  • 31
  • 1
    In "scripting" view preset there is a log of every operation you do, in python-compatible way, as well as console to try things out, and blender is bundled with a lot of addons which is a good reference point, but first you need to figure out what exactly you want to do. As far as I can understand you want to select all cubes within specified vertical range, merge them all into single mesh while keeping materials, and then what? You can use boolean join while keeping materials - target mesh just have to have all required materials in its slots. – keltar Aug 04 '18 at 17:01
  • I found booleans too slow to be practical with this model, at least I'd have to apply them right away anyhow. I'll try and figure out try and see if I can find this live log looks like it might be very useful (thanks) – Chris Camacho Aug 04 '18 at 22:04

1 Answers1

0

In the end I used a partially automated and partially manual method to do what I wanted thanks to @keltar I found the info window and the commands I needed picking one up from the python commands in the menu popup

>>> def dolayer(name):
...     bpy.ops.mesh.select_linked(delimit={'SEAM'})
...     bpy.ops.mesh.separate(type='SELECTED')
...     bpy.data.objects[name].hide = True
... 
>>> dolayer('Cube.018')
>>> dolayer('Cube.019')

I selected the next layer with box select being sure to turn off limit selection to visible! then I simply provide the dolayer function with what will me the new name for the split object (this lets you hide it) the up cursor key is your friend here!

the minimal amount of automation made it practical to separate out 72 layers into separate objects, this allows me to hide different layers and show only the ones I want for each step of the build....

I completely missed the info window, which should make scripting very much more accessible !

Chris Camacho
  • 1,164
  • 1
  • 9
  • 31