CAD drawing loading method, font file replacement method, device and storage medium

Through the preset font matching model, the problem of low font file replacement efficiency and accuracy in the existing technology is solved, and automated and efficient font file replacement is achieved.

CN113886906BActive Publication Date: 2025-08-29GLODON CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111156858.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2025-08-29
Estimated Expiration
2041-09-30

AI Technical Summary

Technical Problem

In the prior art, the font file replacement efficiency and replacement accuracy of CAD drawings are low. Users need to replace manually and different types of font files are not universal, resulting in low replacement efficiency and low accuracy.

Method used

The preset font matching model automatically recognizes the font files that cannot be loaded by the software, and determines the replacement files from the loadable font files. Use the neural network to learn the matching results to achieve automated replacement.

Benefits of technology

It improves the efficiency and accuracy of font files in CAD drawings, reduces user manual operations, and ensures the success rate and consistency of replacement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113886906B_ABST
    Figure CN113886906B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for loading CAD drawings, which can solve the technical problem of low font file replacement efficiency and replacement accuracy of CAD drawings in the prior art. The method comprises: when software loads a CAD drawing, determining the font file used in the CAD drawing; identifying a first font file that cannot be loaded by the software from the font files of the CAD drawing; determining a second font file for replacing the first font file from the font files that can be loaded by the software according to a preset font matching model; and loading the CAD drawing in the software according to the second font file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer-aided design, and in particular to a method for loading a CAD drawing, a method and device for replacing a font file of a CAD drawing, a computer device, and a computer-readable storage medium. Background Art

[0002] In CAD drawings, designers often use a variety of fonts to annotate buildings and structural components. This can also vary between design institutes and construction companies. For example, CAD drawings typically use single-line font files to display rebar symbols, but some manufacturers also develop their own font files. This results in the software not being able to display the corresponding fonts in the CAD drawing if the font files used in the CAD drawing are not stored in the software.

[0003] Currently, the existing technology usually requires users to manually replace font files that cannot be displayed in the software, which has a low replacement efficiency. In addition, since different types of font files may not be universal, for example, a small font type font file cannot support a large font type font, this requires users to perform multiple replacement operations for the same font file that the software cannot display, which has a low replacement accuracy and further reduces the replacement efficiency.

[0004] Therefore, how to improve the replacement efficiency and accuracy of font files in CAD drawings has become a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0005] The purpose of the present invention is to provide a method for loading CAD drawings, a method, device, computer equipment and computer-readable storage medium for replacing font files of CAD drawings, which can solve the technical problems of low efficiency and low replacement accuracy of font files of CAD drawings in the prior art.

[0006] One aspect of the present invention provides a method for loading a CAD drawing, the method comprising: when software loads a CAD drawing, determining the font file used in the CAD drawing; identifying a first font file that cannot be loaded by the software from the font files of the CAD drawing; determining a second font file for replacing the first font file from the font files that can be loaded by the software based on a preset font matching model; and loading the CAD drawing in the software based on the second font file.

[0007] Optionally, determining the second font file for replacing the first font file from the font files loadable by the software according to a preset font matching model includes: obtaining a first identifier of the first font file; detecting whether a second identifier associated with the first identifier is stored in the software; if the second identifier is stored, directly determining the font file associated with the second identifier from the font files loadable by the software as the second font file; if the second identifier is not stored, determining the second font file for replacing the first font file from the font files loadable by the software according to the preset font matching model.

[0008] Optionally, if the second identifier is not stored, after determining the second font file for replacing the first font file from the font files loadable by the software according to a preset font matching model, the method further includes: obtaining the second identifier of the second font file; setting and storing the association relationship between the first identifier and the obtained second identifier.

[0009] Optionally, the determining of the second font file for replacing the first font file from the font files loadable by the software according to a preset font matching model includes: extracting feature words of the first font file; converting the feature words into feature vectors through the word embedding layer of the font matching model; calculating the file vector of the first font file based on the feature vector through the vector conversion layer of the font matching model; and determining the font file with the highest degree of matching with the first font file from the output layer of the font matching model according to the file vector of the first font file, as the second font file, wherein the output layer includes multiple font files loadable by the software.

