The paper is devoted to the problem of dense packing of objects of arbitrary geometric shape with generalization in terms of dimension. A new solution method which consists in transforming the shape of objects by voxelization and the subsequent applying the developed algorithm for placing orthogonal polyhedrons is proposed. The effectiveness of the application of the developed method is demonstrated by an example of solving the problem of generating a layout of parts on the platform of a 3D printer. The application of the developed algorithms for solving the problem of dense packing of objects inside containers of arbitrary geometric shape is shown.