Two-dimensional graph output method and device, equipment and medium

Through transformation matrix and edge detection algorithms, the three-dimensional model to two-dimensional wireframes are automatically processed, which solves the problems of low manual processing efficiency and inconsistent standards, and realizes an efficient and standardized printing process.

CN120374908APending Publication Date: 2025-07-25INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510491922.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-18
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

In the prior art, the process of manually processing the three-dimensional product appearance model to the two-dimensional wireframe diagram is inefficient and prone to errors, resulting in inconsistent printing effects.

Method used

The three-dimensional product appearance model is optimized and coordinates are adjusted through the transformation matrix, the edge detection algorithm is used to identify the line types, and the reduction and verification are performed according to priority to ensure compliance with the printed drawing specifications.

Benefits of technology

Automatic, efficient and standardized line processing is achieved, the quality stability and work efficiency of printed products are improved, and each wireframe is ensured that each wireframe complies with printing specifications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120374908A_ABST
    Figure CN120374908A_ABST
Patent Text Reader

Abstract

The invention discloses a two-dimensional graph output method and device, equipment and a medium, and relates to the technical field of data processing, and the method comprises the steps: obtaining a three-dimensional product appearance model; performing optimization and coordinate adjustment on the three-dimensional product appearance model through the transformation matrix, and converting the optimized and adjusted three-dimensional product appearance model into a first wireframe diagram; determining the priority of each line type in the two-dimensional drawing process; performing line identification on the first wireframe diagram through an edge detection algorithm; deleting the lines of the first wireframe diagram according to the identified line types and the priority of each line type in the two-dimensional drawing process to obtain a second wireframe diagram; checking and repairing the second wireframe diagram according to the drawing specification; and outputting the verified and repaired second wireframe diagram as a target two-dimensional graph. The problems that in the prior art, manual line processing efficiency is low, errors are prone to occurring, and standards are not uniform are solved, and printed drawing line processing is more automatic, efficient and standardized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data processing, and in particular, to a two-dimensional graphic output method, device, equipment and medium. Background Art

[0002] In the product design and printing process, engineers usually need to convert the 3D product appearance pictures generated by industrial design 3D software into two-dimensional wireframes suitable for printing. The traditional method is to manually delete the lines in the two-dimensional software to meet the printing drawing specifications. However, this manual operation method is not only inefficient and prone to human errors, but also there may be differences in the operation standards of different engineers, resulting in uneven final printing effects. Therefore, with the increasing growth of product design and printing requirements, there is an urgent need for an efficient method that can automatically identify lines, automatically delete and automatically verify the correctness to meet the printing drawing specifications. Summary of the Invention

[0003] This application provides a two-dimensional graphic output method, device, equipment and medium. The method includes obtaining a three-dimensional product appearance model; optimizing and adjusting the coordinates of the three-dimensional product appearance model through a transformation matrix, and converting the optimized and adjusted three-dimensional product appearance model into a first wireframe; determining the priority of each line type in the two-dimensional drawing process; performing line recognition on the first wireframe through an edge detection algorithm; deleting the lines of the first wireframe according to the recognized line type and the priority of each line type in the two-dimensional drawing process to obtain a second wireframe; checking and repairing the second wireframe according to the two-dimensional drawing specifications; and outputting the second wireframe after verification and repair as a target two-dimensional graphic. This application solves the problems of low efficiency, easy error and inconsistent standards in manual line processing in the prior art, making the line processing for printing drawings more automated, efficient and standardized.

[0004] This application provides a two-dimensional graphic output method, and the method includes:

[0005] Obtaining a three-dimensional product appearance model;

[0006] Optimizing and adjusting the coordinates of the three-dimensional product appearance model through a transformation matrix, and converting the optimized and adjusted three-dimensional product appearance model into a first wireframe;

[0007] Determining the priority of each line type in the two-dimensional drawing process;

[0008] Performing line recognition on the first wireframe through an edge detection algorithm;

[0009] Deleting the lines of the first wireframe according to the recognized line type and the priority of each line type in the two-dimensional drawing process to obtain a second wireframe;

[0010] Inspect and repair the second wireframe diagram according to the 2D drawing specification;

[0011] Output the second wireframe diagram after inspection and repair as the target 2D graphic.

[0012] This application also provides a 2D graphic output device, including:

[0013] An acquisition module, configured to acquire a 3D product appearance model;

[0014] A preprocessing module, configured to optimize and adjust the coordinates of the 3D product appearance model through a transformation matrix, and convert the optimized and adjusted 3D product appearance model into a first wireframe diagram;

[0015] A determination module, configured to determine the priority of each line type during the 2D drawing process;

[0016] A line recognition module, configured to recognize the lines of the first wireframe diagram through an edge detection algorithm;

[0017] An automatic deletion module, configured to delete the lines of the first wireframe diagram according to the recognized line types and the priority of each line type during the 2D drawing process, to obtain a second wireframe diagram;

[0018] An automatic inspection module, configured to inspect and repair the second wireframe diagram according to the 2D drawing specification;

[0019] An output module, configured to output the second wireframe diagram after inspection and repair as the target 2D graphic.

[0020] This application also provides an electronic device, including: a memory, configured to store a computer program; a processor, configured to implement the steps of the 2D graphic output method when executing the computer program, and the method includes:

[0021] Acquire a 3D product appearance model;

[0022] Optimize and adjust the coordinates of the 3D product appearance model through a transformation matrix, and convert the optimized and adjusted 3D product appearance model into a first wireframe diagram;

[0023] Determine the priority of each line type during the 2D drawing process;

[0024] Recognize the lines of the first wireframe diagram through an edge detection algorithm;

[0025] Delete the lines of the first wireframe diagram according to the recognized line types and the priority of each line type during the 2D drawing process, to obtain a second wireframe diagram;

[0026] Inspect and repair the second wireframe diagram according to the 2D drawing specification;

[0027] Output the second wireframe diagram after verification and repair as the target two-dimensional graph.

[0028] This application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the two-dimensional graph output method are implemented. The method includes:

[0029] Obtain a three-dimensional product appearance model;

[0030] Optimize and adjust the coordinates of the three-dimensional product appearance model through a transformation matrix, and convert the optimized and adjusted three-dimensional product appearance model into a first wireframe diagram;

[0031] Determine the priority of each line type in the two-dimensional drawing process;

[0032] Perform line recognition on the first wireframe diagram through an edge detection algorithm;

[0033] Delete the lines of the first wireframe diagram according to the recognized line type and the priority of each line type in the two-dimensional drawing process to obtain a second wireframe diagram;

[0034] Inspect and repair the second wireframe diagram according to the two-dimensional drawing specification;

[0035] Output the second wireframe diagram after verification and repair as the target two-dimensional graph.

[0036] This application also provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of the two-dimensional graph output method are implemented. The method includes:

[0037] Obtain a three-dimensional product appearance model;

[0038] Optimize and adjust the coordinates of the three-dimensional product appearance model through a transformation matrix, and convert the optimized and adjusted three-dimensional product appearance model into a first wireframe diagram;

[0039] Determine the priority of each line type in the two-dimensional drawing process;

[0040] Perform line recognition on the first wireframe diagram through an edge detection algorithm;

[0041] Delete the lines of the first wireframe diagram according to the recognized line type and the priority of each line type in the two-dimensional drawing process to obtain a second wireframe diagram;

[0042] Inspect and repair the second wireframe diagram according to the two-dimensional drawing specification;

[0043] Output the second wireframe diagram after verification and repair as the target two-dimensional graph.

[0044] With this application, since the method includes obtaining a three-dimensional product appearance model; optimizing and adjusting the coordinates of the three-dimensional product appearance model through a transformation matrix, and converting the optimized and adjusted three-dimensional product appearance model into a first wireframe; determining the priority of each line type in the two-dimensional drawing process; performing line recognition on the first wireframe through an edge detection algorithm; deleting the lines of the first wireframe according to the recognized line types and the priority of each line type in the two-dimensional drawing process to obtain a second wireframe; inspecting and repairing the second wireframe according to the two-dimensional drawing specifications; and outputting the inspected and repaired second wireframe as a target two-dimensional graphic. Therefore, this application solves the problems of low efficiency, error-proneness, and inconsistent standards in manual line processing in the prior art, making the line processing for printed drawings more automated, efficient, and standardized.

