A CAD vector data intelligent preprocessing method based on multiple recognition mechanisms
By constructing a heterogeneous CAD information map and introducing a dynamic threshold adjudication mechanism, efficient and accurate identification and optimization of CAD vector data are achieved, solving the problems of low layer recognition accuracy and low efficiency in existing technologies, and improving cross-project adaptability and data security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 苏州明新智算科技有限公司
- Filing Date
- 2026-03-04
- Publication Date
- 2026-06-09
AI Technical Summary
In existing CAD vector data preprocessing methods, layer recognition relies on a single feature, leading to irregular naming and layer recognition failure. Fixed threshold judgment cannot adapt to drawings of different complexities. Multi-dimensional optimization of entities, layers, and blocks lacks formal dependence, resulting in low recognition accuracy, low efficiency, high cost of full backup and recovery, and low cross-project knowledge reusability.
A multi-recognition mechanism is adopted to construct a heterogeneous CAD information map. Layer node features are aggregated through meta-path aggregation, a dynamic threshold adjudication mechanism is introduced, a global dependency graph is constructed for parallel optimization, multi-level logical checkpoints and incremental storage are set, and a hierarchical common knowledge base is constructed.
It significantly improves the accuracy and efficiency of layer recognition, ensures data security and traceability, and enhances cross-scene adaptability and processing performance.
Smart Images

