Skip to main content
Check the file destination exists before opening the file
Source Link

It's pretty easy with if you know a little Python.

# import the necessary modules we need
# in our case, blender's python API and python's os module
import bpy, os

# get the current selection
selection = bpy.context.selected_objects

# initialize a blank result variable
result = ""

# iterate through the selected objects
for sel in selection:
    # get the current object's dimensions
    dims = sel.dimensions
    # write the selected object's name and dimensions to a string
    result += "%s - %.03fm x %.03fm x %.03fm\n" % (sel.name, dims.x, dims.y, dims.z)

# get path to render output (usually /tmp\)
tempFolder = os.path.abspath (bpy.context.scene.render.filepath)
# make a filename
filename = os.path.join (tempFolder, "newfile.txt")
# confirm path exists
os.makedirs(os.path.dirname(filename), exist_ok=True)
# open a file to write to
file = open(filename, "w")
# write the data to file
file.write(result)
# close the file
file.close()

Copy and paste the above into Blender's Text editor and press Run Script (Alt+P). It will save the data (object name and dimensions) into your tmp folder.

It's pretty easy with if you know a little Python.

# import the necessary modules we need
# in our case, blender's python API and python's os module
import bpy, os

# get the current selection
selection = bpy.context.selected_objects

# initialize a blank result variable
result = ""

# iterate through the selected objects
for sel in selection:
    # get the current object's dimensions
    dims = sel.dimensions
    # write the selected object's name and dimensions to a string
    result += "%s - %.03fm x %.03fm x %.03fm\n" % (sel.name, dims.x, dims.y, dims.z)

# get path to render output (usually /tmp\)
tempFolder = os.path.abspath (bpy.context.scene.render.filepath)
# make a filename
filename = os.path.join (tempFolder, "newfile.txt")
# open a file to write to
file = open(filename, "w")
# write the data to file
file.write(result)
# close the file
file.close()

Copy and paste the above into Blender's Text editor and press Run Script (Alt+P). It will save the data (object name and dimensions) into your tmp folder.

It's pretty easy with if you know a little Python.

# import the necessary modules we need
# in our case, blender's python API and python's os module
import bpy, os

# get the current selection
selection = bpy.context.selected_objects

# initialize a blank result variable
result = ""

# iterate through the selected objects
for sel in selection:
    # get the current object's dimensions
    dims = sel.dimensions
    # write the selected object's name and dimensions to a string
    result += "%s - %.03fm x %.03fm x %.03fm\n" % (sel.name, dims.x, dims.y, dims.z)

# get path to render output (usually /tmp\)
tempFolder = os.path.abspath (bpy.context.scene.render.filepath)
# make a filename
filename = os.path.join (tempFolder, "newfile.txt")
# confirm path exists
os.makedirs(os.path.dirname(filename), exist_ok=True)
# open a file to write to
file = open(filename, "w")
# write the data to file
file.write(result)
# close the file
file.close()

Copy and paste the above into Blender's Text editor and press Run Script (Alt+P). It will save the data (object name and dimensions) into your tmp folder.

key markup, added more information
Source Link
p2or
  • 16.1k
  • 10
  • 87
  • 146

It's pretty easy with if you know a little Python.

# import the necessary modules we need
# in our case, blender's python API and python's os module
import bpy, os

# get the current selection
selection = bpy.context.selected_objects

# initialize a blank result variable
result = ""

# iterate through the selected objects
for sel in selection:
    # get the current object's dimensions
    dims = sel.dimensions
    # write the selected object's name and dimensions to a string
    result += "%s - %.03fm x %.03fm x %.03fm\n" % (sel.name, dims.x, dims.y, dims.z)

# get path to render output (usually /tmp\)
tempFolder = os.path.abspath (bpy.context.scene.render.filepath)
# make a filename
filename = os.path.join (tempFolder, "newfile.txt")
# open a file to write to
file = open(filename, "w")
# write the data to file
file.write(result)
# close the file
file.close()

Copy and paste the above into Blender's Text editor and hit Alt-Ppress Run Script (Alt+P). It will save the data (object name and dimensions) into your tmptmp folder.

It's pretty easy with if you know a little Python.

# import the necessary modules we need
# in our case, blender's python API and python's os module
import bpy, os

# get the current selection
selection = bpy.context.selected_objects

# initialize a blank result variable
result = ""

# iterate through the selected objects
for sel in selection:
    # get the current object's dimensions
    dims = sel.dimensions
    # write the selected object's name and dimensions to a string
    result += "%s - %.03fm x %.03fm x %.03fm\n" % (sel.name, dims.x, dims.y, dims.z)

# get path to render output (usually /tmp\)
tempFolder = os.path.abspath (bpy.context.scene.render.filepath)
# make a filename
filename = os.path.join (tempFolder, "newfile.txt")
# open a file to write to
file = open(filename, "w")
# write the data to file
file.write(result)
# close the file
file.close()

Copy and paste the above into Blender's Text editor and hit Alt-P. It will save the data into your tmp folder.

It's pretty easy with if you know a little Python.

# import the necessary modules we need
# in our case, blender's python API and python's os module
import bpy, os

# get the current selection
selection = bpy.context.selected_objects

# initialize a blank result variable
result = ""

# iterate through the selected objects
for sel in selection:
    # get the current object's dimensions
    dims = sel.dimensions
    # write the selected object's name and dimensions to a string
    result += "%s - %.03fm x %.03fm x %.03fm\n" % (sel.name, dims.x, dims.y, dims.z)

# get path to render output (usually /tmp\)
tempFolder = os.path.abspath (bpy.context.scene.render.filepath)
# make a filename
filename = os.path.join (tempFolder, "newfile.txt")
# open a file to write to
file = open(filename, "w")
# write the data to file
file.write(result)
# close the file
file.close()

Copy and paste the above into Blender's Text editor and press Run Script (Alt+P). It will save the data (object name and dimensions) into your tmp folder.

Source Link

It's pretty easy with if you know a little Python.

# import the necessary modules we need
# in our case, blender's python API and python's os module
import bpy, os

# get the current selection
selection = bpy.context.selected_objects

# initialize a blank result variable
result = ""

# iterate through the selected objects
for sel in selection:
    # get the current object's dimensions
    dims = sel.dimensions
    # write the selected object's name and dimensions to a string
    result += "%s - %.03fm x %.03fm x %.03fm\n" % (sel.name, dims.x, dims.y, dims.z)

# get path to render output (usually /tmp\)
tempFolder = os.path.abspath (bpy.context.scene.render.filepath)
# make a filename
filename = os.path.join (tempFolder, "newfile.txt")
# open a file to write to
file = open(filename, "w")
# write the data to file
file.write(result)
# close the file
file.close()

Copy and paste the above into Blender's Text editor and hit Alt-P. It will save the data into your tmp folder.