Method for quickly importing AutoCAD file data into 3DE software

By establishing communication between AutoCAD and 3DE, using ActiveX Automation and Visual C# programming languages, the problems of data format compatibility and spatial relationship maintenance in geotechnical engineering drawings are solved, and the rapid and accurate import of AutoCAD files in 3DE software is realized, which improves data conversion efficiency and scalability.

CN120279202APending Publication Date: 2025-07-08CHANGJIANG GEOTECHNICAL ENG CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411298108.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-18
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

In geotechnical engineering drawing, problems such as data format compatibility, geometric complexity, spatial relationship maintenance and attribute information transfer of AutoCAD files make it difficult to import data into 3DE software. Traditional methods are cumbersome and prone to errors, and cannot meet the needs of big data application.

Method used

By developing new applications, using ActiveX Automation technology to establish communication between AutoCAD and 3DE, reading primitive object properties and converting and scaling, and using Visual C# programming language to achieve rapid data transmission and import between AutoCAD and 3DE.

Benefits of technology

It realizes the concise and efficient import of AutoCAD file data in 3DE software, improves data conversion efficiency, supports three-dimensional and two-dimensional space import, is highly scalable, reduces manual operation errors, and meets the needs of big data applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120279202A_ABST
    Figure CN120279202A_ABST
Patent Text Reader

Abstract

The invention discloses a method for rapidly importing AutoCAD file data into 3DE software, and relates to the field of geotechnical engineering investigation three-dimensional mapping. The method comprises the following steps of: 1, opening AutoCAD software and a corresponding file needing to read data, and opening 3DE software and a corresponding file needing to import data; step 2, newly establishing an application program through development software, and establishing communication with an AutoCAD program; step 3, reading the attribute of a primitive object in the AutoCAD file; 4, converting the format of the attribute of the primitive object in the AutoCAD; 5, converting the coordinate attributes of the primitive object in the AutoCAD; step 6, establishing communication with the 3DE program; 7, the primitive objects in AutoCAD are written into 3DE according to attributes; and step 8, performing program development and packaging on the processes from the step 2 to the step 7 to realize rapid data import. According to the method, the data imported into the 3DE software is concise and efficient, manual conversion is not needed, and errors are not prone to occurring.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of three-dimensional mapping for geotechnical engineering investigation, and more specifically, it is a method for quickly importing AutoCAD file data into 3DE software. Background Art

[0002] When importing data from AutoCAD into 3DE software in geotechnical engineering drawing, the following difficulties will be encountered:

[0003] 1) Data format compatibility issue. The data format of AutoCAD may not be compatible with 3DE software and needs to be converted or exported to an intermediate format, which may lead to data loss or errors.

[0004] 2) Geometric complexity: The complexity of geological structures may make it difficult to accurately represent the 2D drawings in AutoCAD in 3DE software, especially for complex geological structures and stratigraphic boundaries.

[0005] 3) Maintenance of spatial relationships. Maintaining the spatial relationships between geological points unchanged during the conversion process is a challenge, which is crucial for accurately reflecting geological structures.

[0006] 4) Transfer of attribute information. In addition to geometric data, the geological attribute information in AutoCAD (such as rock layer type, physical properties, etc.) also needs to be correctly imported into the 3D model, and information loss or errors may occur during this process.

[0007] The traditional import method is to first import the AutoCAD file into engineering drawing in 3DE, and then import the objects in the engineering drawing into 3D space or 2D sketch. Coordinate translation and data scaling operations etc. also need to be carried out during this process, which not only has a cumbersome operation process but is also extremely error-prone.

[0008] With the rise of big data applications, the application of three-dimensional geological information technology for importing a large amount of data in AutoCAD format is becoming increasingly urgent, and many current popular data conversion methods can no longer meet the needs of industry development and applications.

[0009] Therefore, it is necessary to develop a simple, convenient and highly versatile method for quickly importing AutoCAD file data into 3DE. Summary of the Invention

[0010] The purpose of the present invention is to overcome the deficiencies of the above background art, and provide a method for quickly importing AutoCAD file data into 3DE software.

[0011] To achieve the above purpose, the technical solution of the present invention is: A method for quickly importing AutoCAD file data into 3DE software, which is characterized by including the following steps:

[0012] Step 1: Open the AutoCAD software and the corresponding file from which data needs to be read, and open the 3DE software and the corresponding file into which data needs to be imported.

[0013] Step 2: Create an application program through the development software and establish communication with the AutoCAD program.

[0014] Create a development project based on Windows Form Application using a programming language that supports both AutoCAD and 3DE development, and communicate with AutoCAD through the ActiveX Automation technical standard.

