3
$\begingroup$

I have a scene and I want to turn it into a blockout scene for presentational purposes. I want to turn every mesh into a box or a block model. Is there any way to achieve this? Scripts are also welcome

$\endgroup$

2 Answers 2

4
$\begingroup$

Bmesh script

Quick, n dirty little bmesh script to do this. For all mesh objects in the screen replace the mesh with the box created from the eight corners of the bounding box.

  • I've used the convex hull operator which produces a triangulated mesh.
  • Current version replaces mesh with hull.
  • As always save before, and / or test on a copy.

script

import bpy
import bmesh
context = bpy.context
scene = context.scene
bm = bmesh.new()
mesh_obs = [o for o in scene.objects if o.type == 'MESH']
for ob in mesh_obs:
    me = ob.data 
    #me = ob.data.copy() # create a copy

    verts = [bm.verts.new(b) for b in ob.bound_box]
    bmesh.ops.convex_hull(bm, input=verts)
    bm.to_mesh(me)
    ob.data = me # needed if copy
    bm.clear()
bm.free()
$\endgroup$
1
  • $\begingroup$ I'll change it to keep the original mesh! But thank you for your time! $\endgroup$ Commented Aug 24, 2018 at 8:40
0
$\begingroup$

You can select Bounding box in Viewport Shading setting:

enter image description here

This option displays all objects as it's Bounding boxes

$\endgroup$
2
  • 1
    $\begingroup$ No. I don't want it to be for the viewport only. I want to actually deform the mesh into it's bounding box $\endgroup$ Commented Aug 24, 2018 at 8:34
  • $\begingroup$ Do you want to render it? Do you know, that you can render OpenGL of current viewport? $\endgroup$
    – Crantisz
    Commented Aug 24, 2018 at 8:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .