A SEMI-AUTOMATED APPROACH TO MODEL ARCHITECTURAL ELEMENTS IN SCAN-TO-BIM PROCESSES

: I n the last years, the AEC (Architecture, Engineering and Construction) domain has exponentially increased the use of BIM and HBIM models for several applications, such as planning renovation and restoration, building maintenance, cost managing, or structural/energetic retrofit design. However, obtaining detailed as-built BIM models is a demanding and time-consuming process. Especially in historical contexts, many different and complex architectural elements need to be carefully and manually modelled. Meshes or surfaces and NURBS or polylines, derived from 3D reality-based data, are recently used as a reference for the HBIM accurate modelling. This work proposes a comprehensive and novel semi-automated approach to reconstruct architectural elements through the Visual Programming Language (VPL) Dynamo software and a Boundary-Representation method (B-rep), starting from 3D surveying data and point clouds classification. A wide package of scripts provides solutions for modelling complex shapes and transferring the obtained 3D models into BIM Authoring tools for a complete reconstruction phase. The presented procedure, useful for different BIM or HBIM applications, proved to reduce the modelling time significantly.


INTRODUCTION
The use of BIM techniques in the cultural heritage (CH) field is still a challenge due to the complexity of geometric data and their interpretation within the BIM environment (Murphy et al., 2013;Barazzetti, 2016). Nowadays, advancements in 3D data acquisition techniques and tools enable the collection of a large amount of data, expressing the geometric and radiometric properties of the structures. Surveying data can be collected with photogrammetric techniques (terrestrial or aerial), as well as laser scanning (terrestrial, mobile, handheld, backpack). Conventionally, the production of a 3D BIM model from realitybased data, enriched with both geometric and semantic information, is a laborious, time-consuming and mostly manual process (Tommasi et al., 2016;Xu and Stilla, 2021). There is a gap between the reduction of surveying times and 3D data acquisition (point clouds) and manual modelling activities. For this reason, the improvement of Scan-to-BIM processes to automatically derive BIM/HBIM objects, such as walls and slabs, from 3D surveying datasets (Rashdi et al., 2022) is an increasingly attractive research investigation area. Data quality primarily conditions the approaches to the Scan-to-BIM process (Xu and Stilla, 2021), considering that 3D surveyed data typically feature noisy or missing areas when reconstructing not collaborative surfaces, reflective or transparent elements, like metal or glass panels (De Geyter et al., 2022). The complexity of a BIM model creation is enhanced by the need to identify a huge variety of shapes, construction techniques and materials, characterising real-built environments (De Geyter et al., 2022). This complexity is evident in the HBIM field, especially for complex models with irregular constructive elements , where the definition of standards and protocols for guiding and assessing the modelling and reconstruction process is still missing. Scan-to-BIM processes comprise two main phases: architectural elements detection/classification and reconstruction. Machine Learning (ML) techniques are currently the most diffused solutions for the automatic segmentation and classification phase, while the automation of the reconstruction step in BIM environments is still really complex. The aim of the paper is two-fold: (i) to review existing Scan-to-BIM processes useful in the heritage field and (ii) to propose a semi-automated and replicable approach to model architectural elements, like windows, within BIM environments.

SCAN-TO-BIM: GENERAL WORKFLOWS
A standard Scan-to-BIM process generally involves four main steps (Bassier et al., 2019): • point cloud generation, either from image datasets or using laser scanning solutions; • segmentation phase, where the point cloud is segmented into point clusters/regions with similar properties; • classification phase, where each region is classified and labelled; • reconstruction and modelling phase, where the modelling of the 3D geometric and semantic data is performed. Generally, data are pre-processed in order to minimize the file dimensions and optimize the processing workflow (Shi et al., 2018). However, pre-processing operations can also reduce the quality of the data, and the final results deeply depend both on the used software and the subjective choices of the operator ).

Segmentation phase
In the point cloud segmentation phase, local features are computed to define similarities among elements, and groups of points, generally called segments, are extracted from 3D data. Several methods have been developed to reach this objective: • edge-based segmentation method (Rabbani et al., 2006) operates by first defining the edges of the various regions and then grouping the points inside the detected boundaries; • region-growing algorithms (Rabbani et al., 2006;Grilli et al., 2017), in which one or more points, called seed points, characterised by specific features are used to create groups of points with shared features; • model fitting algorithms, in which objects are decomposed into basic geometric primitives, such as cubes, cylinders and planes based on mathematical functions; • machine learning segmentation algorithms (including neural network or deep learning approach), which use artificial intelligence to train models and make computers able to take decisions. Machine learning approaches are K-means, hierarchical clustering or mean shift. Generally, in the scan-to-BIM processes, a region growing-based approach, coupled with bottom-up methods, are the most used (Vo et al., 2015). The features employed for the seed points could be efficiently combined to achieve better performances: Tang et al. (2019) employ planar features, local relationships, and geometric constraints to segment an indoor model. A similar approach is used by (Shi et al., 2018).