[0010] Optionally, the method of determining the font file with the highest degree of matching with the first font file from the output layer of the font matching model based on the file vector of the first font file as the second font file includes: obtaining a fully connected layer in the font matching model, wherein each fully connected layer is associated with a font file in the output layer, and each fully connected layer is used to represent the file vector of the corresponding font file; calculating the product of the file vector represented by the fully connected layer and the file vector of the first font file to obtain a vector for representing the degree of matching; converting the vector for representing the degree of matching into a numerical value through a softmax function to obtain a matching value for representing the degree of matching; determining the fully connected layer corresponding to the maximum matching value, and determining the font file associated with the fully connected layer from the output layer of the font matching model as the second font file.

[0011] Optionally, after the CAD drawing is loaded in the software according to the second font file, the method further includes: determining the file type of the first font file; filtering out font files belonging to the file type from the font files loadable by the software; receiving a font file replacement instruction, and determining the font file pointed to by the font file replacement instruction from the filtered font files as a third font file; and reloading the CAD drawing in the software according to the third font file.

[0012] Optionally, after reloading the CAD drawing in the software according to the third font file, the method further includes: obtaining a third identifier of the third font file; setting and storing an association between the first identifier and the third identifier; and releasing the association between the first identifier and the second identifier.

[0013] Another aspect of the present invention provides a method for replacing font files in a CAD drawing, the method comprising: determining a first font file that cannot be loaded in the current CAD drawing; extracting feature words of the first font file; converting the feature words into feature vectors through a word embedding layer of a preset font matching model; calculating a file vector of the first font file based on the feature vector through a vector conversion layer of the font matching model; determining a font file with the highest degree of matching with the first font file from the output layer of the font matching model based on the file vector of the first font file, as a second font file, wherein the output layer includes multiple loadable font files; and replacing the first font file of the CAD drawing with the second font file.

[0014] Another aspect of the present invention provides a device for loading CAD drawings, the device comprising: a first determination module, used to determine the font file used in the CAD drawing when the software loads the CAD drawing; an identification module, used to identify a first font file that cannot be loaded by the software from the font file of the CAD drawing; a second determination module, used to determine a second font file for replacing the first font file from the font files that can be loaded by the software according to a preset font matching model; and a loading module, used to load the CAD drawing in the software according to the second font file.

[0015] Another aspect of the present invention provides a font file replacement device for a CAD drawing, the device comprising: a third determination module for determining a first font file that cannot be loaded in the current CAD drawing; an extraction module for extracting feature words of the first font file; a conversion module for converting the feature words into feature vectors through a word embedding layer of a preset font matching model; a calculation module for calculating the file vector of the first font file based on the feature vector through a vector conversion layer of the font matching model; a fourth determination module for determining, based on the file vector of the first font file, the font file with the highest degree of matching with the first font file from the output layer of the font matching model as the second font file, wherein the output layer includes multiple loadable font files; and a replacement module for replacing the first font file of the CAD drawing with the second font file.

[0016] Another aspect of the present invention provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for loading a CAD drawing and / or the method for replacing a font file of a CAD drawing described in any of the above embodiments is implemented.

[0017] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements the method for loading a CAD drawing and / or the method for replacing a font file of a CAD drawing described in any of the above embodiments.

[0018] The method for loading CAD drawings provided by the present invention first detects whether the software can load all font files used in the CAD drawings during the process of software loading the CAD drawings. If not, it determines which font files the software cannot load, which are recorded as first font files. Further, according to a preset font matching model, a second font file for replacing the first font file is automatically screened from the font files that the software can load. Finally, the CAD drawings are loaded into the software based on the second font file. This embodiment conveniently and quickly achieves the purpose of replacement by automatically replacing the font files that the software cannot load in the CAD drawings, and determines the second font file that can replace the first font file based on the model, thereby ensuring the success rate of the replacement. Therefore, the method for loading CAD drawings provided by this embodiment solves the technical problem of low replacement efficiency and low replacement accuracy in the prior art of manually replacing font files in CAD drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present invention. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:

[0020] Figure 1 A flowchart of a method for loading a CAD drawing provided in the first embodiment of the present invention is shown;

[0021] Figure 2 A schematic diagram showing a secondary replacement font file provided by the first embodiment of the present invention is shown;

[0022] Figure 3 A schematic diagram showing a solution for loading CAD drawings provided in the first embodiment of the present invention is shown;

[0023] Figure 4 A block diagram of a CAD drawing loading device provided in a second embodiment of the present invention is shown;

[0024] Figure 5 A block diagram of a device for replacing font files in CAD drawings provided in a third embodiment of the present invention is shown;