[0045] The technical solution of this application can be automatically processed and can complete the line processing work of a large number of wireframes in a short time. Compared with manual line processing, the work efficiency is greatly improved; at the same time, it avoids the errors in line deletion caused by manual operations, ensures that each wireframe strictly complies with the printed drawing specifications, and improves the quality stability of printed products; by setting unified drawing rules, the wireframes of different products follow the same standards during the processing, ensuring the standardization of the entire printed drawing process. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] To more clearly illustrate the embodiments of this application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0047] Figure 1 It is the first flowchart of the two-dimensional graphic output method provided by the embodiment of this application;

[0048] Figure 2 It is the second flowchart of the two-dimensional graphic output method provided by the embodiment of this application;

[0049] Figure 3 It is a schematic diagram of converting the front window model of the server into a wireframe provided by the embodiment of this application;

[0050] Figure 4 It is a schematic diagram of the front window wireframe of the 1U server provided by the embodiment of this application;

[0051] Figure 5 It is a schematic diagram of the front window wireframe of the 2U server provided by the embodiment of this application;

[0052] Figure 6Schematic diagram of the front window wireframe of the 4U server provided by the embodiment of the present application;

[0053] Figure 7 The first structure diagram of the two-dimensional graphics output device provided by the embodiment of the present application;

[0054] Figure 8 The second structure diagram of the two-dimensional graphics output device provided by the embodiment of the present application;

[0055] Figure 9 An exemplary system that can be used to implement the various embodiments described in the present application. Detailed implementation manners

[0056] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0057] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0058] In order to enable those skilled in the art of the present technology to better understand the solution of the present application, the present application will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.

[0059] Combined with the specific application environment architecture or specific hardware architecture on which the execution of the two-dimensional graphics output method depends, the specific application environment architecture or specific hardware architecture will be described herein.

[0060] To solve the above problems, the present application proposes an automated line deletion and printing drawing method based on 3D software, which solves the problems of low efficiency, easy error and inconsistent standards in manual line processing in the prior art, and realizes the automation, high efficiency and standardization of line processing for printing drawings.

[0061] The embodiment of the present application provides a two-dimensional graphics output method, as Figure 1 shown, the method includes:

[0062] Obtain a 3D product appearance model;

[0063] Optimize the 3D product appearance model and adjust the coordinates through a transformation matrix, and convert the optimized and adjusted 3D product appearance model into a first wireframe diagram;

[0064] Determine the priority of each line type during the 2D drawing process;

[0065] Perform line recognition on the first wireframe diagram through an edge detection algorithm;

[0066] Delete the lines of the first wireframe diagram according to the recognized line types and the priority of each line type during the 2D drawing process to obtain a second wireframe diagram;

[0067] Inspect and repair the second wireframe diagram according to the 2D drawing specifications;

[0068] Output the second wireframe diagram after inspection and repair as the target 2D graphic.

[0069] It can be understood that the automatic drawing method of the present application can complete the line processing work of a large number of wireframe diagrams in a short time. Compared with manual line processing, the work efficiency is greatly improved; the line deletion errors caused by manual operations are avoided, ensuring that each wireframe diagram strictly complies with the printing drawing specifications, and improving the quality stability of printed products. At the same time, by setting unified rules, the wireframe diagrams of different products follow the same standards during the processing, ensuring the standardization of the entire printing drawing process.

[0070] An embodiment of the present application provides a method for outputting a 2D graphic, as Figure 2 shown, the method includes:

[0071] Step S01, obtain a 3D product appearance model;

[0072] Here, an automated line deletion and printing drawing method based on 3D software is established. This method performs automated line deletion and optimization based on preset rules, meets the printing drawing specifications, and realizes automatic recognition, intelligent deletion, and correctness verification of lines during the 3D to 2D drawing conversion process, thereby simplifying the drawing and printing work processes of engineers and improving efficiency and accuracy.

[0073] Step S02, optimize the 3D product appearance model and adjust the coordinates through a transformation matrix, and convert the optimized and adjusted 3D product appearance model into a first wireframe diagram.

[0074] Specifically, receive the 3D product appearance model file exported by industrial design 3D software. The module supports multiple common 3D file formats (such as OBJ, FBX, STEP, IGES, STL, etc.), and sets the storage repository of the default coordinate axis direction, center point, and unit information in the original software according to the file suffix name; preprocess the 3D product appearance model generated in the industrial design 3D software, including model optimization, coordinate adjustment, etc., to ensure the accuracy of subsequent conversion:

[0075] Perform 3D model format recognition and coordinate axis information extraction. Accurately extract the original coordinate axis definition information of the model through the imported file format. For example, if the imported 3D file format is FBX, by reading the suffix of the FBX file, find the node storing the coordinate axis information, and extract that the coordinate axis direction of the model in the original 3D software is X-axis to the right, Y-axis up, Z-axis forward, the origin position is the geometric center of the model itself, and the original unit is inches.

[0076] Step S021, obtain the rotation matrix R, translation matrix T, and scaling matrix S;

[0077] Combine the matrices in the order of scaling first, then rotation, and finally translation to generate the transformation matrix M, where the transformation matrix M = S × R × T;

[0078] Optimize the 3D product appearance model according to the transformation matrix;

[0079] Adjust the coordinates of each vertex of the optimized 3D product appearance model according to the transformation matrix.

[0080] Specifically, information matching and calculation are performed: In the target system, the direction of the target coordinate axes is set as the X-axis forward, the Y-axis upward, and the Z-axis to the right, and the target origin position is the absolute center of the scene, with the unit being centimeters; the extracted original coordinate axis information of the model is compared with the rules set in the target system; for the FBX file read above, it is calculated that its X-axis needs to be rotated by 90 degrees, the Y-axis direction remains unchanged, the Z-axis needs to be reversed, and the model needs to be translated in the X, Y, and Z directions so that its origin coincides with the center of the scene. At the same time, unit conversion is also required, from inches to centimeters; according to the obtained difference parameters, the transformation matrix is calculated using the matrix transformation formula; for the rotation operation, a rotation matrix R is constructed according to the rotation angle. When the rotation matrix R is applied to the vertex coordinates of an object, these vertices will be rotated by the specified angle; for the translation operation, a translation matrix T is constructed, which contains the distances moved along the x, y, and z axes. When the translation matrix T is applied to the vertex coordinates of an object, these vertices will move by the specified distances; for the unit conversion, a scaling matrix S is constructed, which contains the scaling values along the x, y, and z axes. When the scaling matrix S is applied to the vertex coordinates of an object, these vertices will be enlarged or reduced by the specified values; generally, when an original model is imported into the target system, multiple transformations need to be applied. Therefore, the above transformation matrices, the rotation matrix R, the translation matrix T, and the scaling matrix S are combined in the order of first scaling, then rotation, and finally translation according to the rule to form a final transformation matrix M = S × R × T.

[0081] Perform transformation and complete the optimization of the model wireframe and coordinate adjustment: According to the calculated transformation matrix M, transform the vertex coordinates of each model; for a vertex coordinate P(x, y, z) in the model, the transformed coordinate P'(x', y', z') = M × P. Corresponding transformations are also performed on the normal direction and texture coordinate related geometric information of the model to ensure that after the model is imported into the target system, the coordinate axes are consistent with the rules set by the engineer, and the appearance and shape of the model remain unchanged; as Figure 3 shown, during the process of importing and converting the model into a wireframe, the engineer can see in real time that the model is loaded into the scene of the target system in the correct coordinate axis posture, and finally a wireframe is formed.

[0082] The naming rules for the wireframe are specified as follows: As Figure 4 shown, the wireframe of the server front window Figure 1 U server is named F1U. As Figure 5 shown, the wireframe of the server front window Figure 2 U server is named F2U. As Figure 6 shown, the wireframe of the server front window Figure 4 U server is named F4U; the wireframe of the server rear window Figure 1 U server is named H1U, and the wireframe of the server rear window Figure 2The U server is named H2U, and the wireframe of the rear window of the server Figure 4 The U server is named H4U; the left visual line frame of the server Figure 1 The U server is named Z1U, and the left visual line frame of the server Figure 2 The U server is named Z2U, and the left visual line frame of the server Figure 4 The U server is named Z4U; the right visual line frame of the server Figure 1 The U server is named Y1U, and the right visual line frame of the server Figure 2 The U server is named Y2U, and the right visual line frame of the server Figure 4 The U server is named Y4U; the top-down visual line frame of the server Figure 1 The U server is named F1U, and the top-down visual line frame of the server Figure 2 The U server is named F2U, and the top-down visual line frame of the server Figure 4 The U server is named F4U, etc. Save them as corresponding file names according to the naming rules. For example, the wireframe of the front window of the server Figure 2 The U server defines the file name as F2U according to the naming rules and saves it.

