Contour identification analysis and quotation method and device, and storage medium
By classifying primitive type codes, normalizing coordinates, and calculating multi-dimensional features, the problem of low efficiency in geometric entity recognition is solved, and an automated and accurate processing quotation process is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DONGGUAN UNIV OF TECH
- Filing Date
- 2026-01-12
- Publication Date
- 2026-05-15
AI Technical Summary
Existing technologies have low efficiency in geometric entity recognition, which leads to the processing quotation process relying on human experience and being inaccurate.
By reading the primitive type code for contour classification, performing coordinate normalization and data cleaning, and combining closure detection and multi-dimensional feature calculation, the primitive type is accurately identified and the actual processing length is calculated, ultimately achieving automated and accurate quotation.
It improves the automation level of geometric entity recognition and the accuracy of quotations, reduces calculation errors, adapts to complex graphic contours, and ensures reasonable quotations.
Smart Images

Figure CN122049935A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of engineering drawing technology, and more specifically, relates to a contour recognition, analysis and quotation method, device and storage medium. Background Technology
[0002] In the fields of die-cutting, laser cutting, and precision mold making, traditional machining quotation processes heavily rely on the experience and judgment of technicians. Technicians need to manually measure the machining length of geometric entities in drawings using CAD software and then provide a quote. Although some existing CAD analysis tools can parse DXF files, they still have significant shortcomings in terms of the accuracy of geometric entity identification. Summary of the Invention
[0003] The purpose of this application is to provide a contour recognition, parsing, and pricing method, device, and storage medium to solve the technical problem of low efficiency in geometric entity recognition in the prior art.
[0004] To achieve the above objectives, the technical solution adopted in the first aspect of this application is to provide a contour recognition, parsing, and quotation method, which includes the following steps:
[0005] Read the type code of the primitive to classify the primitive by outline.
[0006] The coordinates of each graphic element are normalized and the data is cleaned.
[0007] The primitives of each contour type are classified and filtered.
[0008] The actual processing length of each graphic element is calculated based on its contour type.
[0009] The total price is calculated based on the actual processing length of each graphic element and its outline type.
[0010] Optionally, the classification and filtering of the outline types of each graphic element specifically includes: performing closure detection on the outline of each graphic element to determine whether the graphic element is a closed entity; and performing multi-dimensional feature calculation and classification on each graphic element.
[0011] Optionally, the step of performing closure detection on the contours of each of the graphic elements to determine whether the graphic element is a closed entity specifically includes: extracting all endpoint coordinates of each of the graphic elements as nodes, wherein each node stores the coordinate position of the graphic element; constructing a topology graph, considering graphic elements with overlapping endpoints or a distance between endpoints less than a preset value as interconnected; using a depth-first search algorithm to find interconnected groups of graphic elements in the topology graph, wherein each group of graphic elements represents a potential closed region or continuous path formed by connecting at least two graphic elements; and performing closure verification on the closed region or continuous path.
[0012] Optionally, the multi-dimensional feature calculation and classification of each of the graphic elements specifically includes: detecting the underlying attributes of the graphic elements and performing a fitting test on the underlying attributes, wherein the underlying attributes include circles, arcs, line segments, and rounded corners; calculating feature vector sets for the graphic elements, wherein the feature vector sets include curvature variance, extreme point density, continuity, and smoothness; performing threshold judgment on each feature vector in each feature vector set and generating a propensity score for each feature vector; aggregating each propensity score in each feature vector set to generate a confidence score; and outputting the type of the graphic elements whose confidence scores are higher than the threshold.
[0013] Optionally, the detection of the underlying attributes of the graphic element further includes priority determination of the graphic element with different underlying attributes, wherein the priority order is circle, arc, line segment and rounded corner.
[0014] Optionally, the step of calculating the actual processing length of each graphic element based on its contour type specifically includes: if the graphic element is a line segment entity, its length is calculated using the endpoint distance formula; if the graphic element is an arc or a circle entity, its length is calculated using the standard arc length formula; if the graphic element is a composite kerf or a spline curve entity, its length is calculated using a variable step size integral algorithm; the number of different types of graphic elements is calculated, and the total length of different types of graphic elements is calculated.
[0015] Optionally, the classification and filtering of the primitives of each contour type further includes angle calculation, specifically including: detecting the smallest included angle less than 180° formed between two connected line segments; determining whether the curve connecting the two line segments is a rounded corner; detecting the included angle between each pair of adjacent lines in a number of intersecting lines and excluding angles of 180°; and counting the number of angles of each type.
[0016] Optionally, the angle calculation specifically includes: for rounded corners, detecting arcs with a central angle less than 180°, determining whether the two endpoints of the rounded corner are tangent to adjacent line segments, checking whether the radius of the same group of rounded corners is within a preset tolerance range, and verifying whether the two endpoints of the arc coincide with the endpoints of two adjacent line segments; and / or, for vertex angles, sorting all intersecting line segments according to their direction angles, calculating the included angle formed between each pair of adjacent line segments, calculating the included angle using the vector product formula, filtering out included angles greater than 180°, and verifying the number of angles formed between all intersecting line segments.
[0017] In a second aspect of this application, a contour recognition parsing and pricing device is provided, which includes a memory, a processor, and a contour recognition parsing and pricing program stored in the memory and executable on the processor. When the contour recognition parsing and pricing program is executed by the processor, it implements the aforementioned contour recognition parsing and pricing steps.
[0018] In a third aspect of this application, a storage medium is provided, on which a contour recognition parsing and pricing program is stored, wherein when the contour recognition parsing and pricing program is executed by a processor, the steps of the aforementioned contour recognition parsing and pricing method are implemented.
[0019] The contour recognition, parsing, and pricing method, device, and storage medium provided in this application have at least the following beneficial effects:
[0020] By initially classifying graphic elements based on their type codes, a coordinate normalization process is performed after classification to prevent calculation errors caused by coordinate system inconsistencies. Data cleaning following coordinate normalization ensures that the data used for subsequent parsing is clean and standardized. In terms of outline parsing, identifying closed entity outlines avoids infinite calculation loops caused by system misjudgments during price calculation, saving computational resources. Multi-dimensional feature calculations and classification of graphic elements, specifically through confidence assessment to accurately identify curves, circles, or arcs, provide a secondary screening after the initial outline classification to ensure accurate classification and thus more precise price calculations. Furthermore, graphic element outline classification includes separate angle calculations within graphic elements, with angles assigned individual weights during price calculations, resulting in more reasonable pricing. This solution achieves automated identification of graphic elements in engineering drawing files while maintaining high accuracy and adaptability to complex graphic outlines. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figures 1 to 8 The flowcharts are for different method steps in the embodiments of this application;
[0023] Figure 9 This is a schematic diagram of different types of graphic elements in some embodiments of this application. Detailed Implementation
[0024] To make the technical problems, technical solutions and beneficial effects to be solved by this application clearer, the following describes this application in further detail with reference to the accompanying drawings and embodiments.
[0025] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.
[0026] It should be noted that when a component is referred to as "fixed to" or "set on" another component, it can be directly on the other component or indirectly on that other component.
[0027] When a component is referred to as being "connected to" another component, it can be directly connected to the other component or indirectly connected to that other component.
[0028] It should be understood that the terms "length", "width", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application.
[0029] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature.
[0030] In the description of this application, "multiple" means two or more, unless otherwise expressly and specifically defined.
[0031] Reference Figures 1 to 9The contour recognition, parsing, and quotation method provided in the first aspect of this application will now be described.
[0032] It is understood that the contour recognition parsing and quotation method provided in the first aspect of this application is applied to a server and executed by a program in the server. It is applicable to the parsing and processing quotation of DXF files, in order to solve the technical problem of low efficiency in recognizing the type of graphic elements in the quotation process before processing of such documents. This method automates the accurate recognition of the contour types of graphic elements of different complexities in the quotation process, thereby improving the recognition efficiency and the corresponding quotation efficiency.
[0033] DXF is a format used for exchanging graphic data between different CAD software programs. DXF files store graphic information in ASCII text format, containing the definitions and attributes of various graphic elements in the drawing. Programs extract graphic data by parsing the contents of DXF files. (Reference) Figure 9 The primitive types include line segments, arcs, polylines, circles, text, etc. Each primitive has a corresponding data block in the DXF file, which describes the primitive's type, geometric parameters, style attributes, and other information.
[0034] Overall, reference Figure 1 The contour recognition, parsing, and pricing method in this application includes the following steps S100 to S500. The specific steps are as follows:
[0035] S100: Read the type code of the primitive to classify the primitive by outline.
[0036] Specifically, refer to Figure 2 Step S100 includes the following sub-steps in sequence:
[0037] S110, read the type code of each graphic element.
[0038] Specifically, the DXF file stores the type codes for each primitive. For example, the type code for a line segment is LINE; for an arc, it is ARC; for a spline curve, it is SPLINE; and for a polyline, it is LWPOLYLINE. After the program starts, it scans and locates the model space where the DXF file is located, and then scans and reads each primitive in the DXF file one by one.
[0039] Understandably, in subsequent steps, a polyline with type code LWPOLYLINE will be parsed by the program into a line segment with type code LINE and / or an arc with type code ARC.
[0040] S120: Extract the unique geometric parameters that determine the shape and position of each graphic element based on its type code.
[0041] It is understandable that after the program scans the primitives in the DXF file model space, it also includes a step of extracting the geometric parameters of primitives of various code types. It is also understandable that in the following coordinate extraction steps, the coordinate system is the initial coordinate system of the layer in which the primitive resides (e.g., the same or different layers). Specifically, this step includes:
[0042] For a line segment primitive, extract the coordinates of its two endpoints (i.e., the start and end points). These endpoint coordinates determine the position and orientation of the line segment in the initial coordinate system.
[0043] For a circular arc primitive, extract its center coordinates, radius, starting angle, and ending angle. These four parameters fully define the precise position and size of the circular arc primitive in the initial coordinate system. In addition, in this step, the program automatically converts the angle value of the center angle from degrees to radians for subsequent calculations.
[0044] For circular primitives, extract their center coordinates and radius. This is the simplest parameter set for defining a circle; the system automatically treats a complete circle as a special 360-degree arc.
[0045] For a spline curve primitive, extract its core data such as the list of control points, fitting points, and order. This data collectively defines the shape of the spline curve. Control points determine the direction of the spline curve's extension, fitting points determine the location the spline curve passes through, and the order controls the smoothness of the spline curve.
[0046] For a polyline primitive, extract the coordinate sequence of all its vertices and the convexity value at each vertex. The convexity value determines whether the connection between vertices is a straight line or an arc. For example, a convexity of 0 represents a straight line segment, and a non-zero convexity represents an arc segment. The sign of the convexity determines the direction of the arc.
[0047] S200. Perform coordinate normalization and data cleaning on each graphic element. Specifically, refer to... Figure 3 Step S200 includes the following sub-steps in sequence:
[0048] S210, normalize the coordinates of each graphic element.
[0049] Specifically, the program unifies all coordinate data of the extracted graphic elements into the same fixed coordinate system. Based on the default world coordinate system of the DXF file, the program ensures that the coordinates of all graphic elements are under the same reference, thus avoiding calculation errors caused by coordinate system differences. Simultaneously, coordinate scaling is performed to ensure that the values are within a reasonable floating-point arithmetic range. In practical implementation, by translating the geometric center of the graphic elements to the coordinate origin and scaling the maximum bounding box size to a standard unit range (e.g., 0-1000), the program eliminates the problem of floating-point precision loss caused by different units of measurement (e.g., meters and millimeters) or extremely large coordinate values in the drawing file, ensuring the accuracy of subsequent curvature calculations and fitting error calculations (e.g., ...). Stability of tolerance level.
[0050] S220 performs data cleaning on each graphic element. (Reference) Figure 4 This step includes the following sub-steps. It should be understood that there is no specific order to these sub-steps.
[0051] S221, delete line segment primitives with a length of 0 (i.e., the start and end points coincide).
[0052] S222, delete primitives of the circle or arc type with a radius of 0.
[0053] S223, Remove duplicate primitives (i.e., primitives with exactly the same coordinate position), such primitives include but are not limited to circles, arcs, splines, and line segments.
[0054] S224, process complex polyline primitives that self-intersect and decompose them into simpler primitives. For example, complex polylines with self-intersecting paths, such as figure-eight or bow-tie shapes, are broken at their intersection points to decompose them into two or more closed simple polygons or independent line segments, thereby preventing topological errors that may occur during subsequent steps of enclosed area identification.
[0055] S225, corrects inaccurate but close connection points among elements (e.g., by setting a preset relative tolerance, adjusting the connection point by 0.01% of the diagonal length of the element's maximum bounding box). They are considered as the same point; or the distance between the endpoints of two adjacent graphic elements is less than 0.001mm, which means merging two graphic elements into one graphic element.
[0056] By cleaning the data of each graphic element, a set of clean and standardized graphic element data can be obtained to prepare for subsequent analysis and avoid duplication or errors in calculation.
[0057] S300. Classify and filter the graphic elements of each contour type.
[0058] refer to Figure 5It is understandable that step S300 includes sub-steps S310 and S320. Specifically:
[0059] S310: Perform a closure check on the outline of each graphic element to determine whether the element is a closed entity. This step classifies the graphic elements into closed and open elements, and in subsequent element path length calculations, it avoids the waste of computing power caused by iterative path length calculations for closed elements.
[0060] For example, a closed primitive can be a polygon composed of polylines, a circle composed of arcs, an irregular shape composed of spline curves, an irregular shape composed of spline curves and line segments or polylines, and so on.
[0061] In particular, step S310 mainly uses the structural topological features of each element to determine whether it is a closed entity, so as to further refine the elements of the spline curve type code into ordinary spline curves and complex spline curves, so as to achieve a more accurate classification of spline curve elements, thereby providing a more accurate calculation basis for the quotation step.
[0062] refer to Figure 6 S310 includes the following sub-steps:
[0063] S311, Construct topology nodes. Extract all endpoint coordinates from each primitive as nodes, where each node stores the coordinate position of the primitive.
[0064] S312, Construct a topology graph. Elements with overlapping endpoints or whose distance between endpoints is less than a preset value are considered connected. Specifically, spatial indexing (such as an R-tree) is used to accelerate neighbor search, and a tolerance range is set to determine connectivity (the tolerance range is typically within a certain range). arrive between).
[0065] S313 uses the Depth-First Search (DFS) algorithm to find interconnected groups of graph elements in the topological graph, where each group of graph elements represents a potential continuous and closed path formed by connecting at least two graph elements.
[0066] S314, Detect and verify the closure of closed regions or continuous paths. By performing closure detection and subsequent verification on the path, it is possible to accurately determine whether the path is a closed path. Specifically, the criteria for detecting closed paths are as follows: Starting from any node, traverse all connected elements within the element group to check if it can eventually return to the starting point to form a closed path, and at the same time check whether the closed path has self-intersections.
[0067] Specifically, first, the program calculates the connectivity (i.e., "degree") of each node in the group. For example, a rectangle consisting of four line segments connected end to end has four vertices each connected to two line segments, and the degree is an even number of 2. A closed loop can only be formed when the degree of all nodes is even. Second, the program verifies whether there exists a path that starts from any node, traverses all primitives in the group, and eventually returns to the starting point. If a path starts from any vertex, passes through all edges in a fixed direction, and returns to the starting point, it can be confirmed that this is a complete closed contour entity.
[0068] S320 performs multi-dimensional feature calculations and classifications for each graphic element. It's important to understand that in actual machining, the category of spline curves includes both ordinary spline curves and complex decorative curves. The difference lies in the degree of curvature: ordinary spline curves have a gentler curve, while complex decorative curves have a greater curvature, and the machining prices for ordinary spline curves and complex decorative curves differ. This step allows for more accurate classification of graphic elements of the circle, arc, and spline curve types. For example, it precisely classifies such graphic elements as ordinary spline curves or complex decorative curves, avoiding pricing errors caused by misclassification due to type confusion during subsequent price calculations.
[0069] It is understandable that step S320 involves multi-dimensional feature calculation and classification of primitives, including calculations for primitives of both open and closed entities.
[0070] For details, please refer to Figure 7 Step S320 includes the following sub-steps S321 to S325.
[0071] S321, detect the underlying attributes of the primitives and perform fitting tests on the underlying attributes, whereby the underlying attributes include circles, arcs, line segments and rounded corners.
[0072] In some cases, because some primitives represent a shape of a certain graphic (such as a closed or open entity), but their actual type code is formed by connecting at least two identical or different primitives, misclassification of the primitive can occur. For example, consider a primitive representing a circle. A circular primitive may be composed of primitives with the following two type codes: one is a circle directly composed of the type code CIRCLE, and the other is formed by connecting two arcs of type code ARC end-to-end. However, there is a high probability that it will be misclassified as a circle with the type code CIRCLE.
[0073] Therefore, detecting the underlying attributes of primitives also includes determining the priority of primitives with different underlying attributes, with the priority order being circle, arc, line segment, and rounded corner.
[0074] Specifically, if the type code of a graphic element is CIRCLE, it is directly marked as a circle; if the type code of a graphic element is ARC and the central angle ranges from 5° to 180°, it is marked as an arc; if the type code is LINE and the length is greater than 0, it is marked as a line segment; if both ends are tangent to a line segment and the central angle ranges from 15° to 180°, it is marked as a rounded corner.
[0075] The fitting test for the underlying attributes of primitives includes the following steps: for primitives with the type code CIRCLE (circle), the point set is fitted using the circle equation and the fitting error is calculated; for primitives with the type code ARC (arc), the point set is fitted using the arc equation and the fitting error is calculated; for primitives with the type code LINE (line segment), the point set is fitted using the line equation and the fitting error is calculated. If the fitting error is below a threshold, primitives with that type code are favored. By fitting the underlying attributes of primitives, primitives with underlying attributes that could not be identified in the previous steps can be verified, such as a "circle" formed by connecting two identical arcs end to end, and an arc with a large radius but a very small central angle that is easily identified as a "line segment".
[0076] Through mathematical fitting, the aforementioned fragmented primitives are re-identified as primitives of standard geometric shapes (such as circles or arcs) to reduce the number of primitives and thus avoid calculation errors.
[0077] S322 calculates the eigenvector set for the primitives. The eigenvector set includes three parameters: curvature variance, extreme point density, continuity, and smoothness. It's important to understand that this step targets primitives with curve type codes to achieve accurate identification of both ordinary spline curves and complex decorative curves, thus providing a more precise computational basis for subsequent price calculations.
[0078] In the calculation of the eigenvector group, the curvature variance, extreme point density, continuity and smoothness parameters are calculated separately.
[0079] Specifically, for curvature variance, uniform sampling is performed on each primitive to obtain a sequence of 100-150 sampling points along the primitive path. The discrete curvature value at each sampling point is calculated, and the variance of the curvature sequence is statistically analyzed. This variance reflects the degree of curvature variation of the spline curve. High variance indicates that the curvature variation of the spline curve is more drastic, which tends to be classified as complex curves in price calculation.
[0080] For extreme point density, identify the curvature extreme points (including maxima and minima) on the primitives and calculate the ratio of the number of extreme points to the total number of sampling points. This extreme point density reflects the frequency of fluctuations in the spline curve; a higher extreme point density indicates that the spline curve has more points of curvature change.
[0081] For continuity and smoothness, the first difference variance of curvature is calculated to assess the coherence of spline curve bending variations.
[0082] S323 performs threshold judgment on each feature vector in each feature vector group and generates a propensity score for each feature vector.
[0083] This step is to further distinguish between curves with scissor-like characteristics and ordinary spline curves. For example, for curves with scissor-like characteristics, it checks whether their curvature variance and extreme point density exceed preset thresholds; while for ordinary spline curves, it checks whether their continuity and smoothness exceed preset thresholds. The thresholds for curvature variance, extreme point density, continuity, and smoothness are pre-set parameter values; and there is a mapping relationship between the propensity score and the different parameter thresholds.
[0084] For example, when the curvature variance is greater than 0.05, a bias score of 0.8 is generated; when the extreme point density is greater than 0.12, a bias score of 0.7 is generated; and when the continuity and smoothness are greater than 0.7, a bias score of 0.9 is generated.
[0085] S324, aggregate the propensity scores in each feature vector group to generate a confidence score. In this step, the aggregation formula is: Overall Confidence = Σ(Feature Weight × Propensity Score) / ΣFeature Weight, where the feature weights assigned to primitives of closed entities are greater than those assigned to primitives of open entities.
[0086] It is understood that the aforementioned feature weights are custom parameter values and are only assigned to primitives of the zigzag curve or spline curve. For example, for the curvature variance feature vector group exceeding the threshold, its feature weight is assigned to 0.8; for the extreme point density feature vector group exceeding the threshold, its feature weight is assigned to 0.7.
[0087] S325 outputs the type of primitives whose confidence scores are higher than the threshold.
[0088] In this step, if the confidence level of a certain type of primitive is greater than the threshold, then the primitive of that type is output; if the confidence levels of multiple types of primitives are similar, then the primitive of that type with the highest confidence level is selected; if the confidence levels of all types of primitives are lower than the threshold, then they are marked as "unknown type" or "complex curve".
[0089] S400. Calculate the actual machining length of each graphic element based on its outline type.
[0090] If the graphic element is a line segment entity, its length is calculated using the endpoint distance formula; specifically, this includes the following steps: extracting the starting coordinates of the line segment ( ) and endpoint coordinates ( ), applying the distance formula Calculate the path length of a single graphic element.
[0091] If the primitive is an arc or a solid circle, its length is calculated using the standard arc length formula. Specifically, the following steps are included: obtain the radius r and the central angle θ. For an arc, the arc length formula L = r × θ is applied, and for a circle, the circumference formula L = r × 2π is applied.
[0092] If the primitive is a composite lace cutter or a spline curve entity, the two are calculated separately, but both use a variable step-size integration algorithm to calculate their lengths. Specifically, this includes the following steps: sampling 200-300 points along the path of the spline curve, connecting adjacent sampling points into small straight line segments, and calculating the length of each small straight line segment. For the length of each tiny straight line segment The total length of the spline curve is calculated by summing the results. The sampling frequency is increased in regions of high curvature and decreased in regions of low curvature to effectively balance the accuracy and efficiency of the length calculation.
[0093] Calculate the quantity of different types of graphic elements and the total length of different types of graphic elements. After calculating the length of each type of graphic element (circle, arc, line segment, spline curve, and compound stencil) in the previous steps, sum the calculated lengths of each type of graphic element to obtain the total length of all types of graphic elements.
[0094] It is understandable that the above steps, especially the step of classifying and filtering the primitives of each contour type, also include classifying and calculating the angles contained in the primitives, so as to make the subsequent price calculation more accurate.
[0095] Specifically, refer to Figure 8 Angle calculation includes the following steps:
[0096] S331 detects the smallest angle less than 180° formed between two connected line segments. It only detects angles less than 180°, thus eliminating line segments connected in the same direction. Furthermore, each angle is calculated only once, avoiding duplicate calculations due to the traversal order. It also includes the exclusion of duplicate calculations for opposite angles.
[0097] S332, determine whether the curve connecting two line segments is a rounded corner. In this step, only arcs with a central angle less than 180° are considered; arcs with a central angle greater than 180° are treated as independent decorative arcs, not categorized as rounded corners. Furthermore, when determining rounded corners, whether the ends of the arc are tangent to adjacent line segments is used as a criterion. Additionally, for the same rounded corner, a tolerance range is set to ensure that the radius is consistent throughout the arc. Finally, verify whether the endpoints of the rounded corner coincide with the endpoints of the line segments. Only after all the above criteria are met is the arc marked as a rounded corner.
[0098] S333, detects the angle between every two adjacent lines in a set of intersecting lines and excludes angles of 180°. This step primarily addresses the case where a point connects to multiple line segments. Specifically, this step includes: sorting all line segments connected to the point in order of their direction angles; calculating only the angle between every two adjacent line segments at a time; and calculating the aforementioned angle using the vector dot product formula. Angles greater than 180° are filtered out; finally, the number of angles is verified, specifically the number of angles formed between all intersecting line segments. That is, when a point connects n line segments, at most n-1 valid angles are calculated.
[0099] S334, Count the number of angles of each type. This step, in addition to summarizing the angles calculated in the previous steps, also includes classifying angles by angle type: angles between 0 and 85° are classified as acute, angles between 85 and 95° as right angles, and angles between 95 and 180° as obtuse angles. In other words, this step includes counting the number of angles for each type.
[0100] S500. Calculate the total price based on the actual processing length of each graphic element and the outline type of the graphic element.
[0101] In this step, firstly, the specific curve category primitives under the spline curve type are calculated. That is, according to the spline curve (SPLINE) type code calculated in the previous step, the prices of individual curve categories are summed according to different unit prices. For example, the length of ordinary spline curve primitives is summarized and the first price is calculated based on the length unit price of the corresponding category. The length of complex lace primitives is summarized and the second price is calculated based on the length unit price of the corresponding category. Then, the first price and the second price are summed to obtain the first total price.
[0102] Secondly, the second total price is obtained by multiplying the unit prices of different types of angles (i.e., rounded angles, acute angles, obtuse angles, and right angles) according to the quantity of each type of angle.
[0103] Furthermore, for ordinary line segments, circles, and arcs, the total length of each type of graphic element is multiplied according to the corresponding unit price to calculate the third total price.
[0104] Finally, the first total price, the second total price, and the third total price are summed together.
[0105] In a second aspect of this application, a contour recognition parsing and pricing device is also provided, which includes a memory, a processor, and a contour recognition parsing and pricing program stored in the memory and executable on the processor. When the contour recognition parsing and pricing program is executed by the processor, it implements the aforementioned contour recognition parsing and pricing steps.
[0106] In a third aspect embodiment of this application, a storage medium is also provided, on which a contour recognition parsing and quotation program is stored. The storage medium includes a computer-readable storage medium, which may be... Figure 1 The memory in the storage medium may be at least one of ROM (Read-Only Memory) / RAM (Random Access Memory), magnetic disk, optical disk, etc. The storage medium includes several instructions to cause the program to perform the steps of the methods described in the various embodiments of this application.
[0107] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A contour recognition, analysis, and pricing method, characterized in that, Includes the following steps: Read the type code of the primitive to classify its outline; The coordinates of each of the aforementioned graphic elements are normalized and the data is cleaned. The primitives of each contour type are classified and filtered; The actual processing length of each graphic element is calculated based on its contour type; The total price is calculated based on the actual processing length of each graphic element and its outline type.
2. The contour recognition, parsing, and pricing method as described in claim 1, characterized in that, The classification and filtering of the outline types of each of the graphic elements specifically includes: The contours of each graphic element are subjected to closure detection to determine whether the graphic element is a closed entity; Multi-dimensional feature calculation and classification are performed on each of the aforementioned graphic elements.
3. The contour recognition, parsing, and pricing method as described in claim 2, characterized in that, The step of performing closure detection on the outline of each graphic element to determine whether the graphic element is a closed entity specifically includes: Extract all endpoint coordinates from each of the said graphic elements as nodes, wherein each of the said nodes stores the coordinate position of the said graphic element; Construct a topology graph, and consider elements with overlapping endpoints or a distance between endpoints less than a preset value as interconnected. The depth-first search algorithm is used to find interconnected groups of graph elements in the topological graph, wherein each group of graph elements represents a potential closed region or continuous path formed by the connection of at least two graph elements. The closure of the closed region or continuous path is verified.
4. The contour recognition, parsing, and pricing method as described in claim 2 or 3, characterized in that, The multi-dimensional feature calculation and classification of each of the graphic elements specifically includes: The underlying attributes of the graphic primitives are detected and a fitting test is performed on the underlying attributes, wherein the underlying attributes include circles, arcs, line segments and rounded corners; The primitive is subjected to a feature vector set calculation, wherein the feature vector set includes curvature variance, extreme point density, continuity and smoothness; A threshold judgment is performed on each feature vector in each feature vector group, and a propensity score is generated for each feature vector. The propensity scores in each of the feature vector groups are aggregated to generate a confidence score; Type output is performed for primitives whose confidence scores are higher than the threshold.
5. The contour recognition, parsing, and pricing method as described in claim 4, characterized in that, The detection of the underlying attributes of the graphic elements also includes priority determination of the graphic elements with different underlying attributes, wherein the priority order is circle, arc, line segment and rounded corner.
6. The contour recognition, parsing, and pricing method as described in claim 2, characterized in that, The step of calculating the actual processing length of each graphic element based on its contour type specifically includes: If the graphic element is a line segment entity, its length is calculated using the endpoint distance formula; If the graphic element is an arc or a circular solid, its length is calculated using the standard arc length formula; If the graphic element is a composite lace cutter or spline curve entity, its length is calculated using a variable step-size integral algorithm; Calculate the number of primitives of different types and the total length of primitives of different types.
7. The contour recognition, parsing, and pricing method as described in claim 1 or 6, characterized in that, The classification and filtering of primitives of each contour type also includes angle calculation, specifically including: Detect the smallest included angle less than 180° between two connected line segments; Determine whether the curve connecting two line segments has rounded corners; Detect the included angle between any two adjacent lines in a set of intersecting lines and exclude angles of 180°. Count the number of angles of each type.
8. The contour recognition, parsing, and pricing method as described in claim 7, characterized in that, The angle calculation specifically includes: For rounded corners, detect arcs with a central angle less than 180°, determine whether the two endpoints of the rounded corner are tangent to adjacent line segments, check whether the radius of the same set of rounded corners is within the preset tolerance range, and verify whether the two endpoints of the arc coincide with the endpoints of two adjacent line segments. And / or, for vertex angles, sort all intersecting line segments by their direction angles, calculate the included angle between each pair of adjacent line segments, calculate the included angle using the vector product formula, filter out included angles greater than 180°, and verify the number of angles formed between all intersecting line segments.
9. A contour recognition and quotation analysis device, characterized in that: The system includes a memory, a processor, and a contour recognition parsing and quoting program stored in the memory and executable on the processor, wherein the contour recognition parsing and quoting program, when executed by the processor, implements the steps of contour recognition parsing and quoting as described in any one of claims 1 to 8.
10. A storage medium, characterized in that, The storage medium stores a contour recognition parsing and pricing program, which, when executed by a processor, implements the steps of the contour recognition parsing and pricing method as described in any one of claims 1 to 8.