[0025] Figure 6 A block diagram of a computer device suitable for implementing a method for loading a CAD drawing and / or a method for replacing a font file of a CAD drawing provided by a fourth embodiment of the present invention is shown. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0027] 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.

[0028] Example 1

[0029] Figure 1FIG. 1 shows a flow chart of a method for loading a CAD drawing provided in the first embodiment of the present invention. Figure 1 As shown, the method includes steps S1 to S4, wherein:

[0030] Step S1, when the software loads a CAD drawing, the font file used in the CAD drawing is determined.

[0031] The execution subject of the present invention may be software for loading CAD drawings, which may be an application. Font files are used to support text display in corresponding font styles. For example, when using the "Kaiti" style to display text, a "Kaiti file" is required to support the "Kaiti" style.

[0032] When the software imports CAD drawings, it first detects the font files used by the CAD drawings. Specifically, Figure 2 As shown, the elements that require font files in a CAD drawing include: text, annotations, leaders and table content (i.e., table text), etc. When the software loads the CAD drawing, it will detect all font styles in the CAD drawing to detect the font files used by the font styles. Among them, the file types of font files that may be used include TTF font files, TTC font files and single-line font files. Single-line font files are further divided into large font files and small font files. Furthermore, after the detection is completed, a font file list will be returned, which includes the names of all font files used in the CAD drawing.

[0033] Step S2: identifying a first font file that cannot be loaded by the software from the font files of the CAD drawing.

[0034] The software has its own font library. All font files in the font library can be loaded by the software. In order to ensure the consistency and availability of the software font library used by different users, the font library can be automatically allocated to the software through the cloud.

[0035] In this embodiment, the returned font file list can be compared with the font library. If the font library does not contain a font file corresponding to a font file name in the list, the font file is considered a first font file that cannot be loaded by the software. The above comparison operation is performed sequentially until all the font file names in the list have been compared, and then all the first font files that cannot be loaded by the software are counted.

[0036] Step S3: determining a second font file for replacing the first font file from font files loadable by the software according to a preset font matching model.

[0037] To address the existing technical issues of low efficiency and accuracy in manually replacing font files in CAD drawings, this embodiment, after detecting a first font file that cannot be loaded, automatically selects a second font file to replace the first font file using a font matching model, and then uses the second font file to replace the first font file to display the CAD drawing. Specifically, the font files that can be loaded by the software are some or all font files in the font library.

[0038] Optionally, considering that each time the same CAD drawing is loaded, the model needs to perform a calculation operation, which wastes system resources; and when the user is not satisfied with the replacement scheme calculated by the model and manually changes the replacement scheme, the software will still use the model to calculate the replacement file again the next time the CAD drawing is opened. At this time, the user can only manually change the replacement scheme again, and the user experience is poor. Based on the above problems, the present embodiment further provides a memory function. For replacement schemes accepted by the user, an association relationship between mutually replaced font files will be set, so that when executing the replacement scheme, priority is given to whether there is a replacement scheme accepted by the user. If so, the replacement is performed according to the existing replacement scheme. If not, the replacement scheme is determined using the model. Specifically, according to a preset font matching model, the second font file used to replace the first font file is determined from the font files loadable by the software, including:

[0039] Obtaining a first identifier of the first font file;

[0040] Detecting whether a second identifier associated with the first identifier is stored in the software;

[0041] If the second identifier is stored, directly determining a font file associated with the second identifier from font files loadable by the software as the second font file;

[0042] If the second identifier is not stored, a second font file for replacing the first font file is determined from font files loadable by the software according to a preset font matching model.

[0043] Optionally, if the second identifier is not stored, after determining a second font file for replacing the first font file from font files loadable by the software according to a preset font matching model, the method further includes:

[0044] Obtaining a second identifier of the second font file;

[0045] An association relationship between the first identifier and the obtained second identifier is set and stored.

[0046] In this embodiment, a font matching model can be obtained through neural network learning to improve the accuracy of font file matching results. Specifically, the neural network can be trained using a training set and the trained model can be tested using a test set. When the test results indicate that the accuracy of the trained model meets a threshold, the trained model can be used as the font matching model. The training set and the test set both include multiple pieces of sample data, each of which includes feature words of a first font file sample and feature words of a second font file sample, wherein the second font file sample is used to replace the first font file sample.