[0015] Step 3: Read the properties of the primitive objects in the AutoCAD file.

[0016] Select the primitive objects to be read in AutoCAD, and respectively read the properties of the line, polyline, circle, arc, and text primitives in the selected objects.

[0017] Step 4: Convert the format of the properties of the primitive objects in AutoCAD.

[0018] Step 5: Convert the coordinate properties of the primitive objects in AutoCAD.

[0019] Step 6: Establish communication with the 3DE program.

[0020] In the development project of the Windows Form Application established in Step 2, communicate with 3DE through the ActiveX Automation technical standard at the same time.

[0021] Step 7: Write the primitive objects in AutoCAD into 3DE according to their properties.

[0022] Call the internal drawing function of 3DE after performing corresponding operations on the property data of the primitive objects read from AutoCAD and processed in Step 4 and Step 5, and write them into the current file of 3DE in sequence.

[0023] Step 8: Develop and package the processes in Step 2 - Step 7 to achieve fast data import.

[0024] In the above technical solution, in Step 2, the programming language that supports both AutoCAD and 3DE development is the Visual C# programming language.

[0025] In the above technical solution, in step 3, the attributes of a straight line include the starting point, the ending point, and the color; the attributes of a polyline include all endpoints, chord ratio, and color; the attributes of a circle include the center, the radius, and the color; the attributes of an arc include the center, the radius, the starting point, and the ending point; the attributes of text include the position, the size, the content, and the color.

[0026] In the above technical solution, in step 4, the attributes of the straight lines, circles, and arcs read from AutoCAD do not need to be converted; the straight lines in the polyline are all converted into continuous straight lines according to the number of segments, and the arc segments therein are converted into arcs; the text is converted into continuous straight lines according to the trajectory of the text; the color attributes of the primitives remain unchanged during the conversion.

[0027] In the above technical solution, in step 5, coordinate transformation is performed on the coordinate data of all primitives read from AutoCAD, including the starting point, the ending point, the endpoints, and the center of the circle, and the given large value is subtracted from the X and Y values respectively.

[0028] In the above technical solution, in step 5, the numerical values of the numerical attributes such as the coordinates and lengths of the primitive objects in AutoCAD are magnified;

[0029] The coordinate data of all primitives read from AutoCAD, including the data of the numerical attributes of the starting point, the ending point, the endpoints, the center of the circle, and the length, and their radii are all magnified by 1000 times, with the coordinate (0, 0) as the base point during the magnification.

[0030] In the above technical solution, in step 2, the process of communicating with AutoCAD through the ActiveX Automation technical standard includes: adding a reference to the class library in the newly created development project, including the AutoCADTypeLibrary class library, adding references to the AutoCAD and System.Runtime.InteropServices assemblies in the main program file, defining an AutoCAD object in the main program file, obtaining a running AutoCAD instance, and then obtaining the current AutoCAD active drawing object, so as to read the primitive data in AutoCAD.

[0031] In the above technical solution, in step 6, the process of communicating with 3DE through the ActiveX Automation technology standard includes: adding a reference to the CATIA COM class library in the newly created development project, including the GSMInterfacesObject Library class library, adding references to assemblies such as INFITF and MECMOD in the main program file, defining a CATIA object in the main program file, obtaining a running 3DE instance, then obtaining the current active document of 3DE, and then determining whether the working object of the current active document is a geometric set. When it is not a geometric set, it is prompted to first create or select a geometric set and set it as the working object.

[0032] In the above technical solution, in step 3, when the object selected in AutoCAD is a 2D polyline or a 3D polyline, it is first converted into a polyline; when the selected object is a block, it is first exploded into individual objects.

[0033] In the above technical solution, in step 4, when converting the polyline data, the head and tail are kept connected; the line segments corresponding to the text trajectory are pre-stored in the database and directly retrieved when needed.

[0034] Compared with the prior art, the present invention has the following advantages:

[0035] 1) When reading the data in the AutoCAD file, the required primitive elements and their attributes can be selected according to the application purpose, and at the same time, operations such as data conversion, scaling, and translation, as well as corresponding format conversion, can be completed according to the requirements of the 3DE software, so as to be directly used in the 3DE software, making the data imported into the 3DE software concise and efficient, without manual conversion and not easy to make mistakes.

[0036] 2) For the data read from the AutoCAD file, in addition to the above simple processing, the data can also be processed according to the characteristics and needs of different industries and projects, the data therein can be freely combined and utilized, or data with special requirements can be added, and the data application has strong scalability and good later compatibility; for example, the flat cut data can be imported according to the elevation, the sectional view can be imported according to the plane where the section line is located and the corresponding elevation, and the curve section can be unfolded, etc.

