Rigid-body mechanisms (RBMs) and compliant mechanisms (CMs) are traditionally treated in significantly different ways. In this paper, we present a synthesis approach that is appropriate for both RBMs and CMs. In this approach, RBMs and CMs are generalized into modularized mechanisms that consist of five basic modules, including compliant links (CLs), rigid links (RLs), pin joints (PJs), compliant joints (CJs), and rigid joints (RJs). The link modules and joint modules are modeled through beam elements and hinge elements, respectively, in a geometrically nonlinear finite-element solver, and subsequently a beam-hinge ground structure model is proposed. Based on this new model, a link and joint determination approach—module optimization—is developed for the type and dimensional synthesis of both RBMs and CMs. In the module optimization approach, the states (both presence or absence and sizes) of joints and links are all design variables, and one may obtain an RBM, a partially CM, or a fully CM for a given mechanical task. Three design examples of path generators are used to demonstrate the effectiveness of the proposed approach to the type and dimensional synthesis of RBMs and CMs.