CN111985195A - Text-based AUTOCAD table data reading method - Google Patents

Text-based AUTOCAD table data reading method Download PDF

Info

Publication number
CN111985195A
CN111985195A CN202010833221.2A CN202010833221A CN111985195A CN 111985195 A CN111985195 A CN 111985195A CN 202010833221 A CN202010833221 A CN 202010833221A CN 111985195 A CN111985195 A CN 111985195A
Authority
CN
China
Prior art keywords
text
autocad
coordinate
characters
reading
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
Application number
CN202010833221.2A
Other languages
Chinese (zh)
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.)
Shanghai Waigaoqiao Shipbuilding Co Ltd
Original Assignee
Shanghai Waigaoqiao Shipbuilding 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 Shanghai Waigaoqiao Shipbuilding Co Ltd filed Critical Shanghai Waigaoqiao Shipbuilding Co Ltd
Priority to CN202010833221.2A priority Critical patent/CN111985195A/en
Publication of CN111985195A publication Critical patent/CN111985195A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The invention discloses a text-based AUTOCAD table data reading method, which comprises the following steps: s1 selects a table graph range, S2 identifies a single line of text, multiple lines of text and attribute definition in a selection set as characters, identifies visible attributes in an attribute block in the selection set as characters, S3 filters format characters, reads valid characters, and S4 judges whether the text is a valid text: filtering blank text contents in the selection set, S5 reading and recording text key attributes, S6 judging the number of effective texts, wherein if the number of effective texts is equal to 0, the process is exited, S7 calculates the corresponding coordinates of the cells based on the coordinate positions of the character objects, S8 judges and processes multi-cell texts, and S9 records the text contents to Excel. When the AUTOCAD table data is converted into the Excel table, the user only needs to start the automatic process and appoint the graphic range of the table on the AUTOCAD interface, and compared with the traditional manual conversion method, the method greatly improves the operation efficiency and accuracy.

Description