[0047] The font matching model obtained through training includes a word embedding layer, a vector conversion layer, a fully connected layer, and an output layer. The word embedding layer is used to convert feature words into feature vectors, the vector conversion layer is used to calculate a file vector based on all feature vectors, the fully connected layer is used to calculate the matching degree between the first font file and each font file in the font library, and the output layer is used to output the second font file with the highest matching degree.

[0048] Specifically, determining a second font file for replacing the first font file from font files loadable by the software according to a preset font matching model includes:

[0049] extracting characteristic words of the first font file;

[0050] Converting the feature words into feature vectors through the word embedding layer of the font matching model;

[0051] Calculating a file vector of the first font file according to the feature vector using a vector conversion layer of the font matching model;

[0052] A font file having the highest matching degree with the first font file is determined from an output layer of the font matching model according to the file vector of the first font file as the second font file, wherein the output layer includes a plurality of font files loadable by the software.

[0053] The step of determining, from the output layer of the font matching model according to the file vector of the first font file, a font file having the highest degree of matching with the first font file as the second font file includes:

[0054] Obtaining fully connected layers in the font matching model, wherein each fully connected layer is associated with a font file in the output layer, and each fully connected layer is used to represent a file vector of the corresponding font file;

[0055] Calculating the product of the file vector represented by the fully connected layer and the file vector of the first font file to obtain a vector used to represent the degree of matching;

[0056] Converting the vector representing the degree of matching into a numerical value using a softmax function to obtain a matching value representing the degree of matching;

[0057] A fully connected layer corresponding to the maximum matching value is determined, and a font file associated with the fully connected layer is determined from the output layer of the font matching model as the second font file.

[0058] In this embodiment, the first font file can be segmented using Jieba word segmentation technology, and then useless word segmentation is cleaned and filtered to obtain characteristic words for the first font file, where the characteristic words include the font file name. It should be noted that before using Jieba word segmentation, it is necessary to enter commonly used font file names (such as "yjkeng.shx", "Yjkchn.shx", and "hztxt.shx") in the word segmentation library in advance to ensure that they are still complete words in the word segmentation results, thereby optimizing the word segmentation effect.

[0059] Computers cannot directly recognize text words, so they need to be converted into a language that can be recognized by the machine. That is, the feature words are input into the word embedding layer of the font matching model to obtain a feature vector for each feature word, which can be directly recognized by the machine. Specifically, a trained word vector model (such as word2vec) is used to convert each feature word into a feature word vector, such as "1010011..." If each feature word is mapped to a feature vector of length V, Wi is used to represent a 1*V-dimensional feature vector, where i represents the number of feature words extracted from the first font file.

[0060] The feature vector output by the word embedding layer is received by the vector conversion layer of the font matching model, and then the file vector is calculated based on the received feature vector. For example, the file vector of the first font file can be obtained by performing weighted summation on each feature vector and then normalizing the summation result.

[0061] The number of fully-connected layers is the same as the number of font files contained in the output layer. Each fully-connected layer represents the file vector of a unique font file in the output layer. After each fully-connected layer receives the file vector of the first font file, it multiplies it with the file vector represented by itself to obtain a vector used to characterize the degree of matching between the first font file and the font file corresponding to the fully-connected layer. The vector calculated by each fully-connected layer is then converted into a numerical value through the softmax function to obtain a matching value used to characterize the degree of matching between the first font file and the font file corresponding to the fully-connected layer.

[0062] Finally, a fully connected layer with the largest matching value is determined, a font file associated with the fully connected layer is screened out from the font files contained in the output layer, and the font file is output from the output layer as the second font file.

[0063] As an optional embodiment, the font file replacement operation can also be performed outside the above-mentioned software. The above-mentioned software is only responsible for loading the CAD drawing that has been successfully replaced. Therefore, this embodiment can also provide a method for replacing the font file of a CAD drawing. The execution subject of this method can be a different application program located on the same device as the above-mentioned software, or can be another device different from the device where the above-mentioned software is located. Specifically, the method includes:

[0064] Determine the first font file that cannot be loaded in the current CAD drawing;

[0065] extracting characteristic words of the first font file;

[0066] Converting the feature words into feature vectors through a word embedding layer of a preset font matching model;

[0067] Calculating a file vector of the first font file according to the feature vector through a vector conversion layer of the font matching model;

