The density distribution in an urban matrix is one of the significant issues which affects other urban living factors such as building lighting, energy consumption and residents’ interactions. The research toward achieving the optimum density distribution has received attention for the last decade. However, developing a generative approach that provides more freedom for the formation of the plans and incorporates adaptability in different land blocks is still missing. To address such a gap, this study proposes an adaptable approach developing the formation of residential blocks. This formation is according to the pre defined size and shape of the land, and sought performance objectives. Hence, a suite of applications including Grasshopper, Python and Ladybug were applied in a residential block of Tehran as a case study. The purpose is to develop a new density distribution increasing view quality, visual privacy, and solar gain. For the optimization process, a genetic algorithm was applied utilizing the topology optimization technique. The results of the optimization process highlight the significance of this research since the developed alternatives are more efficient in terms of improving the view quality, visual privacy and increasing the solar gain. This achievement expands the potential of this research to be applied in different case studies and with different design and development objectives in order to develop better shape plans of building blocks.