[0083] Step S03, set the width range of the outline line, auxiliary line, and dimension line

[0084] Set the width of the auxiliary line to be less than the width of the dimension line and less than the width of the outline line

[0085] Set the colors and color values of the outline line, auxiliary line, and dimension line

[0086] Specifically, it records the line recognition rules related to the printing drawing specifications preset in the system, including the thickness, color, type of the lines, and the priority of different lines in printing, etc.; it is stipulated that the outline line must be retained and the line thickness should be within the rule range. Specifically as follows

[0087] The line type and thickness rules pre-set the standard range of thickness for different types of lines; the contour line is a, which constitutes the boundary line of the model wireframe shape, such as the contour line of the server front window F2U that constitutes the main structure, which must be retained and the line thickness must be within the specified range a = Amm-Bmm, and the unit must be accurate to millimeters to ensure the clear expression of the product shape; this range can ensure that the contour line is eye-catching enough on the drawing, and will not cover other detailed information on the drawing due to being too thick, or appear broken or blurred during the printing process due to being too thin; the auxiliary line is b, which constitutes the secondary structural line in the model wireframe diagram, such as the line generated by the internal structure of the server front window body, the line thickness must be within the specified range b = Cmm-Dmm, and at the same time meet the line thickness Cmm-Dmm <Emm-Fmm;标注线为c,用于指示尺寸、角度或其他标注信息的线条,线条粗细需在规定范围c=Emm-Fmm之间,并且同时满足Cmm-Dmm<Emm-Fmm<Amm-Bmm。

[0088] Line color rules define rules for different types of line colors and color values; contour line a uses black 1, and the color value of black 1 is set to RGB (0,0,0), because black 1 has a higher contrast and can form a sharp contrast with the background color of the drawing, thereby highlighting the outline of the product; auxiliary line b uses gray 2, and the color value of gray 2 is RGB (50,50,50); annotation line c uses blue 3, and the color value of blue 3 is RGB (135,206,250). Such colors are relatively soft and will not interfere with the observation of contour lines and auxiliary lines, while being clearly distinguishable when needed; for example, in the server front window wireframe F2U, the outline of the front window uses black 1, the lines generated inside the front window outline use gray 2, and the auxiliary lines used to mark the length, width and height of the front window use blue 3.

[0089] Step S04, determining the priority of each line type in the two-dimensional drawing process.

[0090] Step S041, setting the line type in the target two-dimensional figure, the line type includes contour line, auxiliary line and annotation line; setting the priority of contour line processing to the highest and the priority of annotation line processing to the lowest.

[0091] Specifically, for the line priority rules, the system sets different priorities for different types of lines during the printing process; the outline line a has the highest priority, with a level of 10. In any case, the outline line is preferentially recognized and retained. The system will first ensure the integrity and accuracy of the outline line, and conduct strict recognition and verification on it; only after the outline line is correctly processed, will other types of lines be processed in the order of priority. The auxiliary line b has a lower priority than the outline line, with a level of 9, and is automatically adjusted based on the complexity and clarity requirements of the model on the basis of meeting the product shape; the annotation line c has the lowest priority, with a level of 8. The annotation line is usually a line used by engineers to mark dimensions or angles, and generally does not need to be printed and presented to the user. Therefore, in the automatic deletion module, the annotation line c is selectively deleted according to the system rules; for example, when there are too many auxiliary lines b in the internal structure of the front window wireframe of the server, resulting in crowded, overlapping, and intersecting lines, the system will automatically delete those auxiliary lines that have less impact on the expression of the model shape according to the pre-set rules to ensure the overall clarity and readability of the wireframe.

[0092] Step S05, perform line recognition on the first wireframe through an edge detection algorithm.

[0093] Step S051, obtain the gray-scale change rate of each pixel point in the horizontal direction in the first wireframe, and obtain the gray-scale change rate of each pixel point in the vertical direction in the first wireframe;

[0094] Calculate the gray-scale change rate of each pixel point in the first wireframe according to the gray-scale change rate of each pixel point in the horizontal and vertical directions in the first wireframe and the Pythagorean theorem;

[0095] Judge the gray-scale change rate of each pixel point in the first wireframe;

[0096] When the gray-scale change rate of the pixel point in the first wireframe is greater than the first threshold, then the pixel point is an outline line;

[0097] When the gray-scale change rate of the pixel point in the first wireframe is less than the second threshold, then the pixel point is an auxiliary line;

[0098] When the gray-scale change rate of the pixel point in the first wireframe is between the first threshold and the second threshold, then the pixel point is an annotation line.

[0099] Specifically, according to the set rules, automatically recognize the lines in the picture through an edge detection algorithm, as follows:

[0100] The differential method is used to calculate the gray-scale change rate of each pixel point to determine which pixel points are on the edge. For example, for the model image f(x, y), the first-order difference in the horizontal direction x is represented by f(x + 1, y) - f(x, y), and the first-order difference in the vertical direction y is represented by f(x, y + 1) - f(x, y). In this way, the gray-scale change rate of each pixel point in the horizontal and vertical directions can be obtained, and then the gradient magnitude of the pixel point, that is, the magnitude of the gray-scale change rate, can be calculated according to the Pythagorean theorem.

[0101] A threshold rule is set. The high threshold is G = d, and the low threshold is H = e, which is used to determine whether a pixel point belongs to the edge. After calculating the gray-scale change rate of each pixel point, it is compared with the preset threshold. If the gray-scale change rate of the pixel point is greater than the first threshold G, then the pixel point is considered an edge pixel point, that is, the contour line a; if it is less than the second threshold H, it is considered a non-edge pixel point, that is, the auxiliary line b; and the pixel points e < X < d between the first threshold G and the second threshold H are considered the marking line c.

[0102] Among them, the first threshold is 100; the second threshold is 20.

[0103] It can be understood that assuming the set high threshold G = d = 100 and the low threshold H = e = 20; now there are three pixel points A, B, and C, and the corresponding gray-scale change rates are calculated respectively: the gray-scale change rate of pixel point A is calculated to be 120. Since 120 > 100 (i.e., 120 > G), pixel point A is considered an edge pixel point, that is, it belongs to the contour line a; the gray-scale change rate of pixel point B is calculated to be 10. Since 10 < 20 (i.e., 10 < H), pixel point B is considered a non-edge pixel point, that is, it belongs to the auxiliary line b; the gray-scale change rate of pixel point C is calculated to be 50. Since 20 < 50 < 100 (i.e., H < 50 < G, e < 50 < d), pixel point C is in the situation between the two and belongs to the marking line c.

[0104] At the same time, a connection rule is set. After determining the pixel point type, the contour structure of the model is recognized based on the adjacency relationship between pixel points and the continuity of gray-scale changes, and the model contour and important structures are extracted in the form of lines; for example, after a pixel point is determined to be an edge pixel point, its adjacent pixel points will be checked. If the gray-scale change rates of the adjacent pixel points also meet the same conditions, they will be connected to outline the contour structure of the model.

[0105] Step S06, check the recognized lines according to the line color and width;

[0106] Checking the recognized lines according to the line color and width includes:

[0107] Determine whether the recognized line color and width range are consistent with the set line color and width range;

[0108] If so, delete the lines of the first wireframe according to the recognized line type and the priority of different line types in the 2D drawing process; if not, re-recognize the lines of the first wireframe through the edge detection algorithm.

[0109] Specifically, set the line type inspection rules. After the line recognition is completed, it will check whether the line type is correct according to the line color and thickness characteristics. If the data does not match, the line recognition will be performed again; for example, when the contour line a is recognized (black 1 RGB(0, 0, 0), line thickness a = A mm - B mm), the system will automatically check the line color and thickness of the contour line a according to the rules set by the rule setting module. When it matches that the color of the contour line a is black 1 RGB(0, 0, 0) and the line thickness a = A mm - B mm, and the recognition result is consistent with the inspection result, this line must be the contour line, and the system will enter the automatic deletion mode; if the contour line a is recognized and it matches that the color of the contour line a is gray 2 RGB(50, 50, 50) and the line thickness a = A mm - B mm, and the recognition result is inconsistent with the inspection result, the system will return for re-recognition.

[0110] Step S07, delete the lines of the first wireframe according to the recognized line type and the priority of each line type in the 2D drawing process to obtain the second wireframe.

