The band structure of some translationally invariant lattice Hamiltonians contains strictly dispersionless flat bands(FB). These are induced by destructive interference, and typically host compact localized eigenstates (CLS) which occupy a finite number U of unit cells. FBs are important due to macroscopic degeneracy and consequently due to their high sensitivity and strong response to different types of weak perturbations. We use a recently introduced classification of FB networks based on CLS properties, and extend the FB Hamiltonian generator introduced in Phys. Rev. B 95, 115135 (2017) to an arbitrary number ν of bands in the band structure, and arbitrary size U of a CLS. The FB Hamiltonian is a solution to equations that we identify with an inverse eigenvalue problem. These can be solved only numerically in general. By imposing additional constraints, e.g. a chiral symmetry, we are able to find analytical solutions to the inverse eigenvalue problem.