## 2 Materials and Methods
### Algorithm Modeling  
The algorithm modeling technique is practicable for documenting and simulating the rebuild process. To avoid mistakes in manual operation, the whole process was auto-generated. Five sample tiles were measured as prototype tiles, which were also the minimum model unit to build the block instance (Figure 6). \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Conditions** & **Proportion** & **Interventions** & **Proportion** \\ \hline Oblique & 20\% & Weeding & 0.7\% \\ \hline Over tilting & 2.1\% & Restore position and reinforce & 1.2\% \\ \hline Missing & 0.1\% & Add tile & 5.7\% \\ \hline Missing part & 1.5\% & Replace tile & 6.8\% \\ \hline Missing eaves nail & 4.2\% & Restore tile position and bond & 2.7\% \\ \hline Nail too short & 1.3\% & Bond tile & 5.5\% \\ \hline Break & 4.1\% & Remove old tile and add new tile & 5.5\% \\ \hline Crack & 5.2\% & Add plaster & 2.1\% \\ \hline Weathering Type 1 & 0.1\% & Clean old plaster and add new plaster & 57.7\% \\ \hline Weathering Type 2 & 0.9\% & & \\ \hline Misplacement & 4.7\% & & \\ \hline Loose & 1.2\% & & \\ \hline Plaster detachment & 57.7\% & & \\ \hline Biological colonization & 0.7\% & & \\ \hline Missing eaves tile & 1\% & & \\ \hline Eaves tile & 3.4\% & & \\ \hline Missing mend nail & 0.1\% & & \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The proportion of the condition and intervention. Based on the point cloud, the profile curve of the roof was manually drawn in Rhino. Importing these curves to Grasshopper, the algorithm cluster autoprocessed in the following steps (Figure 7):  
* Rebuild the irregular double-curved surface, using the _Network Surface_ battery;
* Obtain the profile curve on the surface for the tile row, using the _Brep | Plane intersect_ battery;
* Divide the profile curve by length, and output the anchor point, which was 350 mm in this case, and also the length of each model unit, using the _Divide Distance_ battery;
* Evaluate the surface to output the surface normal at the anchor points, using the _Evaluate Surface_ battery;
* Use the _Move_ battery to move the correspondence block instance of each tile to their anchor points (divide points of profile curves); each cover tile was next to one under tile following the level of investigation rather than the two under tiles in reality;
* Use the _Rotate_ battery to rotate each tile in three planes (XY, XZ, YZ), respectively; the origin of the plane was the anchor point, and the angle (in radians) of the rotation was calculated by the surface normal and the X, Y, Z vector;
* Explode the last tile of each row from block instance to polysurface, and cut it to fit the onsite processing technique, using the _VisualARQ Explode_ and the _Solid Difference_ Battery. Using the block instance to rebuild the roof successfully reduced the size of the 3 dm file to 87.4 MB, with 17,154 units (16,135 block instances and 1019 polysurfaces). Before baking to Rhino, all tiles were given identifiers by the algorithm cluster (Figures 8 and 9). The algorithm clusters (M2 metalevel), which generated the IFC models (M1 metalevel) and Cypher clauses (M2 metalevel), embodied data and model as the metamodel repository for the synergy. The metadata repository (Figure 5) was imported to the graph database following Cypher syntax (Table 3):  
Figure 6: Five block instances of prototype tiles. Figure 8: Identifiers given to tiles before baking to Rhino. Figure 7: The steps of algorithm modeling for roof tiles at the corner with the gutter. Each condition and intervention was created as the node; the relationships were created to show the condition and intervention of each tile. The whole process finished in one second. Through the query in the graph database, the identifier, condition, intervention, and property could be visually presented. If the tile had conditions and interventions, the relationship between them was created automatically through the Cypher in Table 3.