[0068] Determining, from the output layer of the font matching model according to the file vector of the first font file, a font file having the highest degree of matching with the first font file as the second font file, wherein the output layer includes a plurality of font files loadable by software;

[0069] The first font file of the CAD drawing is replaced with the second font file.

[0070] Step S4, loading the CAD drawing in the software according to the second font file.

[0071] In this embodiment, step S2 also determines the font files that can be loaded by the software from the font files of the CAD drawing, and finally the software can use these font files and the second font file to display the CAD drawing.

[0072] Alternatively, in existing two-dimensional and three-dimensional design software, opening and importing CAD drawings are both one-time tasks. When the user is not satisfied with the replacement result, the existing technology cannot achieve a secondary replacement of the font file. To solve this problem, the software of this embodiment also supports the function of replacing the font file again after importing the CAD drawing. Specifically, after the CAD drawing is loaded in the software according to the second font file, the method further includes:

[0073] determining a file type of the first font file;

[0074] Filtering font files belonging to the file type from font files loadable by the software;

[0075] receiving a font file replacement instruction, and determining, from the filtered font files, a font file pointed to by the font file replacement instruction as a third font file;

[0076] Reloading the CAD drawing in the software according to the third font file;

[0077] Obtaining a third identifier of the third font file;

[0078] Setting and storing an association relationship between the first identifier and the third identifier; and

[0079] The association between the first identifier and the second identifier is released.

[0080] After the user replaces the second time, the software will store the replacement result, that is, set and store the association between the first identifier and the third identifier, and at the same time clear the memory of the last replacement, that is, cancel the association between the first identifier and the second identifier.

[0081] Below Figure 3 As an embodiment, the complete implementation process of the present invention is described in detail. Figure 3 A schematic diagram of a CAD drawing loading solution provided by the first embodiment of the present invention is shown. Figure 3 As shown, when the software imports a CAD drawing (also known as a CAD file), it first determines all font files used in the CAD drawing. It then determines which font files in the CAD drawing cannot be loaded by the software, recording them as first font files. The software then uses a font matching model and / or the previous matching results to filter out a second font file from the font files that can be loaded by the software, and then uses the second font file to replace the first font file to display the CAD drawing. Furthermore, after the software successfully loads the CAD drawing based on the second font file, the user can perform a secondary replacement as needed, i.e., manually select a third font file of the same file type as the first font file, and then reload the CAD drawing based on the third font file.

[0082] This invention aims to address the issues of missing and replacing fonts during the transfer of CAD drawings in the field of engineering and architecture. By detecting the font files used in imported / opened CAD drawings, the software automatically matches existing font files, achieving automatic font replacement and correct display. This method eliminates the need for users to manually replace font files when importing / opening CAD drawings, and even allows for secondary updates and replacements of missing font files after a CAD drawing has been successfully imported.

[0083] Example 2

[0084] The second embodiment of the present invention further provides a device for loading CAD drawings, which corresponds to some of the contents involved in the method for loading CAD drawings provided in the first embodiment above. The corresponding technical features and technical effects will not be described in detail in this embodiment. For relevant details, please refer to the first embodiment above. Specifically, Figure 4 FIG. 1 shows a block diagram of a device for loading CAD drawings provided by the second embodiment of the present invention. Figure 4 As shown, the CAD drawing loading device 400 may include a first determination module 401, an identification module 402, a second determination module 403 and a loading module 404, wherein:

[0085] The first determining module 401 is used to determine the font file used in the CAD drawing when the software loads the CAD drawing;

[0086] an identification module 402 for identifying a first font file that cannot be loaded by the software from the font files of the CAD drawing;

[0087] A second determining module 403 is configured to determine, from font files loadable by the software, a second font file for replacing the first font file according to a preset font matching model;

[0088] The loading module 404 is configured to load the CAD drawing into the software according to the second font file.

[0089] Optionally, the second determination module is specifically used to: obtain a first identifier of the first font file; detect whether a second identifier associated with the first identifier is stored in the software; if the second identifier is stored, directly determine a font file associated with the second identifier from the font files loadable by the software as the second font file; if the second identifier is not stored, determine a second font file for replacing the first font file from the font files loadable by the software according to a preset font matching model.

[0090] Optionally, the device also includes: a first acquisition module, used to obtain the second identifier of the second font file after determining the second font file to replace the first font file from the font files loadable by the software according to a preset font matching model if the second identifier is not stored; and a first setting module, used to set and store the association relationship between the first identifier and the obtained second identifier.