[0037] 3) The data imported into the 3DE software can be selected to be imported into the three-dimensional space or the two-dimensional sketch, without manual conversion. For example, the terrain point data can be imported into the three-dimensional space, and the plan view, flat cut view, sectional view, etc. can be imported into the two-dimensional sketch; the efficiency of data conversion is significantly improved.

[0038] 4) By taking advantage of the fact that both AutoCAD and 3DE software support ActiveX Automation technology, the present invention can communicate with AutoCAD and 3DE software externally in a newly created application program, thereby operating AutoCAD and 3DE software simultaneously, reading out the data in the AutoCAD file, and directly writing it into the 3DE software after appropriate conversion and processing; for the data read out from AutoCAD, the required primitives and their attributes can be selected according to the application purpose, and at the same time, operations such as data conversion, scaling, and translation can be completed according to the requirements of the 3DE software for direct use in the 3DE software; the present invention establishes a direct connection between AutoCAD software and 3DE software, can customize the content and format of data transmission according to needs, and significantly improves the efficiency of data conversion. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 It is a schematic flowchart of the present invention.

[0040] Figure 2 It is a schematic flowchart of the present invention for converting the arc segments of a polyline in AutoCAD into arcs.

[0041] Figure 3 It is the process of the present invention for translating and magnifying the numerical attribute values of primitive objects in AutoCAD.

[0042] Figure 4 It is the process of the present invention for writing text in AutoCAD into 3DE.

[0043] Figure 5 It is an example diagram of a program developed using Visual C# programming software for application in the field of engineering geological mapping according to the present invention.

[0044] Figure 6 It is an example diagram after importing the AutoCAD file data into 3DE software according to the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0045] The following will describe in detail the implementation of the present invention with reference to the accompanying drawings. However, they do not constitute a limitation to the present invention and are only for illustration purposes. At the same time, the advantages of the present invention will become clearer and easier to understand through the description.

[0046] Referring to the accompanying drawings, a method for quickly importing AutoCAD file data into 3DE software is characterized by including the following steps:

[0047] Step 1, open the AutoCAD software and the corresponding file from which data needs to be read, and open the 3DE software and the corresponding file into which data needs to be imported; after opening the 3DE software, ensure that the logged-in account has write permissions and the current working object should be the geometry set;

[0048] Step 2, create a new application through the development software and establish communication with the AutoCAD program;

[0049] Use the Visual C# programming language or other programming languages that support both AutoCAD and 3DE development to create a development project based on Windows Form Application and communicate with AutoCAD through the ActiveX Automation technology standard;

[0050] The process of communicating with AutoCAD through the ActiveX Automation technology standard includes: adding references to class libraries in the newly created development project, including the AutoCAD Type Library class library, adding references to the AutoCAD and System.Runtime.InteropServices assemblies in the main program file, defining an AutoCAD object in the main program file, obtaining a running AutoCAD instance, and then obtaining the current AutoCAD active drawing object to read the primitive data in AutoCAD.

[0051] Step 3, read the properties of the primitive objects in the AutoCAD file;

[0052] Select the primitive objects to be read in AutoCAD and read the properties of the line, polyline, circle, arc, and text primitives in the selected objects respectively;

[0053] The properties of a line include the start point, end point, and color; the properties of a polyline include all endpoints, chord ratio, and color; the properties of a circle include the center, radius, and color; the properties of text include the position, size, content, and color;

[0054] When the object selected in AutoCAD is a 2D polyline or 3D polyline, first convert it to a polyline; when the selected object is a block, first explode it into individual objects.

[0055] Step 4, convert the format of the properties of the primitive objects in AutoCAD;

[0056] The attributes of the lines and circles read from AutoCAD do not need to be converted; the lines in the polyline are all converted into continuous lines according to the number of segments, and the arc segments are converted into arcs; the text is converted into continuous lines according to the trajectory of the text; the color attributes of the primitives remain unchanged during the conversion; when converting the polyline data, the head and tail are kept connected; the line segments corresponding to the text trajectory are pre-stored in the database and directly retrieved when needed;

[0057] Among them, the method for converting the arc segment into an arc includes the following steps:

[0058] Step S1, solve the distance between the two endpoints of the arc;

[0059] Step S2, solve the radius of the arc;

[0060] Step S3, solve the included angle of the arc;

[0061] Step S4, solve the distance from the midpoint of the two endpoints of the arc to the center of the circle;

[0062] Step S5, calculate the coordinates of the midpoint of the two endpoints of the arc;

[0063] Step S6, calculate the directions of the two endpoints of the arc and the direction of the midpoint radius;

