Digital twin factory layout building method and system based on CAD (Computer Aided Design) data migration
Through the method based on CAD data migration, CAD drawing data is decoded and converted, and the appropriate rendering method is selected, which solves the problems of slow construction of digital twin factory layout, inaccurate position, high rendering pressure, and difficult equipment replacement and adjustment during production replacement, achieving efficient and accurate factory layout construction and rapid production replacement.
Patent Information
- Application Number
- CN202510359621.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2025-06-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the digital twin factory layout is slow, the position is inaccurate, the rendering pressure is high, and the equipment replacement and adjustment is difficult during the production change process.
Using a CAD data migration method, factory drawings are built through drawing software, segments and group codes in DXF files are decoded, data information of multiple CAD types is extracted, and geometric shapes of the three-dimensional rendering engine are converted, and two methods are provided for map rendering and triangular grid rendering. Select the appropriate rendering method according to the data density, generate layout drawings and build a virtual factory.
It improves the efficiency of factory layout construction, ensures the accuracy of layout, reduces rendering pressure, supports rapid production change, and improves the flexibility of factory management.
Smart Images

Figure CN120217706A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of digital twin, and particularly to a method and system for building a digital twin factory layout based on CAD data migration. Background Art
[0002] With the continuous development of industrial Internet technology, digital twin technology has become an important driving force for industrial intelligent transformation. Digital twin factories use digital technology and virtual simulation models to real-time simulate, monitor, and optimize the factory production process, which is of great significance for improving production efficiency and reducing costs. However, in the existing technology, there are still many challenges in building digital twin virtual factories:
[0003] (1) Slow building speed and inaccurate position: Traditional methods rely on the vertical correspondence between devices to drag devices from the model device library for sequential placement, which is not only inefficient but also unable to ensure the accuracy of cross-domain placement, affecting the building speed and accuracy of virtual factories.
[0004] (2) High rendering pressure for drawing models: In a 3D rendering engine, the rendering of a large number of triangular meshes or models brings huge pressure to the GPU, and the corresponding number of points and lines in factory drawings is huge, further exacerbating the rendering burden.
[0005] (3) Difficult equipment replacement and adjustment during product changeover: During the product changeover process, without drawing reference, equipment replacement and adjustment can only rely on manual operation, unable to achieve precise linkage, affecting production efficiency and flexibility. Summary of the Invention
[0006] One object of the present invention is to propose a method for building a digital twin factory layout based on CAD data migration to solve the problems of slow building speed, inaccurate position, high rendering pressure, and difficult equipment replacement and adjustment during product changeover in the existing technology for building digital twin factory layouts.
[0007] Another object of the present invention is to propose a method for building a digital twin factory layout based on CAD data migration, adopting a method for building a digital twin factory layout based on CAD data migration as described above.
[0008] To achieve this purpose, the present invention adopts the following technical solutions:
[0009] A method for building a digital twin factory layout based on CAD data migration includes the following steps:
[0010] S1. Use drawing software to construct a factory drawing and save it as a file in DXF format;
[0011] S2. Decode the segments and group codes in the DXF file, extract various CAD types and corresponding data information, and convert the data information corresponding to the extracted CAD types into geometric shapes of a 3D rendering engine;
[0012] S3. Provide two rendering methods, texture mapping rendering and triangle mesh rendering. Select a single rendering method or a combined rendering method according to the data density of the geometric shape, and summarize the rendered geometric shapes to generate a layout drawing;
[0013] S4. Place the corresponding devices according to the coordinates on the layout drawing to build a virtual factory.
[0014] Preferably, in S2, the various CAD types include lines, arcs, polylines, fills, and blocks, and the data information of the CAD types includes the HEADER segment, ENTITIES segment, TABLES segment, and BLOCKS segment.
[0015] Preferably, in S2, converting the data information of the extracted CAD types into geometric shapes of a 3D rendering engine specifically includes the following steps:
[0016] S21. When traversing the HEADER segment, obtain the drawing unit of the factory drawing and unify it with the unit of the 3D rendering engine;
[0017] S22. When traversing the ENTITIES segment, extract the coordinate data of various CAD types and convert the coordinate data into geometric shapes of the 3D rendering engine;
[0018] S23. When traversing the TABLES segment, obtain the linetype, layer, and text style, and define the material and attributes for the geometric shape;
[0019] S24. When traversing the BLOCKS segment, split the BLOCKS segment into multiple ENTITIES segments, gradually traverse and convert the geometric shapes of each ENTITIES segment, and perform corresponding connection and combination in the 3D rendering engine.
[0020] Preferably, in S22, the extracting the coordinate data of various CAD types and converting the coordinate data into geometric shapes of the 3D rendering engine specifically includes the following steps:
[0021] S221. When the CAD type is a line, obtain the position information through the group code of the line to determine the start point coordinates and end point coordinates of the line, and convert the start point coordinates and end point coordinates into vertex coordinates in the geometric shape. Draw multiple vertex coordinates into a line in the 3D rendering engine to complete the conversion;
[0022] S222. When the CAD type is an arc, obtain the center coordinates, radius, start angle, and end angle through the group code of the arc. Interpolate and discretize according to the start angle and end angle to obtain the coordinates of multiple points on the arc:
[0023] (x,y) = (centerX + radius * cosθ, centerY + radius * sinθ)
[0024] where θ is the interpolation angle;
[0025] Obtain the set of point coordinates of the arc through the above formula and convert them into vertex coordinates in the geometric shape. Draw multiple vertex coordinates into an arc in the 3D rendering engine to complete the conversion;
[0026] S223. When the CAD type is a polyline, split the polyline into multiple line segments, traverse step by step, judge whether the bulge of each line segment is 0 to determine whether the type of the line is a straight line or an arc, and correspondingly convert the geometric shape of each line segment, and perform corresponding connection and combination in the 3D rendering engine:
[0027] When the bulge is 0, it is judged that the line segment is a straight line segment. Obtain the position information through the group code of the straight line segment to determine the start coordinates and end coordinates of the straight line segment, and convert the start coordinates and end coordinates into vertex coordinates in the geometric shape;
[0028] When the bulge is not 0, it is judged that the line segment is an arc segment. If the bulge is less than 0, it is a clockwise arc segment, and if the bulge is greater than 0, it is a counterclockwise arc segment;
[0029] Obtain the start coordinates and end coordinates through the group code of the arc segment;
[0030] Calculate the distance between the start coordinates and the end coordinates and normalize it to obtain the direction vector between the start coordinates and the end coordinates:
[0031]
[0032] Calculate the radian between the start coordinates and the end coordinates:
[0033] α = 4 * tan -1 bulge
[0034] where bulge represents the bulge;
[0035] Calculate the radius and center of the line segment:
[0036]
[0037]
[0038] Calculate the starting angle of the line segment:
[0039]
[0040] Obtain the calculated ending angle of the line segment based on the sum of the starting angle and radian of the line segment;
[0041] Perform interpolation discretization based on the starting angle and ending angle to obtain the coordinates of multiple points on the circular arc:
[0042] (x, y) = (centerX + radius * cosθ, centerY + radius * sinθ)
[0043] where θ is the interpolation angle;
[0044] Obtain the set of point coordinates of the circular arc segment through the above formula and convert them into vertex coordinates in the geometric shape;
[0045] In the 3D rendering engine, draw each vertex coordinate of each line segment into a polyline to complete the conversion.
[0046] Preferably, in S4, the selection of the rendering method according to the data density of the geometric shape specifically includes:
[0047] For geometric shapes of straight lines, circular arcs, and polylines, adopt a single rendering method of triangle mesh rendering;
[0048] For geometric shapes of fills and blocks, adopt a combined rendering method of triangle mesh rendering and texture mapping rendering.
[0049] Preferably, in S4, the texture mapping rendering specifically includes the following steps:
[0050] S411. Obtain the starting coordinate and ending coordinate of each line in the fill, and convert them into UV coordinates in the texture map. The conversion formula is as follows:
[0051] u = x - centerX + width / 2
[0052] v = y - centerY + height / 2
[0053] where width and height respectively represent the width and height of the AABB bounding box of the fill area, and centerX and centerY respectively represent the UV coordinates of the center point of the fill area;
[0054] S412. Output the converted UV coordinates as an image and attach it to a geometric two-dimensional plane with the same width and height as the image to achieve the rendering of the fill part.
[0055] Preferably, in S4, the triangle mesh rendering includes using the filled midpoint coordinate set as the vertex coordinates in the geometric shape, and constructing a shape consistent with the DXF file in the jMonkeyEngine graphics engine, specifically including the following steps:
[0056] S421, vertex processing: using vertex shader to perform coordinate transformation, calculate vertex lighting or transfer data);
[0057] S422, primitive assembly and rasterization: converting the vertex coordinates of the triangle into pixel fragments in screen space;
[0058] S423, fragment processing: using fragment shaders to calculate information including color, texture sampling, and lighting;
[0059] S424, depth test and blending: remove the blocked fragments through the Z-Buffer algorithm and complete the rendering of the filled part.
[0060] A digital twin factory layout construction system based on CAD data migration adopts a digital twin factory layout construction method based on CAD data migration as described above, including:
[0061] Drawing construction module, used to construct factory drawings using drawing software and save them as DXF format files;
[0062] Data migration module, used to decode the segment and group codes in the DXF file, extract various CAD types and corresponding data information, and convert the data information corresponding to the extracted CAD types into geometric shapes for the 3D rendering engine;
[0063] The layout generation module is used to provide two rendering methods: texture rendering and triangle mesh rendering. A single rendering method or a combination of rendering methods is selected according to the data density of the geometric shapes, and the rendered geometric shapes are summarized to generate layout drawings.
[0064] The virtual factory construction module is used to place the corresponding equipment according to the coordinates on the layout drawing and build a virtual factory.
[0065] One of the above technical solutions has the following beneficial effects:
[0066] 1. Improve the efficiency of factory layout construction: Through automated data migration and rendering processes, the time for virtual factory construction is greatly shortened.
[0067] 2. Ensure layout accuracy: Use CAD drawings to perform precise data extraction and conversion to ensure the consistency between the virtual factory layout and the actual factory layout.
[0068] 3. Reduce rendering pressure: Select an appropriate rendering method according to the geometric shape density, effectively reducing the computational pressure during rendering and improving the rendering efficiency.
[0069] 4. Support rapid production changeover: During the production changeover process, simply re-import the new drawing to quickly calibrate the equipment position relationship, realize the visualization of the 2D twin drawing, and provide strong support for rapid production changeover.
[0070] 5. Improve the flexibility of factory management: After the digital twin factory layout is built, operations such as equipment adjustment and layout optimization can be conveniently carried out, improving the flexibility and response speed of factory management. Brief Description of the Drawings
[0071] Figure 1 is a schematic flowchart of the method for building a digital twin factory layout based on CAD data migration of the present invention;
[0072] Figure 2 is a schematic diagram of the definition of the data information of a straight line in the method for building a digital twin factory layout based on CAD data migration of the present invention;
[0073] Figure 3 is a schematic diagram of the definition of the data information of an arc in the method for building a digital twin factory layout based on CAD data migration of the present invention;
[0074] Figure 4 is a schematic diagram of the drawing of a straight line in the method for building a digital twin factory layout based on CAD data migration of the present invention;
[0075] Figure 5 is a schematic diagram of the data information of a straight line in the method for building a digital twin factory layout based on CAD data migration of the present invention;
[0076] Figure 6 is a conversion effect diagram of a straight line in the method for building a digital twin factory layout based on CAD data migration of the present invention;
[0077] Figure 7 is a schematic diagram of the drawing of an arc in the method for building a digital twin factory layout based on CAD data migration of the present invention;
[0078] Figure 8 is a schematic diagram of the data information of an arc in the method for building a digital twin factory layout based on CAD data migration of the present invention;
[0079] Figure 9 is a conversion effect diagram of an arc in the method for building a digital twin factory layout based on CAD data migration of the present invention;
[0080] Figure 10It is a schematic diagram of the polyline drawing in the method for building a digital twin factory layout based on CAD data migration of the present invention;
[0081] Figure 11 It is a schematic diagram of the data information of the polyline in the method for building a digital twin factory layout based on CAD data migration of the present invention;
[0082] Figure 12 It is a conversion effect diagram of the polyline in the method for building a digital twin factory layout based on CAD data migration of the present invention;
[0083] Figure 13 It is a rendering effect diagram of a single rendering method of triangular mesh rendering in the method for building a digital twin factory layout based on CAD data migration of the present invention;
[0084] Figure 14 It is a rendering effect diagram of a combined rendering method of triangular mesh rendering and texture mapping rendering in the method for building a digital twin factory layout based on CAD data migration of the present invention;
[0085] Figure 15 It is an equipment conversion effect diagram of the method for building a digital twin factory layout based on CAD data migration of the present invention. Detailed implementation mode
[0086] The technical solution of the present invention will be further described below with reference to the accompanying drawings and through specific implementation modes.
[0087] In the description of the present invention, it should be understood that the orientation or positional relationship indicated by the terms "center", "longitudinal", "transverse", "length", "width", "thickness", "upper", "lower", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "axial", "radial", "circumferential", etc. is based on the orientation or positional relationship shown in the accompanying drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention.
[0088] In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the present invention, unless otherwise specified, the meaning of "plurality" is two or more.
[0089] In the description of the present invention, it should be noted that unless otherwise clearly specified and defined, the terms "installation", "connection", and "coupling" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a direct connection, or an indirect connection through an intermediate medium, and it can be the communication inside two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0090] As Figures 1 - 15 shown, a method for building a digital twin factory layout based on CAD data migration includes the following steps:
[0091] S1. Use drawing software to construct factory drawings and save them as files in DXF format;
[0092] Specifically, in step S1, professional drawing software such as AutoCAD, SolidWorks, and Zhongwang CAD is mainly used to construct factory drawings according to actual needs. At the same time, set appropriate drawing environments such as units and layers to ensure the accuracy and readability of the drawings. Then save the constructed drawings as DXF format files for subsequent data migration and processing.
[0093] S2. Decode the segments and group codes in the DXF file, extract various CAD types and corresponding data information, and convert the data information corresponding to the extracted CAD types into geometric shapes of a 3D rendering engine;
[0094] Specifically, in step S2, the CAD drawings of the factory are mainly migrated so that the CAD drawings can be correctly presented in the digital twin industrial software, and the positions of the devices are accurately located, thereby ensuring the correctness of the virtual factory construction and the correctness of the factory layout during cross-domain construction.
[0095] S3. Provide two rendering methods, texture mapping rendering and triangle mesh rendering, select a single rendering method or a combined rendering method according to the data density of the geometric shapes, and summarize the rendered geometric shapes to generate layout drawings;
[0096] Specifically, in step S3, a single rendering method or a combined rendering method is mainly selected according to the data density of the geometric shapes, which can reduce the rendering pressure. And summarize the rendered geometric shapes to generate the final layout drawings for subsequent device placement.
[0097] S4. Place the corresponding devices according to the coordinates on the layout drawings to build a virtual factory.
[0098] Specifically, step S4 mainly places the corresponding devices according to the coordinates of the generated layout drawing, which not only realizes the cross-domain construction of the virtual factory but also ensures the correctness of the factory layout. In addition, during the production change process, only the factory drawing of the newly changed production needs to be re-imported to quickly calibrate the positional relationship between various devices.
[0099] In summary, the beneficial effects of the present invention include:
[0100] 1. Improve the efficiency of factory layout construction: By automating the data migration and rendering processes, the time for building the virtual factory is greatly shortened.
[0101] 2. Ensure layout accuracy: Use CAD drawings for precise data extraction and conversion to ensure the consistency between the virtual factory layout and the actual factory layout.
[0102] 3. Reduce rendering pressure: Select an appropriate rendering method according to the geometric shape density, effectively reducing the computational pressure during the rendering process and improving the rendering efficiency.
[0103] 4. Support rapid production change: During the production change process, only by re-importing the new drawing can the positional relationship of the devices be quickly calibrated, realizing the visualization of the 2D twin drawing and providing strong support for rapid production change.
[0104] 5. Enhance the flexibility of factory management: After the digital twin factory layout is built, operations such as device adjustment and layout optimization can be conveniently carried out, improving the flexibility and response speed of factory management.
[0105] Further explanation, in S2, the multiple CAD types include lines, arcs, polylines, fills, and blocks, and the data information of the CAD types includes the HEADER section, ENTITIES section, TABLES section, and BLOCKS section.
[0106] When decoding the sections and group codes in the DXF file, special attention is paid to and the multiple CAD types such as lines, arcs, polylines, fills, and blocks and their corresponding data information are extracted. The information of these CAD types covers the HEADER section (file header information), ENTITIES section (graphical entity information), TABLES section (table information, such as layers, linetypes, etc.), and BLOCKS section (block definition information), as Figure 2 the schematic diagram of the definition of the data information of the line shown and Figure 2 the schematic diagram of the definition of the data information of the arc shown.
[0107] It should be noted that there are more than just these types in CAD. The present invention only lists the relatively common ones, and each type is parsed according to the sections and group codes to extract the composition parameters, that is, the data information, of this type.
[0108] For further illustration, in S2, the extracted CAD type data information is converted into the geometry of a 3D rendering engine, which specifically includes the following steps:
[0109] S21. When traversing to the HEADER section, obtain the drawing unit of the factory drawing and unify it with the unit of the 3D rendering engine; specifically, step S21 is mainly to ensure the accuracy of subsequent data conversion;
[0110] S22. When traversing to the ENTITIES section, extract the coordinate data of multiple CAD types and convert the coordinate data into the geometry of the 3D rendering engine;
[0111] S23. When traversing to the TABLES section, obtain the linetype, layer, and text style, and define the material and properties for the geometry; specifically, step S23 is mainly to present the same effect as the factory drawing in the 3D rendering engine.
[0112] S24. When traversing to the BLOCKS section, split the BLOCKS section into multiple ENTITIES sections, gradually traverse and convert the geometry of each ENTITIES section, and perform corresponding connection and combination in the 3D rendering engine. Specifically, step S24 is to restore the structure and position of CAD types other than straight lines and arcs in the original drawing.
[0113] For further illustration, in S22, the extraction of the coordinate data of multiple CAD types and the conversion of the coordinate data into the geometry of the 3D rendering engine specifically include the following steps:
[0114] S221. When the CAD type is a straight line, obtain the position information through the group code of the straight line to determine the start coordinate and end coordinate of the straight line, and convert the start coordinate and end coordinate into the vertex coordinates in the geometry. Draw multiple vertex coordinates into a line in the 3D rendering engine to complete the conversion;
[0115] As Figures 4 - 6 shown, Figure 4 is a straight line diagram drawn in CAD. After saving it as a DXF file, the data information of the straight line is as Figure 5 shown. Through Figure 5From the DXF file encoding table, it can be obtained that ENTITIES represents the entity section, LINE represents that the entity section is a straight line. The data in the next line of group code 10 is the starting point X coordinate, the data in the next line of group code 20 is the starting point Y coordinate, the data in the next line of group code 30 is the starting point Z coordinate, the data in the next line of group code 11 is the ending point X coordinate, the data in the next line of group code 21 is the ending point Y coordinate, and the data in the next line of group code 31 is the ending point Z coordinate. Therefore, the starting point is (0.0073497241481988, 0.0222291327541981, 0), and the ending point is (1.847113506151856, 0.9558268540650445, 0). After obtaining the starting point coordinates and the ending point coordinates, they are passed into the 3D rendering engine as vertex coordinates to create a geometric shape to display the straight line. The result is as Figure 6 shown.
[0116] S222. When the CAD type is an arc, obtain the center coordinates, radius, start angle, and end angle through the group codes of the arc. Perform interpolation and discretization based on the start angle and the end angle to obtain the coordinates of multiple points on the arc:
[0117] (x,y)=(centerX + radius * cosθ, centerY + radius * sinθ)
[0118] where θ is the interpolation angle;
[0119] Obtain the set of point coordinates of the arc through the above formula and convert them into vertex coordinates in the geometric shape. Draw a series of vertex coordinates as an arc in the 3D rendering engine to complete the conversion;
[0120] As Figures 7 - 9 shown, Figure 7 is the arc diagram drawn in CAD. After saving it as a DXF file, the data information of the arc is as Figure 8 shown. By referring to the Figure 8 DXF file encoding table, it can be obtained that ENTITIES represents the entity section, ARC represents that the entity section is an arc. The data in the next line of group code 10 is the center X coordinate, the data in the next line of group code 20 is the center Y coordinate, the data in the next line of group code 30 is the center Z coordinate, the data in the next line of group code 40 is the arc radius, the data in the next line of group code 50 is the arc start angle, and the data in the next line of group code 51 is the arc end angle. Interpolate the start angle and the end angle, and use the following formula to calculate a series of arc interpolation points:
[0121] (x,y)=(centerX + radius * cosθ, centerY + radius * sinθ)
[0122] After obtaining the coordinates of the interpolation points, use them as vertices and pass them into the 3D rendering engine. Create a geometric shape to connect these point sets into a straight line, and the arc can be displayed. The result is as Figure 9 shown.
[0123] S223. When the CAD type is a polyline, split the polyline into multiple line segments, traverse them step by step, judge whether the bulge of each line segment is 0 to determine whether the type of the line is a straight line or an arc, and correspondingly convert the geometric shape of each line segment, and perform corresponding connection and combination in the 3D rendering engine:
[0124] When the bulge is 0, it is determined that the line segment is a straight line segment. Obtain the position information through the group code of the straight line segment to determine the starting coordinates and ending coordinates of the straight line segment, and convert the starting coordinates and ending coordinates into vertex coordinates in the geometric shape;
[0125] When the bulge is not 0, it is determined that the line segment is an arc segment. When the bulge is less than 0, it is a clockwise arc segment, and when the bulge is greater than 0, it is a counterclockwise arc segment;
[0126] Obtain the starting coordinates and ending coordinates through the group code of the arc segment;
[0127] Calculate the distance between the starting coordinates and the ending coordinates and normalize it to obtain the direction vector between the starting coordinates and the ending coordinates:
[0128]
[0129] Calculate the radian between the starting coordinates and the ending coordinates:
[0130] α = 4 * tan -1 bulge
[0131] where bulge represents the bulge;
[0132] Calculate the radius and center of the line segment:
[0133]
[0134] Calculate the starting angle of the line segment:
[0135]
[0136] Obtain the ending angle of the line segment according to the sum of the starting angle and the radian of the line segment;
[0137] Perform interpolation and discretization according to the starting angle and the ending angle to obtain multiple point coordinates of the arc:
[0138] (x, y) = (centerX + radius * cosθ, centerY + radius * sinθ)
[0139] Among them, θ is the interpolation angle;
[0140] Obtain the set of point coordinates of the arc segment through the above formula and convert it into the vertex coordinates in the geometric shape;
[0141] In the 3D rendering engine, draw each vertex coordinate of each line segment as a polyline to complete the conversion.
[0142] Such as Figures 10 - 12 shown, Figure 10 is the polyline graph drawn in CAD. After saving it as a DXF file, the data information of the polyline is as Figure 11 shown. By referring to the DXF file encoding table of Figure 11 it can be obtained that: Vertex 1: (0.00003315, -0.00008216), straight line segment (no bulge); Vertex 2: (0.0081772, -0.00495366), straight line segment (no bulge); Vertex 3: (0.01460056, -0.00168691), straight line segment (no bulge); Vertex 4: (0.01081538, 0.00169452), bulge 420.682, indicating that it is an arc segment from Vertex 4 to Vertex 5; Vertex 5: (0.00611245, -0.00068395), bulge 420.294, but because the polyline is open, this bulge is invalid, that is, there is no subsequent vertex.
[0143] For a straight line segment, only the starting point coordinates and the ending point coordinates of the straight line need to be recorded. For an arc segment, calculations are required. According to the formula, it can be obtained that:
[0144] α = 137.2°
[0145] r = 0.00285
[0146] (x, y) = (0.0063, 0.0048)
[0147] start = 45.2°
[0148] After obtaining the above parameters, it can be interpolated and analyzed to obtain the set of point coordinates in the same way as the arc analysis. Finally, it is merged with the set of point coordinates of the straight line segment to form the set of point coordinates of the polyline, and these points are passed into the rendering engine as vertices. Creating a geometric shape to connect these point sets into a straight line can display the polyline. The result is as Figure 12 shown.
[0149] For further illustration, in S4, the rendering method is selected according to the data density of the geometric shape, specifically including:
[0150] For geometric shapes of straight lines, arcs, and polylines, a single rendering method of triangular mesh rendering is adopted;
[0151] For the geometry of fills and blocks, a combined rendering method of triangle mesh rendering and texture mapping rendering is adopted.
[0152] For CAD types with a relatively large data density such as fills and blocks, texture mapping technology is used to convert CAD data with a relatively large triangle mesh density into texture mapping rendering, while being compatible with the rendering method of triangle meshes, which can reduce the rendering pressure. See Figure 13 the rendering effect diagram of the single rendering method of triangle mesh rendering shown in Figure 14 and the rendering effect diagram of the combined rendering method of triangle mesh rendering and texture mapping rendering shown in Figure 13 and Figure 14 It can be known from the comparison that:
[0153] Objects represents how many Geometries exist in the scene. The more there are, the more the number of renderings submitted to the GPU, and the greater the pressure.
[0154] Triangles represents the number of triangle meshes in the scene.
[0155] Frams per second represents the frame rate. The full frame is 60 frames. The lower the number of frames, the more laggy it is when moving.
[0156] For further explanation, in S4, the texture mapping rendering specifically includes the following steps:
[0157] S411. Obtain the starting coordinates and ending coordinates of each line in the fill, and convert them into UV coordinates in the texture mapping. The conversion formula is as follows:
[0158] u = x - centerX + width / 2
[0159] v = y - centerY + height / 2
[0160] Among them, widdth and height respectively represent the width and height of the AABB bounding box of the fill area, and centerX and centerY respectively represent the UV coordinates of the center point of the fill area;
[0161] S412. Output the converted UV coordinates as an image, and attach it to a geometric two-dimensional plane with the same width and height as the image to achieve the rendering of the fill part.
[0162] In 3D rendering, the traditional line filling method requires constructing a large number of geometries to depict the outline and internal details of an object. Each line represents an independent geometry. When the number of lines is huge, the amount of data that the rendering engine needs to process will increase sharply, resulting in a decline in performance.
[0163] To solve this problem, the present invention proposes to use texture mapping rendering for visualization. The core idea of this method is to pre-draw the filling pattern that originally needs to be composed of lines into a texture map, and then apply this texture map to the material of the geometric shape. The advantage of this is that by reducing the line processing in the construction and rendering of geometric shapes, texture mapping rendering can significantly improve the rendering efficiency.
[0164] For further illustration, in S4, the triangular mesh rendering includes using the set of filling midpoint coordinates as the vertex coordinates in the geometric shape, and constructing a shape consistent with the DXF file in the jMonkeyEngine graphics engine, specifically including the following steps:
[0165] S421. Vertex processing: Using the vertex shader for coordinate transformation, calculating vertex lighting or transmitting data);
[0166] S422. Primitive assembly and rasterization: Converting the vertex coordinates of the triangle into pixel fragments in screen space;
[0167] S423. Fragment processing: Using the fragment shader to calculate information including color, texture sampling, and lighting;
[0168] S424. Depth testing and blending: Removing the occluded fragments through the Z-Buffer algorithm to complete the rendering of the filled part.
[0169] A digital twin factory layout construction system based on CAD data migration adopts a digital twin factory layout construction method as described above, including:
[0170] A drawing construction module for constructing factory drawings using drawing software and saving them as DXF format files;
[0171] A data migration module for decoding the segments and group codes in the DXF file, extracting various CAD types and corresponding data information, and converting the extracted data information corresponding to the CAD types into geometric shapes of a 3D rendering engine;
[0172] A layout generation module for providing two rendering methods, texture mapping rendering and triangular mesh rendering, selecting a single rendering method or a combined rendering method according to the data density of the geometric shape, and summarizing the rendered geometric shapes to generate layout drawings;
[0173] A virtual factory construction module for placing corresponding devices according to the coordinates on the layout drawing to construct a virtual factory.
[0174] As Figure 15 shown, it is the equipment CAD drawing converted by the present invention and its equipment conversion effect drawing.
[0175] The technical principle of the present invention has been described above in combination with specific embodiments. These descriptions are only for explaining the principle of the present invention and cannot be construed as a limitation on the protection scope of the present invention in any way. Based on the explanations herein, those skilled in the art can readily conceive of other specific embodiments of the present invention without creative efforts, and these equivalent variations or substitutions are all included within the scope defined by the claims of this application.
Claims
1. A method for building a digital twin factory layout based on CAD data migration, characterized in that: The following steps are involved: S1. Use drawing software to construct factory drawings and save them as DXF files; S2, decoding the segment and group codes in the DXF file, extracting multiple CAD types and corresponding data information, and converting the data information corresponding to the extracted CAD types into geometric shapes for a three-dimensional rendering engine; S3. Provide two rendering modes: texture rendering and triangle mesh rendering. Select a single rendering mode or a combination of rendering modes according to the data density of the geometric shapes, and summarize the rendered geometric shapes to generate layout drawings. S4. Place the corresponding equipment according to the coordinates on the layout drawing and build a virtual factory.
2. The method for building a digital twin factory layout based on CAD data migration according to claim 1 is characterized in that: In S2, the multiple CAD types include straight lines, arcs, polylines, fills, and blocks, and the data information of the CAD types includes a HEADER segment, an ENTITIES segment, a TABLES segment, and a BLOCKS segment.
3. The method for building a digital twin factory layout based on CAD data migration according to claim 2 is characterized in that: In S2, the extracted CAD type data information is converted into a geometric shape of a three-dimensional rendering engine, specifically including the following steps: S21. When traversing to the HEADER segment, the drawing unit of the factory drawing is obtained and unified with the unit of the 3D rendering engine; S22, when traversing to the ENTITIES segment, extracting coordinate data of various CAD types, and converting the coordinate data into geometric shapes of a three-dimensional rendering engine; S23, when traversing to the TABLES segment, obtain the line type, layer and text style, and define the material and attributes for the geometric shape; S24. When traversing to the BLOCKS segment, split the BLOCKS segment into multiple ENTITIES segments, gradually traverse and transform the geometric shape of each ENTITIES segment, and perform corresponding connections and combinations in the 3D rendering engine.
4. The method for building a digital twin factory layout based on CAD data migration according to claim 3 is characterized in that: In S22, extracting coordinate data of multiple CAD types and converting the coordinate data into geometric shapes of a three-dimensional rendering engine specifically includes the following steps: S221, when the CAD type is a straight line, obtaining position information through the group code of the straight line to determine the starting point coordinates and the end point coordinates of the straight line, and converting the starting point coordinates and the end point coordinates into vertex coordinates in the geometric shape, and drawing multiple vertex coordinates into a line in the 3D rendering engine to complete the conversion; S222. When the CAD type is an arc, the center coordinates, radius, start angle and end angle are obtained through the arc group code, and interpolation discretization is performed according to the start angle and the end angle to obtain the coordinates of multiple points of the arc: (x,y)=(centerX+radius*cosθ,centerY+radius*sinθ) Where θ is the interpolation angle; The point coordinates of the arc are obtained by the above formula and converted into vertex coordinates in the geometric shape. The multiple vertex coordinates are drawn into an arc in the 3D rendering engine to complete the conversion. S223. When the CAD type is a multi-line segment, the multi-line segment is split into multiple line segments, and the multi-line segment is traversed step by step to determine whether the convexity of each line segment is 0. The line type is a straight line or an arc, and the geometric shape of each line segment is converted accordingly, and the corresponding connection and combination are performed in the 3D rendering engine: When the convexity is 0, the line segment is judged to be a straight line segment, and the position information is obtained through the group code of the straight line segment to determine the starting point coordinates and the end point coordinates of the straight line segment, and the starting point coordinates and the end point coordinates are converted into vertex coordinates in the geometric shape; When the convexity is not 0, the line segment is judged to be an arc segment, and if the convexity is less than 0, it is a clockwise arc segment, and if the convexity is greater than 0, it is a counterclockwise arc segment; Get the starting and ending coordinates through the arc segment group code; Calculate the distance between the starting coordinate and the ending coordinate and normalize it to get the direction vector between the starting coordinate and the ending coordinate: Calculate the distance in radians between the starting and ending coordinates: α=4*tan -1 bulge Among them, bulge represents convexity; Calculate the radius and center of the line segment: Calculate the starting angle of the line segment: The end angle of the line segment is calculated based on the sum of the starting angle and the arc of the line segment; Interpolate and discretize based on the starting angle and the ending angle to obtain the coordinates of multiple points on the arc: (x,y)=(centerX+radius*cosθ,centerY+radius*sinθ) Where, θ is the interpolation angle; The above formula is used to obtain the point coordinate set of the arc segment and convert it into the vertex coordinates in the geometric shape; In the 3D rendering engine, the conversion is completed by drawing the coordinates of each vertex of each line segment into a polyline segment.
5. The method for building a digital twin factory layout based on CAD data migration according to claim 1 is characterized in that: In S4, the selecting of a rendering method according to the data density of the geometric shape specifically includes: For straight lines, arcs, and polylines, a single rendering method using triangular mesh rendering is used; For filled and block geometry, a combination of triangle mesh rendering and texture rendering is used.
6. The method for building a digital twin factory layout based on CAD data migration according to claim 5 is characterized in that: In S4, the texture rendering specifically includes the following steps: S411. Get the starting point coordinates and the ending point coordinates of each line in the filling, and convert them into UV coordinates in the texture. The conversion formula is as follows: u=x-centerX+width / 2 v=y-centerY+height / 2 Among them, width and height represent the width and height of the AABB bounding box of the filling area, centerX and centerY represent the UV coordinates of the center point of the filling area; S412, outputting the converted UV coordinates as an image, attaching the image to a geometric two-dimensional plane having the same width and height as the image, and rendering the filled part.
7. The method for building a digital twin factory layout based on CAD data migration according to claim 5 is characterized in that: In S4, the triangle mesh rendering includes using the filled midpoint coordinate set as the vertex coordinates in the geometric shape, and constructing a shape consistent with the DXF file in the jMonkeyEngine graphics engine, which specifically includes the following steps: S421, vertex processing: using vertex shader to perform coordinate transformation, calculate vertex lighting or transfer data); S422, primitive assembly and rasterization: converting the vertex coordinates of the triangle into pixel fragments in screen space; S423, fragment processing: using fragment shaders to calculate information including color, texture sampling, and lighting; S424, depth test and blending: remove the blocked fragments through the Z-Buffer algorithm and complete the rendering of the filled part.
8. A digital twin factory layout construction system based on CAD data migration, characterized in that: A method for building a digital twin factory layout based on CAD data migration as described in any one of claims 1 to 7 is adopted, comprising: Drawing construction module, used to construct factory drawings using drawing software and save them as DXF format files; Data migration module, used to decode the segment and group codes in the DXF file, extract various CAD types and corresponding data information, and convert the data information corresponding to the extracted CAD types into geometric shapes for the 3D rendering engine; The layout generation module is used to provide two rendering methods: texture rendering and triangle mesh rendering. A single rendering method or a combination of rendering methods is selected according to the data density of the geometric shapes, and the rendered geometric shapes are summarized to generate layout drawings. The virtual factory construction module is used to place the corresponding equipment according to the coordinates on the layout drawing and build a virtual factory.
Citation Information
Patent Citations
Rendering method and device and cloud service
CN114283247A
Quick conversion method and device for three-dimensional model scene data and CAD drawing based on DXF file technology
CN115758494A