[0111] Specifically, automatically delete the lines of the first wireframe according to the recognized line type and the set priority; for the lines with low priority and no key role in expressing the product shape, the system automatically deletes them to simplify the wireframe and meet the simplicity requirements of printing and drawing.

[0112] Step S071, delete the dimension lines of the first wireframe according to the priority of each line type in the 2D drawing process, and retain the contour lines of the first wireframe;

[0113] Reconstruct the shape of the product model according to the recognized contour lines and auxiliary lines to obtain the reconstructed contour;

[0114] Match the similarity between the reconstructed contour and the contour of the first wireframe;

[0115] Set the shape threshold, size threshold, and direction threshold through the contour comparison algorithm;

[0116] Calculate the similarity value between the reconstructed contour and the contour of the first wireframe through the contour comparison algorithm;

[0117] Determine whether the similarity values between the reconstructed contour and the contour of the first wireframe are all higher than the shape threshold, size threshold, and direction threshold;

[0118] If so, delete the auxiliary lines of the first wireframe; if not, retain the auxiliary lines of the first wireframe.

[0119] Meanwhile, conduct a shape reconstruction analysis on the model. For each identified line, according to the line priority order set in the rules, the priority level of the contour line a is the highest at level 10, the priority level of the auxiliary line b is lower than that of the contour line at level 9, and the priority level of the annotation line c is the lowest at level 8. Then, the identified annotation line c will be automatically deleted by the system, and the remaining lines will be used for the reconstruction of the product shape. After the shape is reconstructed, the contour similarity and key dimension deviation between the reconstructed shape and the original shape are matched. According to the line recognition module, the contour a1 of the model is extracted from the original design data (the first wireframe), and the corresponding contour a2 is extracted from the reconstructed model. The contour a2 of the reconstructed shape is aligned with the contour a1 of the original shape in terms of the picture lines. The contour comparison algorithm is used to set the shape threshold as K (0.8), the size threshold as L (0.9), and the direction threshold as M (0.85). If the calculated similarity values are all higher than the thresholds K, L, and M, it is considered that the reconstructed shape and the original shape have a high similarity in terms of the contour, and there are no differences in the key parts between the reconstructed shape and the original shape. Then, it is considered that this line has no key role in expressing the product shape, that is, it can be deleted; after deleting the annotation line c according to the priority recognition, the system will automatically delete the identified auxiliary line b. If there are significant differences in the key parts between the reconstructed contour shape and the original contour shape after deleting a certain auxiliary line b, it is considered that this line has a key role in expressing the product shape, and it is determined that it cannot be deleted; the priority level of the contour line a is the highest at level 10, and all the identified contour lines a will be retained without deletion operations.

[0120] Among them, the contour comparison algorithm is a class of methods in computer vision and image processing for comparing the similarity of two shape contours.

[0121] It can be understood that assume the following lines are identified: there are 3 contour lines a, marked as a1, a2, and a3 respectively; there are 4 auxiliary lines b, marked as b1, b2, b3, and b4 respectively; there are 2 annotation lines c, marked as c1 and c2 respectively; according to the rules, the priority level of the contour line a is 10, the priority level of the auxiliary line b is 9, and the priority level of the annotation line c is 8; the system will automatically delete the identified annotation lines c1 and c2; the rule setting module sets the following thresholds: the shape threshold K = 0.8, indicating that the similarity reaches more than 80%; the size threshold L = 0.9, indicating that the size deviation is within 10%; the direction threshold M = 0.85, indicating that the direction deviation is within 15%.

[0122] According to the first reconstruction and comparison of the rule system, the system uses the remaining line outlines a1, a2, a3 and auxiliary lines b1, b2, b3, b4 to reconstruct the shape of the product, obtaining the reconstructed shape; the outline a1 of the model is extracted from the original design data, and the corresponding outline a2 is extracted from the reconstructed model. Through the contour comparison algorithm, it is calculated that: the shape similarity is 0.85, higher than the shape threshold K = 0.8; the size similarity is 0.92, higher than the size threshold L = 0.9; the direction similarity is 0.88, higher than the direction threshold M = 0.85; the calculated similarities are all higher than the thresholds K, L, M. The system believes that the reconstructed shape and the original shape have a high similarity in contour, and there are no differences in the key parts between the reconstructed shape and the original shape; this means that the current auxiliary lines have no key role in expressing the product shape and can be considered for deletion.

[0123] According to the second deletion and judgment of the rule system, the system will automatically attempt to delete the identified auxiliary lines; first, attempt to delete b1, and perform shape reconstruction and comparison again; the calculated shape similarity is 0.7, lower than the shape threshold K = 0.8, indicating that after deleting b1, there are significant differences in the key parts between the reconstructed shape and the original shape. Therefore, it is determined that b1 has a key role in expressing the product shape and cannot be deleted; then, attempt to delete b2. After reconstruction, the calculated shape similarity is 0.82, the size similarity is 0.93, and the direction similarity is 0.87, all higher than the corresponding thresholds, indicating that after deleting b2, there are no obvious differences in the key parts between the reconstructed shape and the original shape. It is determined that b2 has no key role in expressing the product shape and can be deleted; judge b3 and b4 in the same way. Assume that b3 can be deleted and b4 cannot be deleted; the finally retained lines are the outline lines a1, a2, a3, because the outline line a has the highest priority and no deletion operation is performed.

[0124] At the same time, perform line deletion and backup on the model. Identify all the lines in the model in ascending order of priority. For each low-priority line, first perform shape reconstruction analysis to determine whether it has a key role in expressing the product shape; if the deletion condition is met, delete the line from the wireframe; if not, retain the line; after deleting the line, the system automatically updates the relevant data structures of the first wireframe, such as the line list, topology graph, etc., for subsequent analysis. Before each line deletion operation, the system automatically creates a backup version of the wireframe and stores the complete state of the current wireframe in a specific version library. If it is found later that deleting certain lines affects the understanding of the product or the design requirements, a historical version recovery function can be provided to restore the wireframe to the state before the deletion operation. The maximum number of backups is 10, and if it exceeds 10, the earliest version will be automatically replaced. At the same time, record the historical information of the deleted lines, including the line type, location, etc., for viewing and tracing.

[0125] Step S08: Inspect and repair the second wireframe diagram according to the drawing specifications.

[0126] After the line deletion is completed, check the correctness of the processed second wireframe diagram according to the printing drawing specifications; check whether there are problems such as missing key contour lines in the wireframe diagram and whether the connections at the line intersections are correct; if problems are found, the system automatically marks and prompts the engineer to make corrections.

[0127] Step S081: Verify and repair the integrity of the contour lines of the second wireframe diagram;

[0128] Verify and repair the integrity of the contour lines of the second wireframe diagram, including:

[0129] Obtain each contour line of the preset wireframe diagram;

[0130] Calculate the similarity between each contour line in the second wireframe diagram and each contour line in the preset wireframe diagram through an image matching algorithm;

[0131] When the similarity between each contour line in the second wireframe diagram and each contour line in the preset wireframe diagram is less than the third threshold, automatically repair each contour line in the second wireframe diagram;

[0132] Automatically repair each contour line in the second wireframe diagram, including:

[0133] When a contour line is missing in the second wireframe diagram, generate corresponding lines to fill in the missing positions of the contour lines in the second wireframe diagram according to the position and shape information of the corresponding missing contour lines in the preset wireframe diagram through an image interpolation algorithm;

[0134] When the missing contour lines in the second wireframe diagram involve multiple discontinuous regions, extract the contour lines of the corresponding missing parts from the preset wireframe diagram according to the style of the second wireframe diagram, and embed the contour lines of the missing parts into the missing positions of the second wireframe diagram according to the overall coordinate system of the second wireframe diagram.

[0135] Specifically, check the integrity of the key contour lines: Store the standard templates (preset wireframe diagrams) of the key contour lines of various product wireframe diagrams in advance according to common printing drawing specifications. The standard templates not only define the style of the wireframe diagram but also set detailed naming rules. Read the standard templates in the repository through image recognition and naming calls. Examples of standard template rules are attached Figure 4 Appendix Figure 5 Appendix Figure 6: During inspection, when the name of the generated wireframe is F2U, the system reads the standard template F2U with a matching name from the repository and compares the processed wireframe with these standard templates; through an image matching algorithm, it calculates the similarity between each line in the wireframe and the contour lines of the standard template; if the similarity is less than the third threshold N, it is determined that there is a problem of missing key contour lines, and the system will perform the above matching operations on each type of line in order of priority from high to low.

[0136] Among them, the third threshold is 0.7.

