CN113886906A - CAD drawing loading method, font file replacing method, device and storage medium - Google Patents
CAD drawing loading method, font file replacing method, device and storage medium Download PDFInfo
- Publication number
- CN113886906A CN113886906A CN202111156858.3A CN202111156858A CN113886906A CN 113886906 A CN113886906 A CN 113886906A CN 202111156858 A CN202111156858 A CN 202111156858A CN 113886906 A CN113886906 A CN 113886906A
- Authority
- CN
- China
- Prior art keywords
- font
- file
- font file
- cad drawing
- software
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/10—Geometric CAD
- G06F30/12—Geometric CAD characterised by design entry means specially adapted for CAD, e.g. graphical user interfaces [GUI] specially adapted for CAD
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Geometry (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Mathematical Optimization (AREA)
- Computational Mathematics (AREA)
- Mathematical Analysis (AREA)
- Human Computer Interaction (AREA)
- Pure & Applied Mathematics (AREA)
- Computer Hardware Design (AREA)
- Evolutionary Computation (AREA)
- General Engineering & Computer Science (AREA)
- Architecture (AREA)
- Controls And Circuits For Display Device (AREA)
- Document Processing Apparatus (AREA)
Abstract
The invention discloses a loading method of a CAD drawing, which can solve the technical problems of low replacement efficiency and replacement accuracy of font files of the CAD drawing in the prior art, and comprises the following steps: when the software loads the CAD drawing, determining a font file used in the CAD drawing; identifying a first font file which 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 which 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.
Description
Technical Field
The invention relates to the technical field of computer aided design, in particular to a loading method of a CAD drawing, a font file replacing method and device of the CAD drawing, computer equipment and a computer readable storage medium.
Background
In CAD drawings, designers often label buildings, structural members, and the like with various fonts, and the fonts used for labeling may be different for each design institute, construction unit, and the like. For example, in CAD drawings, a single-line font file is usually used to display a steel bar symbol, but some manufacturers may develop their own font file to display the steel bar symbol. Therefore, in the process of transferring the CAD drawing, if the font file used by the CAD drawing is not stored in the software, the corresponding font in the CAD drawing cannot be displayed.
In the prior art, a user usually replaces a font file which cannot be displayed manually in software, so that the replacement efficiency is low; moreover, because different types of font files may not be commonly used, for example, a small font type font file cannot support a large font type font, a user is required to perform multiple replacement operations on the same font file that cannot be displayed by software, and replacement accuracy is low while replacement efficiency is further reduced.
Therefore, how to improve the replacement efficiency and the replacement accuracy of the font file in the CAD drawing becomes a technical problem to be solved urgently in the field.
Disclosure of Invention
The invention aims to provide a loading method of a CAD drawing, a font file replacing method and device of the CAD drawing, computer equipment and a computer readable storage medium, which can solve the technical problem that in the prior art, the font file replacing efficiency and the replacing accuracy rate of the CAD drawing are low.
One aspect of the present invention provides a loading method for a CAD drawing, including: when the software loads the CAD drawing, determining a font file used in the CAD drawing; identifying a first font file which 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 which 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.
Optionally, the determining, according to a preset font matching model, a second font file for replacing the first font file from the font files loadable by the software includes: acquiring a first identifier of the first font file; detecting whether a second identifier having an association relation with the first identifier is stored in the software; if the second identifier is stored, directly determining a font file having an association relation with the second identifier from the font files which can be loaded by the software, and using the font file as the second font file; and if the second identifier is not stored, determining a second font file for replacing the first font file from the font files which can be loaded by the software according to a preset font matching model.
Optionally, after determining, according to a preset font matching model, a second font file for replacing the first font file from the font files loadable by the software if the second identifier is not stored, the method further includes: acquiring a second identifier of the second font file; and setting and storing the incidence relation between the first identifier and the acquired second identifier.
Optionally, the determining, according to a preset font matching model, a second font file for replacing the first font file from the font files loadable by the software includes: extracting characteristic words of the first font file; converting the feature words into feature vectors through a word embedding layer of the font matching model; calculating a file vector of the first font file according to the characteristic vector through a vector conversion layer of the font matching model; and determining a font file which is matched with the first font file to the highest extent from an output layer of the font matching model according to the file vector of the first font file to serve as the second font file, wherein the output layer comprises a plurality of font files which can be loaded by the software.
Optionally, the determining, from the output layer of the font matching model according to the file vector of the first font file, the font file with the highest matching degree with the first font file as the second font file includes: acquiring fully connected layers in the font matching model, wherein each fully connected layer has an incidence relation with one font file in the output layer, and each fully connected layer is used for representing a file vector of a corresponding font file; calculating the product of the file vector represented by the full connection layer and the file vector of the first font file to obtain a vector for representing the matching degree; converting the vector for representing the matching degree into a numerical value through a softmax function to obtain a matching value for representing the matching degree; and determining a full connection layer corresponding to the maximum matching value, and determining a font file having an association relation with the full connection layer from the output layer of the font matching model to be used as the second font file.
Optionally, after the CAD drawing is loaded in the software according to the second font file, the method further includes: determining a file type of the first font file; screening font files belonging to the file type from the font files which can be loaded by the software; receiving a font file replacing instruction, and determining a font file pointed by the font file replacing instruction from the screened font files as a third font file; and reloading the CAD drawing in the software according to the third font file.
Optionally, after the CAD drawing is reloaded in the software according to the third font file, the method further includes: acquiring a third identifier of the third font file; setting and storing the incidence relation between the first identifier and the third identifier; and releasing the association relationship between the first identifier and the second identifier.
Another aspect of the present invention provides a method for replacing a font file of a CAD drawing, including: determining a first font file which cannot be loaded in a current CAD drawing; extracting characteristic words of the first font file; converting the characteristic words into characteristic vectors through a word embedding layer of a preset font matching model; calculating a file vector of the first font file according to the characteristic vector through a vector conversion layer of the font matching model; determining a font file with the highest matching degree with the first font file from an output layer of the font matching model according to the file vector of the first font file to serve as a second font file, wherein the output layer comprises a plurality of loadable font files; and replacing the first font file of the CAD drawing with the second font file.
In still another aspect of the present invention, there is provided a loading apparatus for a CAD drawing, the apparatus including: the system comprises a first determining module, a second determining module and a display module, wherein the first determining module is used for determining a font file used in a CAD drawing when the CAD drawing is loaded by software; the identification module is used for identifying a first font file which cannot be loaded by the software from the font files of the CAD drawing; the second determining module is used for determining a second font file for replacing the first font file from the font files which can be loaded by the software according to a preset font matching model; and the loading module is used for loading the CAD drawing in the software according to the second font file.
Still another aspect of the present invention provides a font file replacing apparatus for a CAD drawing, the apparatus comprising: the third determining module is used for determining the first font file which cannot be loaded in the current CAD drawing; the extracting module is used for extracting the characteristic words of the first font file; the conversion module is used for converting the characteristic words into characteristic vectors through a word embedding layer of a preset font matching model; the calculation module is used for calculating a file vector of the first font file according to the characteristic vector through a vector conversion layer of the font matching model; a fourth determining module, configured to determine, according to the file vector of the first font file, a font file that has a highest matching degree with the first font file from an output layer of the font matching model, as a second font file, where the output layer includes a plurality of loadable font files; and the replacing module is used for replacing the first font file of the CAD drawing with the second font file.
Yet another aspect of the present invention provides a computer apparatus, comprising: the device comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor realizes the loading method of the CAD drawing and/or the font file replacing method of the CAD drawing in any embodiment when executing the computer program.
A further aspect of the present invention provides a computer-readable storage medium on which a computer program is stored, the computer program, when executed by a processor, implementing the loading method of CAD drawings and/or the font file replacement method of CAD drawings according to any of the above embodiments.
The loading method of the CAD drawing provided by the invention comprises the steps of firstly detecting whether the software can load all font files used by the CAD drawing or not in the process of loading the CAD drawing by the software, if not, determining which font files cannot be loaded by the software, marking as first font files, further automatically screening out second font files for replacing the first font files from the font files which can be loaded by the software according to a preset font matching model, and finally loading the CAD drawing in the software based on the second font files. According to the method for loading the CAD drawing, the purpose of replacing the font file which cannot be loaded by software in the CAD drawing is conveniently and quickly achieved through automatic replacement, the second font file which can replace the first font file is determined based on the model, and the success rate of replacement is guaranteed.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flowchart illustrating a loading method of a CAD drawing according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a twice-replaced font file according to an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating a loading scheme of a CAD drawing provided by the embodiment of the invention;
FIG. 4 is a block diagram illustrating a loading apparatus for CAD drawings provided in the second embodiment of the present invention;
FIG. 5 is a block diagram of a device for replacing a font file of a CAD drawing provided by the third embodiment of the present invention;
fig. 6 is 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 according to a fourth embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Example one
Fig. 1 shows a flowchart of a loading method of a CAD drawing according to a first embodiment of the present invention, and as shown in fig. 1, the method includes steps S1 to S4, where:
and step S1, when the software loads the CAD drawing, determining the font file used in the CAD drawing.
The execution subject of the invention can be software for loading the CAD drawing, and the software can be an application program. The font file is used for supporting the characters to be displayed in a corresponding font style, for example, when the characters are displayed in a "regular script" style, the "regular script" style needs to be supported by the "regular script file".
In the process of importing software into a CAD drawing, the software first detects a font file used by the CAD drawing, specifically, as shown in fig. 2, elements of a font file required to be used in one CAD drawing include: when the software loads the CAD drawing, the software detects all font styles in the CAD drawing to detect font files used by the font styles, wherein the possible file types of the font files comprise a TTF font file, a TTC font file and a single-line font file, the single-line font file is divided into a large font file and a small font file, and further, a font file list is returned after the detection is completed, and the list comprises the names of all the font files used by the CAD drawing.
And step S2, identifying a first font file which is not loadable by the software from the font files of the CAD drawing.
The software corresponds to a font library of the software, font files in the font library can be loaded by the software, and in order to ensure that the font libraries of the software used by different users have consistency and usability, the font libraries can be automatically distributed to the software through the cloud.
In this embodiment, the returned font file list may be compared with a font library, and if the font library does not include a font file corresponding to a certain font file name in the list, the font file is a first font file that cannot be loaded by software. And sequentially executing the comparison operation until all the font file names in the list are compared, and counting all the first font files which cannot be loaded by the software.
Step S3, determining 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.
In order to solve the technical problems that in the prior art, the replacement efficiency and the replacement accuracy rate of the font file for manually replacing the CAD drawing are low, in the embodiment, after the first font file which cannot be loaded is detected, the second font file for replacing the first font file is automatically screened out through the font matching model, and then the CAD drawing is displayed by using the second font file to replace the first font file. Specifically, the font file that can be loaded by the software is a part or all of the font files in the font library.
Optionally, considering that the model is required to perform a calculation operation every time the same CAD drawing is loaded, system resources are wasted; and after the user is unsatisfied with the replacement scheme calculated by the model and manually changes the replacement scheme, the software still uses the model to calculate the replacement file again when opening the CAD drawing next time, at the moment, the user can only manually change the replacement scheme again, and the user experience degree is poor. Based on the above problem, the present embodiment further provides a memory function, and for the replacement scheme accepted by the user, the association relationship between the font files replaced with each other is set, so that when executing the replacement scheme, whether the replacement scheme accepted by the user exists is considered preferentially, if so, the replacement is performed according to the existing replacement scheme, and if not, the replacement scheme is determined by using the model. Specifically, determining 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 includes:
acquiring a first identifier of the first font file;
detecting whether a second identifier having an association relation with the first identifier is stored in the software;
if the second identifier is stored, directly determining a font file having an association relation with the second identifier from the font files which can be loaded by the software, and using the font file as the second font file;
and if the second identifier is not stored, determining a second font file for replacing the first font file from the font files which can be loaded by the software according to a preset font matching model.
Optionally, after determining, according to a preset font matching model, a second font file for replacing the first font file from the font files loadable by the software if the second identifier is not stored, the method further includes:
acquiring a second identifier of the second font file;
and setting and storing the incidence relation between the first identifier and the acquired second identifier.
In this embodiment, the font matching model may be obtained through neural network learning to improve the accuracy of the font file matching result, specifically, the neural network may be trained through the training set, and the trained model may be tested by using the testing set, and when the accuracy of the model trained by the test result representation satisfies the threshold, the trained model may be used as the font matching model. The training set and the test set respectively comprise a plurality of sample data, the sample data comprises characteristic words of a first font file sample and characteristic words of a second font file sample, and the second font file sample is used for replacing the first font file sample.
The font matching model obtained by training comprises a word embedding layer, a vector conversion layer, a full connection layer and an output layer, wherein the word embedding layer is used for converting feature words into feature vectors, the vector conversion layer is used for calculating a file vector according to all the feature vectors, the full connection layer is used for calculating the matching degree of a first font file and each font file in a font library, and the output layer is used for outputting a second font file with the highest matching degree.
Specifically, determining 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 includes:
extracting characteristic words of the first font file;
converting the feature words into feature vectors through a word embedding layer of the font matching model;
calculating a file vector of the first font file according to the characteristic vector through a vector conversion layer of the font matching model;
and determining a font file which is matched with the first font file to the highest extent from an output layer of the font matching model according to the file vector of the first font file to serve as the second font file, wherein the output layer comprises a plurality of font files which can be loaded by the software.
Determining a font file with the highest matching degree with the first font file from an output layer of the font matching model according to the file vector of the first font file, wherein the determining of the font file with the highest matching degree with the first font file as the second font file comprises:
acquiring fully connected layers in the font matching model, wherein each fully connected layer has an incidence relation with one font file in the output layer, and each fully connected layer is used for representing a file vector of a corresponding font file;
calculating the product of the file vector represented by the full connection layer and the file vector of the first font file to obtain a vector for representing the matching degree;
converting the vector for representing the matching degree into a numerical value through a softmax function to obtain a matching value for representing the matching degree;
and determining a full connection layer corresponding to the maximum matching value, and determining a font file having an association relation with the full connection layer from the output layer of the font matching model to be used as the second font file.
In this embodiment, a word segmentation technique may be used to segment the first font file, and then the feature words of the first font file are obtained by cleaning and filtering the useless word segmentation, where the feature words include the font file name. It should be noted that before the final participle is used, the common font file names (such as "yjkeng.shx", "yjkchn.shx" and "hztxt.shx") need to be entered into the participle library in advance to ensure that the common font file names are still a complete word in the participle result, so as to optimize the participle effect.
For a computer, text words cannot be directly recognized, so that the text words need to be converted into a language which can be recognized by a machine, that is, feature words are input into a word embedding layer of a font matching model, so that a feature vector of each feature word is obtained, and the feature vector can be directly recognized by the machine. Specifically, each feature word is converted into a feature word vector by using a trained word vector model (e.g. word2vec), for example, "1010011 …" represents a feature vector with dimension 1 × V by using Wi if each feature word is mapped to a feature vector with length V, where i represents the number of extracted feature words in the first font file.
The feature vectors output by the word embedding layer are received through a vector conversion layer of the font matching model, then the file vectors are calculated according to the received feature vectors, for example, the weighting summation is carried out on all the feature vectors, and then the summation result is normalized to obtain the file vector of the first font file.
The number of the full connection layers is the same as that of the font files contained in the output layer, each full connection layer represents a file vector of only one font file in the output layer, each full connection layer receives the file vector of the first font file, then the full connection layer performs product calculation on the file vector and the file vector represented by the full connection layer to obtain a vector for representing the matching degree of the first font file and the font file corresponding to the full connection layer, and then the vector calculated by each full connection layer is converted into a numerical value through a softmax function to obtain a matching value for representing the matching degree of the first font file and the font file corresponding to the full connection layer.
And finally, determining a full connection layer with the maximum matching value, screening font files having an association relation with the full connection layer from the font files contained in the output layer, and outputting the font files from the output layer as second font files.
As an optional embodiment, the replacing operation of the font file may also be executed outside the software, and the software is only responsible for loading the CAD drawing that is successfully replaced, so this embodiment may also provide a method for replacing the font file of the CAD drawing, where an execution subject of the method may be a different application program located in the same device as the software, or may be another device different from the device where the software is located, and specifically, the method includes:
determining a first font file which cannot be loaded in a current CAD drawing;
extracting characteristic words of the first font file;
converting the characteristic words into characteristic vectors through a word embedding layer of a preset font matching model;
calculating a file vector of the first font file according to the characteristic vector through a vector conversion layer of the font matching model;
determining a font file with the highest matching degree with the first font file from an output layer of the font matching model according to the file vector of the first font file to serve as a second font file, wherein the output layer comprises a plurality of font files which can be loaded by software;
and replacing the first font file of the CAD drawing with the second font file.
And step S4, loading the CAD drawing in the software according to the second font file.
In this embodiment, step S2 further determines a font file that can be loaded by software from the font files of the CAD drawing, and finally, the CAD drawing can be displayed in the software using the font file and the second font file.
Optionally, the existing two-dimensional and three-dimensional design software is used for once-only opening and importing the CAD drawings, and when a user is not satisfied with the replacement result, the existing technology cannot realize secondary replacement of the font file. In order to solve this problem, the software of this embodiment also supports a function of replacing the font file again after the CAD drawing is imported. Specifically, after the CAD drawing is loaded in the software according to the second font file, the method further includes:
determining a file type of the first font file;
screening font files belonging to the file type from the font files which can be loaded by the software;
receiving a font file replacing instruction, and determining a font file pointed by the font file replacing instruction from the screened font files as a third font file;
reloading the CAD drawing in the software according to the third font file;
acquiring a third identifier of the third font file;
setting and storing the incidence relation between the first identifier and the third identifier; and
and releasing the association relationship between the first identifier and the second identifier.
After the user replaces the second time, the software stores the replacement result of this time, namely, the association relationship between the first identifier and the third identifier is set and stored, and meanwhile, the memory of the previous replacement is cleared, namely, the association relationship between the first identifier and the second identifier is released.
The following is a detailed description of the complete implementation of the present invention with reference to fig. 3 as an embodiment. Fig. 3 is a schematic diagram illustrating a loading scheme of a CAD drawing according to an embodiment of the present invention, and as shown in fig. 3, in a process of importing a software into a CAD drawing (also referred to as a CAD file), first all font files used in the CAD drawing are determined, then which font files cannot be loaded by the software are determined from the font files of the CAD drawing and are marked as first font files, a second font file is further screened from the font files that can be loaded by the software according to a font matching model and/or a last matching result, and the CAD drawing is displayed by replacing the first font file with the second font file. Further, after the CAD drawing is successfully loaded by the software according to the second font file, the user can perform secondary replacement according to the requirement, namely manually selecting a third font file with the same file type as the first font file, and then reloading the CAD drawing according to the third font file.
The invention aims to solve the problems of font shortage and font replacement in the process of transferring CAD drawings in the field of engineering construction, and automatically matches the existing font files in software based on the font files used in the CAD drawings which are detected to be imported/opened, thereby realizing the automatic replacement and correct display of the font files. By the method, a user does not need to manually replace the font file when importing/opening the CAD drawing, and the missing font file can be updated and replaced for the second time after the CAD drawing is successfully imported.
Example two
The second embodiment of the present invention further provides a loading device for a CAD drawing, where the loading device corresponds to a part of content involved in the loading method for a CAD drawing provided in the first embodiment, and corresponding technical features and technical effects are not described in detail in this embodiment, and reference may be made to the first embodiment for relevant points. Specifically, fig. 4 shows a block diagram of a loading apparatus for a CAD drawing according to a second embodiment of the present invention. As shown in fig. 4, the loading apparatus 400 of the CAD drawing may include a first determining module 401, an identifying module 402, a second determining module 403, and a loading module 404, where:
the first determining module 401 is configured to determine a font file used in a CAD drawing when the CAD drawing is loaded by software;
an identifying module 402, configured to identify a first font file that is not loadable by the software from font files of the CAD drawing;
a second determining module 403, configured to determine, according to a preset font matching model, a second font file used for replacing the first font file from the font files that can be loaded by the software;
and a loading module 404, configured to load the CAD drawing in the software according to the second font file.
Optionally, the second determining module is specifically configured to: acquiring a first identifier of the first font file; detecting whether a second identifier having an association relation with the first identifier is stored in the software; if the second identifier is stored, directly determining a font file having an association relation with the second identifier from the font files which can be loaded by the software, and using the font file as the second font file; and if the second identifier is not stored, determining a second font file for replacing the first font file from the font files which can be loaded by the software according to a preset font matching model.
Optionally, the apparatus further comprises: a first obtaining module, configured to obtain a second identifier of a second font file after determining, according to a preset font matching model, the second font file that is used to replace the first font file from the font files that can be loaded by the software if the second identifier is not stored; and the first setting module is used for setting and storing the association relationship between the first identifier and the acquired second identifier.
Optionally, when determining, according to a preset font matching model, a second font file for replacing the first font file from the font files loadable by the software, the second determining module is specifically configured to: extracting characteristic words of the first font file; converting the feature words into feature vectors through a word embedding layer of the font matching model; calculating a file vector of the first font file according to the characteristic vector through a vector conversion layer of the font matching model; and determining a font file which is matched with the first font file to the highest extent from an output layer of the font matching model according to the file vector of the first font file to serve as the second font file, wherein the output layer comprises a plurality of font files which can be loaded by the software.
Optionally, when the font file with the highest matching degree with the first font file is determined from the output layer of the font matching model according to the file vector of the first font file, the second determining module is specifically configured to: acquiring fully connected layers in the font matching model, wherein each fully connected layer has an incidence relation with one font file in the output layer, and each fully connected layer is used for representing a file vector of a corresponding font file; calculating the product of the file vector represented by the full connection layer and the file vector of the first font file to obtain a vector for representing the matching degree; converting the vector for representing the matching degree into a numerical value through a softmax function to obtain a matching value for representing the matching degree; and determining a full connection layer corresponding to the maximum matching value, and determining a font file having an association relation with the full connection layer from the output layer of the font matching model to be used as the second font file.
Optionally, the apparatus further comprises: the first processing module is used for determining the file type of the first font file after the CAD drawing is loaded in the software according to the second font file; the screening module is used for screening the font files belonging to the file type from the font files which can be loaded by the software; the receiving module is used for receiving the font file replacing instruction, determining the font file pointed by the font file replacing instruction from the screened font files and using the font file as a third font file; and the second processing module is used for reloading the CAD drawing in the software according to the third font file.
Optionally, the apparatus further comprises: a second obtaining module, configured to obtain a third identifier of the third font file after the CAD drawing is reloaded in the software according to the third font file; the second setting module is used for setting and storing the incidence relation between the first identifier and the third identifier; and the releasing module is used for releasing the association relationship between the first identification and the second identification.
EXAMPLE III
The third embodiment of the present invention further provides a device for replacing a font file of a CAD drawing, where the device corresponds to a part of content involved in the loading method of a CAD drawing provided in the first embodiment, and corresponding technical features and technical effects are not described in detail in this embodiment, and reference may be made to the first embodiment for relevant points. Specifically, fig. 5 shows a block diagram of a font file replacing apparatus for a CAD drawing according to a third embodiment of the present invention. As shown in fig. 5, the apparatus 500 for replacing a font file of a CAD drawing may include a third determining module 501, an extracting module 502, a converting module 503, a calculating module 504, a fourth determining module 505, and a replacing module 506, wherein:
a third determining module 501, configured to determine a first font file that is not loadable in the current CAD drawing;
an extracting module 502, configured to extract a feature word of the first font file;
a conversion module 503, configured to convert the feature words into feature vectors through a word embedding layer of a preset font matching model;
a calculating module 504, configured to calculate, by using a vector conversion layer of the font matching model, a file vector of the first font file according to the feature vector;
a fourth determining module 505, configured to determine, according to the file vector of the first font file, a font file that has a highest matching degree with the first font file from an output layer of the font matching model, as a second font file, where the output layer includes a plurality of loadable font files;
a replacing module 506, configured to replace the first font file of the CAD drawing with the second font file.
Optionally, the fourth determining module is specifically configured to: acquiring fully connected layers in the font matching model, wherein each fully connected layer has an incidence relation with one font file in the output layer, and each fully connected layer is used for representing a file vector of a corresponding font file; calculating the product of the file vector represented by the full connection layer and the file vector of the first font file to obtain a vector for representing the matching degree; converting the vector for representing the matching degree into a numerical value through a softmax function to obtain a matching value for representing the matching degree; and determining a full connection layer corresponding to the maximum matching value, and determining a font file having an association relation with the full connection layer from the output layer of the font matching model to be used as the second font file.
Example four
Fig. 6 is 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 according to a fourth embodiment of the present invention. In this embodiment, the computer device 600 may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster composed of a plurality of servers), and the like that execute programs. As shown in fig. 6, the computer device 600 of the present embodiment includes at least, but is not limited to: a memory 601, a processor 602, a network interface 603, which may be communicatively coupled to each other via a system bus. It is noted that FIG. 6 only shows the computer device 600 having components 601 and 603, but it is to be understood that not all of the shown components are required and that more or fewer components may alternatively be implemented.
In this embodiment, the memory 603 includes at least one type of computer-readable storage medium, which includes flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 601 may be an internal storage unit of the computer device 600, such as a hard disk or a memory of the computer device 600. In other embodiments, the memory 601 may also be an external storage device of the computer device 600, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the computer device 600. Of course, the memory 601 may also include both internal and external storage devices for the computer device 600. In the present embodiment, the memory 601 is generally used for storing an operating system installed in the computer device 600 and various types of application software, such as program codes of a loading method of a CAD drawing and/or a font file replacement method of a CAD drawing.
Processor 602 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 602 is typically used to control the overall operation of the computer device 600. Such as performing control and processing related to data interaction or communication with the computer device 600. In this embodiment, the processor 602 is configured to execute program codes of a loading method of the CAD drawing and/or a font file replacement method of the CAD drawing stored in the memory 601.
In this embodiment, the loading method of the CAD drawing and/or the font file replacement method of the CAD drawing stored in the memory 601 may be further divided into one or more program modules and executed by one or more processors (in this embodiment, the processor 602) to complete the present invention.
The network interface 603 may comprise a wireless network interface or a wired network interface, and the network interface 603 is typically used to establish communication links between the computer device 600 and other computer devices. For example, the network interface 603 is used to connect the computer apparatus 600 to an external terminal via a network, establish a data transmission channel and a communication link between the computer apparatus 600 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth (Bluetooth), or Wi-Fi.
EXAMPLE five
The present embodiment also provides a computer-readable storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application mall, etc., on which a computer program is stored, which when executed by a processor, implements a loading method of a CAD drawing and/or a step of a font file replacement method of a CAD drawing.
It will be apparent to those skilled in the art that the modules or steps of the embodiments of the invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, embodiments of the invention are not limited to any specific combination of hardware and software.
It should be noted that the numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (12)
1. A loading method of a CAD drawing is characterized by comprising the following steps:
when the software loads the CAD drawing, determining a font file used in the CAD drawing;
identifying a first font file which 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 which 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.
2. The method according to claim 1, wherein determining a second font file from the software loadable font files for replacing the first font file according to a preset font matching model comprises:
acquiring a first identifier of the first font file;
detecting whether a second identifier having an association relation with the first identifier is stored in the software;
if the second identifier is stored, directly determining a font file having an association relation with the second identifier from the font files which can be loaded by the software, and using the font file as the second font file;
and if the second identifier is not stored, determining a second font file for replacing the first font file from the font files which can be loaded by the software according to a preset font matching model.
3. The method of claim 2, wherein after determining the second font file for replacing the first font file from the software loadable font files according to a preset font matching model if the second identifier is not stored, the method further comprises:
acquiring a second identifier of the second font file;
and setting and storing the incidence relation between the first identifier and the acquired second identifier.
4. The method according to claim 1 or 2, wherein determining a second font file from the software loadable font files for replacing the first font file according to a preset font matching model comprises:
extracting characteristic words of the first font file;
converting the feature words into feature vectors through a word embedding layer of the font matching model;
calculating a file vector of the first font file according to the characteristic vector through a vector conversion layer of the font matching model;
and determining a font file which is matched with the first font file to the highest extent from an output layer of the font matching model according to the file vector of the first font file to serve as the second font file, wherein the output layer comprises a plurality of font files which can be loaded by the software.
5. The method according to claim 4, wherein the determining the font file which matches the first font file most from the output layer of the font matching model according to the file vector of the first font file as the second font file comprises:
acquiring fully connected layers in the font matching model, wherein each fully connected layer has an incidence relation with one font file in the output layer, and each fully connected layer is used for representing a file vector of a corresponding font file;
calculating the product of the file vector represented by the full connection layer and the file vector of the first font file to obtain a vector for representing the matching degree;
converting the vector for representing the matching degree into a numerical value through a softmax function to obtain a matching value for representing the matching degree;
and determining a full connection layer corresponding to the maximum matching value, and determining a font file having an association relation with the full connection layer from the output layer of the font matching model to be used as the second font file.
6. The method of claim 2, wherein after the loading of the CAD drawing from the second font file in the software, the method further comprises:
determining a file type of the first font file;
screening font files belonging to the file type from the font files which can be loaded by the software;
receiving a font file replacing instruction, and determining a font file pointed by the font file replacing instruction from the screened font files as a third font file;
and reloading the CAD drawing in the software according to the third font file.
7. The method of claim 6, wherein after reloading the CAD drawing from the third font file in the software, the method further comprises:
acquiring a third identifier of the third font file;
setting and storing the incidence relation between the first identifier and the third identifier; and
and releasing the association relationship between the first identifier and the second identifier.
8. A method for replacing a font file of a CAD drawing is characterized by comprising the following steps:
determining a first font file which cannot be loaded in a current CAD drawing;
extracting characteristic words of the first font file;
converting the characteristic words into characteristic vectors through a word embedding layer of a preset font matching model;
calculating a file vector of the first font file according to the characteristic vector through a vector conversion layer of the font matching model;
determining a font file with the highest matching degree with the first font file from an output layer of the font matching model according to the file vector of the first font file to serve as a second font file, wherein the output layer comprises a plurality of loadable font files;
and replacing the first font file of the CAD drawing with the second font file.
9. A loading device for CAD drawings, characterized in that the device comprises:
the system comprises a first determining module, a second determining module and a display module, wherein the first determining module is used for determining a font file used in a CAD drawing when the CAD drawing is loaded by software;
the identification module is used for identifying a first font file which cannot be loaded by the software from the font files of the CAD drawing;
the second determining module is used for determining a second font file for replacing the first font file from the font files which can be loaded by the software according to a preset font matching model;
and the loading module is used for loading the CAD drawing in the software according to the second font file.
10. A font file replacing apparatus for a CAD drawing, comprising:
the third determining module is used for determining the first font file which cannot be loaded in the current CAD drawing;
the extracting module is used for extracting the characteristic words of the first font file;
the conversion module is used for converting the characteristic words into characteristic vectors through a word embedding layer of a preset font matching model;
the calculation module is used for calculating a file vector of the first font file according to the characteristic vector through a vector conversion layer of the font matching model;
a fourth determining module, configured to determine, according to the file vector of the first font file, a font file that has a highest matching degree with the first font file from an output layer of the font matching model, as a second font file, where the output layer includes a plurality of loadable font files;
and the replacing module is used for replacing the first font file of the CAD drawing with the second font file.
11. A computer device, the computer device comprising: memory, processor and computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of claims 1 to 7 and/or the method of claim 8 when executing the computer program.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1 to 7 and/or the method of claim 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111156858.3A CN113886906A (en) | 2021-09-30 | 2021-09-30 | CAD drawing loading method, font file replacing method, device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111156858.3A CN113886906A (en) | 2021-09-30 | 2021-09-30 | CAD drawing loading method, font file replacing method, device and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113886906A true CN113886906A (en) | 2022-01-04 |
Family
ID=79004540
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111156858.3A Pending CN113886906A (en) | 2021-09-30 | 2021-09-30 | CAD drawing loading method, font file replacing method, device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113886906A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115809494A (en) * | 2023-01-30 | 2023-03-17 | 中交第四航务工程勘察设计院有限公司 | Shared primitive community management method, system and medium based on CAD primitives |
-
2021
- 2021-09-30 CN CN202111156858.3A patent/CN113886906A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115809494A (en) * | 2023-01-30 | 2023-03-17 | 中交第四航务工程勘察设计院有限公司 | Shared primitive community management method, system and medium based on CAD primitives |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111401609B (en) | Prediction method and prediction device for traffic flow time series | |
CN109710528B (en) | Test script generation method, device, equipment and medium | |
CN109388675A (en) | Data analysing method, device, computer equipment and storage medium | |
CN111159982B (en) | Document editing method, device, electronic equipment and computer readable storage medium | |
CN111340054A (en) | Data labeling method and device and data processing equipment | |
CN113901647B (en) | Part technical specification compiling method and device, storage medium and electronic equipment | |
CN110928802A (en) | Test method, device, equipment and storage medium based on automatic generation of case | |
CN113448862B (en) | Software version testing method and device and computer equipment | |
CN112100359B (en) | Test case searching method, device, equipment and storage medium | |
CN107316156B (en) | Data processing method, device, server and storage medium | |
CN110362479B (en) | System upgrade test method and system | |
CN106294480A (en) | A kind of file layout change-over method, device and examination question import system | |
CN113157315A (en) | Method, device, equipment and medium for identifying difference information of different versions of software | |
CN112989043A (en) | Reference resolution method and device, electronic equipment and readable storage medium | |
CN115576828A (en) | Test case generation method, device, equipment and storage medium | |
CN113886906A (en) | CAD drawing loading method, font file replacing method, device and storage medium | |
CN111832254B (en) | Drawing annotation display processing method and device | |
CN107766228B (en) | Multi-language-based automatic testing method and device | |
CN117556796A (en) | Project document processing method, device, computer equipment and storage medium | |
CN113642642B (en) | Control identification method and device | |
CN111274128A (en) | Test method, test device, computer equipment and computer readable storage medium | |
CN115309706A (en) | Method, device, equipment, medium and product for updating multi-language configuration file | |
CN114169306A (en) | Method, device and equipment for generating electronic receipt and readable storage medium | |
CN112667874A (en) | Webpage data extraction method and device, electronic equipment and storage medium | |
CN111400245A (en) | Art resource migration method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |