I can't quite figure this out, so I am hoping someone can help.
In Python, I want to create an empty object, and add a Cube primitive to the object. After that I want to create a new material, and set the object to use the material.
# Create an empty object.
basic_cube = bpy.data.objects.new("Basic_Cube", None)
# Add the object into the scene.
bpyscene.objects.link(basic_cube)
bpyscene.objects.active = basic_cube
basic_cube.select = True
# Add a Cube primitive to the empty object.
bpy.ops.mesh.primitive_cube_add(location=(0.0, 0.0, 0.0))
basic_cube_mesh.update()
But this does not add the cube primitive to the object. It adds it directly to the scene.
Any suggestions on how to get this to work?