[0091] Optionally, when the second determination module determines the second font file used to replace the first font file from the font files loadable by the software according to a preset font matching model, it is specifically used to: extract feature words of the first font file; convert the feature words into feature vectors through the word embedding layer of the font matching model; calculate the file vector of the first font file based on the feature vector through the vector conversion layer of the font matching model; and determine the font file with the highest degree of matching with the first font file from the output layer of the font matching model based on the file vector of the first font file, as the second font file, wherein the output layer includes multiple font files loadable by the software.

[0092] Optionally, when the second determination module determines the font file with the highest degree of matching with the first font file from the output layer of the font matching model based on the file vector of the first font file as the second font file, it is specifically used to: obtain a fully connected layer in the font matching model, wherein each fully connected layer has an association relationship with a font file in the output layer, and each fully connected layer is used to represent the file vector of the corresponding font file; calculate the product of the file vector represented by the fully connected layer and the file vector of the first font file to obtain a vector for representing the degree of matching; convert the vector for representing the degree of matching into a numerical value through a softmax function to obtain a matching value for representing the degree of matching; determine the fully connected layer corresponding to the maximum matching value, and determine the font file associated with the fully connected layer from the output layer of the font matching model as the second font file.

[0093] Optionally, the device also includes: a first processing module, used to determine the file type of the first font file after the CAD drawing is loaded in the software according to the second font file; a screening module, used to screen out font files belonging to the file type from the font files loadable by the software; a receiving module, used to receive a font file replacement instruction, and determine the font file pointed to by the font file replacement instruction from the screened font files as a third font file; a second processing module, used to reload the CAD drawing in the software according to the third font file.

[0094] Optionally, the device also includes: a second acquisition module, used to obtain the third identifier of the third font file after the CAD drawing is reloaded in the software according to the third font file; a second setting module, used to set and store the association relationship between the first identifier and the third identifier; and a release module, used to release the association relationship between the first identifier and the second identifier.

[0095] Example 3

[0096] The third embodiment of the present invention further provides a device for replacing font files of CAD drawings, which corresponds to some of the contents involved in the method for loading CAD drawings provided in the first embodiment above. The corresponding technical features and technical effects will not be described in detail in this embodiment. For relevant details, please refer to the first embodiment above. Specifically, Figure 5 FIG. 1 is a block diagram of a font file replacement device for a CAD drawing provided by a third embodiment of the present invention. Figure 5 As shown, the CAD drawing font file replacement device 500 may include a third determination module 501, an extraction module 502, a conversion module 503, a calculation module 504, a fourth determination module 505 and a replacement module 506, wherein:

[0097] The third determining module 501 is configured to determine a first font file that cannot be loaded in the current CAD drawing;

[0098] Extraction module 502, used to extract feature words of the first font file;

[0099] A conversion module 503 is configured to convert the feature word into a feature vector through a word embedding layer of a preset font matching model;

[0100] A calculation module 504 is configured to calculate a file vector of the first font file according to the feature vector using a vector conversion layer of the font matching model;

[0101] a fourth determining module 505, configured to determine, from the output layer of the font matching model, a font file having the highest degree of matching with the first font file based on the file vector of the first font file, as the second font file, wherein the output layer includes a plurality of loadable font files;

[0102] The replacement module 506 is configured to replace the first font file of the CAD drawing with the second font file.

[0103] Optionally, the fourth determination module is specifically used to: obtain a fully connected layer in the font matching model, wherein each fully connected layer is associated with a font file in the output layer, and each fully connected layer is used to represent a file vector of the corresponding font file; calculate the product of the file vector represented by the fully connected layer and the file vector of the first font file to obtain a vector for representing the degree of matching; convert the vector for representing the degree of matching into a numerical value through a softmax function to obtain a matching value for representing the degree of matching; determine the fully connected layer corresponding to the maximum matching value, and determine the font file associated with the fully connected layer from the output layer of the font matching model as the second font file.

[0104] Example 4

[0105] Figure 6 A block diagram of a computer device suitable for implementing a method for loading CAD drawings and / or a method for replacing font files of CAD drawings provided in the fourth embodiment of the present invention is shown. In this embodiment, the computer device 600 may be a smartphone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including an independent server or a server cluster composed of multiple servers) that executes a program. Figure 6 As shown, the computer device 600 of this embodiment includes at least but not limited to: a memory 601, a processor 602, and a network interface 603 that can be interconnected via a system bus. It should be noted that Figure 6 Computer device 600 is shown having only components 601 - 603 , but it is understood that implementing all of the illustrated components is not a requirement, and greater or fewer components may alternatively be implemented.

