Textile materials are characterized by a distinct structural hierarchy, which should be represented by a model of textile geometry and its mechanical behavior. Despite extensive investigations of textile materials and a number of theoretical models existing in the textile literature for different structures, a general model is not available. Hence, the challenge addressed in this work is to take full advantage of the hierarchical principle of textile modeling to create a truly integrated modeling and design tool. The algorithm for extensive simulations of complex yarn interactions uses the minimum energy principle, allowing complex textile structure computations in computer time to be counted in minutes instead of hours or days for FEM implementation of the same nonlinear, nonconservative behavior of yarns under compression and bending. The architecture of the code corresponds to the hierarchical structure of the textile material. General ideas of the hierarchical approach are illustrated by models of the internal geometry of multilayered woven fabrics and weft-knitted fabric topology.