CN112966318B - Method for displaying characters in CAD file and terminal equipment - Google Patents

Method for displaying characters in CAD file and terminal equipment Download PDF

Info

Publication number
CN112966318B
CN112966318B CN202110389861.3A CN202110389861A CN112966318B CN 112966318 B CN112966318 B CN 112966318B CN 202110389861 A CN202110389861 A CN 202110389861A CN 112966318 B CN112966318 B CN 112966318B
Authority
CN
China
Prior art keywords
line segment
character
segment array
cad file
file
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.)
Active
Application number
CN202110389861.3A
Other languages
Chinese (zh)
Other versions
CN112966318A (en
Inventor
陈永宏
张超
胡定贵
雷澍
尹华承
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingju Technology Co ltd
Original Assignee
Qingju Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Qingju Technology Co ltd filed Critical Qingju Technology Co ltd
Priority to CN202110389861.3A priority Critical patent/CN112966318B/en
Publication of CN112966318A publication Critical patent/CN112966318A/en
Application granted granted Critical
Publication of CN112966318B publication Critical patent/CN112966318B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/10Geometric CAD
    • G06F30/12Geometric CAD characterised by design entry means specially adapted for CAD, e.g. graphical user interfaces [GUI] specially adapted for CAD
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text

Abstract

The embodiment of the invention provides a method for displaying characters in a CAD file and terminal equipment, and relates to the field of display of CAD drawings. The method comprises the following steps: loading an SHX file according to indication information in the CAD file, wherein the indication information is used for indicating the position of the SHX file in the CAD file; reading a first broken line segment array of each character in the CAD file according to the header information of the SHX file, wherein the header information is used for indicating the position of the first broken line segment array of each character in the CAD file in the SHX file; normalizing the first broken line segment array of each character to obtain a second broken line segment array of each character; converting the second fold line segment array of each character into a third fold line segment array according to the attribute information of each character; and displaying the characters in the CAD file based on the third fold line segment array of each character, wherein the characters are used for displaying the characters in the CAD file in a browser.

Description

Method for displaying characters in CAD file and terminal equipment
Technical Field
The invention relates to the field of display of CAD drawings, in particular to a method and terminal equipment for displaying characters in a CAD file.
Background
CAD systems have very powerful functions and are widely used in the fields of engineering drawing, garment processing design, electronic industry, etc., for example, in decorative design, drawing of precision parts, design of printed circuit boards, etc. A complete CAD file contains the necessary textual description in addition to the graphics.
In the prior art, text fonts in CAD files generally adopt SHX formats, drawings drawn by CAD generally require CAD software to be installed on terminal equipment to display text information of the complete drawings, but when a user needs to directly open a CAD file by a browser, the text information cannot be directly displayed at a proper position according to the original SHX file at a proper text height, a proper rotation angle and the like.
Disclosure of Invention
In view of the above, the present invention provides a method for displaying characters in a CAD file and a terminal device, which are used to solve the problem that when the CAD file is opened through a browser, the characters in the CAD file cannot be directly displayed at a proper position with a proper text height, a proper rotation angle, and the like.
In order to achieve the above purpose, the technical solutions provided by the embodiments of the present invention are as follows:
in a first aspect, an embodiment of the present invention provides a method for displaying characters in a CAD file, where the method includes:
loading an SHX file according to indication information in a CAD file, wherein the indication information is used for indicating the position of the SHX file in the CAD file;
reading a first broken line segment array of each character in the CAD file according to the header information of the SHX file, wherein the header information is used for indicating the position of the first broken line segment array of each character in the CAD file in the SHX file;
normalizing the first broken line segment array of each character to obtain a second broken line segment array of each character;
converting the second fold line segment array of each character into a third fold line segment array according to the attribute information of each character;
and displaying the characters in the CAD file based on the third fold line segment array of each character.
As an optional implementation manner of the embodiment of the present invention, the normalizing the first group of polyline segments of each character to obtain the second group of polyline segments of each character includes:
drawing a first circumscribed rectangle of the first broken line segment array of each character;
and carrying out first preset operation on the first external rectangle to obtain a second external rectangle, wherein the vertex of the lower left corner of the second external rectangle is superposed with the origin of coordinates of the rectangular plane coordinate system, and the ordinate of the vertex of the upper right corner of the second external rectangle is 1.
Acquiring the second broken line segment array according to the second external rectangle;
and the second external rectangle is an external rectangle of the second broken line segment array.
As an optional implementation manner of the embodiment of the present invention, the first preset operation includes: at least one of a panning operation and a zooming operation.
As an optional implementation manner of the embodiment of the present invention, the converting the second fold line segment array into a third fold line segment array according to the attribute information of each character includes:
performing second preset operation on a second external rectangle of the second broken line segment array according to the attribute information of each character to obtain a third external rectangle;
and acquiring the third broken line segment array according to the third external rectangle, wherein the third external rectangle is the external rectangle of the third broken line segment array.
As an optional implementation manner of the embodiment of the present invention, the attribute information of the character includes:
at least one of a text height, a rotation angle, an alignment type, and a stretching direction of the character.
As an optional implementation manner of the embodiment of the present invention, the second preset operation includes: at least one of a rotation operation, a zoom operation, and a translation operation.
As an optional implementation manner of the embodiment of the present invention, the displaying characters in the CAD file based on the third fold line segment array includes:
determining a corresponding relation between a third fold line segment array and the character according to a mapping relation between the character and the first fold line segment array, wherein the third fold line segment array is a normalized and converted fold line segment array of the first fold line segment array;
and displaying characters corresponding to the third fold line segment array according to the corresponding relation.
In a second aspect, an embodiment of the present invention provides a terminal device, including:
the loading module is used for loading an SHX file according to indication information in the CAD file, wherein the indication information is used for indicating the position of the SHX file in the CAD file;
the reading module is used for reading a first broken line segment array of each character in the CAD file according to the header information of the SHX file, wherein the header information is used for indicating the position of the first broken line segment array of each character in the CAD file in the SHX file;
the processing module is used for normalizing the first broken line segment array of each character to obtain a second broken line segment array of each character;
the conversion module is used for converting the second fold line segment array of each character into a third fold line segment array according to the attribute information of each character;
and the display module is used for displaying the characters in the CAD file based on the third fold line segment array of each character.
As an optional implementation manner of the embodiment of the present invention, the processing module is specifically configured to draw a first circumscribed rectangle of a first polyline segment array of each character; performing a first preset operation on the first external rectangle to obtain a second external rectangle, wherein the vertex of the lower left corner of the second external rectangle is overlapped with the origin of coordinates of the rectangular plane coordinate system, and the ordinate of the vertex of the upper right corner of the second external rectangle is 1; acquiring the second broken line segment array according to the second external rectangle; and the second external rectangle is an external rectangle of the second broken line segment array.
As an optional implementation manner of the embodiment of the present invention, the first preset operation includes: at least one of a panning operation and a zooming operation.
As an optional implementation manner of the embodiment of the present invention, the conversion module is specifically configured to perform a second preset operation on a second circumscribed rectangle of the second polyline segment array according to attribute information of each character, so as to obtain a third circumscribed rectangle; and acquiring the third broken line segment array according to the third external rectangle, wherein the third external rectangle is the external rectangle of the third broken line segment array.
As an optional implementation manner of the embodiment of the present invention, the attribute information of the character includes: at least one of a text height, a rotation angle, an alignment type, and a stretching direction of the character.
As an optional implementation manner of the embodiment of the present invention, the second preset operation includes: at least one of rotation, zoom, and translation operations.
As an optional implementation manner of the embodiment of the present invention, the display module is specifically configured to determine a corresponding relationship between the third fold line segment array and the character according to a mapping relationship between the character and the first fold line segment array, where the third fold line segment array is a normalized and converted fold line segment array of the first fold line segment array; and displaying characters corresponding to the third fold line segment array according to the corresponding relation.
In a third aspect, an embodiment of the present invention provides an electronic device, including: a memory for storing a computer program and a processor; the processor is configured to execute the steps of the method for displaying characters in a CAD file according to the first aspect or any of the alternative embodiments of the first aspect when the computer program is called.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the method for displaying characters in a CAD file according to the first aspect or any one of the optional embodiments of the first aspect.
The method for displaying the characters in the CAD file, provided by the embodiment of the invention, comprises the steps of loading an SHX file according to indication information in the CAD file, wherein the indication information is used for indicating the position of the SHX file in the CAD file, reading a first broken line segment array of each character in the CAD file according to head information of the SHX file, normalizing the first broken line segment array of each character to obtain a second broken line segment array of each character, converting the second broken line segment array of each character into a third broken line segment array according to attribute information of each character, and finally displaying the characters in the CAD file based on the third broken line segment array of each character. According to the embodiment of the invention, after the first broken line segment array of each character in the CAD file is read, the first broken line segment array of each character is firstly subjected to normalization processing to obtain the corresponding second broken line segment array, and the second broken line segment array corresponding to each character is limited in the same threshold range, so that the conversion operation from the second broken line segment array to the third broken line segment array can be simplified.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a flowchart illustrating steps of a method for displaying characters in a CAD file according to an embodiment of the present invention;
FIG. 2 is a second flowchart illustrating steps of a method for displaying characters in a CAD file according to an embodiment of the present invention;
FIG. 3 is a block diagram of an apparatus for displaying characters in a CAD file according to another embodiment of the present invention;
fig. 4 is an internal structural diagram of an electronic device in an embodiment of the present invention.
Detailed Description
In order that the above objects, features and advantages of the present invention may be more clearly understood, a solution of the present invention will be further described below. It should be noted that the embodiments and features of the embodiments of the present invention may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, but the present invention may be practiced in other ways than those described herein; it is to be understood that the embodiments described in this specification are only some embodiments of the invention, and not all embodiments.
The terms "first" and "second," and the like, in the description and in the claims of the present invention are used for distinguishing between synchronized objects, and are not used to describe a particular order of objects. For example, the first and second arrays of polyline segments are used to distinguish between different arrays of polyline segments, rather than to describe a particular order of the arrays of polyline segments.
In the embodiments of the present invention, words such as "exemplary" or "for example" are used to mean serving as examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "e.g.," an embodiment of the present invention is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present relevant concepts in a concrete fashion.
The execution main body of the method for displaying the characters in the CAD file provided by the embodiment of the present invention may be a browser or a server, and is not limited thereto.
An embodiment of the present invention provides a method for displaying characters in a CAD file, and as shown in fig. 1, the method includes the following steps S101 to S105:
and S101, loading the SHX file according to the indication information in the CAD file.
Wherein the indication information is used for indicating the position of the SHX file in the CAD file.
A CAD file is composed of many primitives, for example, TEXT information is stored in a TEXT primitive, TEXT information is stored in a MTEXT primitive, and TEXT information is also stored in primitives such as ATTRIB and dim, and these primitives also contain attribute information such as TEXT height, rotation angle, alignment type, stretching direction, and the like, in addition to the TEXT.
Specifically, the indication information in the embodiment of the present invention may be a sty group code in a tabes section in a CAD file, when loading the CAD file, a corresponding SHX file is loaded according to the sty group code in the tabes section, the SHX file is a font file encoded by a series of character description words and special codes, the shape description words include pen motion vector lengths and direction codes and are composed of 16 directions, the special codes are divided into end of table pen, pen drop, type definition, and the like, and the code specifies the pen motion vector lengths and the direction codes to form a character.
S102, reading a first broken line segment array of each character in the CAD file according to the header information of the SHX file.
The header information is used for indicating the position of a first polyline segment array of each character in the CAD file in the SHX file;
specifically, the SHX file is a font file in the CAD file, the font file may be divided into two parts, the first part stores header information, the second part stores geometric information of the character, the position of the geometric information of the character may be located by the header information, and the geometric information of the character is a set of polyline segments corresponding to the character, that is, a polyline segment array. It should be noted that the drawing of the polyline segments can be decomposed into the following actions: pen down (start drawing), pen up (end drawing), move and draw circular arcs.
Illustratively, for a character, once a stroke is dropped means the beginning of a polyline segment, and once a stroke is written means the end of a polyline segment, so that a character comprises at least one polyline segment, e.g., the character "one" comprises one polyline segment, the character "two" comprises two polyline segments, and the set of the two polyline segments is the polyline segment array of the character "two". After the pen is dropped, the pen can move for a plurality of times, including moving along a straight line on a plane coordinate system, moving on a section of circular arc, or moving on a curve with convexity. It is to be understood that moving over a segment of a circular arc as described herein may also be understood as drawing a circular arc, the arc of which is typically an integer multiple of pi/4.
S103, normalizing the first broken line segment array of each character to obtain a second broken line segment array of each character.
The embodiment of the present invention does not limit the normalization method of the first fold line segment group, and each character has a corresponding fold line segment group, so that there is a mapping relationship between the character in the CAD file and the first fold line segment group, and the first fold line segment group is normalized, thereby facilitating the execution of the following step S104.
And S104, converting the second fold line segment array of each character into a third fold line segment array according to the attribute information of each character.
Optionally, the attribute information of the character includes: at least one of a text height, a rotation angle, an alignment type, and a stretching direction of the character.
Specifically, the attribute information such as the text height, the rotation angle, the alignment type, and the stretching direction described herein is actual information displayed in the browser by the CAD file, and the text height of the character displayed in the browser and the displayed figure are obtained by scaling the character and the figure in the original CAD file in the same ratio, that is, the attribute information such as the text height, the rotation angle, the alignment type, and the stretching direction of the character is kept unchanged with respect to the displayed figure.
And S105, displaying the characters in the CAD file based on the third fold line segment array of each character.
Optionally, step S105 includes:
step a, determining the corresponding relation between the third fold line segment array and the character according to the mapping relation between the character and the first fold line segment array.
And the third broken line segment array is the broken line segment array of the first broken line segment array after normalization and conversion.
The mapping relation between each character in the CAD file and the first fold line segment array is stored in the SHX file, and the third fold line segment array is obtained after the corresponding first fold line segment array is normalized and converted, so that the corresponding relation between the third fold line segment array and each character can be determined.
And b, displaying the characters corresponding to the third fold line segment array according to the corresponding relation.
And the third broken line segment array of each character is the broken line segment array corresponding to the characters in the CAD file displayed in the browser.
The method for displaying the characters in the CAD file, provided by the embodiment of the invention, comprises the steps of loading an SHX file according to indication information in the CAD file, wherein the indication information is used for indicating the position of the SHX file in the CAD file, reading a first broken line segment array of each character in the CAD file according to head information of the SHX file, normalizing the first broken line segment array of each character to obtain a second broken line segment array of each character, converting the second broken line segment array of each character into a third broken line segment array according to attribute information of each character, and finally displaying the characters in the CAD file based on the third broken line segment array of each character. According to the embodiment of the invention, after the first broken line segment array of each character in the CAD file is read, the first broken line segment array of each character is firstly subjected to normalization processing to obtain the corresponding second broken line segment array, and the second broken line segment array corresponding to each character is limited in the same threshold range, so that the conversion operation from the second broken line segment array to the third broken line segment array can be simplified.
Optionally, after steps S101 to S102 are executed, as shown in fig. 2, step S103 (normalizing the first group of polyline segments of each character to obtain the second group of polyline segments of each character) includes:
and S1031, drawing a first circumscribed rectangle of the first broken line segment array of each character.
Specifically, the size of the characters in the CAD file may be different, and the positions of the characters in the CAD file are also different, so that the first circumscribed rectangles of the drawn polygonal line segment array have different sizes and are located at different positions of the rectangular plane coordinate system, and the operation as in S1032 is performed on each obtained first circumscribed rectangle.
S1032, performing first preset operation on the first external rectangle to obtain a second external rectangle.
And the vertex of the lower left corner of the second external rectangle coincides with the origin of coordinates of the planar rectangular coordinate system, and the ordinate of the vertex of the upper right corner of the second external rectangle is 1.
Optionally, the first preset operation includes: at least one of a panning operation and a zooming operation.
Specifically, the opposite sides (length or width) of each first external rectangle are parallel to or perpendicular to the coordinate axes of the planar rectangular coordinate system, if the vertex of the lower left corner of the first external rectangle is coincident with the origin of the planar rectangular coordinate system, translation is not performed, the first preset operation comprises a zooming operation, and only the first external rectangle needs to be zoomed until the vertical coordinate of the vertex of the upper right corner is 1; if the vertex of the lower left corner of each first external rectangle is not coincident with the origin of the planar rectangular coordinate system, each first external rectangle is translated until the vertex of the lower left corner of each first external rectangle is coincident with the origin of the planar rectangular coordinate system, then scaling is performed until the vertical coordinate of the vertex of the upper right corner of each first external rectangle is 1, the horizontal coordinates are scaled in the same proportion to obtain a second external rectangle, and the second external rectangles obtained after the first external rectangles with the same shape and size are subjected to first preset operation are necessarily coincident in the planar rectangular coordinate system.
And S1033, acquiring the second polyline segment array according to the second external rectangle.
And the second external rectangle is an external rectangle of the second broken line segment array.
And correspondingly, all points of the corresponding first broken line segment array are also moved in the same direction and distance as the second external rectangle, and all broken line segments contained in the first broken line segment array are also zoomed according to the same proportion to obtain a second broken line segment array. The normalization of the first broken line segment array is realized by translating and scaling the circumscribed rectangle of the first broken line segment array, so that the calculation and the operation are simplified.
Optionally, the step S104 (converting the second fold line segment array into a third fold line segment array according to the attribute information of each character) may include: steps S1041 to S1042, as shown in fig. 2, continue to execute step S1041 after step S1033 is executed.
And S1041, performing a second preset operation on the second circumscribed rectangle of the second polyline segment array according to the attribute information of each character to obtain a third circumscribed rectangle.
Optionally, the second preset operation includes: at least one of a rotation operation, a zoom operation, and a translation operation.
Specifically, if the characters in the CAD file displayed in the browser are horizontally placed, the second circumscribed rectangle is scaled according to the actual text height of the characters to be displayed in the browser until the actual text height is met, if the characters in the CAD file displayed in the browser have a rotation angle, the second circumscribed rectangle is rotated first, then scaled, and finally translated according to the actual position, so that a third circumscribed rectangle is obtained.
S1042, obtaining the third fold line segment array according to the third external rectangle.
And the third external rectangle is an external rectangle of the third fold line segment array.
Specifically, according to the obtained third circumscribed rectangle, the same rotation operation, zoom operation and translation operation are performed on the polygonal line segments included in the corresponding second polygonal line segment array, so that a corresponding third polygonal line segment array is obtained. The conversion operation of the broken line segments is realized through the conversion operation of the external rectangles, and the conversion process is simplified.
It should be noted that, in addition to the normalization and conversion of the array of polygonal line segments by drawing the circumscribed rectangle provided in the embodiment of the present invention, the normalization and conversion of the array of polygonal line segments may also be performed by determining the translation distance and rotation angle of the polygonal line segments in a calculation manner.
Based on the same inventive concept, as an implementation of the foregoing method, an embodiment of the present invention further provides a terminal device, where the terminal device embodiment corresponds to the foregoing method embodiment, and for convenience of reading, details in the foregoing method embodiment are not repeated in this apparatus embodiment one by one, but it should be clear that the terminal device in this embodiment can correspondingly implement all the contents in the foregoing method embodiment.
Fig. 3 is a schematic structural diagram of an apparatus for displaying characters in a CAD file according to an embodiment of the present invention, and as shown in fig. 3, an apparatus 300 according to this embodiment includes:
a loading module 301, configured to load an SHX file according to indication information in a CAD file, where the indication information is used to indicate a position of the SHX file in the CAD file;
a reading module 302, configured to read a first polyline segment array of each character in the CAD file according to header information of the SHX file, where the header information is used to indicate a position of the first polyline segment array of each character in the CAD file in the SHX file;
the processing module 303 is configured to normalize the first broken line segment array of each character to obtain a second broken line segment array of each character;
the conversion module 304 is configured to convert the second fold line segment array of each character into a third fold line segment array according to the attribute information of each character;
a display module 305, configured to display the characters in the CAD file based on the third fold line segment array of each character.
As an optional implementation manner of the embodiment of the present invention, the processing module 303 is specifically configured to draw a first circumscribed rectangle of the first polyline line segment array of each character; performing a first preset operation on the first external rectangle to obtain a second external rectangle, wherein the vertex of the lower left corner of the second external rectangle is overlapped with the origin of coordinates of the rectangular plane coordinate system, and the ordinate of the vertex of the upper right corner of the second external rectangle is 1; and acquiring the second broken line segment array according to the second external rectangle.
And the second external rectangle is an external rectangle of the second broken line segment array.
As an optional implementation manner of the embodiment of the present invention, the first preset operation includes: at least one of a panning operation and a zooming operation.
As an optional implementation manner of the embodiment of the present invention, the conversion module 204 is specifically configured to perform a second preset operation on a second external rectangle of the second polyline segment array according to attribute information of each character, so as to obtain a third external rectangle; and acquiring the third broken line segment array according to the third external rectangle, wherein the third external rectangle is the external rectangle of the third broken line segment array.
As an optional implementation manner of the embodiment of the present invention, the attribute information of the character includes: at least one of a text height, a rotation angle, an alignment type, and a stretching direction of the character.
As an optional implementation manner of the embodiment of the present invention, the second preset operation includes: at least one of a rotation operation, a zoom operation, and a translation operation.
As an optional implementation manner of the embodiment of the present invention, the display module 205 is specifically configured to determine a corresponding relationship between the third folding line segment array and the character according to a mapping relationship between the character and the first folding line segment array, where the third folding line segment array is a folding line segment array obtained by normalizing and converting the first folding line segment array; and displaying characters corresponding to the third fold line segment array according to the corresponding relation.
The apparatus for displaying characters in a CAD file provided in this embodiment may execute the method for displaying characters in a CAD file provided in the above method embodiment, and the implementation principle and the technical effect are similar, and are not described herein again.
Based on the same inventive concept, the embodiment of the invention also provides electronic equipment. Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 4, the electronic device according to the embodiment includes: a memory 401 and a processor 402, the memory 401 being for storing computer programs; the processor 402 is configured to execute the steps of the method for displaying characters in a CAD file provided by the above-described method embodiments when the computer program is called.
The processor 402 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, and performs various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 401 and calling data stored in the memory 401, thereby performing overall monitoring of the electronic device. Processor 402 may include one or more processing units.
In addition, it should be understood that the electronic device provided by the embodiment of the present invention may further include: the device comprises a radio frequency unit, a network module, an audio output unit, a receiving unit, a sensor, a display unit, a user receiving unit, an interface unit, a power supply and the like. It will be appreciated by those skilled in the art that the above-described configuration of the electronic device does not constitute a limitation of the electronic device, and that the electronic device may include more or fewer components, or some components may be combined, or a different arrangement of components. In the embodiment of the present invention, the electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted terminal, a wearable device, a pedometer, and the like.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements the method for displaying characters in a CAD file provided in the foregoing method embodiment.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media having computer-usable program code embodied in the medium.
Computer readable media includes both permanent and non-permanent, removable and non-removable storage media. Storage media may implement an information store by any method or technology, and the information may be computer-readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include transitory computer readable media (transmyedia) such as modulated data signals and carrier waves.
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 identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (9)

1. A method of displaying characters in a CAD file, the method comprising:
loading an SHX file according to indication information in a CAD file, wherein the indication information is used for indicating the position of the SHX file in the CAD file;
reading a first broken line segment array of each character in the CAD file according to the header information of the SHX file, wherein the header information is used for indicating the position of the first broken line segment array of each character in the CAD file in the SHX file;
normalizing the first broken line segment array of each character to obtain a second broken line segment array of each character;
converting the second fold line segment array of each character into a third fold line segment array according to the attribute information of each character;
displaying characters in the CAD file based on a third fold line segment array of each character;
the text height, the rotation angle, the alignment type and the stretching direction of the characters in the CAD file displayed based on the third fold line segment array of each character are kept unchanged relative to the displayed graph, and the text height, the rotation angle, the alignment type and the stretching direction are actual information displayed in a browser by the characters in the CAD file.
2. The method of claim 1, wherein normalizing the first set of polyline segments for each character to obtain a second set of polyline segments for each character comprises:
drawing a first circumscribed rectangle of the first broken line segment array of each character;
performing a first preset operation on the first external rectangle to obtain a second external rectangle, wherein the vertex of the lower left corner of the second external rectangle is overlapped with the origin of coordinates of the rectangular plane coordinate system, and the ordinate of the vertex of the upper right corner of the second external rectangle is 1;
acquiring the second broken line segment array according to the second external rectangle;
and the second external rectangle is an external rectangle of the second broken line segment array.
3. The method of claim 2,
the first preset operation includes: at least one of a panning operation and a zooming operation.
4. The method of claim 1, wherein converting the second array of fold line segments into a third array of fold line segments according to attribute information of each character comprises:
performing second preset operation on a second external rectangle of the second broken line segment array according to the attribute information of each character to obtain a third external rectangle;
and acquiring the third broken line segment array according to the third external rectangle, wherein the third external rectangle is the external rectangle of the third broken line segment array.
5. The method of claim 4,
the second preset operation includes: at least one of a rotation operation, a zoom operation, and a translation operation.
6. The method of claim 1, wherein the displaying characters in the CAD file based on the third array of fold line segments comprises:
determining a corresponding relation between a third fold line segment array and the character according to a mapping relation between the character and the first fold line segment array, wherein the third fold line segment array is a normalized and converted fold line segment array of the first fold line segment array;
and displaying characters corresponding to the third fold line segment array according to the corresponding relation.
7. A terminal device, comprising:
the loading module is used for loading an SHX file according to indication information in the CAD file, wherein the indication information is used for indicating the position of the SHX file in the CAD file;
the reading module is used for reading a first broken line segment array of each character in the CAD file according to the header information of the SHX file, wherein the header information is used for indicating the position of the first broken line segment array of each character in the CAD file in the SHX file;
the processing module is used for normalizing the first broken line segment array of each character to obtain a second broken line segment array of each character;
the conversion module is used for converting the second fold line segment array of each character into a third fold line segment array according to the attribute information of each character;
the display module is used for displaying the characters in the CAD file based on the third fold line segment array of each character;
the text height, the rotation angle, the alignment type and the stretching direction of the characters in the CAD file displayed based on the third fold line segment array of each character are kept unchanged relative to the displayed graph, and the text height, the rotation angle, the alignment type and the stretching direction are actual information displayed in a browser by the characters in the CAD file.
8. An electronic device, comprising: a memory for storing a computer program and a processor; the processor is adapted to perform the steps of the method of displaying characters in a CAD file as claimed in any of the claims 1-6 when invoking the computer program.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of displaying characters in a CAD file according to any of claims 1 to 6.
CN202110389861.3A 2021-04-12 2021-04-12 Method for displaying characters in CAD file and terminal equipment Active CN112966318B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110389861.3A CN112966318B (en) 2021-04-12 2021-04-12 Method for displaying characters in CAD file and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110389861.3A CN112966318B (en) 2021-04-12 2021-04-12 Method for displaying characters in CAD file and terminal equipment

Publications (2)

Publication Number Publication Date
CN112966318A CN112966318A (en) 2021-06-15
CN112966318B true CN112966318B (en) 2022-06-10

Family

ID=76279844

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110389861.3A Active CN112966318B (en) 2021-04-12 2021-04-12 Method for displaying characters in CAD file and terminal equipment

Country Status (1)

Country Link
CN (1) CN112966318B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114596389B (en) * 2022-05-10 2022-07-08 中国人民解放军海军工程大学 Large-batch text label drawing method based on OpenGL instantiation technology

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1270345A (en) * 1999-04-08 2000-10-18 英业达股份有限公司 Control method for displaying different literal formats in literal archives
JP2005182660A (en) * 2003-12-22 2005-07-07 Matsushita Electric Works Ltd Recognition method of character/figure
CN110110258A (en) * 2018-02-01 2019-08-09 阿里巴巴集团控股有限公司 A kind of method, apparatus and electronic equipment of text conversion

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102982119B (en) * 2012-11-12 2015-12-09 上海够快网络科技有限公司 A kind of edit methods at line file
KR101791930B1 (en) * 2016-09-23 2017-10-31 (주)신성이노테크 Character Input Apparatus
CN106503732B (en) * 2016-10-13 2019-07-19 北京云江科技有限公司 The classification method and categorizing system of text image and non-textual image
CN108763879A (en) * 2018-05-30 2018-11-06 北京溯斐科技有限公司 A kind of automatic generation method and device of watermark character library
CN110717492B (en) * 2019-10-16 2022-06-21 电子科技大学 Method for correcting direction of character string in drawing based on joint features
CN110942128B (en) * 2019-12-06 2022-03-29 中铁第四勘察设计院集团有限公司 Method and system for drawing two-dimensional code based on AutoCAD
CN111242126A (en) * 2020-01-15 2020-06-05 上海眼控科技股份有限公司 Irregular text correction method and device, computer equipment and storage medium
CN111553344B (en) * 2020-04-17 2023-05-12 携程旅游信息技术(上海)有限公司 Inclination correction method, system, device and storage medium for text image
CN111814801B (en) * 2020-08-25 2022-03-15 电子科技大学 Method for extracting labeled strings in mechanical diagram
CN112199615A (en) * 2020-09-28 2021-01-08 长江精工钢结构(集团)股份有限公司 WebGL technology-based method for drawing large amount of two-dimensional characters on webpage end

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1270345A (en) * 1999-04-08 2000-10-18 英业达股份有限公司 Control method for displaying different literal formats in literal archives
JP2005182660A (en) * 2003-12-22 2005-07-07 Matsushita Electric Works Ltd Recognition method of character/figure
CN110110258A (en) * 2018-02-01 2019-08-09 阿里巴巴集团控股有限公司 A kind of method, apparatus and electronic equipment of text conversion

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
Yan Wan等.Research on Scene Chinese Character Recognition Method Based on Similar Chinese Characters.《2020 2nd International Conference on Machine Learning, Big Data and Business Intelligence (MLBDBI)》.2021,459-463. *
万鹏等.基于Web的设计更改管理信息系统的研究与实现.《科技情报开发与经济》.2005,(第05期), *
张凯兵等.手写字符样本自动采集研究.《西华大学学报(自然科学版)》.2004, *
陈飞等.高速绘制中文字的输入方法的设计与实现.《计算机工程与应用》.2011,(第03期), *

Also Published As

Publication number Publication date
CN112966318A (en) 2021-06-15

Similar Documents

Publication Publication Date Title
TWI715814B (en) Image generation method and equipment
CN111433762A (en) Graphically organizing content in a user interface of a software application
US20230068025A1 (en) Method and apparatus for generating road annotation, device and storage medium
CN112966318B (en) Method for displaying characters in CAD file and terminal equipment
US20220121307A1 (en) Method and device of drawing handwriting track, electronic apparatus, medium, and program product
US20220392242A1 (en) Method for training text positioning model and method for text positioning
US20160232151A1 (en) Responsive course design system and method
CN107038199B (en) Drawing method and device
CN113741763A (en) Electronic book display method and device and electronic equipment
CN110705213B (en) PDF table extraction method, device, terminal and computer readable storage medium
CN106776994B (en) Application method and system of engineering symbols in engineering report forms and web pages
CN107193815B (en) Page code processing method, device and equipment
US20230175858A1 (en) Three-dimensional path display method, device, readable storage medium and electronic apparatus
CN103915035A (en) Data conversion method and data conversion apparatus
KR102006915B1 (en) Connected drawing link system and method using drawing number cognition
CN110688116A (en) Image file analysis method, device, equipment and readable medium
CN115729887A (en) File analysis method and device and computer readable medium
CN114254406A (en) Drawing annotation positioning method and system
CN115035032A (en) Neural network training method, related method, device, terminal and storage medium
CN110362790B (en) Font file processing method and device, electronic equipment and readable storage medium
CN114495146A (en) Image text detection method and device, computer equipment and storage medium
CN110058751B (en) Method and device for selecting electronic document content
CN113407080A (en) Method and device for generating component label, computer equipment and storage medium
CN112507938A (en) Geometric feature calculation method, geometric feature recognition method and geometric feature recognition device for text primitives
CN111079771A (en) Method and system for extracting characteristics of click-to-read image, terminal device and storage medium

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
GR01 Patent grant
GR01 Patent grant