Classification phase
The classification phase aims to label the previously detected segments, and it is performed both on clusters of points and on meshes. The approaches can be categorized as supervised (semantic classes are assigned based on a training model created from annotated data), unsupervised (no annotations are required, and data are automatically classified based on the user parameters definition), and interactive (the user has to give inputs and feedback to lead the classification). In the Scan-to-BIM process, classification is generally achieved by a supervised approach, defining topological features and spatial relations. Some works (Shi et al, 2018;Bassier et al., 2019) proposed methods to classify meshes. Macher et al. (2017) delineated a semi-automatic approach to detect primitive-based elements. About point cloud datasets and automatic or semiautomatic techniques, Deep and Machine Learning (DL/ML) algorithms are more and more exploited for classifying building heritage elements Matrone et al., 2020;Croce et al., 2021).

The reconstruction and modelling phase
The reconstruction (or restitution) process is intended to generate 3D shapes from labelled primitives, such as walls, slabs and ceilings, extracted from classified points. In the literature, there are many attempts to generate an effective and broadly applicable automated workflow. Following Xu and Stilla (2021), a general classification for the BIM modelling phase includes: • parametric modelling (e.g., model matching or fitting): it uses standard mathematical expressions, such as cubes, planes and cylinders (Kyriakaki-Grammatikaki et al., 2022) in order to fit shapes into clusters (model fitting method). The estimation of these shapes allows the user to recognise the main architectural elements of an existing building, such as floors and ceilings (Leoni et al., 2019), wall surfaces (Hossein Pouraghdam et al., 2019), and primitive geometriesmasses -describing indoor spaces (Jenke et al., 2009). Representative algorithms are HT algorithm (Hough-Transform), sample consensus (RANSAC) (Schnabel et al., 2007) and maximum likelihood estimation SAC (e.g., MLESACT). • surface modelling (e.g., boundary representation, B-Rep model and Isogeometric Analysis (IGA) method for CAD representation): it is a non-parametric modelling method. It suits complex shapes and doesn't require mathematical formulas to describe the surface. The surface modelling strategy is the most common approach in literature. Thanks to several adaptable software and plug-ins, such as Grasshopper, it is possible to associate geometric and semantic information to the relative volumes (Costantino et al., 2021), both for constructive elements, such as walls, roofs and floors, and for architectural decorative apparatus, such as altars or statues. In addition, other plug-ins implement the editability of the imported point clouds and make it possible to manipulate data to return object, directly modelling on the surveying datasets. The most common surface representations are the boundary-based descriptor (B-Rep), in which boundaries are generated by algorithms (Maalek et al., 2019) or by cell decomposition methods (Becker et al., 2006;Kada and McKinley, 2009;Wang et al., 2017;Tran et al. 2020). • volumetric modelling (e.g., Constructive Solid Geometry (CSG) representation, Procedural Modelling (PM), Finite Cell Method (FCM)): it generally requires different types of prior knowledge to be applied (Tang et al., 2010). For this reason, this method is only partially used for 3D restitutions. In general, there are two main approaches for building 3D models deriving from point clouds data: the direct modelling and the parametric one (Tommasi et al., 2016).

The direct and the parametric modelling
In the direct modelling process, the point cloud is used as a reference for the 3D vectorization of the profiles. This process is manual and time-consuming. The operator needs to create several horizontal and vertical sections of the elements to analyze their complexity and extract the main profiles. In this case, generated 3D elements have fixed dimensions and cannot be easily adapted for representing similar objects.
As an alternative approach, in parametric modelling, pre-built and modifiable models can adapt to broader cases by modifying the associated parameters. A more deeply classification includes: • parametric-generative modelling: the models are editable at any step of the modelling process by changing the parameters' value. This type of modelling is typically operated using different interfaces, such as Grasshopper for Rhino 3D (Guidara, 2011); • parametric object-oriented modelling refers essentially to the BIM working process, where the modelling phase is based on pre-built libraries and basic construction elements. The most known software using this process are ©Revit, ©Archicad, ©Allplan.

