## 1 Introduction
Equations of the motion for single rigid prismatic blocks rocking on rigid interfaces (assuming no bouncing or sliding) were first derived by [PERSON] [18]. Since then, equations of motion have been derived for more complex geometries such as masonry spires [19] and for more complex mechanisms such as facades subjected to additional masses due to floors and roofs, thrusts from vaults, and the restraining influence of tie-rods [20; 21; 22; 23]. Equations have also been derived for mechanisms with two and three elements in the kinematic chain, including cracked wall sections [23], arches [22], and symmetric [23; 24] and asymmetric [25] portal frames. Furthermore, through linearization of the equations of motion about the point of unstable equilibrium, local dynamic equivalence can be derived between more complex rocking systems and the single rocking block [25]. Consequently, the dynamic response of the different mechanisms (single, two and multi-block) can be approximated using the same general linearized equation of motion. Still, derivation of these equations of motion can be challenging, especially for structures with complex geometries, or mechanisms involving more than one element in the kinematic chain. To that end, a CAD-interfaced analytical tool for the non-linear dynamic analysis of masonry collapse mechanisms was developed by [PERSON] and [PERSON] [26]. The tool can directly derive and solve the equation of the motion for any user-defined structural geometry. The broad applicability of this tool was demonstrated by the analysis of a variety of masonry structures such as churches [26] and monumental houses [27]. However, to perform the dynamic rocking analysis following this methodology, the exact collapse mechanism needs to be defined a priori, which requires in-field surveys/site inspections and ultimately, depends extensively on user experience and engineering judgment. The main aim of this paper is to develop a novel, multi-level integrated modelling procedure that uses a combination of upper bound limit analysis [14; 28] and non-linear dynamic (rocking) analysis [26] for the seismic collapse assessment of any user-defined structural configuration. In the first step, parametric modelling of the macro-block geometry is conducted, enabling exploration of the domain of possible solutions using the upper bound method of limit analysis. A heuristic solver based on the Nelder-Mead method [29] is then used to refine the geometry of the macro-blocks and search for the minimum value of the load multiplier. Once the macro-block (i.e., collapse mechanism) has been defined, the digital tool then computes the kinematic constants defining the corresponding (rocking) equation of motion, which can be solved for full time-histories. The response of the structure is provided both in terms of the full time-history response as well as in the form of the maximum predicted rotation. An overview of the proposed analysis procedure can be found in Figure 1.  
The proposed methodology has been entirely integrated into a user-friendly visual programming environment that allows the user to easily connect data from different sources while keeping a clear understanding of the relationships between them thanks to the flowchart-like representation of the different components of the code. The procedure is made available using the environment offered by Rhinoceros3D + Grasshopper [30], which is well known by students, researchers, and practicing structural engineers. Unlike other more time-consuming advanced methods of analysis, the proposed method allows the users to perform a seismic assessment of masonry buildings in a rapid and computationally-efficient manner, while simultaneously providing more accurate predictions than simplified/code-based methods.