A method, device and storage medium for loading custom entities in CAD drawings
Through multi-threaded architecture and differentiated loading strategies, the problem of slow single-threaded loading of custom entities is solved, and the overall loading efficiency and resource security of CAD drawings are improved.
Patent Information
- Application Number
- CN202510840098.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-23
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2045-06-23
AI Technical Summary
In the existing technology, the single-threaded loading method of custom entities causes a decrease in CAD drawing processing speed, affecting engineering efficiency and collaboration experience.
A multi-threaded architecture is adopted, and custom entities are assigned to corresponding loading threads through first-class tags, including the main thread, second-class sub-threads and multiple first-class sub-threads, to implement differentiated loading strategies and perform task hierarchical management in combination with entity loading characteristics.
It achieves a step-by-step optimization of loading speed, balancing loading efficiency and resource security, and is suitable for complex drawing scenarios containing a large number of heterogeneous custom entities.
Smart Images

Figure CN120353518B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer graphics, and in particular to a method, device and storage medium for loading custom entities in CAD drawings. Background Art
[0002] As industries like architecture, manufacturing, and machinery continue to demand higher levels of drawing accuracy and functionality, standard CAD entities (such as lines, circles, and surfaces) are no longer sufficient for diverse design scenarios. This has led to a growing demand for custom entity development. Custom entities are non-standard objects with specific geometric forms and behavioral characteristics, created through secondary development interfaces. For example, in AutoCAD, developers can create custom entities using the ObjectARX platform.
[0003] For example, the invention patent application with patent application publication number CN117910088A discloses a method and device for rapid construction and linkage update of three-dimensional railway lines, which relates to the technical field of railway line design, including: obtaining first information, the first information including the standard design information of the plane, longitudinal section and cross section of the railway line; performing spatial line position splitting processing according to the first information to obtain a custom entity; performing multi-threaded parallel construction processing according to the custom entity to obtain a line entity model; performing minimum segment division processing according to the line entity model to obtain an update range, and obtaining an optimized scene model according to the update range and the line entity model; establishing a communication channel according to the optimized scene model, and the communication channel is used for the linkage update of the line.
[0004] It can be seen that custom entities are completely developed by users independently, can deeply integrate professional domain knowledge to adapt to the usage requirements of different scenarios, and are highly flexible. To ensure data security when importing across devices or platforms, single-threaded sequential loading is usually adopted.
[0005] However, in actual applications, drawings containing custom entities often need to be exchanged frequently. The inefficiency of single-threaded loading leads to a decrease in the overall processing speed of drawings, seriously affecting engineering efficiency and collaboration experience. Summary of the Invention
[0006] The main purpose of this application is to provide a method, device and storage medium for loading custom entities in CAD drawings. In order to solve the above-mentioned technical problems, this application specifically adopts the following technical solutions:
[0007] A first aspect of the present application is to provide a method for loading a custom entity in a CAD drawing, the method comprising:
[0008] S101, obtaining a CAD drawing to be loaded, wherein the CAD drawing includes a plurality of custom entities, and the custom entities are associated with a type of tag, wherein the type of tag is determined based on a loading type supported by the associated custom entities;
[0009] S102, creating an entity loading thread, wherein the entity loading thread includes a main thread, a second-class sub-thread, and multiple first-class sub-threads;
[0010] For each of the custom entities, execute step S103 or S104:
[0011] S103, assigning the custom entity to a corresponding entity loading thread according to the first type of tag for loading, so as to generate display data of the custom entity;
[0012] S104: If the first type of tag is identified as an abnormal state, the corresponding unknown custom entity is assigned to the second type of sub-thread for loading to generate display data of the unknown custom entity.
[0013] In some embodiments, the custom entity includes a type of entity, and the loading type supported by the type of entity is multi-threaded concurrent loading; S103 includes: allocating the type of entity to the corresponding type of sub-thread for loading to generate display data of the type of entity.
[0014] In some embodiments, the custom entity includes two types of entities, and the loading type supported by the second type of entities is concurrent loading; S103 includes: allocating the second type of entities to the second type of sub-threads for loading to generate display data of the second type of entities.
[0015] In some embodiments, the custom entities include three types of entities, and the loading type supported by the three types of entities is single-threaded loading; S103 includes: allocating the three types of entities to the main thread for loading to generate display data of the three types of entities.
[0016] In some embodiments, the method includes: counting the number of custom entities to be loaded in the second type of sub-threads; when the number to be loaded is greater than a preset number, analyzing the predicted loading type supported by the unknown custom entity based on the programming data of the unknown custom entity; updating the first type label of the unknown custom entity based on the predicted loading type; executing step S103 based on the updated first type label to assign the unknown custom entity to the corresponding entity loading thread for loading.
[0017] In some embodiments, analyzing the predicted loading type supported by the unknown custom entity based on the programming data of the unknown custom entity includes: analyzing whether the unknown custom entity has a shared resource reference based on the programming data of the unknown custom entity; if not, the predicted loading type supported by the unknown custom entity is multi-threaded concurrent loading; if so, the predicted loading type supported by the unknown custom entity is concurrent loading.
[0018] In some embodiments, the custom entity is associated with two types of tags, and the two types of tags store the expected display characteristics of the custom entity. The method includes: based on the expected display characteristics, verifying the display data of the custom entity to determine the degree of matching between the display data and the expected display characteristics; if the matching degree is lower than the preset matching degree, allocating the corresponding abnormal custom entity to the main thread for reloading to update the display data of the abnormal custom entity.
[0019] In some embodiments, the method includes: obtaining historical display data of the CAD drawing to be loaded, and extracting expected display data corresponding to each of the custom entities from the historical display data; extracting expected display features from the expected display data, the expected display features including at least one of shape features, color features or area features.
[0020] A second aspect of the present application is to provide a computer device, the device comprising:
[0021] memory for storing computer programs;
[0022] A processor is used to execute the computer program and implement the steps of the method for loading custom entities in a CAD drawing as provided in any embodiment of the present application when executing the computer program.
[0023] The third aspect of the present application is to provide a corresponding computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor performs the steps of the method for loading custom entities in a CAD drawing as provided in any embodiment of the present application.
[0024] Beneficial effects:
[0025] The present invention provides a method, device, and storage medium for loading custom entities in CAD drawings. This method establishes a deep adaptation system for custom entities and a multi-threaded architecture. Furthermore, a differentiated loading strategy is implemented through a class of tags, achieving a step-by-step optimization of loading speed. This effectively balances loading efficiency and resource security in a design environment with a high degree of freedom for custom entities, making it particularly suitable for complex drawing scenarios containing a large number of heterogeneous custom entities.
[0026] Specifically, tasks are precisely assigned to the main thread, multiple Class 1 sub-threads, and Class 2 sub-threads based on the characteristics of entity loading. This collaborative work among the main thread, Class 2 sub-threads, and multiple Class 1 sub-threads enables hierarchical management of loading tasks. The main thread focuses on processing single-thread-dependent entities, ensuring their stability and correctness. Multiple Class 1 sub-threads accelerate the processing of independently loadable entities through parallel mechanisms, fully leveraging the performance of multi-core processors. Class 2 sub-threads serve as dedicated threads for concurrent loading. This differentiated multi-threading and parallel processing significantly reduces overall loading time.
[0027] Furthermore, when the loading type of a custom entity is unknown, a second-class sub-thread serves as the default processing thread for unknown custom entities, improving processing efficiency through moderate concurrency while avoiding the resource conflicts and efficiency losses associated with using a first-class sub-thread. To further enhance processing speed, a mechanism for predicting the entity type of unknown custom entities is triggered by the task backlog of the second-class sub-thread. This adaptively adjusts thread allocation when there is a high task backlog, effectively utilizing multi-thread resources and improving loading efficiency. This is particularly useful for scenarios requiring fast loading, such as drawing review.
[0028] Furthermore, to ensure resource security and loading accuracy, a conservative, slow, and highly accurate single-threaded loading process is implemented for some entities. Display results are automatically verified using expected features from the second-category tags, identifying display anomalies caused by incorrect thread allocation and distinguishing between deliberate designer effects and genuine loading failures. When unexpected display deviations are detected, the anomalous entity is automatically transferred to the most reliable main thread for reloading, making it highly suitable for complex drawings with complex geometry or special rendering requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for the embodiments or the description of the prior art. In all drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the various elements or parts are not necessarily drawn according to the actual scale. Obviously, the drawings described below are some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without paying any creative work.
[0030] Figure 1 This is a schematic flow chart of a method for loading a custom entity in a CAD drawing provided in an embodiment of the present application;
[0031] Figure 2 This is a schematic diagram of entity loading thread allocation provided by an embodiment of the present application;
[0032] Figure 3 This is a schematic flow chart of another method for loading a custom entity in a CAD drawing provided in an embodiment of the present application;
[0033] Figure 4 This is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0034] To make the purpose, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0035] Herein, suffixes such as "module," "component," or "unit" used to represent elements are only used to facilitate the description of the present application and have no specific meaning. Therefore, "module," "component," or "unit" can be used interchangeably.
[0036] As used herein, terms such as "upper," "lower," "inner," "outer," "front," "back," "one end," and "the other end" indicate positions or locations based on those shown in the accompanying drawings. These terms are intended solely to facilitate the description of this application and simplify the description. They are not intended to indicate or imply that the devices or components referred to must have, be constructed, or operate in a specific orientation. Therefore, they should not be construed as limitations on this application. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0037] As used herein, unless otherwise expressly specified or limited, the terms "installed," "provided with," "connected," etc., should be understood broadly. For example, "connected" may refer to a fixed connection, a detachable connection, or an integral connection; it may refer to a mechanical connection, a direct connection, an indirect connection through an intermediate medium, or internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in this application.
[0038] As used herein, "and / or" includes any and all combinations of one or more of the associated listed items.
[0039] Herein, "plurality" means two or more than two, ie, it includes two, three, four, five, etc.
[0040] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0041] In this article, the drawing can be a CAD drawing, and the format of the drawing can be dwg format, dxf format, dwt format, etc. It can also be a proe drawing, SolidWorks drawing and other drawings that can support concurrent calculations, without limitation here.
[0042] In this article, entities refer to the graphical data in a drawing, displayed on the drawing interface. Entities can be divided into two categories: standard entities pre-provided by the software, such as lines, circles, and surfaces; and custom entities customized on demand. These are non-standard objects with specific geometric shapes and behavioral characteristics, created through secondary development interfaces.
[0043] In this article, concurrency refers to the execution of multiple tasks within the same time period, and multithreading is a way to achieve concurrency. By creating and running multiple threads in a program, each thread performs a different task, allowing the program to execute multiple tasks simultaneously, thereby improving the program's efficiency and performance.
[0044] During the development of custom entities, users are granted a high degree of design freedom, enabling them to deeply integrate domain expertise and adapt to complex scenarios. However, because the geometric structure, behavioral logic, and data storage methods of custom entities are all defined by the developer, the loading process is highly uncertain and uncontrollable. To avoid security risks such as data format incompatibilities and logical conflicts that may arise during cross-platform imports, existing technologies generally adopt a conservative single-threaded sequential loading mechanism, resulting in low resource utilization and affecting the overall processing efficiency of drawings.
[0045] Based on this, the embodiments of this application provide a method, device, and storage medium for loading custom entities in CAD drawings. This system establishes a deep adaptation system for custom entities and a multi-threaded architecture. Furthermore, a differentiated loading strategy is implemented through a class of tags, achieving a step-by-step optimization of loading speed. This effectively balances loading efficiency and resource security in a design environment where custom entities are highly free. This approach is particularly suitable for complex drawing scenarios containing a large number of heterogeneous custom entities.
[0046] The following describes some embodiments of the present application in detail with reference to the accompanying drawings. In the absence of conflict, the following embodiments and features of the embodiments can be combined with each other. Figure 1 , Figure 1 This is a schematic flow chart of a method for loading a custom entity in a CAD drawing provided in an embodiment of the present application, such as Figure 1 As shown, an embodiment of the present application provides a method for loading a custom entity in a CAD drawing, and the method includes S101 to S104.
[0047] S101, obtaining a CAD drawing to be loaded, wherein the CAD drawing includes a plurality of custom entities, and the custom entities are associated with a type of tag, wherein the type of tag is determined based on a loading type supported by the associated custom entities.
[0048] Among them, a type of label can be an entity type identifier or a thread support identifier, so as to quickly determine the loading characteristics of the custom entity based on the type of label, such as whether it supports concurrent operations and whether it is compatible with multi-threaded processing, and then provide a decision basis for subsequent differentiated thread allocation, ensuring that the loading strategy is highly consistent with the entity characteristics. Exemplarily, there is a preset mapping relationship between the entity type identifier or the thread support identifier and the loading characteristics of the custom entity. For example, there is a mapping relationship between a type of entity and the loading type of multi-threaded concurrent loading. When the thread support identifier is "supports multi-threaded concurrency" or the entity type identifier is "a type of entity", the custom entity is assigned to a type of sub-thread.
[0049] Among them, custom entities include Class I entities, Class II entities, and Class III entities, which support loading types of multi-threaded concurrent loading, concurrent loading, and single-threaded loading respectively. Class I entities are custom entities that support multi-threaded concurrent loading. Their data and resources are completely independently maintained and do not involve shared resource access. Such custom entities can fully utilize the parallel computing capabilities of multi-core processors during the display data generation process to achieve efficient loading. Class II entities are custom entities that only support concurrent loading but not multi-threaded loading. Since they share resources with other custom entities, such as graphic databases, display lists, file systems, etc., it is necessary to avoid data inconsistencies or conflicts caused by multiple threads accessing the same resource at the same time. Only different tasks can be allowed to access different resources concurrently. Class III entities are custom entities that support neither concurrent nor multi-threaded loading and can only be loaded through a single thread. They are highly dependent on other entities or their own historical states, or have a logical relationship of sequential dependence, or rely on specific single-threaded resources during operation. Therefore, they need to be processed serially in a single thread to ensure resource security.
[0050] It should be understood that due to differences in the implementation functions and writing methods of different custom entities, the loading types applicable to custom entities are limited. For example, the loading of a type of entity does not involve loading dependencies and shared resource references. The three loading types mentioned above (i.e., multi-threaded concurrent loading, concurrent loading, and single-threaded loading) are all applicable. The selection of the loading type only affects the overall loading efficiency of the drawing. For another example, the loading of a type of entity involves shared resource references. The applicable loading types are concurrent loading and single-threaded loading. Concurrent loading is the fastest loading method it can support, while single-threaded loading is a slower loading method. Type II entities can load correctly under both loading methods. However, the loading of a type of entity may involve loading dependencies and specific single-threaded resources. It is only applicable to single-threaded loading. If a type of entity other than single-threaded loading is used for loading, or if a type II entity is loaded with multi-threaded concurrent loading, loading errors or data corruption may occur.
[0051] Load dependencies refer to the fact that a custom entity relies on the existence, status, or loading order of other entities during loading. For example, a custom entity may need to reference the location information of other geometric objects during loading, or flowchart nodes may need to be generated in a specific logical order. Shared resource references refer to the fact that a custom entity requires access to common resources in a drawing file during loading. These resources may be read and written by multiple entities simultaneously.
[0052] In some embodiments, a new flag is added to the secondary development file of a CAD drawing. Users can use this flag to define a class of tags for each custom entity. This flag is embedded in the custom entity's attributes as metadata. When extracting the custom entity from the CAD drawing, the specific value of the class of tags can be quickly identified by parsing the flag. It should be understood that setting the flag accelerates the loading of custom entities, effectively improving loading efficiency and enhancing the user experience without increasing memory consumption or development complexity.
[0053] S102: Create an entity loading thread, where the entity loading thread includes a main thread, a second-type sub-thread, and multiple first-type sub-threads.
[0054] Among them, the entity loading thread is a multi-threaded architecture created for processing custom entities, including a main thread and multiple parallel sub-threads of the same priority. These parallel sub-threads run independently of the main thread and are used to execute entity loading tasks in parallel.
[0055] The main thread is the default thread that runs when the program starts. It is responsible for initializing resources, managing other threads, and coordinating the operation of the entire program. In addition, the main thread is responsible for loading entities with strict single-threaded dependencies. Sub-threads are further divided into Class I sub-threads and Class II sub-threads. Multiple Class I sub-threads are used to process entities that have been verified by Class I tags to support multi-threaded concurrent loading; Class II sub-threads are used to process entities that have been verified by Class I tags to support only concurrent loading. It should be noted that Class II sub-threads and Class I sub-threads can have the same thread structure; the difference between the two is only due to the different entity loading tasks they handle.
[0056] Step S103 or S104 is executed for each of the custom entities to parse a type of tag associated therewith to determine a loading strategy.
[0057] S103, assigning the custom entity to a corresponding entity loading thread according to the first type of tag for loading, so as to generate display data of the custom entity;
[0058] S104: If the first type of tag is identified as an abnormal state, the corresponding unknown custom entity is assigned to the second type of sub-thread for loading to generate display data of the unknown custom entity.
[0059] Specifically, if the first-class label is valid and clear, the custom entity will be accurately assigned to the corresponding entity loading thread based on the parsing result of the first-class label. For example, if the thread support is identified as "support multi-threaded concurrency" or the entity type is identified as "first-class entity", the custom entity will be assigned to the first-class sub-thread; if the first-class label is identified as abnormal, such as missing label, incorrect format, or the identifier cannot match the preset identifier, the entity is judged to be an unknown type, and the unknown custom entity is assigned to the second-class sub-thread for loading.
[0060] The display data is the visual information generated by the entity after thread processing, for example, the entity's geometric shape, color, texture and other entity information. When the entity is loaded abnormally, the display data may include an error prompt, which is not limited here.
[0061] It should be understood that the second-class sub-thread, as the default processing thread, is used to perform concurrent loading tasks for conventional second-class entities and unknown custom entities, generating corresponding display data. Since the loading type of unknown custom entities is still unclear, loading them in the second-class sub-thread can improve loading speed through concurrency, avoiding the performance loss caused by completely serialized processing, and avoiding the risk of resource conflicts that may be caused by directly using multi-threaded concurrent loading. At the same time, although in actual applications, the custom entity types included in drawings are determined by the user's implementation requirements during secondary development, the third-class entities that support neither concurrent nor multi-threaded loading must strictly rely on a single-threaded execution environment. Their development complexity is relatively high, and the workload required by users during the actual writing process is far greater than that of first-class and second-class entities. As a result, the proportion of third-class entities in actual projects is extremely low. Moreover, for these rarely used custom entities, the first-class labels entered by users are generally relatively complete and have a low error rate. Therefore, using the second-class sub-thread as the default processing thread is highly feasible and can achieve a dynamic balance between resource security and processing speed.
[0062] See also Figure 2 , Figure 2 This is a schematic diagram of entity loading thread allocation provided in an embodiment of the present application.
[0063] In some embodiments, the custom entity includes a type of entity, and the loading type supported by the type of entity is multi-threaded concurrent loading; S103 includes: allocating the type of entity to the corresponding type of sub-thread for loading to generate display data of the type of entity.
[0064] Specifically, if Figure 2 As shown, a custom entity can be a Class I entity whose loading type supports multi-threaded concurrent loading. This means that the data resources of the custom entity are independent and have no shared dependencies, allowing for safe parallel processing. Therefore, after identifying such a custom entity based on a Class I tag, it is assigned to a corresponding Class I sub-thread for loading. The Class I sub-thread acts as a parallel processing unit, loading the display data of the custom entity through a multi-threaded mechanism, fully utilizing the computing power of multi-core processors and shortening loading time.
[0065] In some embodiments, the custom entity includes two types of entities, and the loading type supported by the second type of entities is concurrent loading; S103 includes: allocating the second type of entities to the second type of sub-threads for loading to generate display data of the second type of entities.
[0066] Specifically, if Figure 2As shown, a custom entity can be a Class II entity whose loading type supports concurrent loading. This means that this entity only allows for parallel processing acceleration and cannot be accelerated through multi-threading. Therefore, after identifying such entities based on the Class I tags, they are assigned to Class II sub-threads for loading. Class II sub-threads process each Class II entity in sequence according to the order in which they were read (i.e., the order in which they were stored), ensuring consistency in the operations of multiple concurrent tasks on shared resources, thereby generating display data for the Class II entities.
[0067] It should be understood that due to the shared resource characteristics of the second-class entity, its loading process needs to avoid multi-thread conflicts, but the overall efficiency can still be improved through concurrent tasks, and there may be task accumulation in the second-class sub-threads. The main thread can focus on allocating computing resources to the second-class sub-threads, that is, the resource allocation priority of the second-class sub-threads may be higher than that of the first-class sub-threads.
[0068] In some embodiments, the custom entities include three types of entities, and the loading type supported by the three types of entities is single-threaded loading; S103 includes: allocating the three types of entities to the main thread for loading to generate display data of the three types of entities.
[0069] Specifically, if Figure 2 As shown, custom entities can be of three types. Their loading type supports single-threaded loading. This means that due to strict sequential dependencies, historical state binding, or reliance on specific single-threaded resources, these entities must be processed serially in a single thread to ensure logical correctness. Therefore, after identifying such entities based on a class of tags, they are assigned to the main thread for loading. The main thread serially loads the display data for the custom entity, avoiding data conflicts or logical errors caused by multi-threaded concurrency.
[0070] It should be understood that the embodiments of the present application precisely allocate tasks to the main thread, multiple Class 1 sub-threads, and Class 2 sub-threads based on the characteristics of entity loading. By combining the collaborative work of the main thread, Class 2 sub-threads, and multiple Class 1 sub-threads, hierarchical management of loading tasks is achieved. The main thread focuses on processing single-threaded dependent entities to ensure their stability and correctness; multiple Class 1 sub-threads accelerate the processing of independently loadable entities through a parallel mechanism, fully utilizing the performance of multi-core processors; Class 2 sub-threads serve as dedicated threads for concurrent loading, carrying both regular concurrent tasks and serving as the default processing thread for unknown custom entities.
[0071] It should be understood that when the loading type of a custom entity is unclear, the second type of sub-thread can improve processing efficiency through moderate concurrency while avoiding the resource conflicts and efficiency losses that may arise from using the first type of sub-thread. Thus, through differentiated multi-threading and parallel processing, the overall loading time is significantly shortened.
[0072] In some embodiments, the method includes: counting the number of custom entities to be loaded in the second type of sub-threads; when the number to be loaded is greater than a preset number, analyzing the predicted loading type supported by the unknown custom entity based on the programming data of the unknown custom entity; updating the first type label of the unknown custom entity based on the predicted loading type; executing step S103 based on the updated first type label to assign the unknown custom entity to the corresponding entity loading thread for loading.
[0073] The "to-be-loaded" count refers to the total number of custom entities in the queued, yet-to-be-processed, Category II sub-threads, including Category II entities and / or unknown custom entities. The preset count is used to determine the extent of the task backlog in Category II sub-threads. The specific value can be flexibly set based on hardware resources, loading speed, and loading time, and is not limited here.
[0074] Among them, the programming data of the unknown custom entity refers to the part of the code corresponding to the unknown custom entity in the secondary development code, which can be a characteristic code reflecting thread compatibility, including but not limited to resource access mode, dependency, logical structure and other data.
[0075] Specifically, the number of unknown custom entities waiting to be loaded in the second type of sub-thread is counted. When the number of entities to be loaded exceeds a preset number, the entity type prediction mechanism is triggered. Based on the programming data of the unknown custom entity, its potential loading characteristics are inferred. For example, the programming data of the unknown custom entity is compared with a pre-stored code template library, wherein the code template library stores a large number of commonly used code forms for defining dependencies between entities or shared resource references. The predicted loading type is updated to a first-class label so that the unknown custom entity obtains a clear and identifiable first-class label. The updated first-class label will guide the execution of step S103 to assign the entity to a matching entity loading thread.
[0076] It should be understood that the entity type prediction mechanism of the unknown custom entity is triggered by the task backlog of the second type of sub-thread, so that the actual loading type of the entity is predicted and the label is updated through programming data when there is a high task backlog, thereby making full use of the computing resources of the first type of sub-thread, avoiding the waste of resources caused by premature analysis, and preventing the performance degradation caused by the backlog of tasks of the second type of sub-thread, thereby realizing the effective use of multi-thread resources.
[0077] In some embodiments, processing can be prioritized starting from unknown custom entities at the back of the queue to avoid affecting the processing progress of entities at the front of the queue, and when the number to be loaded is less than or equal to a preset number, the analysis of the predicted loading type supported by the unknown custom entity based on the programming data of the unknown custom entity can be stopped.
[0078] In some embodiments, analyzing the predicted loading type supported by the unknown custom entity based on the programming data of the unknown custom entity includes: analyzing whether the unknown custom entity has a loading dependency based on the programming data of the unknown custom entity; if not, the predicted loading type supported by the unknown custom entity is multi-threaded concurrent loading; if so, the predicted loading type supported by the unknown custom entity is concurrent loading.
[0079] Specifically, the predicted loading type of an unknown custom entity is determined based on its programming data, with the aim of identifying a type of entity that can actually be loaded concurrently by multiple threads. Therefore, it is necessary to analyze whether the programming data of the custom entity involves shared resource references in order to distinguish between type one entities and type two entities. If the analysis results show that the unknown custom entity has no shared resource references, it is determined that it supports multi-threaded concurrent loading and can be assigned to a type one sub-thread for parallel processing; if there are characteristics of shared resource references, it will still be retained as an unknown custom entity in a type two sub-thread for processing. In this way, the thread allocation strategy for unknown custom entities is dynamically optimized, improving loading efficiency while ensuring loading accuracy and alleviating task accumulation in type two sub-threads.
[0080] It should be understood that the data and resources of the first-class entities are maintained completely independently, without the need to access shared resources. Their coding structure is significantly different from that of the second-class entities, and the shared resource access in the programming data of the second-class entities has a certain degree of identifiability and high recognition accuracy. Therefore, the entity type prediction mechanism in actual applications is mainly used to distinguish between the first-class entities and the second-class entities, thereby improving the loading speed and achieving effective utilization of multi-threaded resources. It should be noted that the third-class entities rarely appear in actual scenarios, and the anomaly rate of their first-class labels is low, which has limited impact on the overall loading. Therefore, they are of secondary concern in actual applications.
[0081] After a CAD drawing is completed (or the main structure is drawn), the user reviews the completed drawing to determine whether the 3D model complies with regulations and to note any necessary modifications. For example, when a construction company completes a building drawing using CAD software, it will first undergo an internal review. Specifically, the reviewer will review the 3D model (i.e., the model representing the building) on the drawing to assess whether the drawing complies with relevant regulations. Furthermore, after the construction company completes the internal review of the building drawing, it must submit it to a construction drawing review agency designated by the construction authority. This agency will then review the drawing for content related to public interests, public safety, and mandatory engineering construction standards in accordance with relevant laws and regulations. Understandably, to balance multiple factors, such as project construction / processing safety and implementation costs, the process from the creation of a 3D drawing to its implementation involves multiple steps. From the perspective of CAD reviewers, a CAD reviewer may have to review dozens or even hundreds of CAD drawing files every day, and the workload involved is very large. Therefore, the review efficiency can be effectively improved by quickly loading drawings and combining them with the entity type prediction mechanism.
[0082] In some embodiments, analyzing the predicted loading type supported by the unknown custom entity based on the programming data of the unknown custom entity includes: analyzing whether the unknown custom entity has loading dependencies and shared resource references based on the programming data of the unknown custom entity; if not, the predicted loading type supported by the unknown custom entity is multi-threaded concurrent loading; if there are loading dependencies and / or shared resource references, the predicted loading type supported by the unknown custom entity is single-threaded loading.
[0083] Specifically, the programming data for custom entities is analyzed for loading dependencies and shared resource references to distinguish one type of entity from other custom entities. If the analysis results show that the unknown custom entity has neither loading dependencies nor shared resource references, it is determined to support multi-threaded concurrent loading and can be assigned to a type of sub-thread for parallel processing. If any of these characteristics are present, the loading type is predicted to be conservative, slow processing, and high-accuracy single-threaded loading.
[0084] It should be understood that when the file resource security of CAD drawings is the primary consideration, in order to avoid the risk of data corruption due to abnormal loading of unknown custom entities, a low-speed and high-precision processing mode under a conservative strategy can be adopted for uncertain entities, that is, the loading type of such unknown custom entities is preset to single-threaded loading, and the security of resource access is ensured through serial execution. Although some loading efficiency is sacrificed, memory conflicts or dependency errors caused by concurrent operations can be avoided to the greatest extent.
[0085] In some embodiments, to reduce the user's initial configuration workload for Class I tags, the default value of the thread support flag can be set to "support concurrent loading" or the default value of the entity type flag can be directly set to "Class II entity". In this case, users do not need to complete the Class I tag information for the large number of Class II entities, but only need to complete the Class I tags for the smaller number of Class III and Class I entities. In this case, even if there are a large number of unknown custom entities to be loaded in the Class II sub-thread, the entity type prediction mechanism will not be actively triggered.
[0086] Alternatively, the conservatism can be further enhanced by adjusting the judgment parameters of the entity type prediction mechanism. Exemplarily, the preset number is set to a first value, and the blank rate of the first type of label is monitored in real time. When the blank rate is greater than the preset blank rate, it is determined that the second type of label of a large number of custom entities is not set at this time, and the preset number is set to a higher second value, wherein the first value is less than the second value. That is, the preset number is set to a higher threshold, and the analysis is triggered only when extreme tasks accumulate, or a stricter judgment standard is set. For example, the first code template library is used in normal scenarios, and when the second type of label of a large number of custom entities is not set or is set abnormally, the second code template library is switched to use, wherein the storage quantity of the first code template library is lower than that of the second code template library, so as to simplify the pre-stored code template library, identify loading dependencies and shared resource references with high accuracy, effectively avoid misjudging what is actually a second type of entity as a first type of entity, and prevent the risk of resource conflicts caused by incorrect thread allocation.
[0087] The embodiment of the present application also provides a verification mechanism for the second type of label. By pre-storing the second type of label feature data such as entity shape and color, the display results are automatically verified. This can not only capture display anomalies caused by thread allocation errors (such as incorrectly loading three types of entities that should be processed by a single thread concurrently), but also distinguish between special effects deliberately designed by designers and real loading failures. In addition, when unexpected display deviations are detected, the abnormal entity is automatically transferred to the most reliable main thread for reloading. It is highly suitable for complex drawing scenes with complex geometric structures or special rendering requirements. While maintaining high-speed loading, it ensures the accurate restoration of key design elements.
[0088] In some embodiments, the custom entity is associated with two types of tags, and the two types of tags store the expected display characteristics of the custom entity. The method includes: based on the expected display characteristics, verifying the display data of the custom entity to determine the degree of matching between the display data and the expected display characteristics; if the matching degree is lower than the preset matching degree, allocating the corresponding abnormal custom entity to the main thread for reloading to update the display data of the abnormal custom entity.
[0089] The second type of tags is used to store the expected display characteristics of an entity. These can be standardized descriptions of the entity's geometry, color, texture, rendering mode, and so on. They can also be error prompts that may appear during the entity loading process, such as cross-shaped patterns, image cracking patterns, and text descriptions. For example, when a designer intentionally uses non-standard geometric deformations, the expected display characteristic can be a geometric shape. In another example, in an artistic creation scenario, when a designer intentionally designs resource retrieval anomalies, the expected display characteristic can be a resource retrieval failure prompt.
[0090] Specifically, the display data generated after the custom entity is loaded, that is, the actual visual information presented, is obtained and compared with the expected display features stored in the second-category tag to determine the degree of match between the two, such as the quantified similarity value of attributes such as shape and color. The match degree is then compared with the preset match degree to determine whether the display result meets expectations. The preset match degree is used to identify abnormal display data. The corresponding threshold can be pre-set based on the recognition sensitivity and the type of expected display features, such as geometric shape similarity greater than 80% and color similarity greater than 90%, etc., which are not limited here.
[0091] If the matching degree falls below a preset matching degree, the custom entity is determined to be an abnormal custom entity and assigned to the main thread for reloading. It should be understood that the main thread ensures resource access security through single-threaded processing, and can generate display data at a relatively low speed and with high accuracy. Therefore, the main thread can be used to load custom entities with abnormal display data, and can correct incorrect loading caused by thread allocation errors.
[0092] In some embodiments, the method includes: obtaining historical display data of the CAD drawing to be loaded, and extracting expected display data corresponding to each of the custom entities from the historical display data; extracting expected display features from the expected display data, the expected display features including at least one of shape features, color features or area features.
[0093] Specifically, the system obtains the historical display data of the CAD drawing to be loaded. This data is the correct display data stored when the CAD drawing to be loaded is successfully loaded, including the complete rendering record of each entity in the historical scene. From this historical display data, the expected display data corresponding to each or a specific custom entity is extracted. Representative expected display features are then extracted from this expected display data. This system uses the historical display data as a benchmark to improve the accuracy and consistency of the display results.
[0094] Shape features describe the geometric outline or topological structure of an entity, such as the number of polygon sides; color features refer to the color properties of an entity, such as RGB value, hue, and saturation; and area features refer to the amount of space an entity occupies on a drawing, such as the area of a filled region or a projected area. By comparing the currently loaded display data with the above features, we can determine if there are any anomalies, triggering a reload in the main thread to correct any discrepancies.
[0095] It should be understood that the verification mechanism for the second-category tag is designed to mitigate potential thread allocation errors that may occur during default concurrent loading and entity type prediction. During the actual loading process, if the software's pre-set anomaly detection algorithm detects suspected loading errors, such as distorted entity shapes or resource retrieval anomalies, it does not immediately hand the issue off to the main thread for reloading. Instead, it first triggers a secondary verification process for the second-category tag. This mechanism compares the current display data with the expected display characteristics recorded in the second-category tag to determine whether the deviation is a true loading error. Furthermore, users can pre-configure the expected display characteristics for certain key or special custom entities and write second-category tags to accurately distinguish between specific design intent and loading anomalies. For example, if a designer intentionally uses non-standard rendering or geometric distortion, this may be misjudged as an error and result in unnecessary intervention. The verification function for the second-category tag ensures accurate reproduction of key design elements in complex drawing scenarios while effectively avoiding overprocessing caused by misjudging intentional design effects, thereby improving loading efficiency and user experience.
[0096] See also Figure 3 , Figure 3 This is a schematic flow chart of another method for loading custom entities in a CAD drawing provided in an embodiment of the present application, such as Figure 3 As shown, an embodiment of the present application provides another method for loading custom entities in a CAD drawing, and the method includes S201 to S205.
[0097] S201: Identify custom entities based on a first-class tag. S203: After identifying three types of entities, assign the three types of entities to the main thread in the order in which they are stored in the drawing to form a loading queue. S202: After identifying a first-class entity, a second-class entity, or an unknown custom entity, quickly load the first-class entity, the second-class entity, or the unknown custom entity based on the corresponding first-class sub-thread or second-class sub-thread, respectively, to obtain the display data of the first-class entity, the second-class entity, or the unknown custom entity. Steps S202 and S203 are selectively executed based on the identification results of the custom entity based on the first-class tag. During this process, abnormal custom entities with abnormal display data may be generated. In this case, step S204 is executed: the abnormal custom entities are inserted into the corresponding position in the loading queue in the order in which they are stored in the drawing.
[0098] After the display data of the first-class entities, the second-class entities, and the unknown custom entities are all loaded, step S205 is executed to load the third-class entities or the abnormal custom entities in sequence based on the loading queue based on the main thread to obtain the display data of the third-class entities or the abnormal custom entities, and finally complete the loading of the entire CAD drawing.
[0099] It should be understood that the loading tasks of custom entities that support concurrent processing are loaded first, and then the loading tasks of entities that do not support concurrent processing are processed by the main thread. Before reprocessing the abnormal custom entity, it can be inserted into the corresponding position in the loading queue according to its storage position in the drawing to ensure that the main thread's processing order of the three types of entities and abnormal custom entities is consistent with the original design logic, avoiding dependency or resource reference errors caused by out-of-order processing, and thus avoiding logical errors or display anomalies in the display data obtained by single-threaded processing.
[0100] In some embodiments, the loading tasks of various types of custom entities can be executed in batches. For example, multiple custom entities in a drawing are divided into a preset number of batches according to the storage order, and each batch of custom entities is processed in turn. For example, the custom entities of the current batch are identified according to the first-class label; after identifying three types of entities, the identified three types of entities are assigned to the main thread according to their storage order in the drawing to form a loading queue; after identifying a first-class entity, a second-class entity, or an unknown custom entity, the first-class entity, the second-class entity, or the unknown custom entity are quickly loaded based on the corresponding first-class sub-thread or second-class sub-thread, respectively, to obtain the display data of the current batch of first-class entities, second-class entities, or unknown custom entities. In this process, abnormal custom entities with abnormal display data may be generated. According to the storage order of the abnormal custom entities in the drawing, the abnormal custom entities are inserted into the corresponding position in the loading queue.
[0101] After the display data of the current batch of Class I entities, Class II entities, and unknown custom entities are all loaded, the main thread loads the current batch of Class III entities or abnormal custom entities in sequence according to the loading queue to obtain the display data of the Class III entities or abnormal custom entities.
[0102] In some embodiments, if the standard CAD entity supports multi-threaded concurrent loading, it can also be loaded through multiple first-class sub-threads.
[0103] In some embodiments, the task allocation of multiple first-class sub-threads is optimized through a load balancing strategy to fully utilize the parallel computing capabilities of the multi-core processor. For example, based on the number of custom entities, entity complexity, and the current load of each first-class sub-thread, the first-class entities that support multi-threaded concurrent loading are dynamically allocated to idle or low-loaded first-class sub-threads to ensure that the task loads between threads are relatively balanced and avoid the situation where some threads are overloaded while others are idle. Thus, the overall loading efficiency is improved by rationally scheduling the task allocation of multiple first-class sub-threads.
[0104] See also Figure 4 , Figure 4 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a terminal device or a server.
[0105] For example, the above method can be implemented in the form of a computer program. Figure 4 Runs on the computer equipment shown.
[0106] like Figure 4 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0107] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, which, when executed, can cause a processor to execute any method for loading a custom entity in a CAD drawing.
[0108] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0109] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any method for loading a custom entity in a CAD drawing.
[0110] This network interface is used for network communication, such as sending assigned tasks.
[0111] It should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0112] In one embodiment, the processor is configured to execute a computer program stored in the memory to implement the following steps:
[0113] S101, obtaining a CAD drawing to be loaded, wherein the CAD drawing includes a plurality of custom entities, and the custom entities are associated with a type of tag, wherein the type of tag is determined based on a loading type supported by the associated custom entities;
[0114] S102, creating an entity loading thread, wherein the entity loading thread includes a main thread, a second-class sub-thread, and multiple first-class sub-threads;
[0115] For each of the custom entities, execute step S103 or S104:
[0116] S103, assigning the custom entity to a corresponding entity loading thread according to the first type of tag for loading, so as to generate display data of the custom entity;
[0117] S104: If the first type of tag is identified as an abnormal state, the corresponding unknown custom entity is assigned to the second type of sub-thread for loading to generate display data of the unknown custom entity.
[0118] In some embodiments, the custom entity includes a type of entity, and the loading type supported by the type of entity is multi-threaded concurrent loading; when implementing S103, the processor is also used to implement: allocating the type of entity to the corresponding type of sub-thread for loading to generate display data of the type of entity.
[0119] In some embodiments, the custom entity includes two types of entities, and the loading type supported by the two types of entities is concurrent loading; when implementing S103, the processor is also used to implement: allocating the two types of entities to the two types of sub-threads for loading to generate display data of the two types of entities.
[0120] In some embodiments, the custom entity includes three types of entities, and the loading type supported by the three types of entities is single-threaded loading; when implementing S103, the processor is also used to implement: allocating the three types of entities to the main thread for loading to generate display data of the three types of entities.
[0121] In some embodiments, the processor is further used to implement: counting the number of custom entities to be loaded in the second type of sub-threads; when the number to be loaded is greater than a preset number, analyzing the predicted loading type supported by the unknown custom entity based on the programming data of the unknown custom entity; updating the first type label of the unknown custom entity based on the predicted loading type; executing step S103 based on the updated first type label to assign the unknown custom entity to the corresponding entity loading thread for loading.
[0122] In some embodiments, when implementing the analysis of the predicted loading type supported by the unknown custom entity based on the programming data of the unknown custom entity, the processor is also used to implement: analyzing whether the unknown custom entity has a shared resource reference based on the programming data of the unknown custom entity; if not, the predicted loading type supported by the unknown custom entity is multi-threaded concurrent loading; if so, the predicted loading type supported by the unknown custom entity is concurrent loading.
[0123] In some embodiments, the custom entity is associated with two types of tags, and the two types of tags store the expected display characteristics of the custom entity. The processor is also used to implement: based on the expected display characteristics, the display data of the custom entity is checked to determine the degree of match between the display data and the expected display data; if the degree of match is lower than the preset degree of match, the corresponding abnormal custom entity is assigned to the main thread and reloaded to update the display data of the abnormal custom entity.
[0124] In some embodiments, the processor is further used to implement: obtaining historical display data of the CAD drawing to be loaded, and extracting expected display data corresponding to each of the custom entities from the historical display data; extracting expected display features from the expected display data, the expected display features including at least one of shape features, color features or area features.
[0125] Exemplarily, the processor is used to run a computer program stored in the memory, and is also used to implement the steps of the method for loading custom entities in CAD drawings provided in any embodiment of the present application, which will not be repeated here.
[0126] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement the steps of the method for loading custom entities in a CAD drawing provided in any one of the embodiments of the present application.
[0127] The computer-readable storage medium may be an internal storage unit of the computer device described in the aforementioned embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a SmartMedia Card (SMC), a Secure Digital (SD) card, a flash memory card, etc., equipped on the computer device.
[0128] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and such modifications or substitutions should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A method for loading custom entities in CAD drawings, characterized in that: The method comprises: S101, obtaining a CAD drawing to be loaded, wherein the CAD drawing includes multiple custom entities, each of which is associated with a type of tag, wherein the type of tag is determined based on a loading type supported by the associated custom entity; the custom entities include type one entities, type two entities, and type three entities; the loading type supported by the type one entities is multi-threaded concurrent loading; the loading type supported by the type two entities is concurrent loading; and the loading type supported by the type three entities is single-threaded loading; S102, creating an entity loading thread, wherein the entity loading thread includes a main thread, a second-type sub-thread, and multiple first-type sub-threads; For each of the custom entities, execute step S103 or S104: S103, assigning the custom entity to a corresponding entity loading thread according to the first type of tag for loading, so as to generate display data of the custom entity; The S103 further includes: allocating the first type of entity to the corresponding first type of sub-thread for loading, so as to generate display data of the first type of entity; allocating the second type of entity to the second type of sub-thread for loading, so as to generate display data of the second type of entity; allocating the third type of entity to the main thread for loading, so as to generate display data of the third type of entity; S104: If the first type of tag is identified as an abnormal state, the corresponding unknown custom entity is assigned to the second type of sub-thread for loading to generate display data of the unknown custom entity.
2. The method according to claim 1, wherein The method comprises: Counting the number of custom entities to be loaded in the second type of sub-threads; When the number to be loaded is greater than a preset number, analyzing the predicted loading type supported by the unknown custom entity according to the programming data of the unknown custom entity; updating a class label of the unknown custom entity according to the predicted loading type; Step S103 is executed according to the updated class label to assign the unknown custom entity to the corresponding entity loading thread for loading.
3. The method according to claim 2, wherein The analyzing, based on the programming data of the unknown custom entity, the predicted loading type supported by the unknown custom entity includes: Analyzing, based on programming data of the unknown custom entity, whether the unknown custom entity has a shared resource reference; If not, the predicted loading type supported by the unknown custom entity is multi-threaded concurrent loading; If so, the predicted loading type supported by the unknown custom entity is concurrent loading.
4. The method according to any one of claims 1 to 3, wherein The custom entity is associated with two types of tags, and the two types of tags store expected display features of the custom entity. The method includes: Based on the expected display characteristics, checking the display data of the custom entity to determine the degree of match between the display data and the expected display characteristics; If the matching degree is lower than a preset matching degree, the corresponding abnormal custom entity is allocated to the main thread and reloaded to update the display data of the abnormal custom entity.
5. The method according to claim 4, wherein The method comprises: Acquire historical display data of the CAD drawing to be loaded, and extract expected display data corresponding to each of the custom entities from the historical display data; An expected display feature is extracted from the expected display data, where the expected display feature includes at least one of a shape feature, a color feature, or an area feature.
6. A computer device, characterized in that: The device comprises: memory for storing computer programs; A processor is configured to execute the computer program and implement the method for loading a custom entity in a CAD drawing according to any one of claims 1 to 5 when executing the computer program.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, enables the processor to implement the method for loading a custom entity in a CAD drawing according to any one of claims 1 to 5.
Citation Information
Patent Citations
Three-dimensional railway line rapid construction and linkage updating method and device
CN117910088A
Storage method and device of multi-thread data
CN102446117A