Modelling strategies and approaches
Modelling strategies and approaches can also be classified, based on the level of automation, in: • manual approaches: sections are generally extracted from point clouds or meshes. The generated NURBS are used to model masses in the BIM environment, from which parametric elements are extracted (e.g., slabs, pillars, etc.); • semi-automatic approaches: they involve one or more Python scripts (Andriasyan et al., 2020) to deal with particular steps in the process. They are applied in software plug-ins, such as Rhinoceros for Grasshopper and Dynamo for Revit, during the pre-processing or other phases (e.g., mesh creation, geometries extrapolation, etc.). The approach afterwards proposed (Section 3) belongs to this category; • automatic approaches: based on a deep manipulation of the point clouds through ML or DL algorithms. These methods aim to detect opening positions or create watertight volumes of rooms for automatically defining mainly walls and floors, starting from semi-automatic approaches. In recent years, semi-automatic plug-ins were released by several software houses, such as PointSense or the As Built Suite, both developed by FARO Technologies. These plug-ins make it possible to recognise elements from the point cloud and associate primitives and shapes to the detected elements.

METHODOLOGY AND PROPOSED SEMI-AUTOMATIC PIPELINE
The proposed tool and workflow enable the creation of 3D objects from NURBS and 3D profiles (Figure 3). The extraction of closed polylines, which define profiles, could be classified as a Boundary-Representation (B-Rep) method. Meshes/surfaces don't need to be generated before extracting profiles, and 3D BIM and HBIM objects can be directly derived from photogrammetric or LiDAR point clouds. A broad range of heterogeneous information (e.g., materials or state of preservation) can be associated with the generated elements recognized inside the VPL software and the Authoring BIM tool. Finally, modelled objects ( Figure 4) could also be exported as single families to be used in different BIM project files. The proposed workflow Figure 5) is based on Dynamo Visual Programming Language (VPL), inside the Autodesk Revit environment. Dynamo is generally used to automatize processes and make replicable and repetitive operations easier, while a few applications are dedicated to 3D modelling from point clouds. Existing nodes designed for this task cannot properly handle the reconstruction of complex and irregular architectural elements. Some packages have been released instead to improve point clouds' management and help the treatment of clusters of points.

Data segmentation and classification
The implemented workflow is based on two preliminary phases: • the point cloud segmentation to identify objects and single elements to model; • point cloud elements classification, enrichment and storage of semantic, positional, and geometric information (points coordinates, normals, RGB, etc.). Segmented and classified elements (e.g., lateral or upper windows frames) are then exported separately as an ASCII file (.txt file) for the following reconstruction steps.

VPL and modelling
Segmented and classified single elements (like window sills or frames) are imported as separated Excel files in Revit's Dynamo VPL environment for the reconstruction phase. The following operations consist in: • extracting the plane, using points normals values, on which the profile path of the elements will be generated with best-fitting line algorithms; • generating a customized clipping box collecting points used to define closed polyline profiles automatically; • creating the HBIM element, sweeping the profile along the profile path; • assigning the element to a specific Revit Family category. The described workflow results in a complex, flexible, and generalized Dynamo script capable of generating different architectural elements in a semi-automatic way.  Based on the complexity of the element to model and the point cloud density, two parameters were created to be manually set and modified ( Figure 5): • Clipping Box Depth: to better intercept all the points in a selected area/volume; • Normal Values Filter: to select, in a defined range, only the points lying on a specific plane. The proposed tool ( Figure 6) makes it possible to model also elements featured by more complex primitives such as arches, vaults, and moulding frames. The entire code, made up of nodes, has been entirely developed inside the Dynamo environment. The code is structured in a visual language, where wires link nodes. The workflow enables preserving the original points coordinates, and this aspect simplifies the positioning of separately modelled elements in the final BIM model. Also points normals (nx, ny, nz) are preserved, and this is particularly helpful in improving the position of the best-fit line in the sweep operation. The sweeping line, in fact, is computed as the best line through points, orthogonal to the extracted element profile (Fig. 8).
The Normal Values Filter is used to filter points based on their respective normal values. Preserving only points with coherent normal values improves the quality of the plane extracted for the generation of the profile path. The thickness of the clipping box rules the number of points the algorithm uses to create the elements' profile. By increasing the thickness value, the profile will feature more details.   The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLVIII-M-2-2023 29th CIPA Symposium "Documenting, Understanding, Preserving Cultural Heritage: Humanities and Digital Technologies for Shaping the Future", 25-30 June 2023, Florence, Italy

