A method, device and equipment for batch conversion of CAD graphic data
By identifying and setting conversion rules through ObjectARX, conversion processing is performed on different types of AutoCAD graphic data, and attribute fields are extracted through annotation parsing rules. This solves the problems of graphic distortion and conversion failure when batch converting AutoCAD graphic data into GIS data, and improves conversion efficiency.
Patent Information
- Application Number
- CN202310914201.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-24
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2043-07-24
AI Technical Summary
Existing technologies make it difficult to effectively convert AutoCAD graphic data into GIS data in batches. This is especially true when dealing with intersecting topological relationships, unclosed surface graphics, and graphics with arc segments. Graphic distortion, expression errors, or conversion failures are likely to occur.
ObjectARX is used to identify graphic types and set corresponding conversion rules to perform conversion processing for different graphic types. At the same time, annotation parsing rules are used to extract and batch assign graphic attribute fields to avoid manual entry.
It achieves effective conversion of various graphic types, avoids graphic distortion and expression errors, improves conversion efficiency, and reduces manual intervention.
Smart Images

Figure CN117251516B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a method, device and terminal equipment for batch conversion of CAD graphic data. Background Art
[0002] AutoCAD software is widely used in the field of land planning due to its powerful functions and simple operation. AutoCAD software focuses more on the visual expression of data and its ability to handle geometric topological relationships is relatively weak. However, with the increasing requirements for spatial topological operations and the integration of graphics and attributes, AutoCAD software can no longer meet current application requirements. Some application scenarios require converting AutoCAD graphic data into spatial data that conforms to GIS data standards.
[0003] In the existing technology, batch conversion tools such as ArcGIS Toolbox and FME are usually used to convert AutoCAD graphic data into GIS data. However, these batch conversion tools have great limitations. For special graphics such as graphics with intersecting topological relationships, unclosed surface graphics, and graphics with arc segments, using these batch conversion tools to convert AutoCAD graphic data will result in graphic distortion, expression errors, conversion failure, and other problems. Therefore, it is difficult for the existing technology to effectively perform batch conversion of CAD graphic data. Summary of the Invention
[0004] The present invention provides a batch conversion method, device and equipment for CAD graphic data to solve the technical problem that the existing technology is difficult to effectively perform batch conversion of CAD graphic data. Corresponding conversion rules are set for various graphic types in the CAD graphic data conversion process. For special graphics such as graphics with intersecting topological relationships, unclosed surface graphics, graphics with arc segments, etc., the graphic conversion can be effectively completed, effectively avoiding the problems of graphic distortion, expression errors, conversion failure, etc. after conversion to GIS data. By setting annotation parsing rules, the graphic attribute fields corresponding to each target conversion graphic can be extracted and batch assigned, eliminating the need for manual attribute entry one by one after the graphic conversion, thereby significantly improving the conversion efficiency of CAD graphic data.
[0005] In order to solve the above technical problems, a first aspect of an embodiment of the present invention provides a method for batch conversion of CAD graphic data, comprising the following steps:
[0006] Based on the CAD graphic data to be converted, using ObjectARX to obtain a plurality of graphic elements in the CAD graphic data;
[0007] Based on the plurality of graphic elements, using ObjectARX to identify a plurality of graphics in the CAD graphic data, and determining a graphic type corresponding to each of the graphics;
[0008] Based on the graphic type corresponding to each of the graphics, convert each of the graphics according to a preset conversion rule corresponding to each of the graphics types to obtain a plurality of target conversion graphics;
[0009] Based on the drawing annotation data in the CAD graphic data, the drawing annotation data is parsed according to a preset annotation parsing rule to obtain a graphic attribute field corresponding to each target conversion graphic;
[0010] Each of the graphic attribute fields is used to assign a value to the attribute of the target conversion graphic corresponding to each of the graphic attribute fields to obtain a plurality of target graphic data, and the plurality of target graphic data are converted into GIS data.
[0011] As a preferred solution, the graphic types include at least closed graphics, included graphics, intersecting graphics, arc-segment graphics and filled graphics.
[0012] As a preferred solution, the conversion process of each graphic according to the preset conversion rules corresponding to each graphic type based on the graphic type corresponding to each graphic includes at least the following steps:
[0013] When any one of the graphics is a closed-type graphic, determining whether the any one of the graphics is closed;
[0014] If any of the graphics is closed, no closing process is performed on the any of the graphics;
[0015] If any of the graphics is not closed, and the distance between the starting point and the end point of any of the graphics is less than or equal to a preset distance threshold, closing the any of the graphics;
[0016] If any one of the graphics is not closed and the distance between the starting point and the end point of any one of the graphics is greater than the preset distance threshold, the any one of the graphics is stored in a preset queue for manual inspection.
[0017] As a preferred solution, the conversion process of each graphic according to the preset conversion rules corresponding to each graphic type based on the graphic type corresponding to each graphic includes at least the following steps:
[0018] When any one of the graphics is an inclusion-type graphic, determining whether a deduction mark, a non-deduction mark, or an area mark exists within the range of the included graphic in the any one of the graphics; wherein the any one of the graphics is composed of an inclusion graphic and the included graphic, and the inclusion graphic includes the included graphic;
[0019] If the subtraction mark exists within the range where the included graphic is located, subtract the included graphic;
[0020] If the non-subtraction mark exists within the range where the included graphics are located, no conversion process is performed on any of the graphics;
[0021] If the area mark exists within the range of the included graphic, the area difference between the included graphic and the included graphic is calculated; the area difference is compared with the area mark value corresponding to the area mark; when the absolute value of the difference between the area difference and the area mark value is less than a preset area threshold, the included graphic is subtracted; when the absolute value of the difference between the area difference and the area mark value is equal to or greater than the preset area threshold, no conversion is performed on any of the graphics;
[0022] If the deduction mark, the non-deduction mark and the area mark do not exist within the range where the included graphic is located, any one of the graphics will be stored in a preset queue for manual inspection.
[0023] As a preferred solution, the conversion process of each graphic according to the preset conversion rules corresponding to each graphic type based on the graphic type corresponding to each graphic includes at least the following steps:
[0024] When any one of the graphics is an intersection-type graphic, the conversion process is performed on the any one of the graphics according to the boundary of the any one of the graphics.
[0025] As a preferred solution, the conversion process of each graphic according to the preset conversion rules corresponding to each graphic type based on the graphic type corresponding to each graphic includes at least the following steps:
[0026] When any one of the graphics is the arc segment type graphics, the conversion rule is that the area difference between the converted target conversion graphics and the any one of the graphics is less than or equal to the preset area difference threshold, and the area difference is less than or equal to 0.03% of the area of the any one of the graphics, and the conversion processing is performed on the any one of the graphics.
[0027] As a preferred solution, the conversion process of each graphic according to the preset conversion rules corresponding to each graphic type based on the graphic type corresponding to each graphic includes at least the following steps:
[0028] When any one of the graphics is a filled graphic, determining whether the any one of the graphics has a filled boundary line;
[0029] If any one of the graphics has the filled boundary line, converting the any one of the graphics according to the filled boundary line;
[0030] If the arbitrary graphic does not have the filled boundary line, a new filled boundary line is generated according to the filled area of the arbitrary graphic, and the arbitrary graphic is converted according to the new filled boundary line.
[0031] As a preferred solution, the drawing annotation data is parsed according to a preset annotation parsing rule to obtain the graphic attribute field corresponding to each target conversion graphic, which specifically includes the following steps:
[0032] extracting a plurality of plot name data, plot number data and annotated area data from the map annotation data respectively by using regular expressions;
[0033] According to the extracted plot name data, plot number data and annotated area data, a plot name field, a plot number field and annotated area field corresponding to each target conversion graph are constructed.
[0034] A second aspect of an embodiment of the present invention provides a device for batch conversion of CAD graphic data, comprising:
[0035] A graphic element acquisition module, configured to acquire a plurality of graphic elements in the CAD graphic data using ObjectARX based on the CAD graphic data to be converted;
[0036] a graphic type determination module, configured to identify a plurality of graphics in the CAD graphic data using ObjectARX based on the plurality of graphic elements, and determine a graphic type corresponding to each of the graphics;
[0037] A graphics conversion module, configured to convert each of the graphics according to a graphics type corresponding to each of the graphics and a preset conversion rule corresponding to each of the graphics types, to obtain a plurality of target conversion graphics;
[0038] A drawing annotation data parsing module, configured to parse the drawing annotation data in the CAD graphic data according to a preset annotation parsing rule to obtain a graphic attribute field corresponding to each target conversion graphic;
[0039] The target graphic data conversion module is used to use each of the graphic attribute fields to assign attributes of the target conversion graphic corresponding to each of the graphic attribute fields, obtain a plurality of target graphic data, and convert the plurality of target graphic data into GIS data.
[0040] A third aspect of an embodiment of the present invention provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for batch conversion of CAD graphic data as described in any one of the first aspects is implemented.
[0041] Compared with the prior art, the beneficial effect of the embodiments of the present invention is that corresponding conversion rules are set for various graphic types in the CAD graphic data conversion process, and special graphics such as graphics with intersecting topological relationships, unclosed surface graphics, and graphics with arc segments can be effectively converted, effectively avoiding problems such as graphic distortion, expression errors, and conversion failure after conversion to GIS data. By setting annotation parsing rules, the graphic attribute fields corresponding to each target conversion graphic can be extracted and batch assigned, without the need for manual entry of attributes one by one after the graphic conversion, which significantly improves the conversion efficiency of CAD graphic data. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 1 is a flow chart of a method for batch conversion of CAD graphic data in an embodiment of the present invention;
[0043] Figure 2 It is a structural diagram of a device for batch conversion of CAD graphic data in an embodiment of the present invention. DETAILED DESCRIPTION
[0044] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0045] See also Figure 1 A first aspect of an embodiment of the present invention provides a method for batch conversion of CAD graphic data, comprising the following steps S1 to S5:
[0046] Step S1, based on the CAD graphic data to be converted, using ObjectARX to obtain several graphic elements in the CAD graphic data;
[0047] Step S2, based on the plurality of graphic elements, using ObjectARX to identify a plurality of graphics in the CAD graphic data, and determining a graphic type corresponding to each of the graphics;
[0048] Step S3, based on the graphic type corresponding to each graphic, convert each graphic according to a preset conversion rule corresponding to each graphic type to obtain a plurality of target conversion graphics;
[0049] Step S4, parsing the drawing annotation data in the CAD graphic data according to a preset annotation parsing rule to obtain a graphic attribute field corresponding to each target conversion graphic;
[0050] Step S5: using each of the graphic attribute fields to assign a value to the attribute of the target conversion graphic corresponding to each of the graphic attribute fields, obtaining a plurality of target graphic data, and converting the plurality of target graphic data into GIS data.
[0051] Specifically, in step S1, the dwg data (i.e., the CAD graphic data to be converted) is loaded using AutoCAD software. All graphic elements in the dwg data, including points, lines, surfaces, fills, blocks, and other elements, are obtained by using ObjectARX functions to ensure that no data to be converted is missed. The specific implementation code of this step is as follows:
[0052] ads_name entsets;
[0053] int nRes=acedSSGet(_T("X"),NULL,NULL,NULL,entsets);
[0054] long nLen=0;
[0055] acedSSLength(entsets,&nLen);
[0056] In step S2, based on a number of graphic elements, ObjectARX functions are used to identify a number of graphics in the CAD graphic data, and the corresponding graphic type of each graphic is determined. Preferably, the graphic types include at least closed graphics, contained graphics, intersecting graphics, arc-segment graphics, and filled graphics. The specific implementation code of this step is as follows:
[0057] std::map<CString,AcDbObjectIds> entity_class;
[0058] for(int s=0;s <nLen;s++)
[0059] {
[0060] ads_name tmp;
[0061] ads_ssname(entsets,i,tmp);
[0062] TCHAR ent_type
[100] = {0};
[0063] getEntityType(tmp,ent_type);
[0064] AcDbObjectId id;
[0065] acdbGetObjectId(id,tmp);
[0066] entity_class[ent_type].push_back(id)
[0067] }
[0068] In step S3, based on the graphic type corresponding to each graphic, since different graphic types require different conversion methods, this embodiment sets corresponding conversion rules for each graphic type, which are used to convert each graphic of different graphic types to obtain several target conversion graphics.
[0069] In step S4, for the drawing annotation data in the CAD graphic data, the corresponding attribute field names, parsing rules and annotation parsing instructions are set according to different graphic attribute fields, thereby forming annotation parsing rules to parse the drawing annotation data and obtain the graphic attribute fields corresponding to each target conversion graphic.
[0070] In step S5, the graphic attribute fields are used to assign values to the attributes of the corresponding target conversion graphics, thereby eliminating the need to manually enter the attributes one by one. Finally, a number of target graphic data are obtained and further converted and output as GIS data.
[0071] As a preferred solution, the conversion process of each graphic according to the preset conversion rules corresponding to each graphic type based on the graphic type corresponding to each graphic includes at least the following steps:
[0072] When any one of the graphics is a closed-type graphic, determining whether the any one of the graphics is closed;
[0073] If any of the graphics is closed, no closing process is performed on the any of the graphics;
[0074] If any of the graphics is not closed, and the distance between the starting point and the end point of any of the graphics is less than or equal to a preset distance threshold, closing the any of the graphics;
[0075] If any one of the graphics is not closed and the distance between the starting point and the end point of any one of the graphics is greater than the preset distance threshold, the any one of the graphics is stored in a preset queue for manual inspection.
[0076] It's worth noting that when a figure is classified as a closed figure, it's necessary to determine whether it's closed. If it's closed, no closure processing is required. If it's not closed, and the distance between the start and end points is less than or equal to the preset distance threshold, it indicates a small opening and is directly closed. If it's not closed, and the distance between the start and end points is greater than the preset distance threshold, it indicates a large opening and needs to be stored in a preset queue for manual inspection and conversion.
[0077] As an optional embodiment, the preset distance threshold is set to 1 / 100000 meter. The distance threshold can be adjusted according to actual needs and is not specifically limited in this embodiment.
[0078] As a preferred solution, the conversion process of each graphic according to the preset conversion rules corresponding to each graphic type based on the graphic type corresponding to each graphic includes at least the following steps:
[0079] When any one of the graphics is an inclusion-type graphic, determining whether a deduction mark, a non-deduction mark, or an area mark exists within the range of the included graphic in the any one of the graphics; wherein the any one of the graphics is composed of an inclusion graphic and the included graphic, and the inclusion graphic includes the included graphic;
[0080] If the subtraction mark exists within the range where the included graphic is located, subtract the included graphic;
[0081] If the non-subtraction mark exists within the range where the included graphics are located, no conversion process is performed on any of the graphics;
[0082] If the area mark exists within the range of the included graphic, the area difference between the included graphic and the included graphic is calculated; the area difference is compared with the area mark value corresponding to the area mark; when the absolute value of the difference between the area difference and the area mark value is less than a preset area threshold, the included graphic is subtracted; when the absolute value of the difference between the area difference and the area mark value is equal to or greater than the preset area threshold, no conversion is performed on any of the graphics;
[0083] If the deduction mark, the non-deduction mark and the area mark do not exist within the range where the included graphic is located, any one of the graphics will be stored in a preset queue for manual inspection.
[0084] It is worth noting that if there is an area mark in the form of "S=XXX*" within the range of the included figure, the area difference between the including figure and the included figure is calculated. Assuming that the area of the including figure is S1, the area of the included figure is S2, and the area mark value corresponding to the area mark is S, then when |(S1-S2)-S| is less than the preset area threshold, the included figure is deducted; when |(S1-S2)-S| is equal to or greater than the preset area threshold, the figure is not converted.
[0085] It should be noted that the preset area threshold can be adjusted according to actual needs, such as 0.01 square meters, 0.1 square meters, etc.
[0086] As a preferred solution, the conversion process of each graphic according to the preset conversion rules corresponding to each graphic type based on the graphic type corresponding to each graphic includes at least the following steps:
[0087] When any one of the graphics is an intersection-type graphic, the conversion process is performed on the any one of the graphics according to the boundary of the any one of the graphics.
[0088] It is worth noting that when a certain graphic is composed of at least two graphics having an intersecting topological relationship, this embodiment directly performs conversion processing on the graphic according to the boundary of the entire graphic.
[0089] As a preferred solution, the conversion process of each graphic according to the preset conversion rules corresponding to each graphic type based on the graphic type corresponding to each graphic includes at least the following steps:
[0090] When any one of the graphics is the arc segment type graphics, the conversion rule is that the area difference between the converted target conversion graphics and the any one of the graphics is less than or equal to the preset area difference threshold, and the area difference is less than or equal to 0.03% of the area of the any one of the graphics, and the conversion processing is performed on the any one of the graphics.
[0091] It is worth noting that AutoCAD software supports arc segment data, and the area of graphics also takes arc segments into consideration, but other GIS software do not support arc segments. After the data of AutoCAD software is converted to other GIS software, the arc segments are polylineated. Therefore, the area calculation of its graphics is based on the coordinate calculation after polyline processing, which has errors. In order to avoid excessive differences in the graphics after conversion, this embodiment uses the conversion rule that the area difference between the target converted graphics after conversion and the graphics before conversion is less than or equal to the area difference threshold, and the area difference is less than or equal to 0.03% of the area of the graphics before conversion, and converts the graphics.
[0092] As an optional embodiment, the area difference threshold is 0.01 square meters.
[0093] As a preferred solution, the conversion process of each graphic according to the preset conversion rules corresponding to each graphic type based on the graphic type corresponding to each graphic includes at least the following steps:
[0094] When any one of the graphics is a filled graphic, determining whether the any one of the graphics has a filled boundary line;
[0095] If any one of the graphics has the filled boundary line, converting the any one of the graphics according to the filled boundary line;
[0096] If the arbitrary graphic does not have the filled boundary line, a new filled boundary line is generated according to the filled area of the arbitrary graphic, and the arbitrary graphic is converted according to the new filled boundary line.
[0097] As a preferred solution, the drawing annotation data is parsed according to a preset annotation parsing rule to obtain the graphic attribute field corresponding to each target conversion graphic, which specifically includes the following steps:
[0098] extracting a plurality of plot name data, plot number data and annotated area data from the map annotation data respectively by using regular expressions;
[0099] According to the extracted plot name data, plot number data and annotated area data, a plot name field, a plot number field and annotated area field corresponding to each target conversion graph are constructed.
[0100] Specifically, the annotation parsing rules of this embodiment are shown in Table 1 below:
[0101] Table 1 Annotation parsing rules
[0102] Serial number Custom attribute field name Annotation parsing rules Annotation analysis instructions 1 Plot name ^[\u4e00-\u9fa5]{0,}$ Chinese 2 Plot number ^[A-Za-z0-9-]+$ English, numbers and "-" 3 Annotate area ^\d{n,}$ At least n digits
[0103] An embodiment of the present invention provides a batch conversion method for CAD graphic data, which sets corresponding conversion rules for various graphic types in the CAD graphic data conversion process. It can effectively complete the graphic conversion for special graphics such as graphics with intersecting topological relationships, unclosed surface graphics, graphics with arc segments, etc., effectively avoiding problems such as graphic distortion, expression errors, and conversion failure after conversion to GIS data. By setting annotation parsing rules, the graphic attribute fields corresponding to each target conversion graphic can be extracted and batch assigned, eliminating the need for manual attribute entry one by one after the graphic conversion, thereby significantly improving the conversion efficiency of CAD graphic data.
[0104] See also Figure 2 A second aspect of an embodiment of the present invention provides a device for batch conversion of CAD graphic data, comprising:
[0105] A graphic element acquisition module 201 is configured to acquire a plurality of graphic elements in the CAD graphic data using ObjectARX based on the CAD graphic data to be converted;
[0106] A graphic type determination module 202 is configured to identify a plurality of graphics in the CAD graphic data using ObjectARX based on the plurality of graphic elements, and determine a graphic type corresponding to each of the graphics;
[0107] The graphic conversion module 203 is configured to convert each graphic according to a graphic type corresponding to each graphic and a preset conversion rule corresponding to each graphic type, to obtain a plurality of target conversion graphics;
[0108] A drawing annotation data parsing module 204 is configured to parse the drawing annotation data in the CAD graphic data according to a preset annotation parsing rule to obtain a graphic attribute field corresponding to each target conversion graphic;
[0109] The target graphic data conversion module 205 is used to use each graphic attribute field to assign a value to the attribute of the target conversion graphic corresponding to each graphic attribute field, obtain a plurality of target graphic data, and convert the plurality of target graphic data into GIS data.
[0110] As a preferred solution, the graphic types include at least closed graphics, included graphics, intersecting graphics, arc-segment graphics and filled graphics.
[0111] As a preferred solution, the graphic conversion module 203 is configured to convert each graphic according to a preset conversion rule corresponding to each graphic type based on the graphic type corresponding to each graphic, including at least:
[0112] When any one of the graphics is a closed-type graphic, determining whether the any one of the graphics is closed;
[0113] If any of the graphics is closed, no closing process is performed on the any of the graphics;
[0114] If any of the graphics is not closed, and the distance between the starting point and the end point of any of the graphics is less than or equal to a preset distance threshold, closing the any of the graphics;
[0115] If any one of the graphics is not closed and the distance between the starting point and the end point of any one of the graphics is greater than the preset distance threshold, the any one of the graphics is stored in a preset queue for manual inspection.
[0116] As a preferred solution, the graphic conversion module 203 is configured to convert each graphic according to a preset conversion rule corresponding to each graphic type based on the graphic type corresponding to each graphic, including at least:
[0117] When any one of the graphics is an inclusion-type graphic, determining whether a deduction mark, a non-deduction mark, or an area mark exists within the range of the included graphic in the any one of the graphics; wherein the any one of the graphics is composed of an inclusion graphic and the included graphic, and the inclusion graphic includes the included graphic;
[0118] If the subtraction mark exists within the range where the included graphic is located, subtract the included graphic;
[0119] If the non-subtraction mark exists within the range where the included graphics are located, no conversion process is performed on any of the graphics;
[0120] If the area mark exists within the range of the included graphic, the area difference between the included graphic and the included graphic is calculated; the area difference is compared with the area mark value corresponding to the area mark; when the absolute value of the difference between the area difference and the area mark value is less than a preset area threshold, the included graphic is subtracted; when the absolute value of the difference between the area difference and the area mark value is equal to or greater than the preset area threshold, no conversion is performed on any of the graphics;
[0121] If the deduction mark, the non-deduction mark and the area mark do not exist within the range where the included graphic is located, any one of the graphics will be stored in a preset queue for manual inspection.
[0122] As a preferred solution, the graphic conversion module 203 is configured to convert each graphic according to a preset conversion rule corresponding to each graphic type based on the graphic type corresponding to each graphic, including at least:
[0123] When any one of the graphics is an intersection-type graphic, the conversion process is performed on the any one of the graphics according to the boundary of the any one of the graphics.
[0124] As a preferred solution, the graphic conversion module 203 is configured to convert each graphic according to a preset conversion rule corresponding to each graphic type based on the graphic type corresponding to each graphic, including at least:
[0125] When any one of the graphics is the arc segment type graphics, the conversion rule is that the area difference between the converted target conversion graphics and the any one of the graphics is less than or equal to the preset area difference threshold, and the area difference is less than or equal to 0.03% of the area of the any one of the graphics, and the conversion processing is performed on the any one of the graphics.
[0126] As a preferred solution, the graphic conversion module 203 is configured to convert each graphic according to a preset conversion rule corresponding to each graphic type based on the graphic type corresponding to each graphic, including at least:
[0127] When any one of the graphics is a filled graphic, determining whether the any one of the graphics has a filled boundary line;
[0128] If any one of the graphics has the filled boundary line, converting the any one of the graphics according to the filled boundary line;
[0129] If the arbitrary graphic does not have the filled boundary line, a new filled boundary line is generated according to the filled area of the arbitrary graphic, and the arbitrary graphic is converted according to the new filled boundary line.
[0130] As a preferred solution, the drawing annotation data parsing module 204 is used to parse the drawing annotation data according to a preset annotation parsing rule to obtain the graphic attribute field corresponding to each target conversion graphic, specifically including:
[0131] extracting a plurality of plot name data, plot number data and annotated area data from the map annotation data respectively by using regular expressions;
[0132] According to the extracted plot name data, plot number data and annotated area data, a plot name field, a plot number field and annotated area field corresponding to each target conversion graph are constructed.
[0133] It should be noted that the batch conversion device for CAD graphic data provided in an embodiment of the present invention can implement all the processes of the batch conversion method for CAD graphic data described in any of the above embodiments. The functions of each module in the device and the technical effects achieved are respectively the same as the functions and technical effects achieved by the batch conversion method for CAD graphic data described in the above embodiments, and will not be repeated here.
[0134] A third aspect of an embodiment of the present invention provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the batch conversion method for CAD graphic data as described in any embodiment of the first aspect is implemented.
[0135] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor and a memory. The terminal device may also include input and output devices, network access devices, a bus, etc. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting the various parts of the entire terminal device using various interfaces and lines. The memory may be used to store the computer programs and / or modules. The processor implements the various functions of the terminal device by running or executing the computer programs and / or modules stored in the memory and calling the data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area may store data created based on the use of the mobile phone (such as audio data, a phone book, etc.). In addition, the memory may include a high-speed random access memory and may also include a non-volatile memory, such as a hard disk, internal memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0136] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for batch conversion of CAD graphic data, characterized in that: The steps include: Based on the CAD graphic data to be converted, using ObjectARX to obtain a plurality of graphic elements in the CAD graphic data; Based on the plurality of graphic elements, using ObjectARX to identify a plurality of graphics in the CAD graphic data, and determining a graphic type corresponding to each of the graphics; Based on the graphic type corresponding to each of the graphics, convert each of the graphics according to a preset conversion rule corresponding to each of the graphics types to obtain a plurality of target conversion graphics; Based on the drawing annotation data in the CAD graphic data, the drawing annotation data is parsed according to a preset annotation parsing rule to obtain a graphic attribute field corresponding to each target conversion graphic; Assigning a value to an attribute of a target conversion graphic corresponding to each of the graphic attribute fields using each of the graphic attribute fields to obtain a plurality of target graphic data, and converting the plurality of target graphic data into GIS data; The graphic types include closed graphics, contained graphics, intersecting graphics, arc graphics and filled graphics; The converting process of each graphic according to a preset conversion rule corresponding to each graphic type based on the graphic type corresponding to each graphic type includes the following steps: When any one of the figures is a closed figure, the conversion process is performed on the any one of the figures based on the closing condition and the opening distance of the any one of the figures; the opening distance is the distance between the starting point and the end point of the any one of the figures; When any one of the graphics is an inclusion-type graphic, determining whether there is a deduction mark, a non-deduction mark, or an area mark within the range of the included graphics in the any one of the graphics, and performing conversion processing on the any one of the graphics based on the determination result; When any one of the graphics is an intersecting graphic, performing a conversion process on the any one of the graphics according to the boundary of the any one of the graphics; When any one of the graphics is an arc-type graphic, the conversion is performed on the graphic based on the following conversion rule: the area difference between the target converted graphic and the graphic after conversion is less than or equal to a preset area difference threshold, and the area difference is less than or equal to 0.03% of the area of the graphic; When any one of the graphics is a filled graphic, determining whether the any one of the graphics has a filled boundary line; If any one of the graphics has the filled boundary line, converting the any one of the graphics according to the filled boundary line; If the arbitrary graphic does not have the filled boundary line, a new filled boundary line is generated according to the filled area of the arbitrary graphic, and the arbitrary graphic is converted according to the new filled boundary line.
2. The batch conversion method of CAD graphic data according to claim 1, wherein: When any one of the graphics is a closed-type graphic, performing conversion processing on the any one of the graphics based on the closing condition and opening distance of the any one of the graphics comprises the following steps: When any one of the graphics is a closed-type graphic, determining whether the any one of the graphics is closed; If any of the graphics is closed, no closing process is performed on the any of the graphics; If any of the graphics is not closed, and the distance between the starting point and the end point of any of the graphics is less than or equal to a preset distance threshold, closing the any of the graphics; If any of the graphics is not closed and the distance between the starting point and the end point of any of the graphics is greater than the preset distance threshold, the any of the graphics is stored in a preset queue for manual inspection.
3. The batch conversion method of CAD graphic data according to claim 1, wherein: When any one of the graphics is the inclusion-type graphics, determining whether a deduction mark, a non-deduction mark, or an area mark exists within the range of the included graphics in the any one of the graphics, and performing conversion processing on the any one of the graphics based on the determination result, including the following steps: When any one of the graphics is an inclusion-type graphic, determining whether a deduction mark, a non-deduction mark, or an area mark exists within the range of the included graphics in the any one of the graphics; wherein the any one of the graphics is composed of an inclusion graphic and the included graphics, and the inclusion graphic contains the included graphics; If the subtraction mark exists within the range where the included graphic is located, subtract the included graphic; If the non-subtraction mark exists within the range where the included graphics are located, no conversion process is performed on any of the graphics; If the area mark exists within the range of the included graphic, the area difference between the included graphic and the included graphic is calculated; the area difference is compared with the area mark value corresponding to the area mark; when the absolute value of the difference between the area difference and the area mark value is less than a preset area threshold, the included graphic is subtracted; when the absolute value of the difference between the area difference and the area mark value is equal to or greater than the preset area threshold, no conversion is performed on any of the graphics; If the deduction mark, the non-deduction mark and the area mark do not exist within the range where the included graphic is located, any one of the graphics will be stored in a preset queue for manual inspection.
4. The batch conversion method of CAD graphic data according to claim 1, wherein: The step of parsing the drawing annotation data according to a preset annotation parsing rule to obtain the graphic attribute field corresponding to each target conversion graphic specifically includes the following steps: extracting a plurality of plot name data, plot number data and annotated area data from the map annotation data respectively by using regular expressions; According to the extracted plot name data, plot number data and annotated area data, a plot name field, a plot number field and annotated area field corresponding to each target conversion graph are constructed.
5. A batch conversion device for CAD graphic data, characterized in that: include: A graphic element acquisition module, configured to acquire a plurality of graphic elements in the CAD graphic data using ObjectARX based on the CAD graphic data to be converted; a graphic type determination module, configured to identify a plurality of graphics in the CAD graphic data using ObjectARX based on the plurality of graphic elements, and determine a graphic type corresponding to each of the graphics; A graphics conversion module, configured to convert each of the graphics according to a graphics type corresponding to each of the graphics and a preset conversion rule corresponding to each of the graphics types, to obtain a plurality of target conversion graphics; A drawing annotation data parsing module, configured to parse the drawing annotation data in the CAD graphic data according to a preset annotation parsing rule to obtain a graphic attribute field corresponding to each target conversion graphic; a target graphic data conversion module, configured to use each of the graphic attribute fields to assign a value to the attribute of the target conversion graphic corresponding to each of the graphic attribute fields, obtain a plurality of target graphic data, and convert the plurality of target graphic data into GIS data; The graphic types include closed graphics, contained graphics, intersecting graphics, arc graphics and filled graphics; The graphic conversion module is configured to convert each graphic according to a preset conversion rule corresponding to each graphic type based on the graphic type corresponding to each graphic, including: When any one of the figures is a closed figure, the conversion process is performed on the any one of the figures based on the closing condition and the opening distance of the any one of the figures; the opening distance is the distance between the starting point and the end point of the any one of the figures; When any one of the graphics is an inclusion-type graphic, determining whether there is a deduction mark, a non-deduction mark, or an area mark within the range of the included graphics in the any one of the graphics, and performing conversion processing on the any one of the graphics based on the determination result; When any one of the graphics is an intersecting graphic, performing a conversion process on the any one of the graphics according to the boundary of the any one of the graphics; When any one of the graphics is an arc-type graphic, the conversion is performed on the graphic based on the following conversion rule: the area difference between the target converted graphic and the graphic after conversion is less than or equal to a preset area difference threshold, and the area difference is less than or equal to 0.03% of the area of the graphic; When any one of the graphics is a filled graphic, determining whether the any one of the graphics has a filled boundary line; If any one of the graphics has the filled boundary line, converting the any one of the graphics according to the filled boundary line; If the arbitrary graphic does not have the filled boundary line, a new filled boundary line is generated according to the filled area of the arbitrary graphic, and the arbitrary graphic is converted according to the new filled boundary line.
6. A terminal device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the batch conversion method of CAD graphic data according to any one of claims 1 to 4 when executing the computer program.
Citation Information
Patent Citations
Spatial data conversion method and system
CN105279243A
Database auto-building method for link of search data in GIS system using CAD drawings
WO2008105611A1