Laser powder bed fusion (LPBF) is an additive manufacturing technique that is gaining popularity for producing metallic parts in various industries. However, parts produced by LPBF are prone to residual stress, deformation, cracks and other quality defects due to uneven temperature distribution during the LPBF process. To address this issue, in prior work, the authors have proposed SmartScan, a method for determining laser scan sequence in LPBF using a model-based and optimization-driven approach, rather than using heuristics, and applied it to simple 2D geometries. This paper presents a generalized SmartScan methodology that is applicable to arbitrary 3D geometries. This is achieved by: (1) expanding the thermal model and optimization approach used in SmartScan to multiple layers; (2) enabling SmartScan to process shapes with arbitrary contours and infill patterns within each layer and (3) providing SmartScan with global foresight to make it less myopic in its optimization. Sample 3D parts are printed using the proposed generalized SmartScan and compared to those printed using standard heuristic scan sequences. Reductions of up to 93% in temperature inhomogeneity, 87% in residual stress, and 26% in maximum deformation were observed, without significantly sacrificing print speed. However, SmartScan was found to cause minor (<5%) to significant (up to 20%) increases in surface roughness compared to the heuristic approaches, depending on the scan pattern used.