Figure CN122176742A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of CAD vector data processing, and in particular to an intelligent preprocessing method for CAD vector data based on a multi-recognition mechanism. Background Technology
[0002] As a core data carrier in fields such as architectural design, engineering construction, and mechanical manufacturing, the preprocessing effect of CAD vector data directly determines the efficiency and accuracy of subsequent applications such as component identification, quantity calculation, and automatic modeling. Current technologies for CAD vector data preprocessing primarily use DXF files as the processing object. They identify background layers by matching layer name keywords with a rule engine and combining this with a single machine learning model. Then, they perform serial dimensional cleanup on entities, layers, and blocks, while using full backups to roll back and restore the cleanup operations. Some solutions also adapt to new engineering drawing processing requirements by retraining or fine-tuning the model.
[0003] However, existing technologies have several intractable technical flaws in practical applications: First, layer recognition relies solely on the single feature of the name text, failing to recognize layers with irregular or generic names. Furthermore, the use of a globally fixed threshold to determine the background layer makes it unsuitable for drawings of varying complexity within the same batch, resulting in poor recognition accuracy and robustness. Second, the multi-dimensional optimization of entities, layers, and blocks is fragmented, lacking formal constraints on the execution order, which easily leads to data inconsistencies and incomplete cleanup, and the serial processing mode is inefficient. Third, the full backup recovery method has high storage costs and low accuracy, causing users to hesitate to use automated cleanup tools due to concerns about accidentally deleting critical data. Fourth, models need to be retrained for new projects and industry drawings, resulting in low cross-project knowledge reusability. During batch processing, the repeated parsing and calculation of common features further reduces preprocessing efficiency.
[0004] In response to the aforementioned technologies, this application proposes an intelligent preprocessing method for CAD vector data based on a multi-recognition mechanism. Summary of the Invention
[0005] To address the aforementioned issues, this application provides an intelligent preprocessing method for CAD vector data based on a multi-recognition mechanism, employing the following technical solution: A smart preprocessing method for CAD vector data based on a multi-recognition mechanism includes the following steps: S1. Parse the DXF file of CAD vector data, construct a CAD heterogeneous information graph containing multiple types of nodes and associated edges, and use the CAD heterogeneous information graph as a unified data model for the entire process of data processing; S2. For the layer nodes in the CAD heterogeneous information map, extract the text features of the layer names, and aggregate the higher-order semantic structure features of the layer nodes in the CAD heterogeneous information map through meta-path; adaptively fuse the text features and the higher-order semantic structure features through a gating unit to generate a layer embedding vector. S3. Identify the layer based on the layer embedding vector, and introduce a dynamic threshold adjudication mechanism during the identification process. The dynamic threshold adjudication mechanism generates a dynamic identification threshold based on the global statistical features of the CAD drawing. When the predicted probability of a layer belonging to the background layer is greater than the dynamic identification threshold, the layer is determined to be the background layer. S4. Based on the CAD heterogeneous information graph, construct a global dependency graph that includes cleanup dependency edges and semantic constraint edges. Use a graph cut algorithm to divide the global dependency graph into several weakly coupled connected subgraphs, and treat each connected subgraph as an independent optimization transaction. S5. Execute each optimization transaction in parallel. Within each optimization transaction, the transactions are executed sequentially according to the dependencies of atomic operations. During the execution, the semantic constraint edges are verified in real time to complete the cross-dimensional collaborative optimization of entities, layers, and blocks in CAD vector data. S6. During the optimization process, set up multi-level logical checkpoints and generate atomic operation logs. Record data change information based on incremental storage mechanism to achieve traceability and accurate recovery of the optimization process.
[0006] Preferably, in step S1, the multi-type nodes of the CAD heterogeneous information map include layer nodes, block definition nodes, and entity nodes. The entity nodes are set nodes formed by aggregating entities of the same geometric type in the CAD vector data. The associated edges include the belonging edges of entity nodes pointing to layer nodes, the definition edges of block definition nodes pointing to their internal entity nodes, and the reference edges of block reference entity nodes pointing to block definition nodes.
[0007] Preferably, in step S2, the meta-path includes: The first metapath is the path from a layer node to an entity node, used to aggregate the geometric features of entities within the layer; The second meta-path is the path from the layer node through the entity node and the block definition node to the block reference entity node. It is used to aggregate the reusability information of entities within the layer in the block structure. The third-order path is a path from a layer node to other layer nodes through entity nodes and block definition nodes, used to aggregate the semantic relevance information of layers.
[0008] Preferably, in step S2, the text features are obtained by encoding the layer name using a word vector model; the higher-order semantic structure features are obtained by aggregating and extracting the feature information of the meta-path using a graph neural network; the gating unit dynamically calculates the fusion weight of the text features and the higher-order semantic structure features based on the local structural features of the layer nodes, wherein the local structural features include the number of entities associated with the layer nodes and the geometric type diversity of the associated entities.
[0009] Preferably, in step S3, the global statistical features include the total number of nodes, the total number of edges, the average degree of nodes, and the proportion of each type of node in the CAD heterogeneous information graph; the dynamic recognition threshold is calculated and generated by a multilayer perceptron based on the global statistical features; the prediction probability of the background layer is calculated and generated by a classifier based on the layer embedding vector, and the classifier is a binary classifier trained based on a deep neural network.
[0010] Preferably, in step S4, the cleanup dependency edge is a directed edge representing the execution order of atomic operations. If operation A is a prerequisite for the execution of operation B, then a cleanup dependency edge is established from operation A to operation B. The semantic constraint edge is a bidirectional edge representing the engineering semantic association between nodes. If two nodes need to be retained or processed simultaneously in terms of engineering semantics, then the semantic constraint edge is established between the two nodes. The graph cut algorithm is a community detection algorithm or a spectral clustering algorithm.
[0011] Preferably, in step S5, the atomic operation includes deleting a node, cleaning up unreferenced block definition nodes, and merging nodes of the same type of layer; when the execution of the atomic operation detects an edge that violates the semantic constraint, a preset conflict resolution strategy is triggered, which includes terminating the current optimization transaction, issuing a review prompt to the user, and forcibly executing according to the node project priority.
[0012] Preferably, in step S6, the multi-level logical checkpoint only saves the encrypted hash value of the current CAD heterogeneous information map and a snapshot of the pointer to the original entity data, and does not save the full data; the entry information of the atomic operation log includes transaction ID, operation type, target node ID, node attribute hash value before operation, and node attribute hash value after operation.
[0013] Preferably, the method further includes the step of constructing a hierarchical common knowledge base, wherein the hierarchical common knowledge base stores the feature information of CAD vector data in layers according to industry level, project level and drawing level. The industry level stores common layer naming patterns and standard block structures of specific industries, the project level stores the layer set and block definition library shared by all drawings of the current project, and the drawing level stores the unique feature information of a single drawing.
[0014] Preferably, based on the hierarchical common knowledge base, the newly added CAD drawings are preprocessed using an incremental computing engine. First, the newly added CAD drawings are compared with the project-level common knowledge base in terms of features. Only the incremental features that differ from the knowledge base are parsed and stored to form an incremental view of the drawing. Based on the incremental view, the new drawing is quickly preprocessed. When processing across projects, the core model parameters in the industry-level common knowledge base are migrated to the initial model of the new project using knowledge distillation technology. Then, 5-10 CAD drawings from the new project are used to quickly fine-tune the initial model to achieve cross-project knowledge migration.
[0015] In summary, this application includes at least one of the following beneficial technical effects: 1. Synergistic Improvement of Recognition Accuracy and Scene Adaptability: By constructing a heterogeneous CAD information map as a unified data model and employing meta-path aggregation of high-order semantic structure features of layer nodes, combined with gating units for adaptive fusion of textual and structural features, the layer embedding vector can comprehensively reflect the layer's naming semantics, geometric attributes, block structure roles, and spatial topological relationships. Based on this, a dynamic threshold adjudication mechanism is introduced, allowing the background layer judgment criteria to adaptively adjust according to the overall complexity of the drawing. This significantly improves the recognition accuracy of non-standard named layers, unnamed layers, and layers in complex nested structures, effectively overcoming the shortcomings of traditional methods that over-rely on layer names and whose fixed thresholds are difficult to adapt to the diversity of drawings.
[0016] 2. Significantly Improved Multi-Dimensional Collaborative Optimization and Processing Efficiency: Based on the identification results, a global dependency graph containing cleanup dependency edges and semantic constraint edges is constructed. A graph cut algorithm is used to decompose the global optimization problem into multiple loosely coupled connected subgraphs, and optimization operations are performed independently on each subgraph in a parallel transaction manner. This method transforms the multi-dimensional cleanup tasks of entities, layers, and blocks, which originally required serial processing, into a set of parallelizable transactions, significantly shortening the overall processing time. Simultaneously, the real-time verification mechanism for semantic constraint edges ensures the integrity of engineering semantics during cross-dimensional optimization, avoiding redundant residues and semantic loss problems that are easily generated by traditional isolated cleanup methods.
[0017] 3. Effective Guarantee of Data Security and Operational Traceability: During optimization operations, multi-level logical checkpoints are set up and atomic operation logs are generated, recording every data change based on an incremental storage mechanism. Checkpoints only save the graph hash value and a snapshot of the pointer to the original data, while atomic operation logs record key information for each modification, greatly reducing storage overhead while ensuring traceability. When a user accidentally deletes critical data, accurate recovery can be achieved by reverse tracing the logs and incremental data, restoring only the affected elements without affecting other cleaned data, significantly improving the engineering security and user acceptance of automated preprocessing.
[0018] 4. Continuously Enhanced Cross-Scenario Adaptability and Scalable Processing Performance: By constructing a hierarchical common knowledge base at the industry, project, and drawing levels, the system can continuously accumulate and reuse historical processing experience. The incremental calculation engine only processes the incremental features of newly accessed drawings that differ from the knowledge base, forming an incremental view and performing rapid preprocessing based on this, significantly reducing redundant calculations. The cross-project knowledge transfer mechanism migrates core model parameters from the industry-level knowledge base to the initial model of a new project, requiring only a small number of samples for rapid adaptation. These mechanisms enable the system to maintain efficient and stable processing performance when dealing with diverse CAD drawings across industries, projects, and versions, with processing effectiveness continuously improving with use. Attached Figure Description
[0019] Figure 1 This is a flowchart of a method for intelligent preprocessing of CAD vector data based on a multi-recognition mechanism in an embodiment of this application. Detailed Implementation
[0020] The following is in conjunction with the appendix Figure 1 This application will be described in further detail.
[0021] To facilitate understanding, several technical terms used in this application are first defined: CAD Heterogeneous Infographic: A unified data model that represents various entities, layers, block definitions, and their interrelationships in CAD vector data in a graphical structure. The graph contains multiple types of nodes (such as layer nodes, block definition nodes, and entity nodes) and multiple types of associated edges (such as belonging edges, defined edges, and referencing edges), which can comprehensively reflect the geometric, semantic, and structural information of CAD data.
[0022] Meta-path: In a heterogeneous information graph, a specific path connecting two nodes is used to capture higher-order semantic relationships between nodes. This application defines various meta-paths to extract structural features of layer nodes from different perspectives.
[0023] Gating unit: An adaptive feature fusion module that can dynamically calculate the fusion weights of different feature vectors based on the input local context information, thereby achieving optimized combination of features.
[0024] Dynamic threshold adjudication mechanism: A mechanism that dynamically generates recognition thresholds based on global statistical features of drawings, used to replace traditional fixed thresholds, so that background layer judgment can adapt to the complexity and characteristics of different drawings.
[0025] Clean up dependency edges: In the global dependency graph, directed edges are used to represent the execution order between atomic operations. If operation A is a prerequisite for operation B, then a dependency edge A→B is established.
[0026] Semantic constraint edges: In a global dependency graph, these are bidirectional edges used to represent two nodes that need to be retained or processed simultaneously in terms of engineering semantics. For example, the axis layer and the axis number layer are highly semantically related and usually need to be retained simultaneously.
[0027] Atomic Operation Log: Records log entries for every atomic operation (such as deleting or merging nodes) performed on nodes in a CAD heterogeneous information map, enabling traceability and accurate recovery of operations.
[0028] Hierarchical Common Knowledge Base: A knowledge base that stores the feature information of CAD vector data in layers according to industry level, project level, and drawing level, in order to accelerate the preprocessing of subsequent drawings.
[0029] Incremental Computation Engine: A computational module based on an incremental storage mechanism and a hierarchical common knowledge base. It processes only the incremental features of newly added CAD drawings that differ from the knowledge base, thus achieving rapid preprocessing. This engine includes a feature comparison unit, an incremental view generation unit, and a knowledge transfer unit.
[0030] This application discloses an intelligent preprocessing method for CAD vector data based on a multi-recognition mechanism. (Refer to...) Figure 1 A smart preprocessing method for CAD vector data based on a multi-recognition mechanism includes the following steps: S1. Parse DXF files and construct CAD heterogeneous information graph: Parse DXF files of CAD vector data, construct CAD heterogeneous information graph containing multiple types of nodes and associated edges, and use the CAD heterogeneous information graph as a unified data model for the entire process of data processing; S2. Extracting Layer Embedding Vectors: For the layer nodes in the CAD heterogeneous information map, extract the text features of the layer names, and aggregate the higher-order semantic structure features of the layer nodes in the CAD heterogeneous information map through meta-paths; adaptively fuse the text features and the higher-order semantic structure features through a gating unit to generate layer embedding vectors. S3. Dynamic threshold adjudication for background layer identification: The layer is identified based on the layer embedding vector, and a dynamic threshold adjudication mechanism is introduced during the identification process. The dynamic threshold adjudication mechanism generates a dynamic identification threshold based on the global statistical features of the CAD drawing. When the predicted probability of a layer belonging to the background layer is greater than the dynamic identification threshold, the layer is determined to be the background layer. S4. Constructing a global dependency graph and graph cut partitioning: Based on the CAD heterogeneous information graph, construct a global dependency graph that includes cleanup of dependency edges and semantic constraint edges. Use a graph cut algorithm to partition the global dependency graph into several weakly coupled connected subgraphs, and treat each connected subgraph as an independent optimization transaction. S5. Parallel execution of optimization transactions: Each optimization transaction is executed in parallel. Within each optimization transaction, the operations are executed sequentially according to the dependency relationship of atomic operations. During the execution, the semantic constraint edges are verified in real time to complete the cross-dimensional collaborative optimization of entities, layers, and blocks of CAD vector data. S6. Set checkpoints and atomic operation logs: During the optimization operation, set multi-level logical checkpoints and generate atomic operation logs. Record data change information based on incremental storage mechanism to achieve traceability and accurate recovery of the optimization operation process. S7. Construct a hierarchical common knowledge base: Construct a hierarchical common knowledge base, which stores the feature information of CAD vector data in layers according to industry level, project level and drawing level. The industry level stores common layer naming patterns and standard block structures of specific industries, the project level stores the layer set and block definition library shared by all drawings of the current project, and the drawing level stores the unique feature information of a single drawing.
[0031] Through the above steps, this application achieves the following technical effects: Dual improvement in recognition accuracy and adaptability: The multimodal feature fusion in step S2 enables the layer embedding vector to fully reflect the naming semantics, geometric features and structural roles of the layer. Combined with the dynamic threshold adjudication mechanism in step S3, the background layer recognition can adapt to the complexity of different drawings, significantly improving the recognition accuracy of non-standard named layers and unnamed layers, and effectively avoiding the misjudgment or omission problem that traditional fixed threshold methods are prone to in complex drawings.
[0032] Significantly improved processing efficiency: The graph cut partitioning in step S4 decomposes the complex global dependency graph into multiple weakly coupled connected subgraphs, and the parallel transaction processing in step S5 enables multi-dimensional optimization tasks that originally needed to be executed serially to be executed in parallel, greatly shortening the overall processing time, which is especially suitable for batch processing scenarios of large-scale CAD drawings.
[0033] Data security and recoverability are significantly enhanced: The multi-level logical checkpoints and atomic operation log mechanism of the S6 steps make every data change traceable. After accidental data deletion, accurate recovery can be achieved through incremental storage, which greatly reduces the risk of loss of critical data due to misjudgment during automated preprocessing and improves the engineering availability of the system.
[0034] Outstanding cross-scenario adaptability and scalability: The hierarchical common knowledge base of the S7 steps enables the system to continuously accumulate industry and project experience, and the incremental calculation engine only processes the differences in new drawings, significantly reducing redundant calculations; cross-project knowledge transfer makes the model adaptation to new industries more efficient, and the processing effect continues to improve with use.
[0035] The steps are described in detail below with reference to specific embodiments.
[0036] S1. Parse the DXF file and construct a heterogeneous CAD information map.
[0037] First, open-source libraries (such as ezdxf or dxfgrabber) are used to parse the input DXF file. During parsing, it is necessary to handle possible exceptions such as file corruption, version incompatibility, or data incompleteness. As a robust processing strategy, this embodiment sets up a multi-level fault tolerance mechanism: when encountering an unresolvable entity or invalid reference, a warning log is recorded and the entity is skipped, continuing to parse the remaining part to ensure that the overall process is not interrupted. For different versions of DXF files (such as R12, R2007, R2024), a version-aware parser is used to adapt to version characteristics. For example, since the R12 version does not support long layer names, a hash mapping table is used to map long names to short identifiers for storage.
[0038] After parsing, a CAD heterogeneous information diagram is constructed. The node types of this diagram include: Layer node: corresponds to each layer in the DXF file, and each layer is abstracted as a layer node.
[0039] Block definition node: corresponds to each block definition in the DXF file. Each block definition is abstracted into a block definition node.
[0040] Entity Node: A collection node formed by aggregating geometric entities in CAD vector data. Since a large number of entities of the same type (such as thousands of straight lines) may exist in the same layer, treating each entity as an independent node would result in an excessively large drawing size, impacting processing efficiency. Therefore, this embodiment introduces an entity aggregation mechanism: for entities within the same layer that have the same geometric type, similar spatial location, and similar geometric attributes, they are aggregated into a single entity node. Specifically, the aggregation rules are as follows: Same geometric type: such as straight line, arc, circle, polyline, etc.
[0041] Spatially close: The Euclidean distance between the center points (or bounding box centers) of entities is less than a preset distance threshold. This threshold can be dynamically adjusted according to the drawing scale, and generally ranges from 0.001 to 0.1 drawing units. In this embodiment, 0.01 drawing units is preferred.
[0042] Geometric property similarity: For straight lines, the length variance is required to be less than a preset variance threshold (e.g., 0.1); for arcs, both the radius and central angle variances are required to be less than the preset threshold. The variance threshold typically ranges from 0.05 to 0.2, and in this embodiment, 0.1 is preferred.
[0043] When the number of entities of the same type that meet the above conditions within the same layer exceeds a preset aggregation threshold (generally ranging from 20 to 100, preferably 50 in this embodiment), they are aggregated into a single entity node, and information such as the number of entities contained in the node, average geometric attributes, and spatial distribution range is recorded. Entities that do not meet the aggregation conditions remain as independent entity nodes.
[0044] The associated edges of the graph include: Belongs to edge: Each entity node points to the layer node to which it belongs. This edge indicates which layer the entity belongs to.
[0045] Defined by an edge: Each block definition node points to the entity nodes it contains (i.e., the original entities defined in the block definition). This edge indicates which entities constitute the block definition.
[0046] Reference edge: Each block reference entity node (i.e., the block instance inserted into the model space) points to its corresponding block definition node. This edge indicates which block definition the block reference refers to.
[0047] Using the above method, a CAD heterogeneous information graph containing rich semantic and structural information is constructed, serving as a unified data model for all subsequent processing steps.
[0048] Variant: In addition to ezdxf, those skilled in the art can also use other DXF parsing libraries, such as CADLib and Teigha. The threshold for entity aggregation can be adjusted according to the actual application scenario. For example, for high-precision mechanical drawings, the distance threshold can be reduced to 0.001 drawing units; for architectural site plans, the threshold can be increased to 0.1 drawing units.
[0049] The benefits of this step are as follows: By constructing a heterogeneous CAD information map, scattered DXF file data is transformed into a structured, unified data model, laying the data foundation for subsequent intelligent recognition and optimization. The entity aggregation mechanism effectively controls the drawing size, avoiding processing bottlenecks caused by an excessive number of entities, while preserving key geometric and semantic information. A multi-level fault-tolerance mechanism ensures compatibility with old drawings and incomplete data, enabling the system to stably process various types of real-world engineering files.
[0050] S2. Extract the layer embedding vector, specifically including: S2.1 Extracting the text features of the layer name: For each layer node, its layer name is used as text input. A lightweight word vector model is used to encode the layer name's features, resulting in a text feature vector. The word vector model can map layer names (such as "wall" or "label_DIM") to fixed-dimensional numerical vectors for subsequent fusion. Common word vector models include FastText, Word2Vec, and GloVe. In this embodiment, the FastText model is preferred because it can handle out-of-vocabulary words and has good generalization ability for common abbreviations and concatenations in layer names. The model output dimension is generally 64 to 256 dimensions; in this embodiment, 128 dimensions are preferred.
[0051] S2.2 Aggregating high-order semantic structure features through meta-paths: To capture the higher-order semantic information of layer nodes in the graph, this embodiment introduces the concept of meta-paths and defines three types of meta-paths: The first-order path is: Layer node → Entity node. This path is used to aggregate the geometric features of all entity nodes within a layer. Specifically, it collects all directly associated entity nodes of the layer along this path, statistically analyzes their geometric features (such as average line length, average arc radius, entity type distribution entropy, etc.), and forms a geometric feature vector.
[0052] The second-order path is: Layer node → Entity node → Block definition node → Block reference entity node. This path is used to aggregate the reusability information of entities within a layer in the block structure. Specifically, it searches backward along this path to find which block references refer to block definitions containing entities of this layer, counts the occurrences of block references, and uses this as the "reusability" feature of the entities in that layer.
[0053] The third-order path is: Layer node → Entity node → Block definition node → Other layer nodes. This path is used to aggregate the semantic relevance information of layers. Specifically, it searches for other layers that share the same block definition as this layer along this path, counts the frequency of sharing, and uses this as a semantic relevance feature.
[0054] For the aforementioned meta-path, a graph neural network is used to aggregate and extract feature information along the path. In this embodiment, a relational graph convolutional network (R-GCN) is preferably used, which can handle various types of edges and aggregate features of neighboring nodes. The R-GCN network structure has two layers, with each hidden layer having a dimension of 256, and the activation function is ReLU. The input features are the initial features of each node on the path (such as the geometric features of entity nodes, the attribute features of block definition nodes, etc.), and the output is the high-order semantic structure feature vector of the node in that layer, with dimensions aligned with the text feature vector (e.g., 128 dimensions).
[0055] S2.3 Adaptive Fusion of Gated Units: Textual features primarily reflect the naming semantics of layers, while structural features primarily reflect the role and context of layers within the atlas. The importance of these two features may differ across different drawings. Therefore, this embodiment introduces a gating unit to dynamically calculate the fusion weight based on the local structural features of layer nodes.
[0056] Local structural features include: The number of entity nodes directly associated with this layer node; The geometric type diversity of the entities associated with the nodes in this layer is represented by information entropy: H = -∑p i logp i , where p i This represents the proportion of entities of the i-th geometric type to the total number of entities in the layer.
[0057] The gated unit is structured as a single-hidden-layer multilayer perceptron (MLP). The input is a concatenation of text and structural feature vectors, the hidden layer dimension is 128, and the output is a scalar weight α (0 ≤ α ≤ 1). The fused layer embedding vector is: embedding = α × text features + (1-α) × structural features Variant examples: Besides R-GCN, Graph Attention Networks (GAT) or GraphSAGE can also be used for structural feature aggregation. When using GAT, the features of neighboring nodes on the meta-path are weighted and aggregated through attention coefficients; when using GraphSAGE, high-order semantic structural features of layer nodes are generated by sampling neighboring nodes and aggregating features, with the aggregation method consistent with R-GCN. The gating unit can also use GRU or LSTM structures, but a lightweight MLP is sufficient to meet the requirements.
[0058] The benefits of this step are: by aggregating high-order semantic structural features through meta-paths, layer nodes can not only perceive their own attributes but also understand their roles in block structures and spatial topology. The adaptive fusion mechanism of the gating unit dynamically adjusts the weights of textual and structural features based on local context, ensuring that layer embedding vectors accurately express layer semantics regardless of whether the naming is standardized or not, fundamentally solving the limitation of traditional methods that over-rely on layer names.
[0059] S3, the dynamic threshold adjudication mechanism identifies the background layer, specifically including: S3.1 Extracting global statistical features: Extract global statistical features from the heterogeneous CAD information diagram of the current CAD drawing, including: Total number of nodes N (including layers, block definitions, and entity nodes); Total number of sides E; Average node degree (2E / N); Percentage of different types of nodes: percentage of layer nodes, percentage of block definition nodes, percentage of entity nodes.
[0060] These features reflect the overall scale and complexity of the drawings.
[0061] S3.2 Dynamic Threshold Generation: The global statistical features are input into a multilayer perceptron (MLP). The MLP has the following structure: an input layer with a dimension of 8 (corresponding to the 8 features mentioned above), two hidden layers each with 64 neurons (using the ReLU activation function), and an output layer with one neuron (using the Sigmoid activation function). The output is a dynamic recognition threshold T between 0 and 1. This MLP needs to be pre-trained, and the training data consists of a large number of CAD drawings annotated with the optimal recognition threshold. The loss function used is mean squared error.
[0062] S3.3 Background layer probability prediction: For each layer, its layer embedding vector is input into a binary classifier, which outputs the predicted probability P that the layer belongs to the background layer. The classifier can be logistic regression, support vector machine, or deep neural network. In this embodiment, the classifier uses a 2-layer MLP with an input dimension of 128 (corresponding to the dimension of the layer embedding vector), a hidden layer of 64 dimensions, and an output layer of 1 dimension (Sigmoid activation).
[0063] S3.4 Background layer determination: If P > T, the layer is determined to be a background layer and marked for subsequent optimization operations. The dynamic threshold T allows the judgment standard to adapt to the complexity of the drawing: for simple drawings, T may be lower (0.3~0.4), making it easier to identify the background layer; for complex drawings, T may be higher (0.6~0.7), reducing misjudgments.
[0064] The advantage of this step is that the dynamic threshold decision mechanism allows the background layer judgment criteria to adaptively adjust according to the overall complexity of the drawing. For simple drawings, the threshold is appropriately lowered to improve the recall rate of the background layer; for complex drawings, the threshold is appropriately raised to reduce the risk of false positives. This adaptive mechanism overcomes the shortcomings of traditional fixed thresholds, which struggle to balance accuracy and recall across different types of drawings.
[0065] S4. Construct a global dependency graph and perform graph cut partitioning, specifically including: S4.1 Construct a global dependency graph: Based on the heterogeneous CAD information map, two types of edges are added: Clean up dependency edges: Directed edges represent the execution order between atomic operations. Atomic operations include deleting nodes, cleaning up unreferenced block definitions, merging layers, etc., which will be performed in subsequent steps S5. The system automatically establishes dependency edges according to predefined rules. For example, "deleting an entity" is a prerequisite for "deleting a layer," so a directed edge is established from the "deleting entity" operation to the "deleting layer" operation. The rules for establishing dependency edges can be pre-defined based on common sense about CAD data structures, or they can be learned from historical processing records through machine learning.
[0066] Semantic constraint edges: Bidirectional edges, indicating that two nodes need to be retained or processed simultaneously from an engineering semantic perspective. For example, "axis layer" and "axis number layer" usually need to be retained simultaneously in architectural drawings, so a semantic constraint edge is established between the two layer nodes. Semantic constraint edges can be automatically generated based on an industry knowledge base or manually configured by the user.
[0067] S4.2, Graph Cut Partitioning: A graph cut algorithm is used to divide the global dependency graph into several loosely coupled connected subgraphs. Within each subgraph, the dependencies between nodes are tight, while the dependencies between subgraphs are weak. In this way, each subgraph can be processed in parallel as an independent optimization transaction, significantly improving efficiency.
[0068] Graph cut algorithms can employ community detection algorithms (such as the Louvain algorithm) or spectral clustering algorithms. In this embodiment, the Louvain algorithm is preferred because it is highly efficient when processing large-scale graphs. The modularity threshold of the Louvain algorithm is set to 0.6, and the iteration terminates if the modularity improvement is less than 0.01. For graphs that Louvain cannot effectively partition (e.g., whose modularity is consistently below 0.3), spectral clustering is switched to, and the number of clusters k is automatically determined based on the "elbow rule" of eigenvalues.
[0069] Criterion for weak coupling: If the number of connecting edges between two subgraphs is less than 5% of the number of edges inside the subgraph, they are considered to be weakly coupled.
[0070] Variant examples: In addition to Louvain and spectral clustering, community detection can also be performed using the Label Propagation Algorithm (LPA) or the Greedy Algorithm (GN). When using the Label Propagation Algorithm (LPA), the engineering semantics of the nodes are used as the initial labels, and community partitioning is achieved by iteratively propagating the labels; when using the GN algorithm, the connected subgraph is partitioned by continuously removing the edges with the highest betweenness numbers.
[0071] The benefit of this step is that by constructing a global dependency graph containing cleanup dependency edges and semantic constraint edges, the execution order constraints between atomic operations and the semantic association constraints between nodes are formally expressed. Graph cut partitioning decomposes the global optimization problem into multiple subproblems that can be processed in parallel. Each subgraph is highly coupled internally but weakly coupled between subgraphs, creating conditions for subsequent parallel processing. At the same time, semantic constraint edges ensure that the optimization process does not violate the semantic integrity of the project.
[0072] S5. Parallel execution of optimized transactions, specifically including: S5.1 Definition of atomic operations: Atomic operations are the smallest units of modification to heterogeneous CAD graphs, including but not limited to: Delete nodes (e.g., delete an entity node, delete a layer node); Clean up unreferenced block definition nodes (delete block definition nodes and their internal entities that have no block references); Merge similar layer nodes (merge two layers with similar semantics into one, such as merging "wall-1" and "wall-2" into "wall").
[0073] S5.2, Intra-transaction topological sorting: Each connected subgraph is treated as an independent optimization transaction. Within a transaction, the execution order of atomic operations is determined based on the cleanup of dependent edges, and a linear execution sequence is generated using a topological sorting algorithm. For example, "delete entity" must be executed before "delete layer".
[0074] S5.3, Parallel Scheduling: Multiple transactions are executed in parallel using a thread pool, the size of which can be dynamically adjusted based on system resources. Since there are no data dependencies between transactions, they can be safely executed in parallel.
[0075] S5.4 Real-time validation of semantic constraint edges: Before executing each atomic operation, it is checked whether the operation violates any semantic constraint edges. For example, if an attempt is made to delete a layer node, but that layer has a semantic constraint edge with another layer (such as an axis and an axis number), the conflict resolution strategy is triggered.
[0076] Conflict resolution strategies include: Terminate transaction: If the operation involves core-level nodes (such as system layer 0 or DEFPOINTS layer), the current transaction will be terminated and all executed operations will be rolled back.
[0077] Prompt for confirmation: If the operation involves important nodes (such as major component blocks), a prompt box will pop up requesting the user's confirmation.
[0078] Forced execution based on priority: Node project priorities are divided into four levels from high to low: L1 (Core: System layer, load-bearing wall entity), L2 (Important: Main component blocks, dimension annotations), L3 (Normal: Fill patterns, auxiliary lines), L4 (Redundant: Unreferenced block definitions). If the operation involves a conflict between L3 and L4, L3 will be retained and L4 will be deleted.
[0079] The benefits of this step are: the parallel transaction processing mechanism fully utilizes multi-core computing resources, enabling multi-dimensional optimization tasks that originally required sequential execution to be performed simultaneously. Atomic operations are executed sequentially within a transaction according to topological order, ensuring that dependencies between operations are not broken; real-time verification of semantic constraint edges and conflict resolution strategies allows the system to flexibly handle various boundary conditions while maintaining data consistency.
[0080] S6, Checkpoint and Atomic Operation Log, specifically includes: S6.1, Multi-level logic checkpoints: During optimization operations, logical checkpoints are set at critical nodes. Each checkpoint saves a snapshot of the current CAD heterogeneous information map's encrypted hash value (e.g., SHA-256) and pointers to the original entity data. The pointer snapshot only records the offset or memory address of the original data in the file, not the full data, thus significantly reducing storage overhead. Checkpoints are set before a transaction begins, after a transaction commits, and after every 100 atomic operations.
[0081] S6.2, Atomic Operation Log: For each atomic operation performed, an atomic operation log entry is immediately generated, recording the following information: Transaction ID (e.g., T20250228_001) Operation type (e.g., DELETE_NODE) Target node ID (e.g., LAYER_1024) Node attribute hash value before operation Node attribute hash value after operation The attribute hash value is obtained by hashing node attributes (such as entity geometry data, layer color, etc.) and is used to quickly verify whether the data has been tampered with.
[0082] S6.3 Incremental Storage and Precise Recovery: All changed data is stored incrementally, meaning only the parts that differ from the previous version are stored. When a user discovers accidental deletion or needs to roll back, they can select the specific element to be restored through a visual interface. The system traces back the operation logs related to that element, starting from the most recent checkpoint, applying a minimal changeset to accurately restore the element without affecting other cleaned data. The restoration process typically takes less than one second.
[0083] The benefits of this step are: the multi-level logical checkpoints and incremental storage mechanism of atomic operation logs make every data change traceable. Pointer snapshots only record the position of the original data, not the entire data, greatly reducing storage overhead. When a user accidentally deletes critical data, a precise recovery mechanism can restore only the affected elements without affecting other cleaned data, significantly improving the security of automated processing and user acceptance.
[0084] S7, Hierarchical Common Knowledge Base and Incremental Calculation: This step is an independent supplementary optimization step, and its execution order can be selected according to the actual application scenario: 1. When batch processing CAD drawings, this step can be executed first to build the basic knowledge base, and then S1-S6 can be executed based on the knowledge base; 2. When processing a single drawing, this step can be executed after S6 is completed to supplement the feature information of the drawing into the knowledge base; 3. In distributed processing, it can be executed in parallel with S6 without affecting the core preprocessing flow. Specifically, it includes: S7.1 Constructing a hierarchical common knowledge base: The construction of the hierarchical common knowledge base and the execution of the incremental calculation engine both rely on the incremental storage mechanism in step S6. The incremental storage mechanism records CAD data change information, providing a basic source of feature data for the hierarchical common knowledge base. The incremental calculation engine uses this incremental data to construct incremental views of new drawings. During the processing of a large number of CAD drawings, the system automatically constructs the hierarchical common knowledge base. Industry-level: This section collects typical layer naming patterns and standard block structures from various industries such as architecture, machinery, and power. For example, it includes common layer names in the architecture industry such as "A-WALL" and "A-DOOR," as well as block definitions like "standard door" and "standard window." This industry-level knowledge is obtained through statistical analysis of a large number of historical drawings and is updated regularly.
[0085] Project-level: Stores the layer sets and block definition library shared by all drawings in the current project. For example, in a residential building project, all drawings contain layers such as "axis lines," "axis numbers," and "walls," as well as a unified "door" block definition. Project-level knowledge is built at the start of the project and dynamically updated when new drawings are added.
[0086] Drawing level: Stores unique feature information of a single drawing, such as custom layers and non-standard blocks. Drawing-level knowledge only retains incremental parts to avoid duplicate storage.
[0087] S7.2 Incremental Views and Rapid Preprocessing: Based on the hierarchical common knowledge base, newly added CAD drawings are preprocessed using an incremental computing engine.
[0088] Specifically, when a new CAD drawing is added, it is first compared with the project-level common knowledge base in terms of features. The comparison algorithm can use string matching (for layer names) and structural similarity calculation (for block definitions). Only the incremental feature parts with differences are parsed and stored to form an incremental view of the drawing. All subsequent processing (such as atlas construction, layer recognition, and optimization operations) is based on the "project-level knowledge base + incremental view", which greatly reduces redundant calculations.
[0089] Experiments show that for drawings within the same project, the scale of incremental views is usually only 10% to 20% of that of full-volume analysis, improving preprocessing efficiency by more than 5 times.
[0090] S7.3 Cross-project knowledge transfer: The incremental computing engine also supports cross-project knowledge transfer. When starting a new project, the user only needs to specify the project type (e.g., "high-rise residential building"). The system automatically retrieves the most similar historical projects from the industry-level knowledge base and transfers their core model parameters (e.g., neural network weights, gating unit weights, multilayer perceptron parameters) to the initial model of the new project using knowledge distillation technology. Then, only a small number of drawings from the new project (usually 5-10) are needed to quickly fine-tune the initial model, achieving performance comparable to training from scratch. Fine-tuning uses a small learning rate (e.g., 0.001) and fewer iteration rounds (e.g., 10 rounds), reducing adaptation time by more than 90%.
[0091] Variant examples: Knowledge distillation can be replaced by parameter transfer, model fusion, etc.; feature comparison can also be accelerated by vector similarity retrieval (such as Faiss).
[0092] The benefits of this step are as follows: A hierarchical common knowledge base enables the system to continuously learn; industry-level, project-level, and drawing-level knowledge is stored in layers, ensuring knowledge reusability while avoiding redundant storage. The incremental calculation engine only processes the parts of new drawings that differ from the knowledge base, significantly reducing redundant calculations. Cross-project knowledge migration allows the system to quickly apply model parameters accumulated from historical projects to new projects, significantly reducing the adaptation costs for new industries and scenarios.
[0093] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit the scope of protection of the invention. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on these embodiments, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art can still combine, add, delete, or otherwise adjust the features of the various embodiments of the present invention according to the circumstances without conflict or creative effort, thereby obtaining different technical solutions that do not fundamentally depart from the concept of the present invention. These technical solutions also fall within the scope of protection of the present invention.
Claims
1. A smart preprocessing method for CAD vector data based on a multi-recognition mechanism, characterized in that, Includes the following steps: S1. Parse the DXF file of CAD vector data, construct a CAD heterogeneous information graph containing multiple types of nodes and associated edges, and use the CAD heterogeneous information graph as a unified data model for the entire process of data processing; S2. For the layer nodes in the CAD heterogeneous information map, extract the text features of the layer names, and aggregate the higher-order semantic structure features of the layer nodes in the CAD heterogeneous information map through meta-path; adaptively fuse the text features and the higher-order semantic structure features through a gating unit to generate a layer embedding vector. S3. Identify the layer based on the layer embedding vector, and introduce a dynamic threshold adjudication mechanism during the identification process. The dynamic threshold adjudication mechanism generates a dynamic identification threshold based on the global statistical features of the CAD drawing. When the predicted probability of a layer belonging to the background layer is greater than the dynamic identification threshold, the layer is determined to be the background layer. S4. Based on the CAD heterogeneous information graph, construct a global dependency graph that includes cleanup dependency edges and semantic constraint edges. Use a graph cut algorithm to divide the global dependency graph into several weakly coupled connected subgraphs, and treat each connected subgraph as an independent optimization transaction. S5. Execute each optimization transaction in parallel. Within each optimization transaction, the transactions are executed sequentially according to the dependencies of atomic operations. During the execution, the semantic constraint edges are verified in real time to complete the cross-dimensional collaborative optimization of entities, layers, and blocks in CAD vector data. S6. During the optimization process, set up multi-level logical checkpoints and generate atomic operation logs. Record data change information based on incremental storage mechanism to achieve traceability and accurate recovery of the optimization process.
2. The intelligent preprocessing method for CAD vector data based on a multiple recognition mechanism according to claim 1, characterized in that, In step S1, the multi-type nodes of the CAD heterogeneous information map include layer nodes, block definition nodes and entity nodes. The entity node is a set node formed by aggregating entities of the same geometric type in the CAD vector data. The associated edges include the belonging edge of the entity node pointing to the layer node, the definition edge of the block definition node pointing to the entity node inside it, and the reference edge of the block reference entity node pointing to the block definition node.
3. The intelligent preprocessing method for CAD vector data based on a multiple recognition mechanism according to claim 1, characterized in that, In step S2, the meta-path includes: The first metapath is the path from a layer node to an entity node, used to aggregate the geometric features of entities within the layer; The second meta-path is the path from the layer node through the entity node and the block definition node to the block reference entity node. It is used to aggregate the reusability information of entities within the layer in the block structure. The third-order path is a path from a layer node to other layer nodes through entity nodes and block definition nodes, used to aggregate the semantic relevance information of layers.
4. The intelligent preprocessing method for CAD vector data based on a multiple recognition mechanism according to claim 1, characterized in that, In step S2, the text features are obtained by encoding the layer name using a word vector model; the higher-order semantic structure features are obtained by aggregating and extracting the feature information of the meta-path using a graph neural network; the gating unit dynamically calculates the fusion weight of the text features and the higher-order semantic structure features based on the local structural features of the layer nodes, where the local structural features include the number of entities associated with the layer nodes and the geometric type diversity of the associated entities.
5. The intelligent preprocessing method for CAD vector data based on a multiple recognition mechanism according to claim 1, characterized in that, In step S3, the global statistical features include the total number of nodes, the total number of edges, the average degree of nodes, and the proportion of each type of node in the CAD heterogeneous information graph. The dynamic recognition threshold is calculated and generated by a multilayer perceptron based on the global statistical features; the predicted probability of the background layer is calculated and generated by a classifier based on the layer embedding vector, and the classifier is a binary classifier trained based on a deep neural network.
6. The intelligent preprocessing method for CAD vector data based on a multiple recognition mechanism according to claim 1, characterized in that, In step S4, the cleanup dependency edge is a directed edge representing the execution order of atomic operations. If operation A is a prerequisite for the execution of operation B, then a cleanup dependency edge is established from operation A to operation B. The semantic constraint edge is a bidirectional edge representing the engineering semantic association between nodes. If two nodes need to be retained or processed simultaneously in terms of engineering semantics, then the semantic constraint edge is established between the two nodes. The graph cut algorithm is a community detection algorithm or a spectral clustering algorithm.
7. The intelligent preprocessing method for CAD vector data based on a multiple recognition mechanism according to claim 1, characterized in that, In step S5, the atomic operations include deleting nodes, cleaning up unreferenced block definition nodes, and merging nodes of the same type of layer. When the execution of the atomic operation detects an edge that violates the semantic constraint, a preset conflict resolution strategy is triggered. The conflict resolution strategy includes terminating the current optimization transaction, issuing a review prompt to the user, and forcibly executing according to the node project priority.
8. The intelligent preprocessing method for CAD vector data based on a multiple recognition mechanism according to claim 1, characterized in that, In step S6, the multi-level logical checkpoint only saves the encrypted hash value of the current CAD heterogeneous information map and a snapshot of the pointer to the original entity data, and does not save the full data. The entry information in the atomic operation log includes transaction ID, operation type, target node ID, node attribute hash value before operation, and node attribute hash value after operation.
9. The intelligent preprocessing method for CAD vector data based on a multiple recognition mechanism according to claim 1, characterized in that, It also includes the step of constructing a hierarchical common knowledge base, which stores the feature information of CAD vector data in layers according to industry level, project level and drawing level. The industry level stores common layer naming patterns and standard block structures of specific industries, the project level stores the layer set and block definition library shared by all drawings of the current project, and the drawing level stores the unique feature information of a single drawing.
10. The intelligent preprocessing method for CAD vector data based on a multiple recognition mechanism according to claim 9, characterized in that, Based on the hierarchical common knowledge base, newly added CAD drawings are preprocessed using an incremental computing engine. First, the newly added CAD drawings are compared with the project-level common knowledge base in terms of features. Only the incremental features that differ from the knowledge base are parsed and stored to form an incremental view of the drawing. Based on the incremental view, the new drawings are quickly preprocessed. When processing across projects, the core model parameters in the industry-level common knowledge base are migrated to the initial model of the new project using knowledge distillation technology. Then, 5-10 CAD drawings from the new project are used to quickly fine-tune the initial model, realizing cross-project knowledge migration.