In recent years, the applications of interior and exterior model of buildings have been increased in the field of surveying and mapping. This paper presents a new method for extracting a two-dimensional (2D) floor plan of a building from Simultaneous localization and mapping (SLAM)-based point clouds. In the proposed algorithm, after preprocessing, the voxel space is generated for the point cloud. Then, the optimal section of the voxel cube to generate building floor plan is identified. Finally, the linear structures and walls are extracted using the random sample consensus (RANSAC) algorithm. The proposed algorithm was examined on a collected point clouds of a building, and the walls of this building were automatically extracted. To evaluate the proposed method, the obtained walls by the algorithm were compared with the manually extracted walls. The algorithm successfully extracted almost 90% of the walls in the test area. Moreover, the average error of 3 cm for the extracted walls proved the high accuracy of the proposed method for building floor plan modeling.