This paper discusses the application of a heuristic technique to stack regular and irregular shapes objects on the same container or on the same pallet. The computer representation of any object is based on the recursive octree method where each unit volume element is a voxel. Then, the choice of the space taken by any shape object within the volume is made through the heuristic approach. The heuristic technique developed is an evaluation function that compares all the available spaces based on weighing factors and threshold levels. The parameters used are shape, space available, contents of the object, and dimensions. The goal is to choose the most feasible available space every time an object is ready to be stacked. The heuristic algorithm is implemented within a knowledge based system to control a flexible material handling cell. Generally the cell comprises a material handling robot, a conveyance system that brings the objects to the cell where objects are distributed randomly to the cell, a vision system to identify the objects and verify the stacking procedure, and a computer to control and initiate the decision making process to stack all shape objects on the same volume.