Corrosion is one of the most common causes of accidents involving pipelines. Unfortunately, the semi-empirical methods currently available are overly conservative for the assessment of some types of corrosion defects in pipelines. Fortunately, the computational simulations through finite element (FE) method are a very efficient and reliable approach to quantify the remaining strength of corroded pipes. However, the process of computational modeling demands intense manual labor from the engineer, and it is also slow and extremely repetitive, especially in cases of multiple defects. The main purpose of this work was to describe an original methodology for the automatic generation of FE models of pipes with corrosion defects (single or multiple). The model discretization uses semi-structured mesh and specific mesh transitions, which demanded even more manual labor. Also, the computational modeling process needs to be robust and efficient to ensure accuracy without excessive number of degrees of freedom. Thus, the tool allows the pre-configuration of mesh transitions and other parameters related to the mesh refinement. This program, called PIPEFLAW, is built-in as a software extension into the MSC.PATRAN commercial software and is written with Patran Command Language. The PIPEFLAW program has a friendly graphical user interface, which allows the user to provide the main parameters of the pipe and defect (or a series of defects), considering several different configurations and geometries. This paper is focused on the automatic generation of 3D FE models of pipelines with a single or a colony of idealized defects with rectangular or elliptical shapes. As result, some examples of FE pipe models with defects generated automatically by the program are shown and some element shape tests were performed to evaluate the final mesh quality of the FE pipe model. The methodology is validated through the comparison of the internal failure pressure of a pipeline with two rectangular defects, obtained using experimental burst test, manually generated FE models, semi-empirical methods and PIPEFLAW generated model. The developed tools lead to a reduction in the modeling procedure in the case presented from 2 weeks, using non-automatic standard procedure normally used in the industry, to 1 min.