I use Blender as a 3D sketch tool for building terrariums and racks for them or plan my next trip to IKEA.
What I need is a tool that lists all Objects with there names and measurements (Bounding box is ok - I use mostly cubes) and how much of them I uses in the scene - a bill of materials BOM in short.
Does this exist or do I need to code it by my self?
You mean all objects of type “MESH”, don’t you?
all objects are found in bpy.data.objects,
check if it is a mesh, then write its name and boundingbox coordinates to a file
I think it does not yet exist, but it is only some small number of commands … so do it youself
I had no time left to fix the presentation but this is what I uses to create my shopping list
import bpy
bom = list()
objects = bpy.data.objects
for ob in objects:
if ob.type == 'MESH':
# print(ob.name.split('.'))
name = ob.name.split('.')[0]
# print(name)
# print(ob.dimensions)
x = int(round(ob.dimensions[0],3) * 1000)
y = int(round(ob.dimensions[1],3) * 1000)
z = int(round(ob.dimensions[2],3) * 1000)
# print(x,y,z)
try:
bom[0]
except:
bom.append([name,(x,y,z),1])
found = False
for item in bom:
if item[0] == name and item[1] == (x,y,z):
item[2] = item[2] + 1
found = True
if found == False:
bom.append([name,(x,y,z),1])
for thing in bom:
print(thing)
So, I’ve bought the wood for this project. As it happens I’m working on the planing of the next project and was thinking that the display/output of the BOM needs to be improved - suggestions and pointers are most welcomed