We present a method for finding the condensate distribution at the nucleation of superconductivity for arbitrary polygons. The method is based on conformal mapping of the analytical solution of the linearized Ginzburg-Landau problem for the disk and uses the superconducting gauge for the magnetic potential proposed earlier. As a demonstration of the method's accuracy, we calculate the distribution of the order parameter in regular polygons and compare the obtained solutions with available numerical results. As an example of an irregular polygon, we consider a deformed hexagon and prove that its calculation with the proposed method requires the same level of computational efforts as the regular ones. Finally, we extend the method over samples with arbitrary smooth boundaries. With this, we have made simulations for an experimental sample. They have shown perfect agreement with experimental data.