[0106] In this embodiment, the memory 603 includes at least one type of computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 601 can be an internal storage unit of the computer device 600, such as the hard disk or memory of the computer device 600. In other embodiments, the memory 601 can also be an external storage device of the computer device 600, such as a plug-in hard disk equipped on the computer device 600, a smart memory card (SMC), a secure digital (SD) card, a flash card, etc. Of course, the memory 601 can also include both the internal storage unit of the computer device 600 and its external storage device. In this embodiment, the memory 601 is generally used to store an operating system and various application software installed on the computer device 600, such as program codes of a method for loading CAD drawings and / or a method for replacing font files of CAD drawings.

[0107] In some embodiments, processor 602 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. Processor 602 is generally used to control the overall operation of computer device 600. For example, it performs control and processing related to data exchange or communication with computer device 600. In this embodiment, processor 602 is used to execute program code for a method for loading a CAD drawing and / or a method for replacing a font file for a CAD drawing stored in memory 601.

[0108] In this embodiment, the CAD drawing loading method and / or the CAD drawing font file replacement method stored in the memory 601 can also be divided into one or more program modules and executed by one or more processors (processor 602 in this embodiment) to complete the present invention.

[0109] The network interface 603 may include a wireless network interface or a wired network interface. The network interface 603 is generally used to establish a communication link between the computer device 600 and other computer devices. For example, the network interface 603 is used to connect the computer device 600 to an external terminal via a network, and to establish a data transmission channel and a communication link between the computer device 600 and the external terminal. The network can be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile Communications (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth, or Wi-Fi.

[0110] Example 5

[0111] This embodiment also provides a computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, server, App application store, etc., on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for loading a CAD drawing and / or the method for replacing the font file of a CAD drawing are implemented.

[0112] Obviously, those skilled in the art should understand that the various modules or steps of the above-mentioned embodiments of the present invention can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices. Alternatively, they can be implemented using program code executable by the computing device, so that they can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described can be performed in a different order than herein, or they can be made into separate integrated circuit modules, or multiple modules or steps can be made into a single integrated circuit module for implementation. Thus, the embodiments of the present invention are not limited to any specific combination of hardware and software.

[0113] It should be noted that the serial numbers of the embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0114] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method.

[0115] The above are only preferred embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for loading CAD drawings, characterized in that: The method comprises: When the software loads a CAD drawing, determining the font file used in the CAD drawing; Identifying a first font file that is not loadable by the software from the font files of the CAD drawing; Obtaining a first identifier of the first font file; Detecting whether a second identifier associated with the first identifier is stored in the software; wherein the software has a memory function, and for a replacement solution accepted by the user, the software will establish an association between the identifiers corresponding to the font files that replace each other; If the second identifier is stored, directly determining a font file associated with the second identifier from font files loadable by the software as the second font file; If the second identifier is not stored, determining a second font file for replacing the first font file from font files loadable by the software according to a preset font matching model; Loading the CAD drawing in the software according to the second font file; After the CAD drawing is loaded in the software according to the second font file, determining the file type of the first font file; Filtering font files belonging to the file type from font files loadable by the software; receiving a font file replacement instruction, and determining, from the filtered font files, a font file pointed to by the font file replacement instruction as a third font file; The CAD drawing is reloaded in the software according to the third font file.

2. The method according to claim 1, characterized in that After determining, if the second identifier is not stored, a second font file for replacing the first font file from font files loadable by the software according to a preset font matching model, the method further includes: Obtaining a second identifier of the second font file; An association relationship between the first identifier and the obtained second identifier is set and stored.

3. The method according to claim 1, characterized in that The determining, according to a preset font matching model, a second font file for replacing the first font file from font files loadable by the software includes: extracting characteristic words of the first font file; Converting the feature words into feature vectors through the word embedding layer of the font matching model; Calculating a file vector of the first font file according to the feature vector through a vector conversion layer of the font matching model; A font file having the highest matching degree with the first font file is determined from an output layer of the font matching model according to the file vector of the first font file as the second font file, wherein the output layer includes a plurality of font files loadable by the software.

