2
$\begingroup$

if I have kitchen cabinet designed in Blender it consist from multiple boxes with correct dimensions. is there a way to list all parts measurements in one table? enter image description here

$\endgroup$
1
$\begingroup$

Hello Tawfiq abu Halawah,

Try this code, this code export selected objects (kitchen cabinet parts) and store it's name and dimensions into csv file so you can open in excel or send it to cutlist programs like MaxCut.

i'm switching from 3ds max to blender so i can design kitchen and make cutlist. So, this is what i have until now. And i'm trying to figure out more about blender and python so i can have a complete solution for kitchen making

import bpy
#here you need to write where you want to store the file on your system
file = open("/home/monis/Blender/MyFile_02.csv", 'w')
selectedObjects = bpy.context.selected_objects
file.write('Panel name\t hight\t width\t thickness\n')

for obj in selectedObjects:
    dim = obj.dimensions
    file.write(obj.name+'\t'+'{:.3f}\t{:.3f}\t{:.3f}\n'.format(dim.x*100,dim.y*100,dim.z*100))

file.close()
print(obj)

enter image description here

$\endgroup$
  • 1
    $\begingroup$ nice and better answer :) . can you please add a comment to your code (telling users to set correct path on their machines, since windows paths are different ) and I will set it as correct answer $\endgroup$ – Tawfiq abu Halawah Mar 26 at 14:37
  • $\begingroup$ Thanks Tawfiq abu Halawah for putting an explanation comment in the code, i forgot to do so. and thanks Duarte Farrajota Ramos for the approval of the edit $\endgroup$ – elbannhawy Mar 27 at 10:56
2
$\begingroup$

I came up with simple python script to list all selected objects dimensions it does not validate object type

import bpy
selectedObjects = bpy.context.selected_objects
for obj in selectedObjects:
    partDim = (str(obj.dimensions))
    print(obj.name + partDim)

after running the script you can find the list in system console you can show the console by going to window-> toggle system console enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.