[0064] Step S7, calculate the coordinates of the center of the circle;

[0065] Step S8, calculate the included angles of the two endpoints with the positive direction of the x-axis;

[0066] Step S9, obtain the center coordinates, radius, starting point and ending point radian of the arc.

[0067] Among them, converting the attributes of the text object in AutoCAD into multiple continuous lines includes the following steps:

[0068] Step F1, for common characters, with the lower left corner coordinates X = 0.0 and Y = 0.0, height 1.0, approximately convert the outline trajectory of the text into multiple continuous lines, and establish a corresponding database named after the character name;

[0069] Step F2, read the insertion point of a single character in the text;

[0070] Step F3, read the lines of the corresponding character in the database established in Step F1 according to the character name;

[0071] Step F4, magnify the line endpoint coordinates according to the actual height of the text in AutoCAD, and the magnification factor is the actual height of the text;

[0072] Step F5, convert the lines into actual coordinates according to the insertion point;

[0073] Step F6, repeat the operations of Step F1 - Step F5 for the characters in all texts.

[0074] Step 5.1, convert the coordinate attributes of the primitive objects in AutoCAD.

[0075] Perform coordinate transformation on the coordinate data of all primitives read in AutoCAD, including start points, end points, endpoints, and center points of circles, and subtract a given large value from the X and Y values respectively; for use in 3DE;

[0076] The given large value is determined according to the following principles according to the specific needs during work: when the design range in 3DE is the normal range, it should be ensured that the converted coordinate values X and Y are both within ±1000m; when the design range in 3DE is the large range, it should be ensured that the converted coordinate values X and Y are both within ±1000000m; when the design range in 3DE is the extra-large range, it should be ensured that the converted coordinate values X and Y are both within ±1000000000m;

[0077] Step 5.2, magnify the numerical values of the numerical attributes such as coordinates and lengths of the primitive objects in AutoCAD;

[0078] Magnify all the coordinate data of the primitives read in AutoCAD, including the data of the start points, end points, endpoints, center points of circles and the numerical attributes of lengths, and their radii by 1000 times, with the coordinate (0, 0) as the base point; for matching with the units in 3DE.

[0079] Step 6, establish communication with the 3DE program;

[0080] In the development project of the WindowsFormApplication established in Step 2, communicate with 3DE through the ActiveX Automation technology standard at the same time;

[0081] The process of communicating with 3DE through the ActiveX Automation technology standard includes: adding references to the CATIA COM class libraries in the newly created development project, including the GSMInterfaces Object Library class library, adding references to assemblies such as INFITF and MECMOD in the main program file, defining a CATIA object in the main program file, obtaining a running 3DE instance, then obtaining the current active document in 3DE, and then judging whether the working object of the current active document is a geometric set. When it is not a geometric set, prompt to first establish or select a geometric set and set it as the working object.

[0082] Step 7, write the primitive objects in AutoCAD into 3DE according to their attributes;

[0083] The attribute data of the primitive objects read from AutoCAD and processed in Steps 4 and 5 are, after corresponding calculations, used to call the internal drawing functions of 3DE and are successively written into the current 3DE file;

[0084] When an object in AutoCAD needs to be written into the 3DE three-dimensional space, it can be written directly; when an object in AutoCAD needs to be written into the 3DE sketch space, a new sketch file should be created first or the sketch file to which data needs to be written should be selected and set to the edit state. After the data writing is completed, the sketch is closed;

[0085] Step 8: Develop and encapsulate the process of Steps 2 - 7 to achieve fast data import.

[0086] In actual use, an example of the method for quickly importing a polyline in an AutoCAD file into the 3DE software is as follows:

[0087] Steps 1 - 2 are performed according to the above operations;

[0088] In Step 3, select a polyline that includes only 1 line segment and is a straight line. The coordinates of its first point are X = 3333333.25, Y = 444444.35, and the coordinates of its second point are X = 3333555.45, Y = 444666.55, and the color is white;

[0089] In Step 4, no operation is required;

[0090] In Steps 5.1 - 5.2, if the design range in the current 3DE software is a large range, the large value to be subtracted can be taken as X = 3333000, Y = 444000. After subtracting the large value from all the coordinates of the polyline in Step 3, the coordinates of the first point are X = 333.25, Y = 444.35, and the coordinates of the second point are X = 555.45, Y = 666.55. After magnifying by 1000 times, the coordinates of the first point are X = 333250, Y = 444350, and the coordinates of the second point are X = 555450, Y = 666550;

[0091] Steps 6 - 8 are performed according to the above operations, and this polyline can be quickly imported into the 3DE software.