[0137] Automatically repair the missing key contour lines: When a missing key contour line is detected, refer to the position and shape information of the missing contour line in the standard template. If the missing part is a continuous line segment, use the image interpolation algorithm. According to the existing line information around it, for example, in the wireframe F2U of the server front window, one side at the bottom of contour a is missing. First, obtain the missing side, that is, the lower coordinates of the left and right sides. The lower left endpoint coordinate is (x1, y1) and the lower right endpoint coordinate is (x2, y2). For a certain point x (x1 < x < x2) in the middle of the missing bottom side, its corresponding y coordinate is y = y1 + (y2 - y1 / x2 - x1) × (x - x1). By calculating a series of such points, reasonable lines are generated at the missing position to fill the gap; if the missing part is more complex and involves multiple discontinuous regions, the system will extract the contour lines of the corresponding missing part from the standard template according to the wireframe style and naming rules, and accurately embed them into the missing position of the second wireframe according to the overall coordinate system of the second wireframe, and at the same time smooth the embedded lines and the original lines around them to ensure the coherence of the overall visual effect.

[0138] It can be understood that taking the product F2U as an example, its standard template defines the style of the wireframe. For example, there are 5 key contour lines, named L1, L2, L3, L4, L5 respectively, and detailed attributes such as the length and angle of these lines are set; after the system reads the name F2U of the generated second wireframe, it extracts the standard template F2U with a matching name from the repository. There are also 5 lines in the processed second wireframe, named l1, l2, l3, l4, l5 respectively; through the image matching algorithm, calculate the similarity between each line and the standard contour line: the similarity calculation result of line l1 and standard contour line L1 is 0.9, the similarity calculation result of line l2 and standard contour line L2 is 0.85, the similarity calculation result of line l3 and standard contour line L3 is 0.6 (less than the third threshold), the similarity calculation result of line l4 and standard contour line L4 is 0.92, and the similarity calculation result of line l5 and standard contour line L5 is 0.88.

[0139] The third threshold N = 0.7. Since the similarity between the line l3 and the standard contour line L3 is 0.6, which is less than the set threshold N = 0.7, it is determined that there is a problem of missing key contour lines. It is stipulated that the priority of line types for contour lines L1, L2, L4, and L5 is 10, and the priority of contour line L3 is 8. The system will perform the above matching operations on each type of line from high to low according to the line type priority. First, calculate the similarity of contour lines L1, L2, L4, and L5 with a priority of 10 and compare it with the set threshold, and then perform related operations on contour line L3 with a priority of 8.

[0140] Step S082, check and repair the connection correctness at the intersections of the lines in the second wireframe diagram;

[0141] Checking and repairing the connection correctness at the intersections of the lines in the second wireframe diagram includes:

[0142] Obtain the endpoint coordinates of all the lines in the second wireframe diagram;

[0143] Obtain the tolerance of the spatial distance between adjacent line endpoints and the included angle between adjacent lines based on the endpoint coordinates of all the lines in the second wireframe diagram;

[0144] When the tolerance of the spatial distance between adjacent line endpoints is greater than or equal to the fourth threshold or the included angle between adjacent lines is not within the fifth threshold, automatically repair the connection errors at the intersections of the lines in the second wireframe diagram;

[0145] Automatically repairing the connection errors at the intersections of the lines in the second wireframe diagram includes:

[0146] Obtain the tangent vector V1 of the first quadratic Bezier curve (the first curve) at the line intersection point, and obtain the tangent vector V2 of the second quadratic Bezier curve (the second curve) at the line intersection point;

[0147] Calculate the included angle θ between the first quadratic Bezier curve and the second quadratic Bezier curve through the formula: cosθ = (V1·V2) / (∣V1∣∣V2∣);

[0148] Judge whether the included angle θ between the first quadratic Bezier curve and the second quadratic Bezier curve is within the fifth threshold;

[0149] If so, the connection at the line intersection is correct; if not, repeatedly calculate the curve included angle and continue to adjust the control point positions of the quadratic Bezier curve until the included angle θ between the first quadratic Bezier curve and the second quadratic Bezier curve is within the fifth threshold;

[0150] When there are multiple line connection errors at the intersections of the quadratic Bezier curves, repair the line connection errors at the intersections of the quadratic Bezier curves according to the priorities of the contour lines, auxiliary lines, and annotation lines.

[0151] Specifically, check the correctness of the connection at the line intersections: Use the endpoint information of the lines to judge the connection situation at the intersections. It is stipulated that the spatial distance tolerance between adjacent line endpoints is O, where tolerance O < 5 (the fourth threshold), with the unit being pixels, and the included angle is Q, and the specified angle range is between 60° - 120° (the fifth threshold); The system first identifies the endpoint coordinates of all lines in the wireframe. For adjacent line endpoints, if the spatial distance tolerance range O is less than 5 pixels and the line included angle Q is between 60° - 120°, it is considered that the connection at this intersection is correct; otherwise, it is determined as a connection error.

[0152] Automatically repair the connection errors at the line intersections: For the line intersections with connection errors, adjust the endpoints according to the correct connection specifications; If the distance between the endpoints of two lines is too close but the included angle is unreasonable, move the endpoint of one of the lines to make the included angle meet the specification requirements while keeping the overall shape and length of the line as unchanged as possible; Suppose the two intersecting quadratic Bézier curves are C1 and C2 respectively. The starting point of C1 is P 01 , the control point is P 11 , and the ending point is P 21 ; The starting point of C2 is P 02 , the control point is P 12 , and the ending point is P 22 ; First, calculate the tangent directions of the two curves at the intersection point to determine the current included angle; For the quadratic Bézier curve C(t) = (1 - t) 2 P0 + 2t(1 - t)P1 + t 2 P2, its tangent vector is the derivative formula: C′(t) = 2(1 - t)(P1 - P0) + 2t(P2 - P1). Substitute the t value at the intersection point, which can be obtained by solving the intersection equation of the two curves, into the derivative formula to get the tangent vectors v1 and v2 of the two curves at the intersection point; Then calculate the current included angle θ1 according to the formula cosθ = (V1·V2) / (∣v1∣∣v2∣), and automatically adjust according to the included angle rule Q = 60° - 120°, calculate the new control point position, and regenerate the Bézier curve to ensure the smoothness of the line during the adjustment process; The system will use the new control point P 13 to regenerate the quadratic Bézier curve C3, calculate the tangent direction and included angle θ2 of the two curves at the intersection point again, compare θ2 with the included angle Q = 60° - 120°. If the requirement is not met, repeat the calculation and continuously adjust the control point position until the included angle meets the specification requirements; If there are multiple lines with connection errors at the intersection, the system will gradually analyze the correct connection relationships between the lines and adjust the endpoint positions in order of priority. First, process the connections between the main contour lines a, then process the auxiliary lines b and the annotation lines c. The system will automatically identify and delete them according to the rule setting module, line recognition module, and automatic inspection module, and finally make the connection at the intersection meet the printing drawing specification.

[0153] It is understandable that the parameters of two intersecting quadratic Bézier curves C1 and C2 are as follows: The starting point P01 of curve C1 is (0, 0), the control point P11 is (2, 5), and the ending point P21 is (5, 0); the starting point P02 of curve C2 is (5, 5), the control point P12 is (3, 2), and the ending point P22 is (0, 5).

[0154] By solving the intersection equation of the two curves, it is assumed that the parameter t1 of C1 at the intersection point is 0.6, and the parameter t2 of C2 is 0.4; for the quadratic Bézier curve C(t) = (1 - t)^2P0 + 2t(1 - t)P1 + t^2P2, its derivative formula is C′(t) = 2(1 - t)(P1 - P0) + 2t(P2 - P1).

[0155] Calculate the tangent vector v1 of C1 at t = 0.6: P11 - P01 = (2, 5) - (0, 0) = (2, 5), P21 - P11 = (5, 0) - (2, 5) = (3, -5).

[0156] C1′(0.6) = 2×(1 - 0.6)×(2, 5) + 2×0.6×(3, -5) = (0.8×(2, 5) + 1.2×(3, -5)) = (1.6, 4) + (3.6, -6) = (5.2, -2).

[0157] Calculate the tangent vector v2 of C2 at t = 0.4: P12 - P02 = (3, 2) - (5, 5) = (-2, -3), P22 - P12 = (0, 5) - (3, 2) = (-3, 3).

