# How to use a weight to check if an object is stable?

Blender Asked on November 26, 2020

Let’s say that you have a table with randomly generated legs, and that you want to check if the table is stable enough to stand with a weights placed, one at a time, in four different spots on the board.

Question 1: How do you get the coordinates for these 4 different spots?

The best way would to be able to refer to each position as positions on the board rather than numbers , so that future scaling of the board doesn’t affect the weights positions in relation to the board.

So let’s say that you are able to identify the 4 locations. You create 4 cubes based on those postions:

bpy.ops.mesh.primitive_cube_add(radius=0.1, location=(location1)) bpy.ops.mesh.primitive_cube_add(radius=0.1, location=(location2)) bpy.ops.mesh.primitive_cube_add(radius=0.1, location=(location3)) bpy.ops.mesh.primitive_cube_add(radius=0.1, location=(location3))

However, you want to test if the table stands one cube at the time. You want to be able to unlink all cubes, then link back cube 1 to check, unlink and link back cube 2 and so on, till all four cubes are tested.

Ok, so I think I found a solution

def create_cubes():
#board=table without the legs
h=board_height
d=board.dimensions
l=board.location
r=0.3
#First cube
cube1=bpy.context.active_object
cube1.name = "Cube" + str(1)
validation_cubes.append(cube1)
#Second cube
cube2=bpy.context.active_object
cube2.name = "Cube" + str(2)
validation_cubes.append(cube2)
#Third cube
cube3=bpy.context.active_object
cube3.name = "Cube" + str(3)
validation_cubes.append(cube3)


Now you have defined the locations for three cubes. These locations will be the same, no matter how you scale the board or the radius of the cube.The cubes are named and placed in the list validation_cubes, unliked from the mesh

Then you simply need to create a loop that links back each cube, one at a time, so that the cubes don't affect eachother

def validate_table():
create_cubes()
for x in range(0,3):