A novel theoretical estimate of the Casimir force of a metallic structure embedded into a cubic cavity is proposed. We demonstrate that by calculating the eigenmodes of the system we can determine the Casimir force which can be either attractive or repulsive by simply changing the geometry of the structures relative to the walls of the cavity. In this analysis, several cases of structures are taken into account from rectangular slabs to chiral "omega" particles, and the predicted data are consistent with recent literature. We demonstrate that the side walls of the studied cavity contribute decisively to the repulsive Casimir force between the system and the nearby top surface of the cavity. Finally, we have provided evidence that the medium embedded into the studied cavity (and especially its permittivity) can change the intensity of the Casimir force, while its repulsive nature once established (thanks to favorable geometrical features) remain quite robust. PACS number(s): 42.50.Ct, 78.20.Ek, 81.05.Xj.