[0158] C2′(0.4) = 2×(1 - 0.4)×(-2, -3) + 2×0.4×(-3, 3) = (1.2×(-2, -3) + 0.8×(-3, 3)) = (-2.4, -3.6) + (-2.4, 2.4) = (-4.8, -1.2).

[0159] Calculate the current included angle θ1: According to the formula

[0160] v1·v2 = (5.2)×(-4.8) + (-2)×(-1.2) = -24.96 + 2.4 = -22.56.

[0161]

[0162] cosθ1 = (-22.56) / (5.57×4.95) ≈ (-22.56) / 27.57 ≈ -0.82, θ1 = arccos(-0.82) ≈ 145. Given the included angle rule Q = 60° - 120°, the current included angle θ1 = 145° does not meet the requirements. Then, first try to adjust the control point P11 of curve C1. The new control point P13 = (2.5, 4). Use the new control point P13 to regenerate the quadratic Bézier curve C3. Repeat the above steps of calculating the intersection point, tangent direction, and included angle until the connection at the intersection meets the printing drawing specifications.

[0163] Step S09, output the second wireframe diagram after verification and repair as the target 2D graphic.

[0164] In addition, after outputting the second wireframe diagram after verification and repair as the target 2D graphic, it also includes:

[0165] Verify the target 2D graphic through the drawing file color conversion rule and the file format conversion rule;

[0166] Specifically, output the drawing file that passes the inspection and repair as a directly printable file. For the wireframe diagram that passes the correctness inspection and meets the printing drawing specifications, the system will further check whether it meets the printing drawing specifications. The printing drawing specifications include requirements for the width of the lines, color mode, resolution, and size limits of the drawing file. The system checks each attribute of the drawing file according to the pre-set specification standards. The color mode is CMYK and the resolution ≥ 300 dpi. For example, the system reads the resolution information of the drawing file and finds that its resolution is 300 dpi, meeting the requirement of at least 300 dpi in the printing drawing specifications. When checking the line width, it is found that the widths of all lines are within the specified range. When checking the color mode, it is found that the color mode of the drawing file is RGB, while the printing drawing specifications require CMYK. Therefore, this drawing file does not meet the color mode requirement. Since the color mode does not meet the requirement, the system uses an image conversion library to convert the drawing file from the RGB color mode to the CMYK color mode. Here, the conversion rules and algorithms are set as follows:

[0167] Drawing file color conversion rules and algorithms. Open the image img = Image.open(image_path), check the color mode of the image if img.mode == 'RGB', the check result is RGB, convert the RGB image to a CMYK image cmyk_img = img.convert('CMYK'). If checking the color mode of the image if img.mode == 'CMYK', the check result is CMYK, the image does not need to be converted and directly command the system return img.

[0168] File format conversion rules and algorithms. Open the image img = Image.open(image_path), save it as a PDF format img.save(output_path, 'PDF', resolution = 300.0), print a message indicating successful conversion print(f"The image has been successfully converted to PDF and saved to {output_path}") or an error message print(f"An error occurred during the conversion: {e}"); if an error occurs, the system will give an alarm prompt, send an email notification to the engineer for review, and re-encode and organize the pixel data of the drawing file through rule instructions to generate a PDF file in the required CMYK mode.

[0169] According to the set output path D:\xxFiles\xx\ and file name rules, the system automatically generates a printable wireframe. The file suffix will add the _print word, and the converted drawing file will be saved as D:\xxFiles\xx\xx_print.pdf. The system completes the file writing operation and records the output time as xx year xx month xx day xx:xx:xx, with the specific time set to the second. The system sends an email notification to the engineer, informing them that the file xx_print.pdf has been successfully output and stored in the D:\xxFiles\xx\ path for the engineer to perform subsequent printing work processes.

[0170] Here, this application takes the automatic generation of the server front window wireframe as an example to illustrate the implementation steps, as follows:

[0171] Model preprocessing and rule setting steps: The engineer opens the system software. In the model preprocessing interface, import the 3D model of the server front window. The system performs format recognition and axis information extraction on the model, matches and calculates the extracted information with the axis information set by the system itself, and uses the matrix transformation formula to perform corresponding transformations on the geometric information related to the normal direction and texture coordinates of the model to ensure that after the model is imported into this system, the axes are consistent with the rules set by the system itself, and the appearance and shape of the model remain unchanged; in the rule setting interface, according to the printing drawing specifications and actual product requirements, set detailed line recognition and deletion rules, including line type and thickness rules, line color rules, and line priority rules. The system automatically converts the 3D model of the server front window into a 2D wireframe according to the above rules and names the file as 2FU according to the naming rules for subsequent rule recognition.

[0172] Automatic line recognition and deletion steps: After generating the 2D wireframe diagram, the system performs line recognition. According to the set rules, the lines in the wireframe diagram are recognized, and the contour lines, auxiliary lines, and annotation lines in the 2FU diagram are identified. After the recognition is completed, it enters automatic deletion, and the lines are deleted according to the rules. For example, the system recognizes that there are multiple internal auxiliary lines b in the 2FU diagram with a thickness between b = Cmm - Dmm, and at the same time satisfying the condition that the line thickness Cmm - Dmm < Emm - Fmm. These lines meet the deletable conditions set by the system, so they are deleted from the 2FU diagram.

[0173] Automatic inspection and output steps: Finally, the 2FU diagram after deletion is inspected to check whether there are any problems violating the printing drawing specifications. If it is found that a key contour line in the 2FU diagram is interrupted, the system automatically marks and returns to the rule setting module, reads the automatic repair function for the missing key contour line in the rule setting module, and after correction according to the rules, it is inspected again until the 2FU diagram fully meets the printing drawing specifications. Finally, the 2FU diagram that has passed the inspection is automatically output and saved by the output module, and an email is sent to prompt the engineer that it can be used for subsequent work such as printing and plate making.

[0174] Without departing from the technical solution of the present application, several improvements and optimizations can be made to the method for outputting 2D graphics provided in the embodiments of the present application, and these improvements and optimizations should also be regarded as the protection scope of the present application.

[0175] The beneficial effects brought by the technical solution provided in the embodiments of the present application are:

[0176] The present application solves the problems of low efficiency, error-proneness, and inconsistent standards in manual line processing in the prior art, making the line processing for printing drawings more automated, efficient, and standardized.

[0177] The technical solution of the present application can be automatically processed and can complete the line processing work of a large number of wireframe diagrams in a short time. Compared with manual line processing, the work efficiency is greatly improved. At the same time, it avoids the errors in line deletion caused by manual operation, ensures that each wireframe diagram strictly conforms to the printing drawing specifications, and improves the quality stability of printed products. By setting unified drawing rules, the wireframe diagrams of different products follow the same standards during the processing, ensuring the standardization of the entire printing drawing process.

[0178] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method.

[0179] The embodiments of the present application also provide a 2D graphics output device, such as Figure 7As shown, the device includes: an acquisition module, a preprocessing module, a setting module, a determination module, a line recognition module, an automatic deletion module, an automatic verification module, and an output module.

[0180] In this embodiment, the acquisition module is used to acquire a three-dimensional product appearance model;

[0181] The preprocessing module is used to optimize and adjust the coordinates of the three-dimensional product appearance model through a transformation matrix, and convert the optimized and adjusted three-dimensional product appearance model into a first wireframe;

[0182] The setting module is used to set the width ranges of the contour lines, auxiliary lines, and annotation lines;

[0183] The width of the auxiliary line is set to be less than the width of the annotation line which is less than the width of the contour line;

[0184] Set the colors and color values of the contour lines, auxiliary lines, and annotation lines;

[0185] The determination module is used to determine the priority of each line type in the two-dimensional drawing process;

[0186] The line recognition module is used to recognize the lines in the first wireframe through an edge detection algorithm;

[0187] The automatic deletion module is used to delete the lines in the first wireframe according to the recognized line types and the priority of each line type in the two-dimensional drawing process, and obtain a second wireframe;

[0188] The automatic verification module is used to verify and repair the second wireframe according to the two-dimensional drawing specifications;

[0189] The output module is used to output the verified and repaired second wireframe as a target two-dimensional graphic.

[0190] In this embodiment, the automatic verification module is used to verify and repair the integrity of the contour lines of the second wireframe;

[0191] Verifying and repairing the integrity of the contour lines of the second wireframe includes:

[0192] Obtain the contour lines of the preset wireframe;

[0193] Calculate the similarity between the contour lines in the second wireframe and the contour lines in the preset wireframe through an image matching algorithm;

[0194] When the similarity between the contour lines in the second wireframe and the contour lines in the preset wireframe is less than a third threshold, automatically repair the contour lines in the second wireframe;

