We propose a new framework for toolpath generation for five-axis machining of part surfaces represented by the StereoLithography (STL) format. The framework is based on flattening the STL part and generation of adaptive curvilinear toolpaths. The corresponding cost functions, designed to represent the accuracy and the efficiency of the toolpath, are scalar functions, such as the curvature, kinematic error, rotation angles, machining strip or material removal rate or a vector field when the tool moves along a curvilinear path partly or even entirely aligned with directions considered to be optimal. The adaptive toolpath exploits grid generation methods and biased space-filling curves, combined with adaptation to the boundary and the domain decomposition. The proposed methodology of the adaptive curvilinear toolpath (ACT) has been tested on a variety of STL surfaces, including a case study of STL dental parts. Machining crowns/ implants for four basic types of human teeth, molar, premolar, canine and incisor, has been considered and analysed. The reference methods are the standard iso-parametric path, MasterCam toolpath, and advanced methods of NX9 (former UG). The experiments show that there is no universal sequence of steps applicable to every surface. However, a correct choice of the tools available within the proposed ACT-framework always leads to a substantial improvement of the toolpath, in terms of its length and the machining time.