AI-based CAD drawing cable path recognition and engineering quantity accounting method and system
By constructing an electrical design semantic graph and a graph attention network, the system automatically identifies equipment types and circuit numbers in CAD drawings, resolving issues such as cable tray capacity exceeding limits and path conflicts. This achieves full-process automation of cable path identification and quantity calculation, improving efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA RAILWAY ELECTRIFICATION ENGINEERING GROUP CO LTD
- Filing Date
- 2026-07-07
- Publication Date
- 2026-08-04
AI Technical Summary
Existing technologies cannot automate the entire process of cable path identification and quantity calculation in CAD drawings. Overcapacity of cable trays and path conflicts are difficult to resolve automatically, and manual operation is inefficient, inaccurate, and inconsistent.
Construct an electrical design semantic graph, predict equipment type and circuit number through graph attention network, perform multi-circuit path search on cable tray topology graph, dynamically update capacity occupancy status, solve the problem of replanning path when capacity exceeds limit, and realize full-process automation.
It improved the accuracy and consistency of cable path identification, reduced manual statistical steps, and achieved full automation from drawing recognition to engineering quantity calculation, thus solving the problems of cable tray capacity exceeding limits and path conflicts.
Smart Images

Figure CN122509504A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of engineering drawing information processing based on artificial intelligence, and specifically relates to an AI-based method and system for cable path identification and engineering quantity calculation in CAD drawings. Background Technology
[0002] In building electrical engineering design, cable route planning and quantity calculation are core tasks in the construction drawing design phase. Designers need to identify distribution boxes, terminal equipment, and cable tray routes in CAD drawings, allocate laying paths for each circuit while meeting cable tray capacity constraints, and calculate the cable length and equipment quantity for each circuit to form a bill of quantities.
[0003] Currently, the above work is mainly done manually. Designers painstakingly read the geometric lines, text annotations, and block references in the CAD drawings, manually determine the equipment type, classify the circuit affiliation, estimate the cross-sectional dimensions of the cable trays, and then plan the cable routing for each circuit based on experience. Because building electrical drawings contain a large number of circuits and the cable tray topology is complex, manual operation makes it difficult to accurately track the capacity occupancy status of each cable tray section. When multiple circuits share the same cable tray section, it can easily lead to the cable tray capacity exceeding limits, causing the route planning results to differ from the actual project. Furthermore, manually counting the number of equipment and cable lengths is labor-intensive and inefficient, and different designers may interpret the information in the drawings differently, directly affecting the accuracy and consistency of the quantity calculation results.
[0004] Some software tools attempt to semi-automatically process CAD drawings, extracting partial electrical equipment information through layer filtering or element matching. However, these methods rely solely on predefined layer names or element attributes for identification, placing high demands on the consistency of drawing specifications and failing to effectively handle graphic variations arising from different drawing habits. Regarding cable tray topology extraction, existing methods lack the ability to automatically aggregate the connection relationships of cable tray endpoints, making it difficult to construct a topology map that accurately reflects the actual cable tray routing. In terms of path search, most existing methods only solve for the shortest path for a single circuit, failing to consider the capacity constraints of cable tray sections in scenarios with multiple circuits laid in parallel, and thus cannot automatically resolve path conflicts or perform path replanning after capacity exceedance.
[0005] With the development of artificial intelligence technology in the engineering field, explorations have emerged in using graph neural networks to process engineering drawing information. However, existing graph neural network-based drawing recognition methods mostly focus on the classification and recognition of single primitives, failing to model geometric primitives, text annotations, and block references into a unified semantically related graph structure. This makes it impossible to predict the cross-sectional dimensions of cable tray sections while simultaneously identifying equipment types and loop numbers. In terms of multi-loop path planning, existing AI methods have not yet established a complete technical chain from semantic graph construction, graph attention network prediction, automatic cable tray topology generation to multi-loop capacity-constrained path search, and cannot achieve fully automated processing from drawing recognition, topology construction, multi-loop capacity-constrained path search to quantity calculation within a unified framework. Summary of the Invention
[0006] To address the aforementioned problems in existing technologies, namely the inability to achieve fully automated processing and the difficulty in automatically resolving issues such as cable tray capacity exceeding limits and path conflicts, this invention provides an AI-based method and system for identifying cable paths and calculating quantities in CAD drawings.
[0007] In a first aspect, this invention proposes an AI-based method for cable path identification and quantity calculation in CAD drawings, comprising: Obtain geometric primitives, text annotations, and block references from CAD drawings as nodes, and establish spatial proximity edges, topological connection edges, and semantic belonging edges based on spatial proximity and loop annotations to construct an electrical design semantic graph; The electrical design semantic graph is input into a graph attention network to predict the device type and circuit number of the nodes, as well as the cable tray segment attributes and cross-sectional dimensions of the topology connection edges; Based on the cable tray section attributes and cross-sectional dimensions, extract the cable tray sections and aggregate the endpoints into a cable tray topology diagram. Initialize the capacity occupancy status of the cable tray sections and generate an equipment list and a loop equipment mapping table based on the equipment type and loop number. Based on the circuit equipment mapping table, the distribution box node and terminal equipment node of each circuit are determined. A multi-circuit rotation path search is performed on the cable tray topology map, and the capacity occupancy of each cable tray segment is dynamically updated. When the capacity of a cable tray segment exceeds the limit, the circuit passing through that cable tray segment is replanned until there are no cable tray segments exceeding the limit or the preset iteration termination condition is reached. Then, the cable length of each circuit is calculated. If there are still cable tray segments exceeding the limit after the preset iteration termination condition is reached, a capacity over-limit prompt message is output. Summarize the number of devices and cable lengths for each circuit, and output the engineering quantity calculation results.
[0008] Furthermore, an electrical design semantic graph is constructed, including: Traverse the CAD drawings, extract the coordinates of the first and last endpoints of each geometric element, extract the positioning points and text content of each text annotation, and extract the insertion points of each block reference. Identify loop annotations in the text content; Connect two geometric primitives whose end-to-end distance is less than the preset splicing tolerance to create a spatial proximity edge; Connect two geometric primitives whose first and last endpoint coordinates coincide to establish a topological connection edge; For each text annotation node containing the loop annotation, determine the block reference node that is closest to the positioning point of the text annotation node, connect the text annotation node and the block reference node to establish a semantic belonging edge, and assign the loop annotation to the semantic belonging edge; Generate an electrical design semantic graph with the geometric primitives, text labels, and block references as nodes, and the spatial proximity edges, topological connection edges, and semantic affiliation edges as edges.
[0009] Furthermore, the electrical design semantic graph is input into a graph attention network to predict the device type and circuit number of the nodes, as well as the cable tray segment attributes and cross-sectional dimensions of the topology connection edges, including: The geometric primitives, text labels, and block references are encoded into initial node feature vectors, and the edge types and the loop labels carried by the semantically associated edges are encoded into initial edge feature vectors. By using multi-layer iterative aggregation and updating of the graph attention network, the initial node feature vectors of adjacent nodes and the initial edge feature vectors of connected edges are fused using attention weights to obtain the final node feature vectors of each node and the final edge feature vectors of each topological connection edge. Based on the final node feature vector, classify and predict the device type and loop number of the node. Based on the final edge feature vector and the final node feature vector of the connected node, classify and map to predict the cable tray segment attributes and cross-sectional dimensions of the topology connection edge.
[0010] Furthermore, the multi-level iterative aggregation update includes: For the central node in the current iteration layer, calculate the attention weights between the node feature vector of the central node and the node feature vectors of each of the adjacent nodes. The node feature vectors of each adjacent node and the edge feature vectors of the connected edges are weighted and aggregated according to the attention weights to obtain the aggregated feature vector; A nonlinear transformation is performed on the aggregated feature vector and the node feature vector of the central node to obtain the updated node feature vector of the central node.
[0011] Furthermore, based on the cable tray segment attributes and cross-sectional dimensions, the cable tray segments are extracted and their endpoints are aggregated into a cable tray topology diagram. The capacity occupancy status of the cable tray segments is initialized, and an equipment list and a loop equipment mapping table are generated based on the equipment type and loop number, including: The edges whose attribute identifier is cable tray segment among the predicted topological connection edges are selected as cable tray segments, and the endpoint coordinates, direction and cross-sectional dimensions of each cable tray segment are obtained; Based on the endpoint spacing and endpoint connection conditions of the cable tray segments, the endpoints of the cable tray segments are aggregated. The endpoints of the cable tray segments whose endpoint spacing is less than a preset distance threshold and which meet any of the following conditions: endpoint coordinate coincidence, cable tray segment intersection, continuous direction, or preset corner connection, are merged into the same cable tray topology node. A cable tray topology graph is constructed with the cable tray segments as edges and the merged cable tray topology node as vertices. The total capacity of each cable tray section is determined based on the cross-sectional dimensions and the preset cable fill rate, and the occupied capacity of the cable tray section is set to zero. Associate the predicted loop numbers with nodes of equipment type distribution box and nodes of equipment type terminal equipment, and establish a loop equipment mapping table from loop numbers to the set of distribution box nodes and terminal equipment nodes; Count the number of nodes according to equipment type and generate an equipment list.
[0012] Furthermore, the aggregation of cable tray segment endpoints based on the endpoint spacing and endpoint connection conditions, merging cable tray segment endpoints with endpoint spacing less than a preset distance threshold and satisfying any one of the following conditions—endpoint coordinate coincidence, cable tray segment intersection, continuous routing, or preset corner connection—into a single cable tray topology node, includes: The beginning and end points of each bridge section are clustered according to the preset distance threshold to form end point clusters; Obtain the orientation direction of the cable tray segment to which each endpoint belongs within the same endpoint cluster; For any two endpoints within the same endpoint cluster, determine whether the cable tray segments to which the two endpoints belong satisfy any of the following conditions: endpoint coordinate coincidence, cable tray segments intersecting, continuous routing, or preset corner connection; assign endpoints that satisfy any condition to the same connected component, and merge the endpoints within the same connected component into a single cable tray topology node; for endpoints that do not form a connected component with other endpoints, retain them as independent cable tray topology nodes.
[0013] Furthermore, based on the circuit equipment mapping table, the distribution box nodes and terminal equipment nodes of each circuit are determined. A multi-circuit rotation path search is performed on the cable tray topology map, dynamically updating the capacity occupancy of each cable tray segment. When the capacity of a cable tray segment exceeds the limit, the circuits passing through that segment are re-planned until no more cable tray segments exceed the limit or a preset iteration termination condition is met. Then, the cable length of each circuit is calculated. If an over-limit cable tray segment still exists after the preset iteration termination condition is met, a capacity over-limit warning message is output, including: Extract the distribution box node and end device node corresponding to each circuit from the circuit device mapping table; Using the length of the cable tray segment as the edge weight, and following the preset circuit priority order, the shortest connection cable tray segment set covering the distribution box node and all end device nodes is searched for each circuit in turn. The shortest connection cable tray segment set is obtained by merging the segmented shortest paths from the distribution box node to each end device node and deduplicating them according to the cable tray segment number. Each cable tray segment in the shortest connection cable tray segment set occupies the capacity required by the corresponding circuit. Identify cable tray sections whose occupied capacity exceeds the total capacity and determine them as oversized cable tray sections; For loops passing through the oversized cable tray segments, path replanning is performed in reverse order of loop priority. The path replanning includes: searching for alternative paths on the cable tray topology graph with increased edge weights of the oversized cable tray segments; if the occupied capacity of each cable tray segment traversed by the alternative path does not exceed the total capacity, the alternative path is adopted and the capacity occupancy is updated; otherwise, the original path is maintained. Repeat the over-limit detection and reverse replanning until there are no over-limit cable tray segments or the preset iteration termination condition is met; The cable length of each circuit is obtained by summing the lengths of the cable tray sections traversed by the final path of each circuit.
[0014] Furthermore, an alternative path is searched on the cable tray topology graph with increased edge weights for the overloaded cable tray segments. If the occupied capacity of each cable tray segment traversed by the alternative path does not exceed the total capacity, the alternative path is adopted and the capacity occupancy is updated; otherwise, the original path is maintained, including: Release the capacity occupied by the remaining cable tray segments in the current path of the loop to be replanned, excluding the oversized cable tray segment; Multiply the edge weight of the oversized cable tray segment in the cable tray topology graph by a preset penalty coefficient; Starting from the distribution box node of the circuit to be replanned, and the set of terminal equipment nodes is the set of reachable nodes, the shortest path is searched on the cable tray topology graph after modifying the edge weights and capacity to obtain candidate alternative paths. Check whether the remaining capacity of all cable tray segments traversed by the candidate alternative path is not less than the capacity required by the loop to be replanned; If all are not less than, then the candidate alternative path is used to replace the current path, the capacity occupation of the loop to be replanned on the oversized cable tray segment is released, the original edge weight of the oversized cable tray segment is restored, and the capacity required by the loop to be replanned is occupied on the cable tray segment through which the candidate alternative path passes. If any cable tray segment has a remaining capacity less than the capacity required by the loop to be replanned, then the capacity occupancy of the loop to be replanned on the original path and the original edge weight of the over-limit cable tray segment are restored, and the process is redirected to the previous loop in the reverse order for replanning; if there is no previous loop in the reverse order, or all loops passing through the over-limit cable tray segment fail to be replanned, then the over-limit cable tray segment is recorded as an unresolved over-limit cable tray segment, and the process proceeds to the preset iteration termination condition judgment.
[0015] Furthermore, the quantity of equipment and cable length for each circuit are summarized, and the project quantity calculation results are output, including: Based on the aforementioned loop device mapping table, the number of devices of each device type is counted according to the loop. Based on the final determined cable tray route for each circuit, the cable length of each circuit is divided into segments according to the cable tray sections it passes through, and the cross-sectional dimensions and capacity occupancy rate of each cable tray segment are correlated. The quantity of equipment counted by circuit, the cable length counted by segment, and the cross-sectional dimensions and capacity occupancy rate of each cable tray segment are combined to form the result of the engineering quantity calculation.
[0016] A second aspect of the present invention proposes an AI-based CAD drawing cable path identification and quantity calculation system for executing an AI-based CAD drawing cable path identification and quantity calculation method. The system includes: The semantic graph construction module is used to obtain geometric primitives, text annotations and block references from CAD drawings as nodes, and to establish spatial proximity edges, topological connection edges and semantic belonging edges based on spatial proximity and loop annotations to construct the electrical design semantic graph. The graph attention network prediction module is used to input the electrical design semantic graph into the graph attention network to predict the device type and circuit number of the nodes, as well as the cable tray segment attributes and cross-sectional dimensions of the topology connection edges; The cable tray topology construction and initialization module is used to extract cable tray segments based on the cable tray segment attributes and cross-sectional dimensions, aggregate endpoints into a cable tray topology, initialize the capacity occupancy status of cable tray segments, and generate an equipment list and a loop equipment mapping table based on the equipment type and loop number. The multi-loop path search and replanning module is used to determine the distribution box node and end device node of each loop according to the loop equipment mapping table, perform multi-loop alternating path search on the cable tray topology map, dynamically update the capacity occupancy of each cable tray segment, and replan the path of the loop passing through the cable tray segment when the capacity of the cable tray segment exceeds the limit, until there are no cable tray segments exceeding the limit or the preset iteration termination condition is reached, and calculate the cable length of each loop; when there are still cable tray segments exceeding the limit after the preset iteration termination condition is reached, the capacity over-limit prompt message is output. The quantity calculation output module is used to summarize the number of devices and cable lengths for each circuit and output the quantity calculation results.
[0017] The beneficial effects of this invention are: This invention constructs an electrical design semantic graph by unifying geometric primitives, text annotations, and block references in CAD drawings, and establishes spatial proximity edges, topological connection edges, and semantic belonging edges. This enables the scattered graphic information and annotation information in the drawings to form a structured semantic association, providing a complete graph structure input for subsequent automated recognition and reducing the reliance on the consistency of drawing drawing specifications.
[0018] This invention uses graph attention networks to predict node equipment types and circuit numbers, topology connection edge cable tray segment attributes and cross-sectional dimensions of electrical design semantic graphs. By using attention mechanisms to fuse features of adjacent nodes and connected edges, it can simultaneously complete equipment identification, circuit attribution, and cable tray segment attribute judgment within a unified network framework, thereby improving the completeness of information extraction and processing efficiency.
[0019] This invention aggregates the predicted cable tray segment endpoints into a cable tray topology map and merges endpoints based on the consistency of the direction and the spacing between endpoints, so that the automatically constructed cable tray topology map more accurately reflects the actual cable tray direction and connection relationship, providing a reliable topology basis for subsequent path search.
[0020] This invention dynamically updates the capacity occupancy status of each cable tray segment during the multi-loop alternating path search process, and performs reverse replanning of the passing loops when the capacity of the cable tray segment is detected to be over-limit. Under the premise of satisfying the capacity constraints of the cable tray segment, the laying path of each loop is determined, which solves the capacity conflict problem when multiple loops share the cable tray segment and improves the degree of conformity between the path planning results and the actual engineering conditions.
[0021] This invention integrates the final determined cable tray path, segmented cable length, cable tray section cross-sectional dimensions, and capacity occupancy rate of each circuit into the engineering quantity calculation result, realizing the fully automated processing from drawing recognition, topology construction, path planning to engineering quantity calculation, reducing manual statistical steps, and improving the accuracy and consistency of the calculation results. Attached Figure Description
[0022] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a flowchart of an AI-based CAD drawing cable path identification and engineering quantity calculation method according to the present invention; Figure 2This is a schematic diagram of data processing in the AI-based CAD drawing cable path identification and engineering quantity calculation method of the present invention, which parses the original CAD drawing into an electrical design semantic diagram; Figure 3 This is a schematic diagram illustrating the output of the quantity calculation results based on the cable tray path, equipment list, and loop statistics in the AI-based CAD drawing cable path identification and quantity calculation method of the present invention. Figure 4 This is a flowchart of an AI-based CAD drawing cable path identification and engineering quantity calculation system according to the present invention. Detailed Implementation
[0023] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the invention. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.
[0024] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0025] The first embodiment of the present invention provides an AI-based method for cable path identification and quantity calculation in CAD drawings, including: Step S10: Obtain geometric primitives, text annotations, and block references from the CAD drawings as nodes, and establish spatial proximity edges, topological connection edges, and semantic belonging edges based on spatial proximity and loop annotations to construct an electrical design semantic graph; Step S20: Input the electrical design semantic graph into the graph attention network to predict the device type and circuit number of the node, as well as the cable tray segment attributes and cross-sectional dimensions of the topology connection edge; Step S30: Extract the cable tray segment based on the cable tray segment attributes and cross-sectional dimensions, aggregate the endpoints into a cable tray topology map, initialize the cable tray segment capacity occupancy status, and generate an equipment list and a loop equipment mapping table based on the equipment type and loop number; Step S40: Determine the distribution box node and terminal device node of each circuit according to the circuit equipment mapping table, perform multi-circuit rotation path search on the cable tray topology map, dynamically update the capacity occupancy of each cable tray segment, and replan the path of the circuit passing through the cable tray segment when the capacity of the cable tray segment exceeds the limit, until there are no cable tray segments exceeding the limit or the preset iteration termination condition is reached, and calculate the cable length of each circuit; if there are still cable tray segments exceeding the limit after the preset iteration termination condition is reached, output the capacity over-limit prompt message. Step S50: Summarize the number of devices and cable lengths for each circuit, and output the engineering quantity calculation results.
[0026] To more clearly explain the AI-based CAD drawing cable path identification and quantity calculation method of this invention, the following will be combined with... Figure 1 The steps in the embodiments of the present invention are described in detail below: Step S10: Obtain geometric primitives, text annotations, and block references from the CAD drawings as nodes, and establish spatial proximity edges, topological connection edges, and semantic belonging edges based on spatial proximity and loop annotations to construct an electrical design semantic graph; In this embodiment, constructing an electrical design semantic graph includes: Step S11: Traverse the CAD drawing, extract the coordinates of the first and last endpoints of each geometric element, extract the positioning points and text content of each text annotation, and extract the insertion points of each block reference. Step S12: Identify loop annotations in the text content; Step S13: Connect two geometric primitives whose end-to-end distance is less than the preset splicing tolerance to establish a spatial proximity edge; Step S14: Connect two geometric primitives whose start and end coordinates coincide to establish a topological connection edge; Step S15: For each text annotation node containing the loop annotation, determine the block reference node that is closest to the positioning point of the text annotation node, connect the text annotation node and the block reference node to establish a semantic belonging edge, and assign the loop annotation to the semantic belonging edge; Step S16: Generate an electrical design semantic graph with the geometric primitives, text annotations, and block references as nodes, and the spatial proximity edges, topological connection edges, and semantic affiliation edges as edges.
[0027] In step S11, the CAD drawing is parsed, and the graphic objects in the drawing database are traversed to extract all geometric primitives, including line segments, polylines, arcs, and splines. For line segments, the starting and ending coordinates are directly obtained as the coordinates of the first and last endpoints. For polylines, they are decomposed into a continuous sequence of line segments according to the vertex order, and the first and last endpoints of each line segment are the coordinates of the two adjacent vertices. For arcs and splines, they are discretized according to a set precision, converted into a sequence of polyline segments, and the endpoint coordinates of each polyline segment are extracted. The extracted geometric primitives are all used as candidate nodes, and their endpoint coordinates and geometric attributes are recorded. The geometric attributes include layer name, line type name, line segment length, and color index value. At the same time, the text annotation objects in the drawing are traversed to extract the positioning point coordinates and complete text content of single-line and multi-line text. The positioning point is the insertion base point of the text annotation in the drawing coordinate system. The extracted text annotations are used as candidate nodes, and their positioning point coordinates and text content are recorded. The block reference objects in the drawing are traversed to extract the insertion point coordinates and block definition name of each block reference. A block reference is a block instance representing a device symbol in a CAD drawing, and its insertion point is its location point in the drawing. All extracted block references are used as candidate nodes, and their insertion point coordinates and block names are recorded.
[0028] In step S12, loop labels in text annotations are identified. Loop labels are identifiers used to distinguish electrical loops, typically containing a combination of letters and numbers, such as "WP1", "WP2", or "WP3", and may also include preset keyword prefixes, such as "loop" or "distribution loop". The identification process uses text pattern matching. Based on a preset regular expression or keyword list, the loop number string is extracted from the text content of each text annotation. If the text contains multiple candidate loop labels, the one with the highest matching degree to the preset format is selected as the loop label for that text annotation node. If a text annotation node does not contain any identifiable loop labels, that node will not participate in subsequent semantic attribution edges that use loop labels as a condition for connection.
[0029] In step S13, spatial proximity edges are established. Spatial proximity edges are used to connect geometric elements that should be connected on the drawing but have slight gaps due to drawing errors or inaccurate capture. For any two geometric element nodes, the Euclidean distance between all pairs of their endpoints is calculated. If there is a pair of endpoints with a distance less than a preset splicing tolerance, these two geometric element nodes are connected to establish a spatial proximity edge. The preset splicing tolerance can be set according to the drawing scale and engineering accuracy requirements, and is usually taken as 5 units of length in the drawing unit, for example, 5 millimeters in a millimeter unit drawing. To avoid duplicate edge creation, connected node pairs can be marked. The two geometric elements connected by the spatial proximity edge are considered to be spatially close and may belong to the same continuous cable tray or conductor path.
[0030] In step S14, topological connection edges are established. Topological connection edges represent the end-to-end connections between geometric primitives. For any two geometric primitive nodes, it is checked whether any endpoint of one geometric primitive coincides with any endpoint of another geometric primitive. The determination of coordinate coincidence takes into account numerical calculation errors, setting a coordinate tolerance, for example, 10 to the power of -6 drawing units. When the distance between two points is less than this tolerance, they are considered to coincide. If endpoints coincide, the two geometric primitive nodes are connected to establish a topological connection edge. Topological connection edges reflect the precise physical connections between primitives and are used for subsequent prediction of cable tray segment attributes and construction of the topology map. A geometric primitive can form multiple topological connection edges with multiple other geometric primitives through different endpoints to express branching or merging relationships.
[0031] In step S15, semantic attribution edges are established. Semantic attribution edges are used to associate the loop annotation information contained in the text annotation with the corresponding device block reference. All text annotation nodes containing loop annotations are traversed. For each such text annotation node, the distance between its location point and the insertion points of all block reference nodes is calculated. Using the nearest neighbor principle, the nearest block reference node is connected to the text annotation node to establish a semantic attribution edge. The loop annotation string identified by the text annotation node is assigned to the semantic attribution edge as an edge attribute, called the loop attribute. If multiple block reference nodes are equidistant from the text annotation node and are all the closest, a block reference node is selected for connection by comparing the text relevance between the block name and the loop annotation, or based on layer priority. Semantic attribution edges realize the transmission of electrical loop information to device symbols, enabling multiple devices under the same loop annotation to be indirectly associated through block reference nodes connected to the text annotation.
[0032] In step S16, all the nodes and edges mentioned above are combined into an electrical design semantic graph. The set of vertices of the graph consists of all geometric primitive nodes, text annotation nodes, and block reference nodes. The set of edges consists of all established spatial proximity edges, topological connection edges, and semantic attribution edges. The edge type is stored as an edge attribute, including spatial proximity edge type, topological connection edge type, and semantic attribution edge type, where semantic attribution edges also carry a loop attribute. The generated electrical design semantic graph is represented as a graph data structure, where the node feature vectors are obtained by encoding the node's own attributes, and the edge feature vectors are obtained by encoding the edge type and loop attribute, providing a complete graph structure input for subsequent prediction by the graph attention network. This semantic graph integrates the geometric connection relationships, topological connection relationships, and semantic annotation relationships of the CAD drawings, unifying the scattered graphic and textual information into a structured relational graph.
[0033] In this embodiment, as Figure 2As shown, the original CAD drawing to be processed can first undergo element parsing. The original CAD drawing includes graphic objects such as cable tray segments, circuit labels, distribution boxes, lighting fixtures, sockets, switches, and junction boxes. After traversing the original CAD drawing, the system extracts geometric element nodes, text label nodes, and block reference nodes. Among them, geometric element nodes are used to represent graphic elements such as cable tray segments or arcs, and record the coordinates of the endpoints; text label nodes are used to represent circuit labels such as WP1, WP2, and WP3, and record the corresponding positioning point coordinates; block reference nodes are used to represent equipment symbols such as distribution boxes, lighting fixtures, sockets, switches, and junction boxes, and record the corresponding insertion point coordinates.
[0034] Furthermore, the system establishes spatial proximity edges based on the endpoint distances between geometric primitives, topological connection edges based on the overlap of the start and end endpoints of geometric primitives, and semantic attribution edges based on the positional relationship between text labels and the nearest equipment block reference. Thus, the scattered line segments, text, and equipment blocks in the original CAD drawings are transformed into an electrical design semantic graph containing node types and edge types, enabling the subsequent graph attention network to identify equipment types, circuit numbers, and cable tray segment attributes within the same graph structure.
[0035] Step S20: Input the electrical design semantic graph into the graph attention network to predict the device type and circuit number of the node, as well as the cable tray segment attributes and cross-sectional dimensions of the topology connection edge; In this embodiment, step S20 includes: Step S21: Encode the geometric primitives, text annotations, and block references into initial node feature vectors, and encode the edge types and the loop annotations carried by the semantically associated edges into initial edge feature vectors. Step S22: Through multi-layer iterative aggregation and update of the graph attention network, the initial node feature vectors of adjacent nodes and the initial edge feature vectors of connected edges are fused using attention weights to obtain the final node feature vectors of each node and the final edge feature vectors of each topological connection edge. Step S23: Based on the final node feature vector, classify and predict the device type and loop number of the node; based on the final edge feature vector and the final node feature vector of the connected node, classify and map to predict the cable tray segment attributes and cross-sectional dimensions of the topology connection edge.
[0036] Multi-level iterative aggregation updates include: Step S221: For the central node in the current iteration layer, calculate the attention weights between the node feature vector of the central node and the node feature vectors of each adjacent node. Step S222: The node feature vectors of each adjacent node and the edge feature vectors of the connected edges are weighted and aggregated according to the attention weights to obtain the aggregated feature vector. Step S223: Perform a nonlinear transformation on the aggregated feature vector and the node feature vector of the central node to obtain the updated node feature vector of the central node.
[0037] In step S21, feature encoding is performed on each node and edge in the electrical design semantic graph to generate initial node feature vectors and initial edge feature vectors. For geometric primitive nodes, their attributes include layer name, line type name, line segment length, and color index value. The layer name and line type name are mapped into dense vectors through word embedding. The line segment length is normalized and used as a continuous value feature. The color index value is one-hot encoded. The above features are concatenated to obtain the initial node feature vector of the geometric primitive node. For text annotation nodes, their attribute is text content. A pre-trained text encoder is used to convert the text content into a fixed-dimensional semantic feature vector. At the same time, a binary indicator feature indicating whether the text content contains loop annotations is extracted. The semantic feature vector and the binary indicator feature are concatenated to obtain the initial node feature vector of the text annotation node. For block reference nodes, their attribute is the block definition name. They are mapped into a dense vector through word embedding to obtain the initial node feature vector. The initial node feature vectors of all nodes have a unified dimension, and any insufficient dimension is padded with zeros. For edges, the edge types of spatially adjacent edges and topologically connected edges are represented by one-hot encoding. In addition to the one-hot encoding of the edge type, the semantically attributed edges also have their carried loop label strings converted into fixed-dimensional vectors through character-level encoding or hash mapping, which are then concatenated with the edge type encoding as the initial edge feature vector.
[0038] In step S22, the graph attention network is updated through multi-layer iterative aggregation. The node feature vectors of adjacent nodes and the edge feature vectors of connected edges are fused using attention weights to obtain the final node feature vectors of each node and the final edge feature vectors of each topological connection edge. The graph attention network stacks multiple attention layers, and the calculation process of each layer is carried out in steps S221 to S223.
[0039] In step S221, for the center node in the current iteration layer, the attention weights between the node feature vector of the center node and the node feature vectors of each of its neighboring nodes are calculated. Let the node feature vector of the center node i in the current layer be... The feature vector of the neighboring node j in the current layer is The edge feature vector of the edge connecting node i and node j is ;Will and Multiply by the learnable linear transformation matrix respectively This yields the transformed node feature vectors, which are then compared with the edge feature vectors. Perform concatenation, combining the concatenated vector with the learnable attention weight vector. Calculate the dot product, process it using the LeakyReLU activation function, and then perform softmax normalization on all neighboring nodes of the center node i to obtain the attention weights of neighboring node j to the center node i. Its calculation formula is expressed as: ; In the formula, This represents a vector concatenation operation. This is the transpose of the attention weight vector. For the modified linear unit activation function with leakage, This indicates that the normalized exponential function operation is performed on all neighboring nodes j of the central node i.
[0040] In step S222, the node feature vectors of each adjacent node and the edge feature vectors of the connected edges are weighted and aggregated according to attention weights to obtain an aggregated feature vector. For the center node i, the feature vectors of each of its adjacent nodes j are linearly transformed. With edge feature vectors Perform concatenation, then multiply by the attention weight of neighboring node j to center node i. The aggregated feature vector is obtained by summing the weighted results of all adjacent nodes. The calculation formula is expressed as: ; in, Let i represent the set of neighboring nodes of the central node i.
[0041] In step S223, a nonlinear transformation is performed on the aggregated feature vector and the node feature vector of the center node to obtain the updated node feature vector of the center node. The aggregated feature vector... The node feature vector of the current layer of the central node The data is concatenated using a learnable weight matrix. Perform a linear transformation, followed by the exponential linear unit activation function. After processing, a residual connection is introduced to superimpose the original feature vectors of the central nodes onto the transformation result, resulting in updated node feature vectors. The calculation formula is expressed as: ; in, The learnable weight matrix is used for feature updates. The activation function is an exponential linear unit. In multi-layer iterations, a multi-head attention mechanism is introduced, which involves parallel computation of multiple independent attention weights and aggregation results. The outputs of each group are concatenated or averaged to obtain the final node feature vector of that layer. After a preset number of iterations, the node feature vector output by the last layer becomes the final node feature vector for each node. The preset number of layers in the graph attention network is determined based on the scale of the electrical design semantic graph, typically set to 2 to 4 layers. For small drawings with fewer than 500 nodes, 2 layers are sufficient to obtain adequate neighborhood information; for large drawings with more than 2000 nodes, up to 4 layers can be added to expand the receptive field. Each layer employs a multi-head attention mechanism, with 4 or 8 attention heads. The outputs of each head are concatenated and linearly transformed to obtain the node feature vector for that layer. The above settings for the number of layers and heads are based on engineering experience; those skilled in the art can adjust them according to the actual drawing complexity and computational resources. For a topologically connected edge, its final edge feature vector is obtained by concatenating the initial edge feature vector of the edge with the final node feature vectors of the nodes at both ends of the edge, and then performing a nonlinear mapping through a fully connected layer.
[0042] In step S23, the device type and loop number of a node are predicted based on the feature vector of the final node. The cable tray segment attributes and cross-sectional dimensions of the topology connection edges are predicted based on the feature vector of the final edge and the feature vector of the final node of the connected nodes. The device type classifier is a fully connected layer followed by a softmax activation function. The input is the final node feature vector of the node, and the output is the probability distribution of each candidate device type. The device type with the highest probability is taken as the prediction result. Candidate device types include distribution boxes, lighting fixtures, sockets, switches, junction boxes, etc. The loop number classifier has a similar structure to the device type classifier. The output is the probability distribution of the loop number to which the node belongs. The set of loop number categories is the union of all loop labels extracted from all text annotations. For topological connection edges, the final node feature vectors of the nodes at both ends of the edge are concatenated with the final edge feature vector of the edge, and then input into the cable tray segment attribute classifier. After processing by a fully connected layer and a softmax activation function, the output is a binary classification result of cable tray segment attribute or non-cable tray segment. If classified as a cable tray segment, the concatenated feature vector is further input into the cross-section size mapping module. The cross-section size mapping module is a regression network composed of fully connected layers, which outputs the normalized values of the cross-section width and cross-section height of the cable tray segment. Then, it is mapped to the actual cross-section size value through inverse normalization. The cross-section size is selected from the preset set of standard cable tray cross-section specifications, and the specification that is closest to the regression result is selected as the final predicted cross-section size. The standard cable tray cross-section specifications include, but are not limited to, the following common specifications (width × height, unit: mm): 100×50, 100×75, 100×100, 150×75, 150×100, 200×100, 200×150, 300×100, 300×150, 400×150, 400×200, 500×200, 600×200. The selection method is: calculate the width value output by regression. Width of each specification in the specification set absolute difference, height value With each specification height The absolute difference between the two differences is used, and the specification with the smallest weighted sum of the two differences (with width and height weights both set to 0.5) is taken as the final predicted cross-sectional size. If the regression value exceeds the maximum size in the specification set, the maximum specification is taken and a prompt message is issued.
[0043] In this embodiment, the graph attention network needs to be pre-trained. The training process includes the following steps: constructing a training dataset by collecting annotated electrical CAD drawings, with annotations including the equipment type and circuit number of each node, and the cable tray segment attributes and cross-sectional dimensions of each topological connection edge; using the annotated electrical design semantic graph as input, supervising the classification prediction of equipment type, circuit number, and cable tray segment attributes with a cross-entropy loss function, and supervising the regression prediction of cross-sectional dimensions with a mean squared error loss function, the total loss being the weighted sum of all loss terms; employing the Adam optimizer with an initial learning rate of 0.001 and a batch size of 4–16 drawings, iteratively training until the validation set loss converges. It should be noted that the above training process is a prerequisite for the method of this invention and is not a necessary step for every drawing to be identified; in practical applications, pre-trained network weights can be directly loaded for inference without retraining. Those skilled in the art can complete network training based on conventional deep learning practices.
[0044] Step S30: Extract the cable tray segment based on the cable tray segment attributes and cross-sectional dimensions, aggregate the endpoints into a cable tray topology map, initialize the cable tray segment capacity occupancy status, and generate an equipment list and a loop equipment mapping table based on the equipment type and loop number; In this embodiment, step S30 includes: Step S31: Filter the edges with the cable tray segment attribute identifier as cable tray segments in the predicted topology connection edges as cable tray segments, and obtain the endpoint coordinates, direction and cross-sectional dimensions of each cable tray segment; Step S32: Aggregate the endpoints of the cable tray segments according to the endpoint spacing and endpoint connection conditions. Merge the endpoints of the cable tray segments whose endpoint spacing is less than a preset distance threshold and which meet any of the following conditions: endpoint coordinate coincidence, cable tray segment intersection, continuous direction, or preset corner connection into the same cable tray topology node. Construct a cable tray topology graph with the cable tray segments as edges and the merged cable tray topology node as vertices. Step S33: Determine the total capacity of each cable tray section based on the cross-sectional dimensions and the preset cable fill rate, and set the occupied capacity of the cable tray section to zero; Step S34: Associate the predicted loop number with the node whose equipment type is distribution box and the node whose equipment type is terminal device, and establish a loop device mapping table from the loop number to the set of distribution box nodes and terminal device nodes; Step S35: Count the number of nodes according to equipment type and generate an equipment list.
[0045] In step S32, the endpoints of the cable tray segments are aggregated according to the endpoint spacing and endpoint connection conditions. Endpoints of cable tray segments with an endpoint spacing less than a preset distance threshold and satisfying any one of the following conditions—endpoint coordinate coincidence, cable tray segment intersection, continuous routing, or preset corner connection—are merged into the same cable tray topology node. This includes: Step S321: Cluster the beginning and end endpoints of each cable tray segment according to the preset distance threshold to form endpoint clusters; Step S322: Obtain the orientation direction of the cable tray segment to which each endpoint belongs within the same endpoint cluster; Step S323: For any two endpoints within the same endpoint cluster, determine whether the cable tray segments to which the two endpoints belong satisfy any one of the following conditions: endpoint coordinate coincidence, cable tray segments intersecting, continuous routing, or preset corner connection; assign endpoints that satisfy any condition to the same connected component, and merge the endpoints within the same connected component into a single cable tray topology node; retain endpoints that do not form a connected component with other endpoints as independent cable tray topology nodes.
[0046] Step S33, determining the total capacity of each cable tray section based on the cross-sectional dimensions and the preset cable fill rate, and setting the occupied capacity of the cable tray section to zero, includes: Step S331: Multiply the cross-sectional width and cross-sectional height in the cross-sectional dimensions to obtain the cross-sectional area of the cable tray section; Step S332: Based on the cable tray category to which the cable tray section belongs, the capacity verification level of the project configuration, or the preset safety fill rate, obtain the cable fill rate corresponding to the cable tray section from the preset fill rate mapping table; when no cable tray category or capacity verification level is configured, use the minimum fill rate in the fill rate mapping table as the cable fill rate of the cable tray section. Step S333: Multiply the cross-sectional area of the cable tray section by the cable fill rate to obtain the total capacity of the cable tray section, and initialize the occupied capacity of the cable tray section to zero.
[0047] In specific implementation, in step S31, topological connection edges are filtered from the graph attention network prediction results, and topological connection edges that are classified as cable tray segments are extracted as cable tray segments. For each cable tray segment, the coordinate values of its two endpoints in the CAD drawing coordinate system are obtained. The direction of the cable tray segment is calculated based on the coordinates of its first and last endpoints, specifically the direction vector from the first endpoint to the last endpoint, which is then normalized to a unit direction vector. The cross-sectional dimensions are the cross-sectional width and height values output by the cross-sectional dimension mapping module in the graph attention network, recorded in millimeters.
[0048] In step S32, the endpoints of the cable tray segments are aggregated according to the endpoint spacing and endpoint connection conditions. The endpoints of the cable tray segments with an endpoint spacing less than a preset distance threshold and satisfying any of the following conditions are merged into the same cable tray topology node to construct a cable tray topology map. This specifically includes steps S321 to S323.
[0049] In step S321, the start and end points of each cable tray segment are clustered according to a preset distance threshold to form end point clusters. All start and end points of all cable tray segments are collected to construct an end point set. A density-based clustering method is used to cluster the end point set, with the Euclidean distance between the end points as the clustering distance metric. The preset distance threshold is set according to the scale of the engineering drawings and the typical grid spacing of cable tray installation, ranging from 200 mm to 500 mm in millimeter-unit drawings. For any two end points in the end point set, if the Euclidean distance between them is less than the preset distance threshold, the two end points are grouped into the same end point cluster. Through transitive expansion, end points whose distances both satisfy the distance threshold are clustered together, ultimately forming several non-overlapping end point clusters.
[0050] In step S322, the orientation direction of the cable tray segment to which each endpoint belongs within the same endpoint cluster is obtained. Each endpoint corresponds to one cable tray segment, and the normalized orientation direction vector of that cable tray segment calculated in step S31 is used as the orientation direction associated with that endpoint.
[0051] In step S323, each endpoint cluster is traversed. For any two endpoints within the same cluster, it is determined whether the cable tray segments to which the two endpoints belong satisfy any one of the following conditions: endpoint coordinate coincidence, cable tray segment intersection, continuous routing, or preset corner connection. Coincident endpoint coordinates mean the distance between the two endpoints is less than a preset coordinate tolerance; intersecting cable tray segments mean that the line segments or discrete polylines corresponding to the two cable tray segments intersect at a point located within the end connection range of the corresponding cable tray segments; continuous routing means the angle between the routing directions of the two cable tray segments is less than a preset continuous angle threshold; preset corner connection means the angle between the routing directions of the two cable tray segments is within a preset corner range, which includes a 90-degree corner range or a pre-configured cable tray corner range in the drawings. Endpoints satisfying any of the conditions are assigned to the same connected component, and endpoints within the same connected component are merged into a single cable tray topology node; endpoints not forming a connected component with other endpoints are retained as independent cable tray topology nodes. During merging, the coordinates of the cable tray topology node are taken as the geometric mean of the coordinates of all endpoints within the connected component. The merged cable tray topology nodes are used as vertices of the graph, and the cable tray segments selected in step S31 are used as edges of the graph. The connection relationship between vertices and edges is determined by the cable tray topology nodes to which the first and last endpoints of the cable tray segments belong, thereby constructing the cable tray topology graph.
[0052] In step S33, the total capacity of each cable tray section is determined based on the cross-sectional dimensions and the preset cable fill rate, and the occupied capacity of the cable tray section is set to zero. This specifically includes steps S331 to S333.
[0053] In step S331, the cross-sectional width is denoted as W, the cross-sectional height is denoted as H, and the cross-sectional area S of the cable tray section is calculated as S=W×H, where W and H are in millimeters.
[0054] In step S332, the cable filling rate corresponding to the cable tray segment is obtained from the preset filling rate mapping table according to the cable tray category to which the cable tray segment belongs, the capacity verification level of the project configuration, or the preset safety filling rate; when no cable tray category or capacity verification level is configured, the minimum filling rate in the filling rate mapping table is used as the cable filling rate r of the cable tray segment.
[0055] In step S333, the cross-sectional area S of the cable tray section is multiplied by the cable filling rate r to obtain the total capacity C of the cable tray section C=S×r, and the occupied capacity of the cable tray section is initialized to 0.
[0056] In step S34, the predicted circuit number is associated with nodes of type distribution box and nodes of type end device, establishing a circuit device mapping table from circuit number to distribution box node and end device node set. All nodes with predicted circuit numbers from step S20 are traversed, and classified according to the device type predicted in step S23. Nodes of type distribution box are designated as power supply nodes for the corresponding circuit number, and nodes of type lighting fixtures, sockets, switches, and junction boxes are designated as power receiving nodes for the corresponding circuit number. A mapping table is constructed using the circuit number as the key. The value of the mapping table contains two fields: a list of distribution box nodes and a set of end device nodes. The same circuit number corresponds to one distribution box node and multiple end device nodes. The mapping table is stored using a hash table or dictionary structure, supporting fast retrieval by circuit number.
[0057] In step S35, the number of nodes is counted according to equipment type, and an equipment list is generated. All nodes with predicted equipment types from step S23 are traversed, and counted by equipment type (including distribution boxes, lighting fixtures, sockets, switches, and junction boxes). The statistical results are output in tabular form, with columns for equipment type name and quantity, and rows for each equipment type and its corresponding statistical quantity. This equipment list serves as the basis for subsequent quantity calculations and, when combined with the cable length summary, forms a complete quantity calculation report.
[0058] Step S40: Determine the distribution box node and terminal device node of each circuit according to the circuit equipment mapping table, perform multi-circuit rotation path search on the cable tray topology map, dynamically update the capacity occupancy of each cable tray segment, and replan the path of the circuit passing through the cable tray segment when the capacity of the cable tray segment exceeds the limit, until there are no cable tray segments exceeding the limit or the preset iteration termination condition is reached, and calculate the cable length of each circuit; if there are still cable tray segments exceeding the limit after the preset iteration termination condition is reached, output the capacity over-limit prompt message. In this embodiment, step S40 includes: Step S41: Extract the distribution box node and end device node corresponding to each circuit from the circuit device mapping table; Step S42: Using the length of the cable tray segment as the edge weight, and according to the preset circuit priority order, search for the shortest connection cable tray segment set covering the distribution box node and all end device nodes for each circuit. The shortest connection cable tray segment set is obtained by merging the segmented shortest paths from the distribution box node to each end device node and deduplicating them according to the cable tray segment number. Each cable tray segment in the shortest connection cable tray segment set occupies the required capacity of the corresponding circuit. Step S43: Identify cable tray sections whose occupied capacity exceeds the total capacity and determine them as over-limit cable tray sections; Step S44: For loops passing through the oversized cable tray segment, perform path replanning in reverse order of the loop priority. The path replanning includes: searching for alternative paths on the cable tray topology graph with increased edge weights of the oversized cable tray segment; if the occupied capacity of each cable tray segment traversed by the alternative path does not exceed the total capacity, then the alternative path is adopted and the capacity occupancy is updated; otherwise, the original path is maintained. Step S45: Repeat the over-limit detection and reverse replanning until there are no over-limit cable tray segments or the preset iteration termination condition is met. Step S46: Accumulate the length of the cable tray section traversed by the final path of each circuit to obtain the cable length of each circuit.
[0059] In step S42, the set of shortest connection cable tray segments covering the distribution box node and all end device nodes is searched sequentially for each loop. This set of shortest connection cable tray segments is obtained by merging the segmented shortest paths from the distribution box node to each end device node and deduplicating them according to the cable tray segment number. It includes: Step S421: Take the distribution box node as the starting point of the path and take all the terminal device nodes in the set of terminal device nodes as the must-reach nodes. Step S422: Search for the segmented shortest paths from the starting point of the path to each reachable node on the cable tray topology map, merge the segmented shortest paths, and remove duplicates according to the cable tray segment number to obtain the set of the shortest connecting cable tray segments of the loop. Step S423: Add the currently occupied capacity of each cable tray segment in the set of shortest connection cable tray segments to the required capacity of the loop.
[0060] Furthermore, an alternative path is searched on the cable tray topology graph with increased edge weights for the overloaded cable tray segments. If the occupied capacity of each cable tray segment traversed by the alternative path does not exceed the total capacity, the alternative path is adopted and the capacity occupancy is updated; otherwise, the original path is maintained, including: Step S441: Release the capacity occupied by the remaining cable tray segments in the current path of the loop to be replanned, excluding the oversized cable tray segment. Step S442: Multiply the edge weight of the oversized cable tray segment in the cable tray topology graph by a preset penalty coefficient; Step S443: Starting from the distribution box node of the circuit to be replanned, and the set of terminal equipment nodes is the set of reachable nodes, search for the shortest path on the cable tray topology graph after modifying the edge weights and capacity to obtain candidate alternative paths. Step S444: Check whether the remaining capacity of all cable tray segments traversed by the candidate alternative path is not less than the capacity required by the loop to be replanned. If all are not less than, then the candidate alternative path is used to replace the current path, the capacity occupation of the loop to be replanned on the oversized cable tray segment is released, the original edge weight of the oversized cable tray segment is restored, and the capacity required by the loop to be replanned is occupied on the cable tray segment through which the candidate alternative path passes. Step S445: If any cable tray segment has a remaining capacity less than the capacity required by the loop to be replanned, then restore the capacity occupancy of the loop to be replanned on the original path and the original edge weight of the over-limit cable tray segment, and switch to the previous loop in the reverse order for replanning. If there is no previous loop in the reverse order, or if all loops passing through the over-limit cable tray segment fail to be replanned, then the over-limit cable tray segment is recorded as an unresolved over-limit cable tray segment, and the process proceeds to the preset iteration termination condition judgment; when the preset iteration termination condition is reached, a capacity over-limit prompt message is output.
[0061] In specific implementation, in step S41, the mapping record corresponding to each circuit number is read one by one from the circuit equipment mapping table established in step S34, and the set of distribution box nodes and terminal equipment nodes corresponding to each circuit is extracted. The distribution box node corresponds to a specific cable tray topology node in the cable tray topology diagram; this cable tray topology node is the one whose spatial location is closest to the distribution box node. Specifically, this is determined by calculating the Euclidean distance between the coordinates of the distribution box node and the coordinates of each cable tray topology node, and selecting the one with the smallest distance as the access point of the distribution box node on the cable tray topology diagram. The distribution box node coordinates... Coordinates of cable tray topology nodes For example, the Euclidean distance between two coordinate points The formula for calculation is: ; For example, the coordinates of the distribution box node are The cable tray topology diagram contains three cable tray topology nodes with coordinates as follows: The Euclidean distance to the first cable tray topology node is... The distance to the second one is The distance to the third is The first cable tray topology node is selected as the access point of the distribution box node on the cable tray topology diagram. Similarly, each end device node in the set of end device nodes is also determined by nearest neighbor matching to find its corresponding cable tray topology node on the cable tray topology diagram, which serves as the set of end access points that the circuit needs to connect to. For example, circuit WP1 contains one distribution box node and three lighting fixture end device nodes. After matching, the starting access point is cable tray topology node A, and the three end access points are cable tray topology nodes D, E, and F, respectively.
[0062] In step S42, using the length of the cable tray segment as the edge weight, and according to the preset circuit priority order, the set of shortest connecting cable tray segments covering the distribution box node and all end equipment nodes is searched for each circuit in turn. Each cable tray segment in the set of shortest connecting cable tray segments occupies the capacity required for that circuit. Specifically, this includes steps S421 to S423.
[0063] In step S421, the cable tray topology node corresponding to the distribution box node of the currently processed loop is taken as the path starting point on the cable tray topology diagram, and all the cable tray topology nodes corresponding to the end device nodes in the set of end device nodes of the loop are taken as the mandatory nodes. The preset loop priority order is determined according to the loop load level, cable cross-section specifications, or loop numbering rules. For example, for three loops WP1, WP2, and WP3, where WP1 is a power loop with a high load level, WP2 is an emergency lighting loop, and WP3 is a general lighting loop, the priority order is WP1, WP2, WP3. Starting from the first loop WP1 in the sequence, the path starting point and mandatory node set of each loop are determined sequentially.
[0064] In step S422, the segmented shortest paths from the starting point to each reachable node are searched on the cable tray topology graph, resulting in multiple segmented paths. The cable tray segments traversed by each segmented path are merged and deduplicated according to the cable tray segment number to obtain the set of shortest connecting cable tray segments for the loop. Dijkstra's algorithm is used when searching for segmented shortest paths, with the edge weights of each edge in the cable tray topology graph used as the path cost. The edge weights are the actual length values of the corresponding cable tray segments, which have been calculated and recorded in step S32.
[0065] In step S423, the currently occupied capacity of each cable tray segment in the set of shortest connection cable tray segments is added to the required capacity of the circuit. The cable cross-sectional area required for the circuit is calculated based on the specifications and outer diameter of the cables in the circuit. For example, if a circuit uses 3 cables with a cross-sectional area of... Copper core cable, cable outer diameter is Then the cross-sectional area of a single cable Calculated based on a circular cross section: ; The required cross-sectional area of this circuit It is calculated by multiplying the cross-sectional area of a single strand by the number of strands, and taking into account the margin factor. : ; The calculated results As the occupied cross-sectional area of the loop, this value is added to the occupied capacity of each cable tray section along the path.
[0066] In step S43, after all loops have completed the initial path search and capacity occupancy, a capacity check is performed on all cable tray segments in the cable tray topology diagram. Each cable tray segment is traversed, and its currently occupied capacity is compared with the total capacity determined in step S33. Comparison. For example, the cross-sectional dimension of a certain cable tray section is width. ,high The cable fill rate determined in step S33 is used. Its total capacity for: ; If the current occupied capacity of this cable tray section is Comparison If the occupied capacity exceeds the total capacity, the cable tray segment is marked as an over-limit cable tray segment. A set of all over-limit cable tray segments is recorded. If this set is empty, the current path planning result already satisfies the capacity constraint, and the process jumps directly to step S46. If the set of over-limit cable tray segments is not empty, for example, it includes over-limit cable tray segment B3, and there is a situation where the remaining capacity of cable tray segment B5 is insufficient to support the loop to be replanned, then the process proceeds to step S44 for path replanning.
[0067] In step S44, for loops passing through oversized cable tray sections, path replanning is performed in reverse order of loop priority. Each oversized cable tray section is traversed to obtain all loops passing through that section. The path passes through loops WP1, WP2, and WP3. The loop priority order is WP1, WP2, WP3, and the reverse order is WP3, WP2, WP1. Loops are selected in reverse order for path replanning. Path replanning specifically includes steps S441 to S445.
[0068] In step S441, the capacity occupied by the cable tray segments (excluding the oversized cable tray segment) in the current path of the loop to be replanned is released. The set of cable tray segments traversed by the current path of the loop to be replanned is determined, and the occupied capacity of each cable tray segment in this set (excluding the target oversized cable tray segment) is subtracted from the current occupied cross-sectional area of that loop. For example, the current occupied cross-sectional area of loop WP3 is... Its current path passes through the bridge section. , , , The oversized bridge section is Then , , Subtract the occupied capacity respectively , The available capacity will be temporarily reserved.
[0069] In step S442, the edge weight of the oversized cable tray segment in the cable tray topology graph is multiplied by a preset penalty coefficient. The preset penalty coefficient is greater than 1, for example, a value of 1. Designated oversized bridge section The original edge weights, i.e., lengths After multiplying by the penalty coefficient, the weight becomes: ; This penalty coefficient applies only to the path search phase of the current replanning process. Its purpose is to significantly increase the cost of passing through the oversized bridge section, thereby effectively suppressing alternative path selection through the oversized bridge section in the subsequent shortest path search.
[0070] In step S443, starting from the distribution box node of the loop to be replanned, and using the set of end device nodes as the set of reachable nodes, the shortest path is searched on the cable tray topology graph after modifying edge weights and capacity to obtain candidate alternative paths. The search algorithm is the same as in step S422, except that the edge weights of the search graph are corrected edge weights multiplied by a penalty coefficient, and during the search process, edges whose remaining capacity is insufficient to support the required cross-sectional area of the loop are temporarily removed from the search space. For example, the required cross-sectional area of loop WP3 is... Bridge section The remaining capacity is Comparison If the remaining capacity is insufficient, it will not be included in the current search. The search space includes candidate paths.
[0071] In step S444, it is checked whether the remaining capacity of all cable tray segments traversed by the candidate alternative path is not less than the capacity required for the replanned loop. (Remaining capacity) Equal to the total capacity of the cable tray section Subtract the currently occupied capacity ,Right now For example, candidate alternative paths passing through bridge sections. , , , Total capacity Already occupied Remaining ; Total capacity Already occupied Remaining ; Total capacity Already occupied Remaining The required capacity for loop WP3 The remaining capacity of each cable tray section meets the following requirements: ; If the candidate alternative path is deemed feasible, it will be used to replace the current path of loop WP3, and... , , Accumulate the occupied capacity separately At the same time The occupied capacity minus .
[0072] In step S445, if the remaining capacity of any cable tray segment traversed by the candidate alternative path is less than the capacity required for the replanned loop, the candidate alternative path is determined to be infeasible. For example, if the candidate alternative path traverses a cable tray segment... Its remaining capacity is Comparison If the capacity constraint is not met, the candidate alternative path is abandoned. The capacity occupancy of the loop to be replanned on the original path is restored, that is, the capacity released in step S441 is restored. , , The capacity was added back. and the oversized bridge section The edge weights are restored to their original values. Then, proceed to the replanning process of the preceding loop in reverse order, executing steps S441 to S444. In reverse order, the preceding loop refers to the loop that precedes the loop to be replanned in the loop priority sequence and also passes through the oversized cable tray segment. For example, WP3 replanning fails, and WP2 also passes through the oversized cable tray segment. If so, then switch to WP2 for replanning.
[0073] In step S45, the over-limit detection and reverse replanning are repeated until no over-limit cable tray segments exist or the preset iteration termination condition is met. After each round of replanning, the over-limit detection in step S43 is re-executed. If over-limit cable tray segments still exist, the reverse replanning in step S44 continues. The preset iteration termination condition is the maximum number of iteration rounds, for example, 50 rounds. When the replanning rounds reach 50, the iteration terminates even if over-limit cable tray segments still exist, and a prompt message is output indicating that all loop path planning cannot be completed within the capacity constraint. If the occupied capacity of all cable tray segments is not greater than the total capacity within 50 iteration rounds, the capacity constraint is satisfied, and the iteration exits.
[0074] In step S46, the cable tray segment lengths traversed by the final path of each loop are summed to obtain the cable length of each loop. For each loop, its final determined cable tray path is obtained, the sequence of cable tray segments traversed by that path is extracted, and the length of each cable tray segment is calculated. By summing the results, the total cable length of the corresponding cable tray path for that loop can be obtained. : In the formula, This represents the set of cable tray segments included in the length statistics of the final path of the loop; when branch paths exist, This represents the set of cable tray segments after deduplication by segment number; Indicates the first The length of each cable tray section.
[0075] For example, the final path of loop WP1 passes through the cable tray section. Length is , Length is , Length is ,but: ; If the terminal equipment nodes in the loop path are connected in a branching manner, then the distribution box node is taken as the root node. All cable tray segments included in the final path of the loop are extracted. For repeated cable tray segments, duplicates are removed by cable tray segment number, and the lengths of each cable tray segment are summed to obtain the cable length for the loop. For example, the path of loop WP2 is in the cable tray segment... The end forks into two branches, and the branches... To the end node Length is Branching meridian To the end node Length is Then, both the main cable tray section and the branch cable tray section are included in the length statistics, and the cable length of loop WP2 is obtained by summing the lengths of the cable tray sections after deduplication.
[0076] Step S50: Summarize the number of devices and cable lengths for each circuit, and output the engineering quantity calculation results.
[0077] In this embodiment, step S50 includes: Step S51: Based on the loop device mapping table, count the number of devices of each device type according to the loop; Step S52: Based on the final determined cable tray path for each circuit, the cable length of each circuit is divided into segments according to the cable tray sections it passes through, and the cross-sectional dimensions and capacity occupancy rate of each cable tray segment are associated. Step S53: Combine the number of devices counted by loop, the cable length counted by segment, and the cross-sectional dimensions and capacity occupancy rate of each cable tray segment as the result of the engineering quantity calculation.
[0078] The step of segmenting and statistically analyzing the length of each circuit cable according to the cable tray sections it passes through, and relating this to the cross-sectional dimensions and capacity occupancy rate of each cable tray section, includes: Step S521: Obtain the sequence of cable tray segments traversed by the final determined cable tray path for each loop; Step S522: For each cable tray segment in the cable tray segment sequence, record the length of the corresponding loop cable segment, the cross-sectional dimensions of the cable tray segment, and the current capacity occupancy rate of the cable tray segment. Step S523: Summarize the segment records of all cable tray sections under the same circuit to form the segment cable details of the circuit; Step S524: Establish a correlation between the segmented cable details and the cross-sectional dimensions and capacity occupancy rate of each corresponding cable tray segment, as the segmented statistical result.
[0079] In specific implementation, in step S51, based on the circuit device mapping table established in step S34, the number of devices of each device type is counted by circuit. Each circuit number in the circuit device mapping table is traversed to obtain the set of end device nodes corresponding to that circuit, and the device type of each end device node is extracted. The device type is predicted and output by the device type classifier in step S23, and the types include distribution boxes, lighting fixtures, sockets, switches, junction boxes, etc. End device nodes under the same circuit number are grouped by device type, and the number of each device type is counted separately. The statistical results are used to construct a device quantity statistics table with the circuit number as the row and the device type as the column. The cells in the table record the number of devices of the corresponding device type under the corresponding circuit. Taking circuit WP1 as an example, the set of end device nodes of this circuit contains 6 nodes of device type lighting fixtures and 2 nodes of device type sockets. Therefore, in the device quantity statistics table, the number of lighting fixtures corresponding to circuit WP1 is 6, and the number of sockets is 2. Simultaneously, the distribution box nodes corresponding to each circuit are extracted from the circuit equipment mapping table. Each circuit corresponds to one distribution box node, and the distribution box is counted separately as an equipment type. The number of distribution boxes for each circuit is 1, and it is included in the equipment quantity statistics table. If there are multiple distribution box nodes for a circuit in the circuit equipment mapping table, the actual number is used for counting.
[0080] In step S52, based on the final determined cable tray path for each circuit, the cable length of each circuit is segmented and statistically analyzed according to the cable tray sections it passes through, and the cross-sectional dimensions and capacity occupancy rate of each cable tray section are correlated. Specifically, this includes steps S521 to S524.
[0081] In step S521, the sequence of cable tray segments traversed by the final determined cable tray path for each loop is obtained. For each loop, a list of cable tray segments traversed by the path is extracted from the final cable tray path determined in step S46. The cable tray segments in the list are arranged in order from the distribution box node to the terminal equipment node. Taking loop WP1 as an example, its final cable tray path is the cable tray topology node A corresponding to the distribution box node, passing through the cable tray segments in sequence. , , Upon reaching the end device node D, the cable tray segment sequence is as follows: Each cable tray segment points from the distribution box end to the terminal equipment end. If the loop path has branches, a separate cable tray segment sequence is established for each branch, with the branch starting point being the fork node and the ending point being the terminal equipment node at the end of that branch.
[0082] In step S522, for each cable tray segment in the cable tray segment sequence, the length of the corresponding loop cable segment, the cross-sectional dimensions of the cable tray segment, and the current capacity occupancy rate of the cable tray segment are recorded. For the first segment in the cable tray segment sequence... Each cable tray section has a return cable segment length. This refers to the length value of the cable tray segment calculated and recorded in step S32, in millimeters. The cross-sectional dimensions of the cable tray segment include the cross-sectional width. and cross-sectional height The value is taken from the cross-sectional dimensions of the cable tray section recorded in step S31. The current capacity occupancy rate of the cable tray section. Defined as the occupied capacity of this cable tray section Its total capacity The ratio is calculated using the following formula: ; in The total capacity of the cable tray section determined in step S33. This represents the final occupied capacity of the cable tray section after step S40, which involves multi-loop path search and replanning. The unit is... For example, the bridge section. Total capacity The capacity is already occupied. Then capacity utilization rate for: ; The length of the above-mentioned loop cable segments Cross-sectional width Cross-sectional height and capacity utilization This serves as a segment record for that bridge section.
[0083] In step S523, the segment records of all cable tray sections under the same circuit are summarized to form the segmented cable details for that circuit. Following the sequence of cable tray sections, the segment records of each cable tray section are arranged sequentially to form the segmented cable details table for that circuit. Each row in the segmented cable details table corresponds to one cable tray section and includes fields such as cable tray section number, segment length, cross-sectional width, cross-sectional height, and capacity occupancy rate. Taking circuit WP1 as an example, its segmented cable details are shown in the table below: Cable Tray Section Segment length Cross-sectional dimensions Capacity utilization rate Bridge section Segment length Cross-sectional dimensions Capacity utilization rate Bridge section Segment length Cross-sectional dimensions Capacity utilization rate .
[0084] In step S524, the segmented cable details are associated with the cross-sectional dimensions and capacity occupancy rates of each corresponding cable tray segment, serving as the segmented statistical result. The association is established by binding each row in the segmented cable details with the cross-sectional dimensions and capacity occupancy rates of the corresponding cable tray segment through the cable tray segment number, forming a segmented statistical result data structure organized by loop number. This data structure includes the loop number, a list of segmented records for all cable tray segments under that loop, and each segmented record fully includes the segment length, cross-sectional dimensions, and capacity occupancy rate fields.
[0085] In step S53, the equipment quantity statistics by loop, the cable length statistics by segment, and the cross-sectional dimensions and capacity utilization rate of each cable tray segment are merged to form the engineering quantity calculation result. Using the loop number as the association key, the equipment quantity statistics table generated in step S51 is merged with the segment statistics result generated in step S52. The merged data record includes the loop number, the equipment quantity of each equipment type, the segment length of each cable tray segment, the cross-sectional dimensions of each cable tray segment, and the capacity utilization rate of each cable tray segment. The merging process uses a data table join operation; the two datasets are aligned by loop number and then horizontally joined to form a complete engineering quantity calculation result dataset. This engineering quantity calculation result dataset contains both the quantity summary information of the equipment dimension and the path segmentation information and cable tray capacity utilization information of the cable laying dimension, which can comprehensively reflect the equipment composition of each loop and the detailed cable laying situation in the cable tray.
[0086] In this embodiment, as Figure 3As shown, after obtaining the cable tray topology diagram and the mapping relationship of circuit equipment, the cable tray path can be further determined and the engineering quantity calculated. The diagram uses the distribution box node as the starting point and the terminal equipment nodes such as lighting fixtures, sockets, switches, and junction boxes as the target nodes, determining the cable tray path corresponding to each circuit on the cable tray topology diagram. Each cable tray segment is associated with a cable tray segment number, cross-sectional dimensions, and capacity status. For example, cable tray segment B1 corresponds to a specification size of 300×150 and has a remaining capacity of 3750mm². 2 The B3 cable tray section corresponds to a size of 300×150 and occupies a capacity of 16800mm. 2 Greater than the total capacity of 15750mm 2 The specifications, dimensions, and capacity status of cable tray sections B4, B5, and B6 are recorded separately.
[0087] Based on the final determined loop path, the system calculates the number of devices and cable lengths for each loop and outputs the results in conjunction with the cable tray section information. Specifically, it can output a device list by device type, the final path and cable length by loop number, and the specifications, dimensions, and capacity status by cable tray section. Thus, the system can combine CAD drawing recognition results, cable tray path planning results, and capacity occupancy results into a quantity calculation result, providing a data foundation for subsequent generation of quantity calculation tables or visual reports.
[0088] like Figure 4 As shown, a second embodiment of the present invention provides an AI-based CAD drawing cable path identification and quantity calculation system, used to execute an AI-based CAD drawing cable path identification and quantity calculation method. The system includes: The semantic graph construction module is used to obtain geometric primitives, text annotations and block references from CAD drawings as nodes, and to establish spatial proximity edges, topological connection edges and semantic belonging edges based on spatial proximity and loop annotations to construct the electrical design semantic graph. The graph attention network prediction module is used to input the electrical design semantic graph into the graph attention network to predict the device type and circuit number of the nodes, as well as the cable tray segment attributes and cross-sectional dimensions of the topology connection edges; The cable tray topology construction and initialization module is used to extract cable tray segments based on the cable tray segment attributes and cross-sectional dimensions, aggregate endpoints into a cable tray topology, initialize the capacity occupancy status of cable tray segments, and generate an equipment list and a loop equipment mapping table based on the equipment type and loop number. The multi-loop path search and replanning module is used to determine the distribution box node and end device node of each loop according to the loop equipment mapping table, perform multi-loop alternating path search on the cable tray topology map, dynamically update the capacity occupancy of each cable tray segment, and replan the path of the loop passing through the cable tray segment when the capacity of the cable tray segment exceeds the limit, until there are no cable tray segments exceeding the limit or the preset iteration termination condition is reached, and calculate the cable length of each loop; when there are still cable tray segments exceeding the limit after the preset iteration termination condition is reached, the capacity over-limit prompt message is output. The quantity calculation output module is used to summarize the number of devices and cable lengths for each circuit and output the quantity calculation results.
[0089] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process and related descriptions of the system described above can be found in the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0090] The terms “first”, “second”, etc., are used to distinguish similar objects, not to describe or indicate a specific order or sequence.
[0091] The term "comprising" or any other similar term is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus / device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent in such process, method, article, or apparatus / device.
[0092] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of the present invention.
Claims
1. A method for cable path identification and quantity calculation in CAD drawings based on AI, characterized in that, include: Obtain geometric primitives, text annotations, and block references from CAD drawings as nodes, and establish spatial proximity edges, topological connection edges, and semantic belonging edges based on spatial proximity and loop annotations to construct an electrical design semantic graph; The electrical design semantic graph is input into a graph attention network to predict the device type and circuit number of the nodes, as well as the cable tray segment attributes and cross-sectional dimensions of the topology connection edges; Based on the cable tray section attributes and cross-sectional dimensions, extract the cable tray sections and aggregate the endpoints into a cable tray topology diagram. Initialize the capacity occupancy status of the cable tray sections and generate an equipment list and a loop equipment mapping table based on the equipment type and loop number. Based on the circuit equipment mapping table, the distribution box node and terminal equipment node of each circuit are determined. Multi-circuit rotation path search is performed on the cable tray topology map, and the capacity occupancy of each cable tray segment is dynamically updated. When the capacity of a cable tray segment exceeds the limit, the circuit passing through the cable tray segment is replanned until there are no cable tray segments exceeding the limit or the preset iteration termination condition is reached. Then, the cable length of each circuit is calculated. If there are still over-limit cable tray sections after the preset iteration termination condition is met, output a capacity over-limit prompt message. Summarize the number of devices and cable lengths for each circuit, and output the engineering quantity calculation results.
2. The method according to claim 1, characterized in that, Constructing an electrical design semantic graph, including: Traverse the CAD drawings, extract the coordinates of the first and last endpoints of each geometric element, extract the positioning points and text content of each text annotation, and extract the insertion points of each block reference. Identify loop annotations in the text content; Connect two geometric primitives whose end-to-end distance is less than the preset splicing tolerance to create a spatial proximity edge; Connect two geometric primitives whose first and last endpoint coordinates coincide to establish a topological connection edge; For each text annotation node containing the loop annotation, determine the block reference node that is closest to the positioning point of the text annotation node, connect the text annotation node and the block reference node to establish a semantic belonging edge, and assign the loop annotation to the semantic belonging edge; Generate an electrical design semantic graph with the geometric primitives, text labels, and block references as nodes, and the spatial proximity edges, topological connection edges, and semantic affiliation edges as edges.
3. The method according to claim 1, characterized in that, The electrical design semantic graph is input into a graph attention network to predict the device type and circuit number of the nodes, as well as the cable tray segment attributes and cross-sectional dimensions of the topology connection edges, including: The geometric primitives, text labels, and block references are encoded into initial node feature vectors, and the edge types and the loop labels carried by the semantically associated edges are encoded into initial edge feature vectors. By using multi-layer iterative aggregation and updating of the graph attention network, the initial node feature vectors of adjacent nodes and the initial edge feature vectors of connected edges are fused using attention weights to obtain the final node feature vectors of each node and the final edge feature vectors of each topological connection edge. Based on the final node feature vector, classify and predict the device type and loop number of the node. Based on the final edge feature vector and the final node feature vector of the connected node, classify and map to predict the cable tray segment attributes and cross-sectional dimensions of the topology connection edge.
4. The method according to claim 3, characterized in that, Multi-level iterative aggregation updates include: For the central node in the current iteration layer, calculate the attention weights between the node feature vector of the central node and the node feature vectors of each of the adjacent nodes. The node feature vectors of each adjacent node and the edge feature vectors of the connected edges are weighted and aggregated according to the attention weights to obtain the aggregated feature vector; A nonlinear transformation is performed on the aggregated feature vector and the node feature vector of the central node to obtain the updated node feature vector of the central node.
5. The method according to claim 1, characterized in that, Based on the cable tray segment attributes and cross-sectional dimensions, extract the cable tray segments and aggregate the endpoints into a cable tray topology diagram. Initialize the capacity occupancy status of the cable tray segments, and generate an equipment list and a loop equipment mapping table based on the equipment type and loop number, including: The edges whose attribute identifier is cable tray segment among the predicted topological connection edges are selected as cable tray segments, and the endpoint coordinates, direction and cross-sectional dimensions of each cable tray segment are obtained; Based on the endpoint spacing and endpoint connection conditions of the cable tray segments, the endpoints of the cable tray segments are aggregated. The endpoints of the cable tray segments whose endpoint spacing is less than a preset distance threshold and which meet any of the following conditions: endpoint coordinate coincidence, cable tray segment intersection, continuous direction, or preset corner connection, are merged into the same cable tray topology node. A cable tray topology graph is constructed with the cable tray segments as edges and the merged cable tray topology node as vertices. The total capacity of each cable tray section is determined based on the cross-sectional dimensions and the preset cable fill rate, and the occupied capacity of the cable tray section is set to zero. Associate the predicted loop numbers with nodes of equipment type distribution box and nodes of equipment type terminal equipment, and establish a loop equipment mapping table from loop numbers to the set of distribution box nodes and terminal equipment nodes; Count the number of nodes according to equipment type and generate an equipment list.
6. The method according to claim 5, characterized in that, The endpoints of cable tray segments are aggregated based on the endpoint spacing and endpoint connection conditions. Endpoints of cable tray segments with an endpoint spacing less than a preset distance threshold and meeting any of the following conditions—endpoint coordinate coincidence, intersecting cable tray segments, continuous routing, or preset corner connection—are merged into a single cable tray topology node. This includes: The beginning and end points of each bridge section are clustered according to the preset distance threshold to form end point clusters; Obtain the orientation direction of the cable tray segment to which each endpoint belongs within the same endpoint cluster; For any two endpoints within the same endpoint cluster, determine whether the cable tray segments to which the two endpoints belong satisfy any of the following conditions: endpoint coordinate coincidence, cable tray segments intersecting, continuous routing, or preset corner connection; assign endpoints that satisfy any condition to the same connected component, and merge the endpoints within the same connected component into a single cable tray topology node; for endpoints that do not form a connected component with other endpoints, retain them as independent cable tray topology nodes.
7. The method according to claim 1, characterized in that, Based on the circuit equipment mapping table, the distribution box node and terminal equipment node of each circuit are determined. Multi-circuit rotation path search is performed on the cable tray topology map, and the capacity occupancy of each cable tray segment is dynamically updated. When the capacity of a cable tray segment exceeds the limit, the circuit passing through the cable tray segment is replanned until there are no cable tray segments exceeding the limit or the preset iteration termination condition is reached. Then, the cable length of each circuit is calculated. If an over-limit cable tray segment still exists after the preset iteration termination condition is met, an over-limit capacity warning message will be output, including: Extract the distribution box node and end device node corresponding to each circuit from the circuit device mapping table; Using the length of the cable tray segment as the edge weight, and following the preset circuit priority order, the shortest connection cable tray segment set covering the distribution box node and all end device nodes is searched for each circuit in turn. The shortest connection cable tray segment set is obtained by merging the segmented shortest paths from the distribution box node to each end device node and deduplicating them according to the cable tray segment number. Each cable tray segment in the shortest connection cable tray segment set occupies the capacity required by the corresponding circuit. Identify cable tray sections whose occupied capacity exceeds the total capacity and determine them as oversized cable tray sections; For loops passing through the oversized cable tray segments, path replanning is performed in reverse order of loop priority. The path replanning includes: searching for alternative paths on the cable tray topology graph with increased edge weights of the oversized cable tray segments; if the occupied capacity of each cable tray segment traversed by the alternative path does not exceed the total capacity, the alternative path is adopted and the capacity occupancy is updated; otherwise, the original path is maintained. Repeat the over-limit detection and reverse replanning until there are no over-limit cable tray segments or the preset iteration termination condition is met; The cable length of each circuit is obtained by summing the lengths of the cable tray sections traversed by the final path of each circuit.
8. The method according to claim 7, characterized in that, On the cable tray topology graph with increased edge weights for the overloaded cable tray segments, an alternative path is searched. If the occupied capacity of each cable tray segment traversed by the alternative path does not exceed the total capacity, the alternative path is adopted and the capacity occupancy is updated; otherwise, the original path is maintained, including: Release the capacity occupied by the remaining cable tray segments in the current path of the loop to be replanned, excluding the oversized cable tray segment; Multiply the edge weight of the oversized cable tray segment in the cable tray topology graph by a preset penalty coefficient; Starting from the distribution box node of the circuit to be replanned, and the set of terminal equipment nodes is the set of reachable nodes, the shortest path is searched on the cable tray topology graph after modifying the edge weights and capacity to obtain candidate alternative paths. Check whether the remaining capacity of all cable tray segments traversed by the candidate alternative path is not less than the capacity required by the loop to be replanned; If all are not less than, then the candidate alternative path is used to replace the current path, the capacity occupation of the loop to be replanned on the oversized cable tray segment is released, the original edge weight of the oversized cable tray segment is restored, and the capacity required by the loop to be replanned is occupied on the cable tray segment through which the candidate alternative path passes. If any cable tray segment has a remaining capacity less than the capacity required by the loop to be replanned, then the capacity occupancy of the loop to be replanned on the original path and the original edge weight of the over-limit cable tray segment are restored, and the process is redirected to the previous loop in the reverse order for replanning; if there is no previous loop in the reverse order, or all loops passing through the over-limit cable tray segment fail to be replanned, then the over-limit cable tray segment is recorded as an unresolved over-limit cable tray segment, and the process proceeds to the preset iteration termination condition judgment.
9. The method according to claim 1, characterized in that, Summarize the number of devices and cable lengths for each circuit, and output the project quantity calculation results, including: Based on the aforementioned loop device mapping table, the number of devices of each device type is counted according to the loop. Based on the final determined cable tray route for each circuit, the cable length of each circuit is divided into segments according to the cable tray sections it passes through, and the cross-sectional dimensions and capacity occupancy rate of each cable tray segment are correlated. The quantity of equipment counted by circuit, the cable length counted by segment, and the cross-sectional dimensions and capacity occupancy rate of each cable tray segment are combined to form the result of the engineering quantity calculation.
10. An AI-based CAD drawing cable path identification and quantity calculation system, used to execute the AI-based CAD drawing cable path identification and quantity calculation method according to any one of claims 1-9, characterized in that, The system includes: The semantic graph construction module is used to obtain geometric primitives, text annotations and block references from CAD drawings as nodes, and to establish spatial proximity edges, topological connection edges and semantic belonging edges based on spatial proximity and loop annotations to construct the electrical design semantic graph. The graph attention network prediction module is used to input the electrical design semantic graph into the graph attention network to predict the device type and circuit number of the nodes, as well as the cable tray segment attributes and cross-sectional dimensions of the topology connection edges; The cable tray topology construction and initialization module is used to extract cable tray segments based on the cable tray segment attributes and cross-sectional dimensions, aggregate endpoints into a cable tray topology, initialize the capacity occupancy status of cable tray segments, and generate an equipment list and a loop equipment mapping table based on the equipment type and loop number. The multi-loop path search and replanning module is used to determine the distribution box node and end device node of each loop according to the loop equipment mapping table, perform multi-loop alternating path search on the cable tray topology map, dynamically update the capacity occupancy of each cable tray segment, and replan the path of the loop passing through the cable tray segment when the capacity of the cable tray segment exceeds the limit, until there are no cable tray segments exceeding the limit or the preset iteration termination condition is reached, and calculate the cable length of each loop; when there are still cable tray segments exceeding the limit after the preset iteration termination condition is reached, the capacity over-limit prompt message is output. The quantity calculation output module is used to summarize the number of devices and cable lengths for each circuit and output the quantity calculation results.