## 3 Framework for Automated Earthwork Network Architecture (ENA)
### Module-1: Topological Feature Collector
This method provides a robust approach for establishing topological connectivity, making it easier to model complex cross-sectional geometries in CAD drawings. After establishing connectivity, the module converts the geometric and topological data into a structured and trainable format. This includes tokenizing features, which is especially beneficial for models like Transformers and LLMs that require sequential data as input. The structured sequences enable the models to learn spatial relationships and dependencies more effectively, ensuring higher prediction accuracy. Figure 4: Pseudocode of creating a closed polyline using the Half-Edge Topology Structure and above algorithm. Figure 3: Example of creating a closed polyline. The training feature vector \(f\) for each entity is standardized to include elements such as layer, length, and vertex coordinates:  
\[\textbf{vector}_{\text{data}}=\left\{\textbf{Layer},\textbf{Length},\textbf{v}\right\} \tag{1}\]  
where  
**Layer**: Includes attributes like name, line type, and color. **Length**: Represents the geometric dimensions of the entity. \(\textbf{v}\): Denotes the x, y coordinates of the vertex. Since entities in CAD drawings can vary significantly in representation, immutable elements such as layer names, vertical relationships, and intersection counts are used for consistency. The features are defined as:  
\[f=\left\{\textbf{Layer}_{\text{name}},\textbf{rel}_{\text{gnd}},\textbf{int}_{ \text{pave}}\right\} \tag{2}\]  
where  
\(\textbf{Layer}_{\text{name}}\): Captures the context of overlapping layers, such as ground, slope, and pavement layers. \(\textbf{rel}_{\text{gnd}}\): Describes the vertical relationship between the entity and the ground line, indicating whether the entity is above, below, or overlapping the ground line. \(\textbf{int}_{\text{pave}}\): Represents the number of intersections between the entity and pavement layers, crucial for area quantity characterization. The feature relgnd determines whether an entity is above, below, or overlapping with the ground line, facilitating as a cut or fill. It is defined as  
\[rel_{gnd}=\left\{ \begin{array}{rcl}below&if&\text{max}\big{(}D_{y}\big{)}< \text{min}\big{(}G_{y}\big{)}\\ above&if&\text{min}\big{(}D_{y}\big{)}<\text{max}\big{(}G_{y}\big{)}\\ below&otherwise\end{array} \right. \tag{3}\]  
where  
\(\textbf{D}\textbf{y}\) is the y-coordinate of the design line;  
\(\textbf{Gy}\) is the y-coordinate of the ground line. Similarly, intpave measures the intersections between the design lines and the pavement layers using  
\[\textbf{int}_{\text{pave}}=\left\{\text{ count }(ip)\mid ip\in\textbf{IP}\right\} \tag{4}\]  
where  
\(\textbf{IP}=\left\{\text{ }x\mid\text{ intersect }(V_{PB},\text{ pave})\right\}\);  
\(V_{PB}=(P_{BCP},PL_{cp})\);  
\(P_{BCP}=\text{center point of the pavement's bottom}\);  
\(PL_{cp}=\text{center point of each pavement layer}\);  
\(\textbf{pave}=\left\{\text{pavement}_{\text{layer}(b)}\mid i=\left\{1,\dots,n \right\}\right\}\);  
\(\textbf{intersect}=\text{intersection calculation function between two lines}\). These feature definitions help to distinguish between different entities and their relationships within a cross-sectional drawing, providing critical inputs for accurate earthwork. The processed and structured data from the Topological Feature Collector become the primary input for the ENA models developed in Module-2. By organizing the data into a format suitable for model training, this module ensures that the deep learning models can accurately learn and generalize from the dataset, leading to better performance in Quantity Takeoff Classification and prediction tasks.