Text-based AUTOCAD table data reading method
Technical Field
The invention relates to the technical field of table data reading methods based on vector diagrams, in particular to an AUTOCAD table data reading method based on texts.
Background
AutoCAD is an automatic computer aided design software developed by Autodesk (Ottek) company in 1982 for the first time, which is used for two-dimensional drawing, detailed drawing, designing documents and basic three-dimensional design, and has now become a drawing tool widely spread internationally, the AutoCAD has a good user interface, can perform various operations by means of interactive menus or command lines, its multi-document design environment enables non-computer professionals to quickly learn and use it, and better grasp its various applications and development skills in the course of continuous practice, thereby continuously improving the work efficiency, the AutoCAD has a wide adaptability, it can be operated on microcomputers and workstations supported by various operating systems, the AutoCAD software can be used for drawing two-dimensional drawing and basic three-dimensional design, through it can automatically draw without understanding programming, therefore it is widely used globally, it can be used for civil engineering and construction, in various fields such as decoration, industrial drawing, engineering drawing, electronic industry, garment processing and the like, AUTOCAD is used as excellent vector diagram design software and is widely applied to the fields of design drawing of ships, machinery, electronics, engineering and the like, layout drawing, assembly drawing, flow drawing, piping drawing, electrical wiring drawing and the like drawn by AUTOCAD usually comprise a certain number of data tables (the data tables are usually represented by text content and text position difference), data processing such as statistics, classification summary, search feedback and the like needs to be carried out on data table information in the design and subsequent application processes of the design drawing, and the AUTOCAD does not have the data processing function, so the traditional method is to write the AUTOCAD data tables into surface processing software such as EXCEL and the like one by one and then carry out data processing on the form processing software such as the EXCEL and the like. The conventional method is inefficient, not only needs to consume a lot of manpower, but also is easy to generate errors in the process of converting into EXCEL data due to excessive manual intervention.
The existing partial patent documents relate to an AUTOCAD table data reading technology, but still have the problems that the technical description is not clear enough, the data processing description combining the characteristics of AUTOCAD software is not clear, the multi-text cell processing is not related or clear, and the like. Most of the methods are only suitable for AUTOCAD data tables of a straight line plus text type, reading of the data tables of only texts is rarely involved, specific products corresponding to related patents are difficult to find in the market, and application of specific technologies is inconvenient.
Disclosure of Invention
The invention aims to provide a text-based AUTOCAD table data reading method, which provides a set of truly feasible methods by combining the characteristics of AUTOCAD software and can realize the copying of AUTOCAD table data into EXCEL. Therefore, the problems of low efficiency and easy error existing in the traditional method are solved.
The technical scheme for realizing the purpose is as follows:
a text-based AUTOCAD table data reading method comprises the following steps:
s1, selecting a table graph range: selecting the range of the form on an AutoCAD software interface by a user;
s2, identifying the definition of the attributes of the single-line text and the multi-line text in the selection set as characters, and identifying the visible attributes in the attribute blocks in the selection set as characters;
s3, filtering the format characters, and reading effective characters;
s4, judging whether the text is a valid text: filtering out blank text content in a selected set;
s5, reading the text key attribute and recording: reading and recording the position (x, y), the height Th and the content T after 3.3 correction;
s6, judging the number of effective texts, if the number of effective texts is equal to 0, exiting the process;
s7, calculating corresponding cell coordinates (R, C) based on the coordinate position (x, y) of the character object;
s8, judging and processing the multi-text of the cell;
and S9, recording the text content to Excel, and finishing reading the form data.
Further optimizing the technical scheme, in the step S3, the auto cad character that can be directly read is { \ C3; gamma \ Microsoft YaHei | b0| i0| c134| p 34; \ H1.2x; \ C256; meaning, for the situation, invalid characters in AUTOCAD characters need to be filtered, and only schematic characters are reserved.
Further optimizing the technical solution, in step S7, calculating coordinates R of a cell line corresponding to the text, the steps are as follows:
a. sorting in descending order according to the Y coordinate value of the text;
b. setting the line coordinate of the first text T1 object to 1;
c. the difference Del is calculated in order from the Y coordinate of the text T1:
if Del < character high Th coefficient K1, it indicates that the data is in the same line as the text T1, and the coordinate value of the line T1 is copied;
if Del > is high Th coefficient K1, it indicates that the text starts a new line, and sets the object as T1, and adds 1 to the line coordinate;
the calculation is performed on all subsequent objects to obtain the line coordinate values R1, R2, … Rn for all text objects.
Further optimizing the technical solution, in the step S7, the cell column coordinate C corresponding to the text is calculated, and the steps are as follows:
a. sorting according to the ascending order of the X coordinate values of the text;
b. setting the column coordinate of the first text T1 object to 1;
c. the difference Del is calculated in order from the X coordinate of the text T1:
if Del < character high Th coefficient K1, it indicates that the data is in the same column with the text T1, and copies the coordinate value of T1 column;
if Del > is high Th coefficient K1, it indicates that the text starts new column, and sets the object as T1, and adds 1 to the column coordinate;
the column coordinate values C1, C2, … Cm of all text objects can be obtained after the calculation is performed on all subsequent objects;
the text and cell coordinate data model of fig. 4 can be obtained by the above calculation.
In step S8, the text number of the cell is counted according to the coordinates (R, C) of the text cell as the keyword, if the text number is greater than 1, it indicates that the cell includes a plurality of text objects, and at this time, the relevant cell text merging technique may be selected to merge a plurality of texts into one valid text T1, and if the text number is 1, the valid text T1 is equal to the text content.
Further optimizing the technical solution, in the step S9, the text contents are written into the Excel data table one by one according to the corrected cell coordinates (R, C) and the corrected text contents T1.
Further optimize this technical scheme, the position of text is the matrix arrangement, has obvious horizontal and vertical vision to cut apart between the text.
Further optimizing the technical scheme, the text corresponding to the AUTOCAD graph is a single-line text, a multi-line text, an attribute definition and a block visible attribute.
Further optimizing the technical scheme, the text-based AUTOCAD table data reading method is already applied to data table reading conversion operation of various CAD drawings based on the compiled computer program.
Compared with the prior art, the invention provides a text-based AUTOCAD table data reading method, which has the following beneficial effects:
1. according to the text-based AUTOCAD table data reading method, when the AUTOCAD table data is converted into the Excel table, a user only needs to start an automatic flow, and the graphic range of the table is specified on the AUTOCAD interface, so that the operation efficiency and the accuracy are greatly improved compared with the traditional manual conversion method.
2. Compared with part of the existing auto CAD table data conversion technology based on the straight line text, the text format character filtering processing is added, and the readability and the practicability of the final table are improved.
3. According to the text-based AUTOCAD table data reading method, a multi-text merging judgment processing flow is added, the problem that reading of multi-text unit table data is covered and omitted is solved, and the accuracy and the application range of a practical method are improved.
4. According to the text-based AUTOCAD table data reading method, the data reading from the AUTOCAD table to the Excel table can be completed only by text contents, and the coverage range of the AUTOCAD table data reading technology is effectively expanded.
Drawings
Fig. 1 is a schematic flow chart of a text-based autoscad table data reading method according to the present invention;
FIG. 2 is a data representation intention of a text-based AUTOCAD table data reading method according to the present invention;
fig. 3 is a schematic diagram of character reading in a filter format of the method for reading data in an autoscad table based on a text according to the present invention;
fig. 4 is a schematic diagram of a text and cell coordinate data model of the text-based autoscad table data reading method according to the present invention.
Detailed Description
The invention will be further explained with reference to the drawings.
Example (b):
the invention relates to a text-based AUTOCAD table data reading method, wherein a table refers to a data representation intention shown in FIG. 2, and has the following characteristics:
1.1, the text positions are arranged in a matrix form.
1.2, obvious horizontal and vertical visual segmentation exists among texts.
1.3, the TEXT corresponds to the AUTOCAD graphic as single line TEXT (TEXT), multi-line TEXT (MTEXT), Attribute definition (Attribute) and block visibility Attribute (AttributeReference).
A text-based AUTOCAD table data reading method, as shown in fig. 1, comprising the following steps:
s1, selecting a table graph range: selecting the range of the form on an AutoCAD software interface by a user;
s2, identifying a single line TEXT (TEXT), a multi-line TEXT (MTEXT), an Attribute definition (Attribute) as a word and identifying a visible Attribute (Attribute reference) in an Attribute block in the selection set as a word;
s3, filtering format characters, and reading effective characters, wherein the AUTOCAD characters which can be directly read in the figure 3 are { \ C3; gamma \ Microsoft YaHei | b0| i0| c134| p 34; \ H1.2x; \ C256; meaning, filtering invalid characters in AUTOCAD characters, and only keeping 'schematic characters';
s4, judging whether the text is a valid text: filtering out blank text content in a selected set;
s5, reading the text key attribute and recording: reading and recording the position (x, y), the height Th and the content T after 3.3 correction;
s6, judging the number of effective texts, if the number of effective texts is equal to 0, exiting the process;
s7, calculating corresponding cell coordinates (R, C) based on the coordinate position (x, y) of the character object;
s7.1, calculating the cell line coordinate R corresponding to the text, and the steps are as follows:
a. sorting in descending order according to the Y coordinate value of the text;
b. setting the line coordinate of the first text T1 object to 1;
c. the difference Del is calculated in order from the Y coordinate of the text T1:
if Del < character high Th coefficient K1, it indicates that the data is in the same line as the text T1, and the coordinate value of the line T1 is copied;
if Del > is high Th coefficient K1, it indicates that the text starts a new line, and sets the object as T1, and adds 1 to the line coordinate;
after the calculation is carried out on all the subsequent objects, the line coordinate values R1, R2 and … Rn of all the text objects can be obtained;
s7.2, calculating the coordinate C of the cell column corresponding to the text, wherein the steps are as follows:
a. sorting according to the ascending order of the X coordinate values of the text;
b. setting the column coordinate of the first text T1 object to 1;
c. the difference Del is calculated in order from the X coordinate of the text T1:
if Del < character high Th coefficient K1, it indicates that the data is in the same column with the text T1, and copies the coordinate value of T1 column;
if Del > is high Th coefficient K1, it indicates that the text starts new column, and sets the object as T1, and adds 1 to the column coordinate;
the column coordinate values C1, C2, … Cm of all text objects can be obtained after the calculation is performed on all subsequent objects;
the text and cell coordinate data model as shown in FIG. 4 can be obtained through the above calculation;
s8, judging and processing the multi-text of the cell;
counting the number of texts in the cell according to the coordinates (R, C) of the texts in the cell as keywords,
if the number of texts is greater than 1, the cell contains a plurality of text objects, and at the moment, a relevant cell text merging technology can be selected to merge a plurality of texts into a valid text T1;
if the text number is 1, the valid text T1 is equal to the text content T;
s9, recording the text content to Excel, and completing reading of the form data;
and writing the text contents into the Excel data table one by one according to the corrected cell coordinates (R, C) and the corrected text contents T1.
The text-based AUTOCAD table data reading method is applied to data table reading and converting operation of various CAD drawings based on a compiled computer program, the text-based AUTOCAD table data reading method has the advantages that when the AUTOCAD table data is converted into an Excel table, a user only needs to start an automatic flow and appoint the graph range of the table on an AUTOCAD interface, compared with the traditional manual converting method, the operation efficiency and the accuracy are greatly improved, compared with part of the existing linear text-based AUTOCAD table data converting technology, text format character filtering processing is added, the readability and the practicability of the final table are improved, a multi-text merging judgment processing flow is added, the problem that the reading of multi-text unit grid data is covered and omitted is solved, the accuracy and the use range of a practical method are improved, the method can finish the data reading from the AUTOCAD table to the Excel table only by text contents, the coverage range of the AUTOCAD table data reading technology is effectively expanded.
1. The method is also applicable to CAD in software.
2. The method adds a text format character processing flow for the first time.
3. The utility model adds the multi-text cell data processing flow in the method for reading the AutoCAD form data for the first time.
The utility model provides a method for reading the form data based on the text position for the first time.
The above embodiments are provided only for illustrating the present invention and not for limiting the present invention, and those skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention, and therefore all equivalent technical solutions should also fall within the scope of the present invention, and should be defined by the claims.

Claims (9)

1. A text-based AUTOCAD table data reading method is characterized by comprising the following steps:
s1, selecting a table graph range: selecting the range of the form on an AutoCAD software interface by a user;
s2, identifying the definition of the attributes of the single-line text and the multi-line text in the selection set as characters, and identifying the visible attributes in the attribute blocks in the selection set as characters;
s3, filtering the format characters, and reading effective characters;
s4, judging whether the text is a valid text: filtering out blank text content in a selected set;
s5, reading the text key attribute and recording: reading and recording the position (x, y), the height Th and the content T after 3.3 correction;
s6, judging the number of effective texts, if the number of effective texts is equal to 0, exiting the process;
s7, calculating corresponding cell coordinates (R, C) based on the coordinate position (x, y) of the character object;
s8, judging and processing the multi-text of the cell;
and S9, recording the text content to Excel, and finishing reading the form data.
2. The method of claim 1, wherein in step S3, the directly readable AUTOCAD word is { \ C3; gamma \ Microsoft YaHei | b0| i0| c134| p 34; \ H1.2x; \ C256; meaning, for the situation, invalid characters in AUTOCAD characters need to be filtered, and only schematic characters are reserved.
3. The method for reading AUTOCAD table data based on text according to claim 1, wherein in step S7, the coordinates R of cell row corresponding to text are calculated as follows:
a. sorting in descending order according to the Y coordinate value of the text;
b. setting the line coordinate of the first text T1 object to 1;
c. the difference Del is calculated in order from the Y coordinate of the text T1:
if Del < character high Th coefficient K1, it indicates that the data is in the same line as the text T1, and the coordinate value of the line T1 is copied;
if Del > is high Th coefficient K1, it indicates that the text starts a new line, and sets the object as T1, and adds 1 to the line coordinate;
the calculation is performed on all subsequent objects to obtain the line coordinate values R1, R2, … Rn for all text objects.
4. The method for reading AUTOCAD table data based on text according to claim 1, wherein in step S7, the cell column coordinate C corresponding to the text is calculated by the following steps:
a. sorting according to the ascending order of the X coordinate values of the text;
b. setting the column coordinate of the first text T1 object to 1;
c. the difference Del is calculated in order from the X coordinate of the text T1:
if Del < character high Th coefficient K1, it indicates that the data is in the same column with the text T1, and copies the coordinate value of T1 column;
if Del > is high Th coefficient K1, it indicates that the text starts new column, and sets the object as T1, and adds 1 to the column coordinate;
the column coordinate values C1, C2, … Cm of all text objects can be obtained after the calculation is performed on all subsequent objects;
the text and cell coordinate data model of fig. 4 can be obtained by the above calculation.
5. The method as claimed in claim 1, wherein in step S8, the cell text number is counted according to the text cell coordinates (R, C) as the keywords, if the text number is greater than 1, it indicates that the cell contains a plurality of text objects, and the relevant cell text merging technique is selected to merge a plurality of texts into one valid text T1, and if the text number is 1, the valid text T1 is equal to the text content.
6. The method of claim 1, wherein in step S9, the text contents are written into the Excel data table one by one according to the corrected cell coordinates (R, C) and the corrected text contents T1.
7. The method of claim 1, wherein the text is arranged in a matrix form, and there is a distinct horizontal and vertical visual segmentation between texts.
8. The method of claim 1, wherein the text-based AUTOCAD table data is selected from the group consisting of single line text, multiple lines of text, attribute definition, and block visibility attributes.
9. The method of claim 1, wherein the text-based AUTOCAD tabular data reading method is based on a spreadsheet reading conversion operation that is programmed to have been applied to various CAD drawings.
CN202010833221.2A 2020-08-18 2020-08-18 Text-based AUTOCAD table data reading method Pending CN111985195A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010833221.2A CN111985195A (en) 2020-08-18 2020-08-18 Text-based AUTOCAD table data reading method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010833221.2A CN111985195A (en) 2020-08-18 2020-08-18 Text-based AUTOCAD table data reading method

Publications (1)

Publication Number Publication Date
CN111985195A true CN111985195A (en) 2020-11-24

Family

ID=73433968

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010833221.2A Pending CN111985195A (en) 2020-08-18 2020-08-18 Text-based AUTOCAD table data reading method

Country Status (1)

Country Link
CN (1) CN111985195A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060124013A (en) * 2005-05-30 2006-12-05 (주)에스오씨건설엔지니어링 Automatic recording method of description details and file names for title block of auto cad
CN105912516A (en) * 2016-04-01 2016-08-31 南京朗坤软件有限公司 Method for one-lick extraction of table data from AutoCAD file
CN108763382A (en) * 2018-05-18 2018-11-06 中铁山桥集团有限公司 A method of the chart content in CAD program is imported into Excel programs

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060124013A (en) * 2005-05-30 2006-12-05 (주)에스오씨건설엔지니어링 Automatic recording method of description details and file names for title block of auto cad
CN105912516A (en) * 2016-04-01 2016-08-31 南京朗坤软件有限公司 Method for one-lick extraction of table data from AutoCAD file
CN108763382A (en) * 2018-05-18 2018-11-06 中铁山桥集团有限公司 A method of the chart content in CAD program is imported into Excel programs

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
建筑师的魔术手: "ActiveX.MTextPropertie获取MTEXT纯文本内容", HTTPS://ZHUANLAN.ZHIHU.COM/P/47182732, pages 1 - 2 *
张裕生: "AutoCAD中表格处理方法的研究", 中国优秀硕士学位论文全文数据库, pages 138 - 2435 *
赵红梅: "基于参数化技术的CAD系统二次开发的研究与实现", 中国优秀硕士论文全文数据库, pages 138 - 480 *

Similar Documents

Publication Publication Date Title
CN101794280B (en) Form automatic generation method and system based on form template set
US7750924B2 (en) Method and computer-readable medium for generating graphics having a finite number of dynamically sized and positioned shapes
CN112861384B (en) Three-dimensional model construction method of electrostatic precipitator based on CATIA
CN113051885B (en) AutoCAD-based design drawing rapid typesetting method
CN110059121B (en) Method, system, device and storage medium for rapidly exporting bill of materials
CN111985195A (en) Text-based AUTOCAD table data reading method
CN112307725B (en) Method for adding table information on two-dimensional drawing interface
CN104408267A (en) Finite element modeling method for special-shaped spatial structure
US6948132B2 (en) Method for mapping screen display objects with spatial coordinates into an HTML table
CN107229687B (en) Dft file is converted to the system and method for DWG file by a kind of batch
CN112241411B (en) Spreadsheet structured identification and extraction method based on CAD basic elements
CN110826185A (en) Method for establishing bearing part library based on CAD secondary development
CN107240150A (en) A kind of three-dimensional tube numeral dissolves drawing method
CN113821881A (en) Large-scale amphibious aircraft iron bird test bed structure installation coordination data construction method
CN110032718B (en) Table conversion method, system and storage medium
CN111985015A (en) System and method for automatically generating BOM (Bill of Material) by using VBA (visual basic Access) function
CN115310237B (en) Automatic profile steel hole type parameterization method based on graphic file
CN110728114A (en) Analysis report generation method
Paprotny et al. Reducing model creation cycle time by automated conversion of a CAD AMHS layout design
CN115525953A (en) Method for generating component processing diagram based on BIM (building information modeling) key
CN107908813B (en) Urban planning digital terrain parameterization processing method based on ObjectARX
CN115526993A (en) Three-dimensional model construction method and device, electronic equipment and storage medium
CN110889214A (en) Rule-based CAD drawing automatic error detection method
CN110750818A (en) Height marking method and system for drainage well design and storage medium
CN113743063A (en) Method, system and storage medium for generating physical characteristic report of article

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