[0195] Automatically repairing the contour lines in the second wireframe includes:

[0196] When the contour line in the second wireframe diagram is missing, the corresponding line is generated and filled at the missing position of the contour line in the second wireframe diagram through an image interpolation algorithm according to the position and shape information of the corresponding missing contour line in the preset wireframe diagram.

[0197] When the missing contour line in the second wireframe diagram involves multiple discontinuous regions, the contour line of the corresponding missing part is extracted from the preset wireframe diagram according to the style of the second wireframe diagram, and the contour line of the missing part is embedded into the missing position of the second wireframe diagram according to the overall coordinate system of the second wireframe diagram.

[0198] In one of the embodiments, an automatic verification module is used to verify and repair the connection correctness at the intersection of the lines in the second wireframe diagram.

[0199] Verifying and repairing the connection correctness at the intersection of the lines in the second wireframe diagram includes:

[0200] Obtain the endpoint coordinates of all the lines in the second wireframe diagram.

[0201] Obtain the tolerance value of the spatial distance between adjacent line endpoints and the included angle between adjacent lines according to the endpoint coordinates of all the lines in the second wireframe diagram.

[0202] When the tolerance value of the spatial distance between adjacent line endpoints is greater than or equal to the fourth threshold or the included angle between adjacent lines is not within the fifth threshold, automatically repair the connection error at the intersection of the lines in the second wireframe diagram.

[0203] Automatically repairing the connection error at the intersection of the lines in the second wireframe diagram includes:

[0204] Obtain the tangent vector V1 of the first quadratic Bezier curve at the intersection of the lines, and obtain the tangent vector V2 of the second quadratic Bezier curve at the intersection of the lines.

[0205] Calculate the included angle θ between the first quadratic Bezier curve and the second quadratic Bezier curve through the formula: cosθ = (V1·V2) / (∣v1∣∣v2∣).

[0206] Judge whether the included angle θ between the first quadratic Bezier curve and the second quadratic Bezier curve is within the fifth threshold.

[0207] If so, the connection at the intersection of the lines is correct; if not, repeat the calculation of the curve included angle and continue to adjust the control point positions of the quadratic Bezier curve until the included angle θ between the first quadratic Bezier curve and the second quadratic Bezier curve is within the fifth threshold.

[0208] When there are multiple line connection errors at the intersections of quadratic Bézier curves, the line connection errors at the intersections of quadratic Bézier curves are repaired according to the priority of the contour line, auxiliary line, and annotation line.

[0209] Specifically, as Figure 8 shown, this application constructs an automated line deletion and printing drawing device based on 3D software, covering six modules: model preprocessing, rule setting, line recognition, automatic deletion, automatic inspection, and output, realizing the automatic processing of lines and the automated process of printing drawings during the conversion from 3D to 2D drawing.

[0210] Automatic model preprocessing: Supports multiple common 3D file formats, accurately extracts the original coordinate axis information, center point, and unit information through the file suffix; uses matrix transformation (rotation matrix, translation matrix, scaling matrix) to achieve the conversion of the original model coordinate axis and the target system coordinate axis, including angle rotation, direction adjustment, translation, and unit conversion, ensuring that the appearance and shape of the model remain unchanged and the coordinate axis conforms to the set rules.

[0211] Line rule setting: Details the rules of line types (contour line, auxiliary line, annotation line), thickness range, color and color value, printing priority, etc., providing clear standards for subsequent line processing, ensuring that the wireframe clearly expresses the product shape and meets the printing requirements.

[0212] Automatic line recognition algorithm: Uses the difference method to calculate the gray change rate of pixel points, combines threshold rules (first threshold, second threshold) to judge the line type (contour line, auxiliary line, annotation line) to which the pixel points belong; based on the adjacency relationship of pixel points and the continuity of gray change, recognizes the contour structure of the model, and verifies the correctness of the line type through the line color and thickness characteristics.

[0213] Automatic deletion strategy: Automatically deletes according to the line priority and the key role in expressing the product shape. First, delete the annotation line, and then decide whether to keep or remove the auxiliary line according to the shape reconstruction analysis result, and keep the contour line; back up the line deletion operation, record historical information, and provide a version recovery function to ensure the traceability and recoverability of the wireframe.

[0214] Automatic inspection and repair technology: Uses a standard template (preset wireframe) and an image matching algorithm to check the integrity of the key contour line, sets a similarity threshold to judge the missing situation of the contour line; judges the connection correctness at the line intersection through the line endpoint information (spatial distance tolerance and angle range); for the missing key contour line, uses an image interpolation algorithm and a standard template to extract and embed for repair; for the connection error at the line intersection, repairs it by calculating the tangent direction, adjusting the control point position, etc., to ensure that the wireframe meets the printing drawing specifications.

[0215] Output printing process: For the document files that pass the inspection and repair, check attributes such as line width, color mode, resolution, and document size according to the printing drawing specifications, use an image conversion library to perform color mode conversion and file format conversion, and record the output information.

[0216] The beneficial effects brought by the technical solution provided by the embodiments of the present application are as follows:

[0217] The present application solves the problems of low efficiency, easy error, and inconsistent standards in manual line processing in the prior art, making the line processing for printing drawings more automated, efficient, and standardized.

[0218] The technical solution of the present application can be automatically processed and can complete the line processing work of a large number of wireframe drawings in a short time. Compared with manual line processing, the work efficiency is greatly improved; at the same time, it avoids the error of line deletion caused by manual operation, ensures that each wireframe drawing strictly complies with the printing drawing specifications, and improves the quality stability of printed products; by setting unified drawing rules, the wireframe drawings of different products follow the same standards during the processing, ensuring the standardization of the entire printing drawing process.

[0219] For the description of the features in the corresponding embodiments of the two-dimensional graphic output device, reference can be made to the relevant descriptions in the corresponding embodiments of the two-dimensional graphic output method, which will not be elaborated here one by one.

[0220] The embodiments of the present application also provide an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in the embodiments of the two-dimensional graphic output method, and the method includes:

[0221] Obtain a three-dimensional product appearance model;

[0222] Optimize and adjust the coordinates of the three-dimensional product appearance model through a transformation matrix, and convert the optimized and adjusted three-dimensional product appearance model into a first wireframe drawing;

[0223] Determine the priority of each line type during the two-dimensional drawing process;

[0224] Perform line recognition on the first wireframe drawing through an edge detection algorithm;

[0225] Delete the lines of the first wireframe drawing according to the recognized line types and the priority of each line type during the two-dimensional drawing process to obtain a second wireframe drawing;

[0226] Inspect and repair the second wireframe drawing according to the two-dimensional drawing specifications;

[0227] Output the second wireframe drawing after verification and repair as a target two-dimensional graphic.

[0228] AsFigure 9 As shown in Figure 9 , an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. Among them, the computer program is configured to execute the steps in the embodiment of the two-dimensional graphic output method when running. The method includes:

[0229] Obtain a three-dimensional product appearance model;

[0230] Optimize and adjust the coordinates of the three-dimensional product appearance model through a transformation matrix, and convert the optimized and adjusted three-dimensional product appearance model into a first wireframe;

[0231] Determine the priority of each line type in the two-dimensional drawing process;

[0232] Perform line recognition on the first wireframe through an edge detection algorithm;

[0233] Delete the lines of the first wireframe according to the recognized line type and the priority of each line type in the two-dimensional drawing process to obtain a second wireframe;

[0234] Inspect and repair the second wireframe according to the two-dimensional drawing specification;

[0235] Output the second wireframe after verification and repair as a target two-dimensional graphic.

[0236] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media such as USB flash drives, read-only memories (ROM for short), random access memories (RAM for short), mobile hard disks, magnetic disks, or optical discs that can store computer programs.

[0237] An embodiment of the present application further provides a computer program product. The above computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in the embodiment of the two-dimensional graphic output method. The method includes:

[0238] Obtain a three-dimensional product appearance model;

[0239] Optimize and adjust the coordinates of the three-dimensional product appearance model through a transformation matrix, and convert the optimized and adjusted three-dimensional product appearance model into a first wireframe;

[0240] Determine the priority of each line type in the two-dimensional drawing process;

[0241] Perform line recognition on the first wireframe through an edge detection algorithm;

[0242] Delete the lines of the first wireframe according to the recognized line types and the priority of each line type in the 2D drawing process, and obtain the second wireframe;

[0243] Inspect and repair the second wireframe according to the 2D drawing specifications;