VPL Script customization
The final step of the workflow enables the creation of Custom Nodes, which are helpful for effectively organizing visual scripts within the working environment. The visual scripts are composed of a considerable number of differently complex nodes, which can be grouped and customized. In this work, some custom nodes have been designed to group all the nodes useful to merge related functions. As an example, the custom node called CutRefPlane_ByBestFitPoints simplifies the automatic generation of a cross-section plan. In this case, this type of custom node contains eight single nodes and functions. Finally, custom nodes allow all Dynamo users -also visual programmers -to understand, use and also implement a code graph that is clean and intuitive, manipulating only customized graphic elements. the architectural elements, as explained in Grilli and Remondino (2020), a few selected covariance features were used. Following this classification approach, each window element was segmented and classified as a preliminary step of the reconstruction phase (Section 3.1) with the Dynamo codes.

Dataset segmentation and classification
The implemented workflow was tested using the photogrammetric 3D reconstruction of Piazza Duomo in Trento  . Some architectural elements of the Pretorio palace (IX-XIII century), one of the buildings facing the square, and the Duomo, were selected for evaluating the proposed reconstruction pipeline. The dataset (Figure 1) features 11 million points and has a spatial resolution of 1.3 cm. For the segmentation and classification of The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLVIII-M-2-2023 29th CIPA Symposium "Documenting, Understanding, Preserving Cultural Heritage: Humanities and Digital Technologies for Shaping the Future", 25-30 June 2023, Florence, Italy

Validation tests
Windows and arcades were selected among the architectural elements as test-case for the higher level of modelling complexity. In particular ( Figure 7): a) Four types of windows from the main façade of Pretorio palace, located on the southern part of the building: • Typologies 01 and 03 are featured by more regular elements, such as linear frames and moulding frames; • Typologies 02 and 04 present an arch in the upper moulding; b) Arcades in the façade of the Duomo of Trento, located on the western front of the monument, and overlooking both the rose window and the entrance. The arcade is featured by twelve repeated arches with an average height of 0,63 m, a total heigh of 2.53 m and a total length of 11.52 m. The metric assessment of the results considers: • C2M: the comparison between the original point cloud, used as the ground truth, and the mesh obtained from the model within the Revit environment (Cloud-to-Mesh); • C2C: the comparison between the original point cloud, used as the ground truth, and the cloud obtained from the model within the Revit environment (Cloud-to-Cloud); • M2M: the comparison between the mesh obtained from the original point cloud, used as ground truth, and the mesh obtained from the Revit model (Mesh-to-Mesh). Table 1 and Figure 9 as well as Table 2 and Figure 10 report the results for the Pretorio palace windows and for the Duomo arcades, respectively.  This methodology has shown the possibility to save time in modelling complex objects, since the modelling phase is substituted by a semi-automatic process to return objects. The main operations are focused, in fact, on the preparation of the data of the point cloud and the input data. The implemented solution can be easily expanded and replicated for managing different architectural elements with additional nodes and directly modelling in BIM environment from 3D reality-based data. Workflows based on profile lofts combining with Boolean operations of union or subtraction could be implemented. Furthermore, a future development of this work will include the realization of libraries of customizable nodes for modelling heterogeneous and complex architectural elements. Figure 11. The comparison between the mesh profile and the corresponding point cloud used as ground truth, referred to the upper moulding frame.

CONCLUSIONS AND FUTURE WORKS
The results of this work consist of some complete and customizable visual programming nodes for BIM and HBIM modelling. They are based on the Dynamo VPL and require a single file in input, derived from the segmented point cloud dataset. In the developed framework, the automatic extraction of profile path and orthogonal sweeping lines makes it possible to model complex shapes, while using point clouds' normal information increases the precision of the reconstructed geometries.
As mentioned above, the precision of the algorithm is related to thickness of the clipping box used during the reconstruction and the 3D model obtained inside Revit is more detailed the greater is the thickness itself. In addition, incrementing the number of points inside the clipping box, the Level of Detail (LOD), especially the Level of Geometry (LOG) of the returned objects will reach higher precision, since the profiles are closer to the reference point cloud. Figure 11 shows, in fact, the correspondence between the point cloud, used as ground truth and the mesh obtained from the BIM element, referred to the upper moulding frame. In addition, Figure 12, shows instead the comparison between the BIM object of a lateral moulding frame, obtained from Dynamo VPL script within the Revit environment, and the imported point clouds, used as ground truth.