A DLP-based 3D printing slice filling method
By traversing the scan lines based on line segments and adding slight jitter processing in DLP 3D printing, the problems of low efficiency and incorrect or missing filling in the scan line filling algorithm are solved, achieving efficient and high-precision slice filling and generating high-quality 3D printed models.
Patent Information
- Application Number
- CN202310299038.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-24
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2043-03-24
AI Technical Summary
Existing scan line filling algorithms in DLP 3D printing suffer from low computational efficiency, incorrect filling, and missing filling issues. In particular, when determining the intersection of scan lines and line segments in the fill area of the slice, there are problems of invalid calculations and duplicate storage.
The DLP-based 3D printing slicing and filling method is adopted. The 3D model is converted into a discrete triangular mesh, cut into slice layers along the z-axis, and scan lines are traversed with line segments as the reference. Slight jitter is added to handle the case where the endpoints of the line segments coincide with the scan lines, the intersection information is recorded, and the segments are connected after sorting to generate a two-dimensional projection pattern.
It improves the efficiency and accuracy of slice filling, achieves high-precision and high-speed 3D printing results, avoids invalid calculations and redundant storage, and solves the problems of incorrect filling and omissions.
Smart Images

Figure CN116330663B_ABST
Abstract
Description
Technical Field
[0001] This invention provides a 3D printing slice filling method based on DLP, belonging to the field of 3D printing technology. Background Technology
[0002] Digital Light Processing (DLP) is a 3D printing technology based on photopolymerization. DLP requires a digitized 3D model as input. First, the input model is sliced using a slicing technique. The slicing process involves dividing the 3D model into a series of 2D slices, and then using an infill technique to generate a corresponding 2D projection pattern for each slice. Next, a DLP light source projects the projection pattern of each layer onto the surface of a photosensitive resin, causing the resin to cure under light. Finally, after cleaning and curing processes, the final 3D printed model is obtained. DLP technology offers advantages such as high manufacturing speed and high precision, and is currently widely used in industrial and personal manufacturing fields.
[0003] Slicing is a key step in DLP (Digital Processing) technology, and the efficiency of the infill algorithm directly affects the printing quality and time of the 3D printed model. Currently, the commonly used infill algorithm is the scanline infill algorithm. The basic idea of this algorithm is as follows: First, the sliced area is divided into several horizontal lines, i.e., scanlines; second, the intersection points of each scanline with the line segments in the fill area of the slice are calculated; the intersection points on the same scanline are sorted according to their x-coordinate values from smallest to largest, and the sorted intersection points are paired up as the two endpoints of line segments. These line segments are then filled into the fill area, ultimately filling in the desired shape. The above process has two problems: (1) When calculating the intersection of the scan line and the line segment in the fill area, each scan line needs to determine whether there is an intersection with each line segment in the fill area. For line segments that do not intersect with the scan line, this process is obviously wasteful of calculation, resulting in low filling efficiency; (2) If the endpoints of two line segments in the fill area coincide, the following problems will occur: the scan line needs to calculate its intersection with the two line segments separately. In the end, the scan line records two duplicate endpoints, and then the intersection points are matched pairwise during the filling process, resulting in errors and incorrect pairing; if the scan line coincides with the line segment in the fill area, the scan line has countless intersections with the line segment, which makes it impossible for the scan line to record the intersection with the line segment, thus missing the line segment during filling; the above two situations cause the problems of incorrect filling and missing filling during filling. Therefore, under the requirement of completing 3D printing quickly and efficiently, it is crucial to invent an efficient and accurate filling method for 3D printing slices based on DLP. Summary of the Invention
[0004] In order to solve the problems of missing filling and wrong filling in the scan line filling algorithm, the present invention proposes a 3D printing slice filling method based on DLP to improve the filling efficiency of the slice contour.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is: a 3D printing slice filling method based on DLP, including the following steps:
[0006] S1: Import a 3D model and convert the 3D model into a discrete triangular mesh;
[0007] S2: Set the ranges of x, y, and z of the 3D printing platform as buildPlatformXRange, buildPlatformYRange, and buildPlatformZRange; set the resolutions of the x and y directions as layerXResolution and layerYResolution, and set the slice thickness in the z-axis direction as layerZResolution;
[0008] S3: Along the z-axis direction, slice the 3D model into a series of slice layers according to layerZResolution;
[0009] S4: Calculate the line segments where each slice layer intersects with the triangular mesh in the 3D model, and record the line segments in the corresponding slice layer;
[0010] S5: For each slice layer in the 3D model, repeat steps S6 to S14 until all slice layers of the 3D model are traversed;
[0011] S6: For each line segment in the slice layer, repeat steps S7 to S10 until all line segments of the slice layer are traversed;
[0012] S7: Define the starting point coordinates of the line segment as (x1, y1) and the ending point coordinates as (x2, y2). Compare the y values of the endpoints of each line segment. If y1 > y2, swap the values of the two endpoints so that the y value of the starting point coordinate is less than the y value of the ending point coordinate. If y1 < y2, proceed to step S8;
[0013] S8: Divide the slice area into several straight lines perpendicular to the y-axis, that is, scan lines. Determine whether all endpoints of the line segments coincide with the scan lines. If they coincide, use the method of adding slight jitter for processing;
[0014] S9: Calculate the minimum and maximum ordinates of the line segment after jitter, denoted as y_min and y_max respectively. Then find all scan lines with the ordinate range of [y_min, y_max], that is, all scan lines between the minimum scan line and the maximum scan line, and record them as the set of all scan lines passing through the line segment after calculating the jitter;
[0015] S10: Traverse the set of scan lines of the line segment after jitter calculation; find the intersection point of each scan line with the line segment, and record the coordinates of the intersection point in the intersection point array of the corresponding scan line, until all scan lines in the set of scan lines of the line segment have been traversed, and end the traversal;
[0016] S11: For each scan line of the slice layer, repeat steps S12 to S13 until all scan lines of the slice layer have been traversed, and then end the traversal.
[0017] S12: Sort the intersection points in the scan line intersection point array in ascending order of their x-coordinates;
[0018] S13: Connect the intersection points of the scan lines in pairs according to the sorting size of S12, and store the line segments in the slice image of this slice layer;
[0019] S14: Read the sliced image of each layer and generate the corresponding two-dimensional projection pattern;
[0020] S15: Complete the slicing filling for 3D printing;
[0021] S16: Using a DLP light source, the projection pattern of each layer is projected onto the surface of the photosensitive resin, causing the resin to cure under the light to obtain a 3D printed model.
[0022] In step S8, it is determined whether the endpoints of the line segment coincide with the scan line. If they coincide, a slight jitter is added to process the signal. The specific method is as follows:
[0023] First, a series of scan lines are defined on the slice layer. The number of scan lines is buildPlatformYRange / layerYResolution. The direction of the scan lines is perpendicular to the y-axis. The length of the scan lines is buildPlatformXRange. The scanning range of the scan lines is buildPlatformYRange. The step size is layerYResolution. One scan line is added for each step size.
[0024] Let the coordinates of the two endpoints of the line segment be (x1, y1) and (x2, y2). Calculate the minimum and maximum scan lines for the two coordinates of the line segment using the following formulas:
[0025]
[0026]
[0027]
[0028]
[0029] Determine whether the endpoint coincides with the scan line, that is, y1 - y1_min1 < threshHold or y1 - y1_min2 < threshHold, where threshHold is a number close to 0. If the above equation holds, the endpoint (x1, y1) is on the scan line, that is, the endpoint (x1, y1) coincides with the scan line. The same judgment method is used for the endpoint (x2, y2);
[0030] If the endpoint coincides with the scan line, perform the following operations: y_min = y1 + disturbance, disturbance = 0.000001, that is, a slight jitter; perform the same operation on the endpoint (x2, y2), that is: y_max = y2 + disturbance.
[0031] In step S9, calculate the minimum and maximum ordinates of the line segment after jitter, denoted as y_min and y_max respectively, and then find all scan lines with the ordinate range [y_min, y_max], that is, all scan lines between the minimum scan line and the maximum scan line, and record them as the set of all scan lines passing through the line segment after this calculation of jitter; the specific method is as follows:
[0032] The minimum and maximum ordinates of the line segment after jitter are y_min and y_max respectively. The minimum scan line and the maximum scan line are obtained by rounding up and down the minimum and maximum ordinates respectively. The specific formulas are as follows:
[0033] The multiples of the minimum and maximum scan lines are:
[0034]
[0035]
[0036] The minimum and maximum scan lines are:
[0037]
[0038]
[0039] Divide the line segment into (x_indice_max - x_indice_min + 1) scan lines.
[0040] In step S10, find the intersection point (x, y) of the scan line and the line segment, and record the coordinates of the intersection point in the array of the scan line. The specific formula is as follows:
[0041]
[0042] In the above formula: y0 is the y-axis coordinate of the scan line, and (x1, y1) and (x2, y2) are the coordinates of the two starting endpoints of the line segment.
[0043] The advantages of this invention compared to existing technologies are as follows: Traditional slice filling algorithms use the scan line as a reference when calculating the intersection point of the scan line and the slice contour, dividing the slice area into several scan lines and sequentially determining the intersection point information of each scan line with the slice contour. This method results in a large number of cases where line segments do not intersect with the scan lines. Furthermore, when calculating the intersection point of a scan line with multiple line segments, the slope of each line segment needs to be calculated repeatedly, leading to wasted computation and low algorithm efficiency. This invention takes a different approach, using the line segment in the slice layer as a reference and traversing all scan lines of that line segment. This avoids invalid calculations when the scan line and line segment do not intersect. For that line segment, only the slope needs to be calculated once, effectively solving the problems of traditional slice filling algorithms and greatly improving the algorithm's efficiency. Additionally, this invention addresses the issue of duplicate storage when the scan line and line segment intersection point is the end point of the line segment or when the scan line and line segment coincide, causing incorrect or missed filling during filling. It proposes a method of adding slight jitter, effectively avoiding the above-mentioned duplicate storage, solving the problems of incorrect and missed filling, and greatly improving the accuracy of the algorithm. Therefore, this algorithm achieves high-precision and high-speed 3D printing slice filling. Attached Figure Description
[0044] The present invention will be further described below with reference to the accompanying drawings:
[0045] Figure 1 This is a flowchart of the method of the present invention;
[0046] Figure 2 This is a schematic diagram showing the intersection of the scan line and two sides of the polygon in an embodiment of the present invention. Detailed Implementation
[0047] like Figure 1 As shown, this invention provides a DLP-based 3D printing slice filling method, a novel 3D printing slice filling method proposed specifically for the characteristics of DLP technology. The main process of this method is as follows: For each line segment stored in each layer of the 3D model, using each line segment as a reference, the intersection of the line segment and the scan line is determined. If the endpoint of the line segment coincides with the scan line, or if the line segment and the scan line coincide, a slight jitter is added to that point so that the scan line can avoid this special point. After all scan lines of the line segment have been traversed, the intersection information of each scan line is recorded. Then, the other line segments of the same layer are traversed until all line segments of the layer have been processed. Finally, the intersection information recorded in each scan line is sorted according to the horizontal coordinate, and the points are connected in pairs to form a line segment, which is then output to the image. The specific steps are as follows.
[0048] S1: Import a 3D model and convert it into a discrete triangular mesh;
[0049] S2: Set the ranges of x, y, and z of the 3D printing platform as buildPlatformXRange, buildPlatformYRange, and buildPlatformZRange; set the resolutions in the x and y directions as layerXResolution and layerYResolution, and set the slice thickness in the z - axis direction as layerZResolution;
[0050] S3: Along the z - axis direction, slice the 3D model into a series of slice layers according to layerZResolution;
[0051] S4: Calculate the line segments where each slice layer intersects the triangular mesh in the 3D model and record the line segments in the corresponding slice layer;
[0052] S5: For each slice layer in the 3D model, repeat steps S6 to S14 until all slice layers of the 3D model are traversed;
[0053] S6: For each line segment in the slice layer, repeat steps S7 to S10 until all line segments in the slice layer are traversed;
[0054] S7: Define the starting coordinates of the line segment as (x1, y1) and the ending coordinates as (x2, y2). Compare the y values of the endpoints of each line segment. If y1 > y2, swap the values of the two endpoints so that the y value of the starting coordinate is less than the y value of the ending coordinate. If y1 < y2, proceed to step S8;
[0055] S8: Divide the slice area into several lines perpendicular to the y - axis, i.e., scan lines. Determine whether all endpoints of the line segments coincide with the scan lines. If they coincide, use the method of adding slight jitter for processing;
[0056] S9: Calculate the minimum and maximum ordinates of the line segment after jitter, denoted as y_min and y_max respectively. Then find all scan lines with ordinate ranges of [y_min, y_max], that is, all scan lines between the minimum scan line and the maximum scan line, and record them as the set of all scan lines passing through the line segment after calculating the jitter;
[0057] S10: Traverse the set of scan lines of the line segment after calculating the jitter; find the intersection points of each scan line and the line segment, and record the coordinates of the intersection points in the intersection point array of the corresponding scan line until all scan lines in the set of scan lines of the line segment are traversed, and end the traversal;
[0058] S11: For each scan line of the slice layer, repeat steps S12 to S13 until all scan lines of the slice layer have been traversed, and then end the traversal.
[0059] S12: Sort the intersection points in the scan line intersection point array in ascending order of their x-coordinates;
[0060] S13: Connect the intersection points of the scan lines in pairs according to the sorting size of S12, and store the line segments in the slice image of this slice layer;
[0061] S14: Read the sliced image of each layer and generate the corresponding two-dimensional projection pattern;
[0062] S15: Complete the slicing filling for 3D printing;
[0063] S16: Using a DLP light source, the projection pattern of each layer is projected onto the surface of the photosensitive resin, causing the resin to cure under the light to obtain a 3D printed model.
[0064] In the above steps, when the endpoints of two line segments in the filling area coincide, the following problems arise: the scan line needs to calculate its intersection points with the two line segments separately, ultimately recording two duplicate endpoints. This leads to errors in matching the intersection points pairwise during the filling process, preventing correct pairing. Furthermore, if the scan line coincides with a line segment in the filling area, the scan line has countless intersection points with that line segment, making it impossible for the scan line to record these intersection points, resulting in the omission of that line segment during filling. Both of these situations cause incorrect and missed filling during the filling process. Figure 2 Point H on line b in the diagram.
[0065] To address the aforementioned issues, this invention proposes a method to handle cases where the vertex lies on the scan line by adding slight jitter. Specifically, in step S8, it is determined whether the endpoint of the line segment coincides with the scan line. If they do, a method of adding slight jitter is used to handle the situation. The specific method is as follows:
[0066] First, a series of scan lines are defined on the slice layer. The number of scan lines is buildPlatformYRange / layerYResolution. The direction of the scan lines is perpendicular to the y-axis. The length of the scan lines is buildPlatformXRange. The scanning range of the scan lines is buildPlatformYRange. The step size is layerYResolution. One scan line is added for each step size.
[0067] Let the coordinates of the two endpoints of the line segment be (x1, y1) and (x2, y2). Calculate the minimum and maximum scan lines for the two coordinates of the line segment using the following formulas:
[0068]
[0069]
[0070]
[0071]
[0072] Determine whether the endpoint coincides with the scan line, that is, y1 - y1_min1 < threshHold or y1 - y1_min2 < threshHold, where threshHold is a number close to 0. If the above equation holds, the endpoint (x1, y1) is on the scan line, that is, the endpoint (x1, y1) coincides with the scan line. The same judgment method is used for the endpoint (x2, y2);
[0073] If the endpoint coincides with the scan line, perform the following operations: y_min = y1 + disturbance, disturbance = 0.000001, that is, a slight jitter; perform the same operation on the endpoint (x2, y2), that is: y_max = y2 + disturbance.
[0074] In step S9, calculate the minimum and maximum ordinates of the line segment after jitter, denoted as y_min and y_max respectively. Then find all the scan lines with the ordinate range [y_min, y_max], that is, all the scan lines between the minimum scan line and the maximum scan line, and record them as the set of all scan lines passing through the line segment after this calculation of jitter; the specific method is as follows:
[0075] The minimum and maximum ordinates of the line segment after jitter are y_min and y_max respectively. The minimum scan line and the maximum scan line are the operations of rounding up and rounding down the minimum and maximum ordinates respectively. The specific formulas are as follows:
[0076] The multiples of the minimum and maximum scan lines are:
[0077]
[0078]
[0079] The minimum and maximum scan lines are:
[0080]
[0081]
[0082] Divide the line segment into (x_indice_max - x_indice_min + 1) scan lines.
[0083] In step S10, the intersection point (x, y) of the scan line and the line segment is calculated, and the coordinates of the intersection point are recorded in the array of scan lines. The specific formula is as follows:
[0084]
[0085] In the above formula: y0 is the y-axis coordinate of the scan line, and (x1, y1) and (x2, y2) are the coordinates of the two starting endpoints of the line segment.
[0086] This invention is based on a 2D polygon scan line filling algorithm. By using a line segment in the slice layer as a reference, it traverses all scan lines of that line segment, avoiding invalid calculations when the scan line does not intersect with the line segment. Furthermore, for each line segment, only the slope needs to be calculated once, effectively solving the problems of traditional slice filling algorithms and greatly improving the algorithm's efficiency. Simultaneously, this invention addresses the issue of duplicate storage when the scan line and line segment intersect at the line segment endpoint or when the scan line coincides with the line segment, leading to incorrect or missed filling during filling. It proposes a method of adding slight jitter to effectively avoid the aforementioned duplicate storage, solving the problems of incorrect and missed filling and greatly improving the algorithm's accuracy. Therefore, this algorithm achieves high-precision and high-speed 3D printing slice filling. The method of this invention achieves high precision and high speed in the 3D printing slice filling process.
[0087] Regarding the specific structure of this invention, it should be noted that the connection relationships between the various component modules used in this invention are definite and achievable. Except as specifically described in the embodiments, their specific connection relationships can bring about corresponding technical effects and solve the technical problems proposed by this invention without relying on the execution of corresponding software programs. The models of the components, modules, and specific components appearing in this invention, the connection methods between them, and the conventional usage methods and expected technical effects brought about by the above technical features, unless specifically described, are all publicly disclosed content in patents, journal articles, technical manuals, technical dictionaries, and textbooks that can be obtained by those skilled in the art before the application date, or belong to conventional technology, common knowledge, and other existing technologies in this field. There is no need to elaborate, which makes the technical solution provided in this case clear, complete, and achievable, and can reproduce or obtain corresponding physical products based on this technical means.
[0088] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A 3D printing slice filling method based on DLP, characterized in that: It includes the following steps: S1: Import a 3D model and convert the 3D model into a discrete triangular mesh; S2: Set the ranges of x, y, and z of the 3D printing platform as buildPlatformXRange, buildPlatformYRange, and buildPlatformZRange; set the resolutions in the x and y directions as layerXResolution and layerYResolution, and set the slice thickness in the z-axis direction as layerZResolution; S3: Along the z-axis direction, slice the 3D model into a series of slice layers according to layerZResolution; S4: Calculate the line segments where each slice layer intersects the triangular mesh in the 3D model and record the line segments in the corresponding slice layer; S5: For each slice layer in the 3D model, repeat steps S6 to S14 until all slice layers of the 3D model are traversed; S6: For each line segment in the slice layer, repeat steps S7 to S10 until all line segments of the slice layer are traversed; S7: Define the starting point coordinates of the line segment as (x1, y1) and the ending point coordinates as (x2, y2). Compare the y values of the endpoints of each line segment. If y1 > y2, swap the values of the two endpoints so that the y value of the starting point coordinate is less than the y value of the ending point coordinate. If y1 < y2, proceed to step S8; S8: Divide the slice area into several lines perpendicular to the y-axis, i.e., scan lines, and determine whether all endpoints of the line segments coincide with the scan lines. If they coincide, use the method of adding slight jitter for processing; In step S8, when determining whether the endpoints of the line segment coincide with the scan line, if they coincide, use the method of adding slight jitter for processing. The specific method is as follows: First, determine a series of scan lines on the slice layer. The number of scan lines is buildPlatformYRange / layerYResolution. The direction of the scan lines is perpendicular to the y-axis. The length of the scan lines is buildPlatformXRange. The scanning range of the scan lines is buildPlatformYRange, and the moving step size is layerYResolution. Add one scan line for each movement of one step size; Let the coordinates of the two endpoints of the line segment be (x1, y1) and (x2, y2), and calculate the minimum scan line and the maximum scan line of the two coordinates of the line segment. The calculation formula is as follows: Determine whether the endpoint coincides with the scan line, that is, y1 - y1_min1 < threshHold or y1 - y1_min2 < threshHold, where threshHold is a number close to 0. If the above equation holds, the endpoint (x1, y1) is on the scan line, that is, the endpoint (x1, y1) coincides with the scan line. The same judgment method is used for the endpoint (x2, y2); If the endpoint coincides with the scan line, perform the following operations: y_min = y1 + disturbance, disturbance = 0.000001, that is, a slight jitter; perform the same operation on the endpoint (x2, y2), that is: y_max = y2 + disturbance; S9: Calculate the minimum and maximum ordinates of the line segment after jitter, denoted as y_min and y_max respectively, and then find all the scan lines with the ordinate range [y_min, y_max], that is, all the scan lines between the minimum scan line and the maximum scan line, and record them as the set of all scan lines passing through the line segment after this calculation of jitter; S10: Traverse the set of scan lines of the line segment after this calculation of jitter; find the intersection points of each scan line and the line segment, and record the coordinates of the intersection points in the intersection point array corresponding to the scan line until all the scan lines in the set of scan lines of the line segment are traversed, and end the traversal; S11: For each scan line in the slice layer, repeat steps S12 to S13 until all the scan lines in the slice layer are traversed, and end the traversal; S12: Sort the intersection points in the scan line intersection point array in ascending order of abscissa; S13: Group the scan line intersection point array in pairs according to the sorting size in S12, connect them into line segments, and store the line segments in the slice image of this slice layer; S14: Read the slice images of each layer and generate the corresponding two-dimensional projection patterns; S15: Complete the slice filling of 3D printing; S16: Use a DLP light source to project the projection pattern of each layer onto the surface of the photosensitive resin so that the resin cures under the irradiation of light to obtain a 3D printing model.
2. The 3D printing slice filling method based on DLP according to claim 1, characterized in that: In the step S9, calculate the minimum and maximum ordinates of the line segment after jitter, denoted as y_min and y_max respectively, and then find all the scan lines with the ordinate range [y_min, y_max], that is, all the scan lines between the minimum scan line and the maximum scan line, and record them as the set of all scan lines passing through the line segment after this calculation of jitter; the specific method is as follows: The minimum and maximum ordinates of the line segment after jitter are y_min and y_max respectively. The minimum scan line and the maximum scan line are the operations of rounding up and rounding down the minimum and maximum ordinates respectively. The specific formulas are as follows: The multiples of the minimum and maximum scan lines are: x_indice_min = ⌈(y_min / layerYResolution)⌉; x_indice_max = ⌊(y_max / layerYResolution)⌋; The minimum and maximum scan lines are: x_scan_min=⌈(y_min / layerYResolution)⌉×layerYResolution; x_scan_max=⌊(y_max / layerYResolution)⌋×layerYResolution; Divide the line segment into (x_indice_max-x_indice_min+1) scan lines.
3. The 3D printing slice filling method based on DLP according to claim 2, characterized in that: In step S10, the intersection point (x, y) of the scan line and the line segment is calculated, and the coordinates of the intersection point are recorded in the array of scan lines. The specific formula is as follows: ; In the above formula: y0 is the y-axis coordinate of the scan line, and (x1, y1) and (x2, y2) are the coordinates of the two starting endpoints of the line segment.
Citation Information
Patent Citations
Two-dimension variable-scale scanning moulding 3D printing technology based on section graphs
CN108656557A
Automatic trajectory planning method and system for multi-layer and multi-channel wire arc additives of metal structure
CN112846232A