[0244] Output the second wireframe after inspection and repair as the target 2D graphic.

[0245] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, it implements the steps in the embodiment of the 2D graphic output method. The method includes:

[0246] Obtain a 3D product appearance model;

[0247] Optimize and adjust the coordinates of the 3D product appearance model through a transformation matrix, and convert the optimized and adjusted 3D product appearance model into a first wireframe;

[0248] Determine the priority of each line type in the 2D drawing process;

[0249] Perform line recognition on the first wireframe through an edge detection algorithm;

[0250] Delete the lines of the first wireframe according to the recognized line types and the priority of each line type in the 2D drawing process, and obtain the second wireframe;

[0251] Inspect and repair the second wireframe according to the 2D drawing specifications;

[0252] Output the second wireframe after inspection and repair as the target 2D graphic.

[0253] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0254] The above has introduced in detail a two-dimensional graphic output method, device, equipment and medium provided by this application. Specific examples are used in this article to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art, without departing from the principle of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of the claims of this application.

Claims

1. A two-dimensional graphic output method, characterized in that, The method includes: Obtaining a 3D product appearance model; Optimizing and adjusting the coordinates of the 3D product appearance model through a transformation matrix, and converting the optimized and adjusted 3D product appearance model into a first wireframe; Determining the priority of each line type during the 2D drawing process; Performing line recognition on the first wireframe through an edge detection algorithm; Deleting the lines of the first wireframe according to the recognized line types and the priority of each line type during the 2D drawing process to obtain a second wireframe; Inspecting and repairing the second wireframe according to the 2D drawing specifications; Outputting the second wireframe after verification and repair as a target 2D graphic.

2. The two-dimensional graphic output method according to claim 1, wherein The optimizing and adjusting the coordinates of the 3D product appearance model through a transformation matrix includes: Obtaining a rotation matrix R, a translation matrix T, and a scaling matrix S; Combining the matrices in the order of first scaling, then rotating, and finally translating to generate a transformation matrix M, where the transformation matrix M = S × R × T; Optimizing the 3D product appearance model according to the transformation matrix; Adjusting the coordinates of each vertex of the optimized 3D product appearance model according to the transformation matrix; The determining the priority of each line type during the 2D drawing process includes: Setting the line types in the target 2D graphic, and the line types include contour lines, auxiliary lines, and dimension lines; Setting the highest priority for processing the contour lines and the lowest priority for processing the dimension lines.

3. The two-dimensional graphic output method according to claim 1, wherein The performing line recognition on the first wireframe through an edge detection algorithm includes: Obtaining the gray-scale change rate of each pixel point in the horizontal direction of the first wireframe, and obtaining the gray-scale change rate of each pixel point in the vertical direction of the first wireframe; Calculating the gray-scale change rate of each pixel point in the first wireframe according to the gray-scale change rates of each pixel point in the horizontal and vertical directions of the first wireframe and the Pythagorean theorem; Judging the gray-scale change rate of each pixel point in the first wireframe; When the gray-scale change rate of the pixel point in the first wireframe is greater than the first threshold, then the pixel point is a contour line; When the gray-scale change rate of the pixel point in the first wireframe is less than the second threshold, then the pixel point is an auxiliary line; When the gray-scale change rate of the pixel point in the first wireframe is between the first threshold and the second threshold, then the pixel point is a dimension line.

4. The two-dimensional graphic output method according to claim 2, wherein The deleting the lines of the first wireframe according to the recognized line types and the priority of each line type during the 2D drawing process includes: Deleting the dimension lines of the first wireframe according to the priority of each line type during the 2D drawing process, and retaining the contour lines of the first wireframe; Reconstructing the shape of the product model according to the recognized contour lines and auxiliary lines to obtain a reconstructed contour; Performing similarity matching between the reconstructed contour and the contour of the first wireframe; Setting a shape threshold, a size threshold, and a direction threshold through a contour comparison algorithm; Calculating the contour similarity value between the reconstructed contour and the contour of the first wireframe through a contour comparison algorithm; Determine whether the similarity values between the reconstructed contour and the contour of the first wireframe are all higher than the shape threshold, size threshold, and direction threshold; If so, delete the auxiliary lines of the first wireframe; if not, retain the auxiliary lines of the first wireframe.

5. The two-dimensional graphic output method according to claim 1, wherein The inspection and repair of the second wireframe according to the 2D drawing specification includes: Verify and repair the integrity of the contour lines of the second wireframe; The verification and repair of the integrity of the contour lines of the second wireframe includes: Obtain the contour lines of the preset wireframe; Calculate the similarity between each contour line in the second wireframe and each contour line in the preset wireframe through an image matching algorithm; When the similarity between each contour line in the second wireframe and each contour line in the preset wireframe is less than the third threshold, automatically repair each contour line in the second wireframe; The automatic repair of each contour line in the second wireframe includes: When a contour line is missing in the second wireframe, generate corresponding lines at the missing position of the contour line in the second wireframe according to the position and shape information of the corresponding missing contour line in the preset wireframe through an image interpolation algorithm for filling; When the missing contour lines in the second wireframe involve multiple discontinuous regions, extract the contour lines of the corresponding missing part from the preset wireframe according to the style of the second wireframe, and embed the contour lines of the missing part into the missing position of the second wireframe according to the overall coordinate system of the second wireframe.

6. The two-dimensional graphic output method according to claim 5, characterized in that, The inspection and repair of the second wireframe according to the 2D drawing specification further includes: Verify and repair the correctness of the connection at the intersection of the lines in the second wireframe; The verification and repair of the correctness of the connection at the intersection of the lines in the second wireframe includes: Obtain the endpoint coordinates of all lines in the second wireframe; Obtain the spatial distance tolerance between adjacent line endpoints and the included angle between adjacent lines according to the endpoint coordinates of all lines in the second wireframe; When the spatial distance tolerance between adjacent line endpoints is greater than or equal to the fourth threshold or the included angle between adjacent lines is not within the fifth threshold, automatically repair the incorrect connection at the intersection of the lines in the second wireframe; The automatic repair of the incorrect connection at the intersection of the lines in the second wireframe includes: Obtain the tangent vector V1 of the first curve at the line intersection point, and obtain the tangent vector V2 of the second curve at the line intersection point; Calculate the included angle θ between the first curve and the second curve through the formula: cosθ = (V1·V2) / (∣V1∣∣V2∣); Determine whether the included angle θ between the first curve and the second curve is within the fifth threshold; If so, the connection at the line intersection is correct; if not, repeatedly calculate the curve included angle and continue to adjust the positions of the curve control points until the included angle θ between the first curve and the second curve is within the fifth threshold; When there are multiple incorrect line connections at the curve intersection, repair the incorrect line connections at the curve intersection according to the priorities of the contour lines, auxiliary lines, and annotation lines.

7. The two-dimensional graphic output method according to claim 2, wherein Before determining the priority of each line type in the 2D drawing process, it includes: Set the width ranges of the contour lines, auxiliary lines, and annotation lines; Set the width of the auxiliary line to be less than the width of the dimension line and less than the width of the contour line; Set the colors and color values of the contour line, auxiliary line, and dimension line; After performing line recognition on the first wireframe through the edge detection algorithm, it includes: Verify the recognized lines according to the line color and width; The verification of the recognized lines according to the line color and width includes: Judge whether the recognized line color and width range are consistent with the set line color and width range; If so, delete the lines of the first wireframe according to the recognized line types and the priority of each line type in the 2D drawing process; if not, re-perform line recognition on the first wireframe through the edge detection algorithm.

8. A two-dimensional graphic output device, characterized in that, The device includes: An acquisition module for acquiring a 3D product appearance model; A preprocessing module for optimizing and adjusting the coordinates of the 3D product appearance model through a transformation matrix, and converting the optimized and adjusted 3D product appearance model into a first wireframe; A determination module for determining the priority of each line type in the 2D drawing process; A line recognition module for performing line recognition on the first wireframe through the edge detection algorithm; An automatic deletion module for deleting the lines of the first wireframe according to the recognized line types and the priority of each line type in the 2D drawing process to obtain a second wireframe; An automatic verification module for verifying and repairing the second wireframe according to the 2D drawing specification; An output module for outputting the verified and repaired second wireframe as a target 2D graphic.

9. An electronic device, characterized in that, It includes: A memory for storing a computer program; A processor for implementing the steps of the 2D graphic output method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, wherein the computer program, when executed by the processor, implements the steps of the 2D graphic output method according to any one of claims 1 to 7.