4. The method according to claim 3, characterized in that The step of determining, from the output layer of the font matching model according to the file vector of the first font file, a font file with the highest matching degree with the first font file as the second font file includes: Obtaining fully connected layers in the font matching model, wherein each fully connected layer is associated with a font file in the output layer, and each fully connected layer is used to represent a file vector of the corresponding font file; Calculating the product of the file vector represented by the fully connected layer and the file vector of the first font file to obtain a vector used to represent the degree of matching; Converting the vector representing the degree of matching into a numerical value using a softmax function to obtain a matching value representing the degree of matching; A fully connected layer corresponding to the maximum matching value is determined, and a font file associated with the fully connected layer is determined from the output layer of the font matching model as the second font file.

5. The method according to claim 1, wherein After the CAD drawing is reloaded in the software according to the third font file, the method further includes: Obtaining a third identifier of the third font file; Setting and storing an association relationship between the first identifier and the third identifier; and The association between the first identifier and the second identifier is released.

6. A method for replacing font files of CAD drawings, characterized in that: The method comprises: Determine the first font file that cannot be loaded in the current CAD drawing; Obtaining a first identifier of the first font file; Detecting whether a second identifier associated with the first identifier is stored in software used to load the CAD drawing; wherein the software has a memory function and sets an association between the font files that replace each other for a replacement solution accepted by the user; If the second identifier is stored, directly determining a font file associated with the second identifier from font files loadable by the software as the second font file; If the second identifier is not stored, extracting feature words of the first font file; converting the feature words into feature vectors through a word embedding layer of a preset font matching model; calculating a file vector of the first font file based on the feature vectors through a vector conversion layer of the font matching model; and determining, based on the file vector of the first font file, a font file with the highest degree of matching with the first font file from an output layer of the font matching model as a second font file, wherein the output layer includes a plurality of loadable font files; Replacing the first font file of the CAD drawing with the second font file; After the CAD drawing is loaded in the software according to the second font file, determining the file type of the first font file; Filtering font files belonging to the file type from font files loadable by the software; receiving a font file replacement instruction, and determining, from the filtered font files, a font file pointed to by the font file replacement instruction as a third font file; The CAD drawing is reloaded in the software according to the third font file.

7. A CAD drawing loading device, characterized in that: The device comprises: A first determining module is used to determine the font file used in the CAD drawing when the software loads the CAD drawing; an identification module, configured to identify, from the font files of the CAD drawing, a first font file that is not loadable by the software; a second determination module configured to obtain a first identifier of the first font file; detect whether a second identifier associated with the first identifier is stored in the software; if the second identifier is stored, directly determine a font file associated with the second identifier from font files loadable by the software as the second font file; if the second identifier is not stored, determine a second font file from font files loadable by the software to replace the first font file based on a preset font matching model; wherein the software has a memory function and, for replacement schemes accepted by the user, sets an association relationship between the mutually replacing font files; A loading module, configured to load the CAD drawing in the software according to the second font file; a first processing module, configured to determine a file type of the first font file after the CAD drawing is loaded in the software according to the second font file; A screening module, configured to screen font files of the file type from font files loadable by the software; a receiving module, configured to receive a font file replacement instruction, and determine, from the filtered font files, a font file pointed to by the font file replacement instruction as a third font file; The second processing module is used to reload the CAD drawing in the software according to the third font file.

8. A device for replacing font files of CAD drawings for implementing the method of claim 6, characterized in that: The device comprises: A third determining module is used to determine a first font file that cannot be loaded in the current CAD drawing; An extraction module, configured to extract characteristic words of the first font file; A conversion module, configured to convert the feature word into a feature vector through a word embedding layer of a preset font matching model; a calculation module, configured to calculate a file vector of the first font file according to the feature vector through a vector conversion layer of the font matching model; a fourth determining module, configured to determine, from an output layer of the font matching model, a font file having the highest degree of matching with the first font file based on the file vector of the first font file, as a second font file, wherein the output layer includes a plurality of loadable font files; The replacement module is used to replace the first font file of the CAD drawing with the second font file.

9. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method according to any one of claims 1 to 5 and / or the method according to claim 6 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 and / or the method according to claim 6 is implemented.

Citation Information

Patent Citations

  • System and method for independent font substitution of string characters

    US20090109227A1

  • Intelligent font replacement of missing glyphs

    US20190243875A1