Method for converting single line into zigzag embroidery track
By converting single lines into Z-shaped embroidery tracks, the process of generating Z-shaped tracks is simplified, enabling the rapid generation of embroidery tracks without the need for specialized software or personnel, thus improving the operating efficiency of embroidery machines.
Patent Information
- Application Number
- CN202510015899.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2045-01-06
AI Technical Summary
In existing technologies, Z-shaped trajectory pattern making requires professional designers to use specialized pattern making software, which is time-consuming and costly.
A method for converting single lines into Z-shaped embroidery trajectories is adopted. By traversing graphic points, generating new points, processing graphic elements in segments, shrinking and expanding them, and generating Z-shaped trajectories based on density, the method simplifies the stitch data into data that can be directly processed by machines.
Z-shaped embroidery patterns can be generated quickly without the need for specialized pattern-making software or professional personnel, simplifying the operation process and improving processing speed.
Smart Images

Figure CN119711064B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the embroidery machine technical field, especially to a method for converting single line into Z-shaped embroidery track. BACKGROUND
[0002] The embroidery machine adopts computer program control to convert the pattern into digital embroidery instruction, and then the pattern is embroidered through stitch control and programming;
[0003] The traditional Z-shaped track plate needs professional designers to use special plate software to generate the edge track, which not only takes a long time, but also needs special learning and costs a lot. SUMMARY
[0004] The present application relates to the embroidery machine technical field, especially to a method for converting single line into Z-shaped embroidery track.
[0005] In order to achieve the above purpose, the present application adopts the following technical scheme:
[0006] A method for converting single line into Z-shaped embroidery track, comprising the following steps:
[0007] S1, first traverse all the points of the figure, the starting point is the first point, the length is greater than the set density value 1 / 3, or the turning angle is greater than 180 degrees, a new point is generated, all the middle points between the starting point and the current end point are deleted, and then the current end point is set as the current starting point, and then the loop processing is started to the last point of the figure element;
[0008] S2, traverse the starting point of the figure element to find the smooth point segment or the center point of the straight line, set the starting point as the current point to prevent the starting point from being inconvenient to process at the sharp corner, then segment the figure element according to the set minimum offset angle acute angle value 45 degrees, slope change rate 0.15 and minimum deflection angle 180 degrees, finally judge whether the length between two segments is greater than the set needle number, if yes, the segment is divided on both sides of each point segment, otherwise, one segment or no segment is divided according to the situation, then all the points are numbered, and all the line segments are connected to form a whole figure element;
[0009] S3, the processed figure element is processed by internal shrinkage and external expansion respectively, the distance is 1 / 2 of the length of the set Z-shaped track, and the processed figure element retains the original numbering information;
[0010] S4, then the inner contraction and the outer expansion of the graphics elements, according to the original segmentation data number for extraction, Z track generation, two line segment according to the set of 1 / 2 of the density of the distance for point, then Z fold to and fro line can be obtained to the needle data.
[0011] Preferably, in S2, the entire graphics element is segmented and processed as follows:
[0012] Determine the segmentation criteria: first, determine the criteria or principles for segmentation. Segmentation can be based on length, angle, area or other geometric characteristics; Process linear graphics elements: equidistant segmentation: calculate the total length of the graphics element, then divide it by the number of segments you want to determine the length of each segment;
[0013] Point segmentation: if you have a series of points, you can use these points as segmentation points to divide the line into multiple parts;
[0014] Dynamic segmentation: dynamically determine the segmentation points according to the conditions;
[0015] Process face-shaped graphics elements: grid division: divide the polygon into regular grids, each grid cell is a small polygon; Triangulation: use Delaunay triangulation or other triangulation algorithms to divide the polygon into triangles; Feature-based segmentation: segment according to the features inside the polygon.
[0016] Preferably, in S2, use existing libraries or tools to simplify the segmentation process, including computer graphics libraries, GIS software, programming libraries, CGAL.
[0017] Preferably, in S2, when segmenting and processing the entire graphics element, monitor the processing performance as follows: hardware layer monitoring: mainly focus on CPU usage, memory usage indicators; System layer monitoring: including the number of connection requests, the number of rejections; Link layer monitoring: involving code execution functions, service call time; Business layer monitoring: focus on user input compliance, business logic operation.
[0018] Preferably, in S2, when determining whether the length between two segments is greater than the set number of needles, ensure that the unit of the segment length and the unit of the length represented by the number of needles are consistent, to avoid false judgments due to different units.
[0019] Preferably, in S2, when determining whether the length between two segments is greater than the set number of needles, compare the total length of the two segments with the set number of needles. If the total length of the segments is greater than or equal to the length represented by the set number of needles, it can be determined that the length between the two segments is greater than the set number of needles; otherwise, it is less than.
[0020] Preferably, in the S3, the inward shrinking is implemented as follows: for each vertex, the perpendicular bisector of its adjacent edges is calculated, and a certain distance is moved inward on the perpendicular bisector to obtain the new vertex position.
[0021] Preferably, in the S3, the outward expansion is implemented as follows: for each vertex, the perpendicular bisector of its adjacent edges is calculated, but a certain distance is moved outward on the perpendicular bisector to obtain the new vertex position.
[0022] Preferably, in the S2, the numbering of points is implemented as follows: determine the set of points: clearly define the set of points to be processed, which can be points in a two-dimensional plane, points in a three-dimensional space, or points in a higher-dimensional space; assign a number: assign a unique number to each point, which can be done by simply traversing the point set, using a loop index as the number, or using a dictionary to store the mapping relationship between points and their numbers.
[0023] Preferably, in the S2, when numbering all points, ensure that there are no duplicate points numbered, and each point should only have a unique number.
[0024] In the present application, the method for converting a single line into a Z-shaped embroidery track has the following advantages:
[0025] The present application is specifically designed to extract the contour from the camera, and then without the need for special plate personnel to use other software to process the Z-shaped track and import it into the embroidery machine for processing, which is simple to learn and fast to process. BRIEF DESCRIPTION OF DRAWINGS
[0026] Figure 1 The camera extracts the contour picture extracted from the camera;
[0027] Figure 2 The Z-shaped track effect diagram of the method for converting a single line into a Z-shaped embroidery track proposed in the present application;
[0028] Figure 3 The control flow of the method for converting a single line into a Z-shaped embroidery track proposed in the present application Figure 1 ;
[0029] Figure 4 The control flow of the method for converting a single line into a Z-shaped embroidery track proposed in the present application Figure 2 ;
[0030] Figure 5 The control flow of the method for converting a single line into a Z-shaped embroidery track proposed in the present application Figure 3 . DETAILED DESCRIPTION
[0031] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application.
[0032] Embodiment one
[0033] A method for converting a single line into a zigzag embroidery track, comprising the following steps:
[0034] S1, first traverse all the points of the figure, the starting point is the first point, the length is greater than the set density value 1 / 3, or the turning angle is greater than 180 degrees, a new point is generated, all the middle points between the starting point and the current end point are deleted, and then the current end point is set as the current starting point, and then the loop processing is started to the last point of the figure element;
[0035] S2, traverse the starting point of the figure element to find the smooth point segment or the center point of the straight line, set the starting point as the current point to prevent the starting point from being inconvenient to process at the sharp corner, then according to the set minimum deflection angle acute angle value 45 degrees, the slope change rate 0.15, the minimum deflection angle 180 degrees, the figure element is segmented, and finally it is judged whether the length between two segments is greater than the set needle number, if yes, the segment is given out on both sides of each point segment, otherwise, according to the situation, a segment is divided or not, and then all the points are numbered, and all the line segments are connected to become a whole figure element;
[0036] S3, the processed figure element is processed by internal shrinkage and external expansion respectively, the distance is 1 / 2 of the length of the set zigzag track, and the processed figure element retains the original numbering information;
[0037] S4, then the internal shrinkage figure element and the external expansion figure element are extracted according to the original segment data number to generate a zigzag track, two line segments are divided according to the distance of 1 / 2 of the set density, and then the zigzag folding is performed to connect back and forth to obtain the needle track data.
[0038] In this embodiment, in S2, the figure element is segmented and processed, specifically as follows:
[0039] Determine the segmentation standard: first, determine the standard or principle of segmentation. Segmentation can be based on length, angle, area or other geometric characteristics; process linear figure elements: equidistant segmentation: calculate the total length of the figure element, and then divide it by the number of segments you want to determine the length of each segment;
[0040] Segment by points: if you have a series of points, you can use these points as segmentation points to divide the line into multiple parts;
[0041] Dynamic segmentation: dynamically determine the segmentation point according to the condition;
[0042] Processing planar primitives: meshing: dividing a polygon into regular meshes, each mesh cell is a small polygon; triangulation: using Delaunay triangulation or other triangulation algorithms to divide the polygon into triangles; feature-based segmentation: segmenting according to the features inside the polygon.
[0043] In this embodiment, in S2, existing libraries or tools are used to simplify the segmentation process, including computer graphics libraries, GIS software, programming libraries, CGAL.
[0044] In this embodiment, in S2, when segmenting the entire primitive, the processing performance is monitored, as follows: hardware layer monitoring: mainly focusing on CPU usage, memory usage indicators; system layer monitoring: including connection request number, rejection number; link layer monitoring: involving function code execution, service call time consumption; business layer monitoring: focusing on user input compliance, business logic operation.
[0045] In this embodiment, in S2, when determining whether the length between two segments is greater than the set number of needles, it is ensured that the unit of the segment length and the unit of the length represented by the number of needles are consistent, so as to avoid misjudgment due to different units.
[0046] In this embodiment, in S2, when determining whether the length between two segments is greater than the set number of needles, the total length of the two segments is compared with the set number of needles. If the total length of the segments is greater than or equal to the length represented by the set number of needles, it can be determined that the length between the two segments is greater than the set number of needles; otherwise, it is less than the set number of needles.
[0047] In this embodiment, in S3, the internal shrinkage is as follows: for each vertex, the perpendicular bisector of its adjacent edges is calculated, and a certain distance is moved inward on the perpendicular bisector to obtain a new vertex position.
[0048] In this embodiment, in S3, the external expansion is as follows: for each vertex, the perpendicular bisector of its adjacent edges is calculated, but a certain distance is moved outward on the perpendicular bisector to obtain a new vertex position.
[0049] In this embodiment, in S2, the numbering of points is as follows: determining the set of points: clearly defining the set of all points to be processed, which may be points in a two-dimensional plane, points in a three-dimensional space, or points in a higher-dimensional space; assigning a unique number to each point, which is completed by simply traversing the point set, using a loop index as the number, or using a dictionary to store the mapping relationship between points and their numbers.
[0050] In this embodiment, in S2, when numbering all points, it is ensured that there is no repeated point numbered, and each point should only have a unique number.
[0051] Embodiment Two
[0052] Referring to Figures 1-5 A method for converting a single line into a Z-shaped embroidery track, comprising the following steps:
[0053] 1. First, call the MetaSameDistance() function to traverse, obtain the contour points through image processing algorithms and edge extraction algorithms, perform equal-interval processing, and fix the distance of the points to StainDensit / 3. During the traversal process, accumulate the turning angles of the points. If it is found that the accumulated turning angle is greater than 180 degrees, it indicates that it is not a straight line. At this time, take the current point as a segmented point, the points before the current point as the previous segment, and the points after the current point as the next segment. Re-traverse the subsequent points from the current point, perform equal-interval processing, and re-accumulate the turning angles for segmentation judgment. Repeat the processing until the last point.
[0054] 2. Re-traverse all the points, select a line segment with a small change in turning angle, and then the line segment length is also greater than 3*StiNum (number of sharp corners). Set the center point of the line segment as the starting point of the primitive.
[0055] 3. Call the SegmentToSmallLine() function to segment the primitive. Starting from the starting point of the primitive, select the first point, the second point, and the third point to calculate their turning angles as CrtAgl. Calculate the distance between the first point and the second point as Length, and accumulate the distance SumDis += Length. Then, according to the set parameters, judge whether the current point set is on the same line segment. Mark the points on the same line segment with the same code, and the code starts from 0 and increments.
[0056] 4. Connect the marked line segments at the head and tail to combine into the original closed primitive. The above operation is mainly to mark and code the line segments.
[0057] 5. Perform inward and outward shrinkage on the coded primitive with a width of StainWidth / 2 to obtain two new primitives InWardMeta and OutWardMeta with point numbering information.
[0058] 6. If InWardMeta and OutWardMeta are empty, read the next closed figure and re-execute step 1. Otherwise, call the OpposeSatin() function to process the primitive.
[0059] 7. The OpposeSatin() function first gets the line segment with the number of points equal to 0 in InWardMeta and OutWardMeta, the line segment with a large length is the outer edge, and the line segment with a small length is the inner edge, and the number of points NormNum = NormLen / StainDensit of the outer edge is calculated, the outer edge step NormRfr = NormLen / NormNum, the inner edge density DrivDensit = DrivLen * NormRfr / NormLen, the interpolation record InterPolation = 0, the outer edge wavelength NorStep = 0, the inner edge wavelength DrivStep = 0, the internal cumulative wavelength ResiDual = 0, and the interpolation ratio ItrPosRatio = PsRatio.
[0060] 8. If NorStep < NormLen, NorStep + = NormRfr, DrivStep + = DrivDensit, ResiDual + = DrivDensit, and whether the length of the inner edge accumulation is greater than StRatio * NormRfr is determined, if true, then the point InsertPoint is calculated at a distance of DrivStep from the starting point of the inner edge, and the point InsertOutPoint is calculated at a distance of NormStep from the starting point of the outer edge, if false, whether the interpolation flag InterPolation is equal to 0 is determined, if not equal to 0, whether the number of times is less than 2 is determined, if less than 2, InterPolation = PsRatio * InterPolation, if not less than 2, InterPolation = 0, ItrPosRatio = PsRatio, then InterPolation + = 1, the interpolated inner point InterPolation ++ is calculated, the point Point at a distance of DrivStep from the inner edge of the Z-shaped point is calculated, the point Point2 at a distance of NormStep from the outer edge of the Z-shaped point is calculated, the coordinates of the final point InsertPoint -> x = Point2 -> x + (Point -> x - Point2 -> x) * ItrPosRatio, InsertPoint -> y = Point2 -> y + (Point -> y - Point2 -> y) * ItrPosRatio, and the point InsertOutPoint at a distance of NormStep from the starting point of the outer edge is calculated, and then InsertPoint and InsertOutPoint are connected.
[0061] 9. Then all the numbered line segments of the graphics primitive are executed in steps 7-8.
[0062] 10. Sequentially traversing all the closed primitives, sequentially performing steps 1-9, realizing the Z-trace generation algorithm.
[0063] The above merely describes the preferred embodiments of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art, according to the technical solution and the inventive concept of the present application, makes equivalent replacement or change within the technical range disclosed by the present application, which should be covered within the protection scope of the present application.
Claims
1. A method for converting a single line stitch into a zigzag stitch track, characterized in that, The method comprises the following steps: S1, first traverse all points of the graphic primitive, the starting point is the first point, the length is greater than the set density value 1 / 3, or the turning angle is greater than 180 degrees to generate a new point, delete all the middle points between the starting point and the current end point, and then set the current end point as the current starting point, and then start the loop processing until the last point of the graphic primitive; S2, traverse the starting point of the graphic primitive to find the smooth point segment or the center point of the straight line, set the starting point as the current point to prevent the starting point from being inconvenient to process at the sharp corner, then segment the graphic primitive according to the set minimum deflection angle acute angle value 45 degrees, slope change rate 0.15 and minimum deflection angle 180 degrees, finally judge whether the length between two segments is greater than the set needle number, if yes, divide the segment into two segments at both sides of each point segment, otherwise, divide one segment or no segment according to the situation, and then number all the points and connect all the line segments to form a whole graphic primitive; S3, the processed graphic primitive is subjected to internal shrinkage and external expansion treatment, the distance is 1 / 2 of the length of the set Z-shaped track, and the processed graphic primitive retains the original numbering information; S4, then the internal shrinkage graphic primitive and the external expansion graphic primitive are extracted according to the original segment data numbering to generate a Z-shaped track, two line segments are divided according to the distance of 1 / 2 of the set density value, and then Z-shaped folding is performed to obtain the needle trace data by connecting lines back and forth; In S2, the graphic primitive is segmented, specifically as follows: Determine the segmentation standard: first, determine the segmentation standard or principle; Segmentation is based on length, angle, area or other geometric characteristics; Process linear graphic primitives: Equal interval segmentation: calculate the total length of the graphic primitive, then divide it by the desired number of segments to determine the length of each segment; Segment by points: use a series of points as segmentation points to divide the line into multiple parts; Dynamic segmentation: dynamically determine the segmentation points according to the conditions; Process face-shaped graphic primitives: Mesh division: divide the polygon into regular meshes, and each mesh unit is a small polygon; Triangulation: use Delaunay triangulation or other triangulation algorithms to divide the polygon into triangles; Feature-based segmentation: segment based on features within the polygon; In S2, use existing libraries or tools to simplify the segmentation process, including computer graphics libraries, GIS software, programming libraries and CGAL; In S3, the internal shrinkage is as follows: for each vertex, calculate the perpendicular bisector of its adjacent edges, and move a certain distance inward on the perpendicular bisector to obtain the new vertex position; In S3, the external expansion is as follows: for each vertex, calculate the perpendicular bisector of its adjacent edges, and move a certain distance outward on the perpendicular bisector to obtain the new vertex position.
2. The method of claim 1, wherein, In S2, when segmenting the graphic primitive, monitor the processing performance, specifically as follows: Hardware layer monitoring: Mainly focus on CPU usage and memory usage indicators; System layer monitoring: including connection request number and rejection number; Link layer monitoring: involving function code execution and service call time consumption; Business layer monitoring: Focus on user input compliance, business logic operation.
3. A method of converting single thread to zigzag embroidery stitch path as claimed in claim 2 wherein, In the S2, when judging whether the length between the two segments is greater than the set number of needles, it is ensured that the unit of the segment length and the unit of the length represented by the number of needles are consistent.
4. The method of claim 3, wherein, In the S2, when judging whether the length between the two segments is greater than the set number of needles, the total length of the two segments is compared with the set number of needles; if the total length of the segments is greater than or equal to the length represented by the set number of needles, it is determined that the length between the two segments is greater than the set number of needles; otherwise, it is less than.
5. A method of converting single thread to zigzag embroidery stitch path as claimed in claim 4 wherein, In the S2, the numbering of points is as follows: Determine the set of points: Clearly define the set of points to be processed; Assign a unique number to each point, which can be done by simply iterating through the set of points, using a loop index as the number, or using a dictionary to store the mapping between points and their numbers.
6. A method of converting single thread to zigzag embroidery stitch path as claimed in claim 5 wherein, In the S2, when numbering all points, it is ensured that there are no duplicate points numbered, and each point should only have a unique number.
Citation Information
Patent Citations
High-resolution machine embroidery method
CN107012601A
Automatically generating embroidery designs from a scanned image
US20020007228A1