[0092] Other parts not described belong to the prior art.

Claims

1. A method for quickly importing AutoCAD file data into 3DE software, characterized in that, Including the following steps: Step 1: Open the AutoCAD software and the corresponding file from which data needs to be read, and open the 3DE software and the corresponding file into which data needs to be imported. Step 2: Create an application program through the development software and establish communication with the AutoCAD program. Create a development project based on Windows Form Application using a programming language that supports both AutoCAD and 3DE development, and communicate with AutoCAD through the ActiveX Automation technology standard. Step 3: Read the properties of the primitive objects in the AutoCAD file. Select the primitive objects to be read in AutoCAD, and read the properties of the line, polyline, circle, and text primitives in the selected objects respectively. Step 4: Convert the format of the properties of the primitive objects in AutoCAD. Step 5: Convert the coordinate properties of the primitive objects in AutoCAD. Step 6: Establish communication with the 3DE program. In the development project of the Windows Form Application established in Step 2, communicate with 3DE through the ActiveX Automation technology standard at the same time. Step 7: Write the primitive objects in AutoCAD into 3DE according to their properties. Call the internal drawing function of 3DE after performing corresponding operations on the property data of the primitive objects read from AutoCAD and processed in Step 4 and Step 5, and write them into the current 3DE file in sequence. Step 8: Develop and package the processes in Step 2 - Step 7 to achieve fast data import.

2. A method for quickly importing AutoCAD file data into 3DE software according to claim 1, characterized in that, In Step 2, the programming language that supports both AutoCAD and 3DE development is the Visual C# programming language.

3. A method for quickly importing AutoCAD file data into 3DE software according to claim 1, characterized in that, In Step 3, the properties of a line include the starting point, ending point, and color; the properties of a polyline include all endpoints, chord ratio, and color; the properties of a circle include the center, radius, and color; the properties of an arc include the center, radius, starting point, and ending point; the properties of text include the position, size, content, and color.

4. A method for quickly importing AutoCAD file data into 3DE software according to claim 3, characterized in that, In Step 4, the properties of the lines, circles, and arcs read from AutoCAD do not need to be converted; the lines in the polyline are all converted into continuous lines according to the number of segments, and the arc segments are converted into arcs; the text is converted into continuous lines according to the text trajectory; the color properties of the primitives remain unchanged during the conversion.

5. A method for quickly importing AutoCAD file data into 3DE software according to claim 4, characterized in that, In Step 5, perform coordinate transformation on the coordinate data of all primitives read from AutoCAD, including the starting point, ending point, endpoints, and center, and subtract a given large value from the X and Y values respectively.

6. A method for quickly importing AutoCAD file data into 3DE software according to claim 5, characterized in that, In Step 5, magnify the numerical values of the numerical properties such as coordinates and lengths of the primitive objects in AutoCAD. Magnify all the coordinate data of the primitives read from AutoCAD, including the data of the starting point, ending point, endpoints, center, and length numerical properties, and their radii by 1000 times, with the coordinate (0, 0) as the base point during the magnification.

7. A method for quickly importing AutoCAD file data into 3DE software according to claim 6, characterized in that In step 2, the process of communicating with AutoCAD through the ActiveX Automation technology standard includes: adding references to class libraries in the newly created development project, including the AutoCADTypeLibrary class library, adding references to the AutoCAD and System.Runtime.InteropServices assemblies in the main program file, defining an AutoCAD object in the main program file, obtaining a running instance of AutoCAD, and then obtaining the current active drawing object in AutoCAD, so as to read the primitive data in AutoCAD.

8. A method for quickly importing AutoCAD file data into 3DE software according to claim 7, characterized in that, In step 6, the process of communicating with 3DE through the ActiveX Automation technology standard includes: adding references to the CATIA COM class libraries in the newly created development project, including the GSMInterfaces Object Library class library, adding references to the INFITF and MECMOD assemblies in the main program file, defining a CATIA object in the main program file, obtaining a running instance of 3DE, and then obtaining the current active document in 3DE. Then, it is judged whether the working object of the current active document is a geometric set. When it is not a geometric set, it is prompted to first create or select a geometric set and set it as the working object.

9. A method for quickly importing AutoCAD file data into 3DE software according to claim 3, characterized in that, In step 3, when the object selected in AutoCAD is a 2D polyline or a 3D polyline, it is first converted into a polyline; when the selected object is a block, it is first exploded into individual objects.

10. A method for quickly importing AutoCAD file data into 3DE software according to claim 4, characterized in that, In step 4, when converting the polyline data, the head and tail are kept connected; the line segments corresponding to the text trajectory are pre-stored in the database and directly retrieved when needed.