I am new to scripting in Blender and I have a set of commands that work to create my object when pasted into the command line, but not when run as a script. The first major issue I've run into is that the dimensions and location change on a selected object, but the scale does not. How can I resolve this?
import bpy
import bmesh
from bpy_extras.object_utils import AddObjectHelper
from bpy import context
bpy.ops.mesh.primitive_cube_add(size=16, enter_editmode=False, align='WORLD', location=(0, 0, 0))
bpy.context.view_layer.objects.active = bpy.data.objects['6']
bpy.context.object.location[0] = 0
bpy.context.object.location[1] = 0
bpy.context.object.location[2] = 8.6
bpy.context.object.scale[0] = 1250
bpy.context.object.scale[1] = 1250
bpy.context.object.dimensions[2] = 2
The dimensions and location change when I run this, but the scale does not. I appreciate all your help and insights. Thanks very much!