3D printing rotational surface slicing method, system, device and storage medium
By adopting the rotating surface slice method in 3D printing technology, using technical means such as matrix transformation and contour processing, the accuracy and efficiency of surface slices in the existing technology are solved, and efficient slicing and precise reconstruction of the rotating surface is achieved.
Patent Information
- Application Number
- CN202411407799.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-10-10
AI Technical Summary
In the existing 3D printing technology, the surface slicing method has problems such as serious self-intersection, uncontrollable accuracy, high algorithm complexity, and difficulty in processing. It is mainly aimed at cylinder and spherical models, and the surface generation effect is not good.
A 3D printing rotary surface slice method is adopted to achieve accurate slice and reconstruction of the rotary surface through matrix transformation, acquisition of rotary contour lines, bias contour lines, axial discrete and circumferential discrete steps.
This method can achieve accuracy setting in the axial and circumferential directions for the slewing body model or workpiece, avoid self-intersection problems, fast calculation speed, and good surface generation effect.
Smart Images

Figure CN119152159B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a 3D printing rotating surface slicing method, belonging to the technical field of 3D printing. Background Art
[0002] When 3D printing, the plane slicing method is usually used. Plane slicing will be sliced along a fixed direction, while surface slicing generally has serious self-intersection, uncontrollable accuracy, high algorithm complexity, and difficult processing. At present, the existing surface slicing method is relatively simple in processing models, and is mainly used for cylindrical and spherical models or workpieces, and the generated surface effect is not good. Summary of the invention
[0003] The technical problem to be solved by the present invention is to overcome the defects of the prior art and provide a 3D printing rotation surface slicing method, device and storage medium.
[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is as follows:
[0005] A 3D printing rotational surface slicing method comprises the following steps:
[0006] Step 1) obtaining basic data, including workpiece and rotational surface;
[0007] Step 2) Matrix transformation
[0008] The rotation surface and the workpiece are respectively subjected to translation and then rotation transformation to obtain a transformed rotation surface and a transformed workpiece;
[0009] Step 3) Get the rotation contour
[0010] 3.1) Determine the z-direction interval: The maximum value of the second bounding box of the transformed rotation surface in the z-direction is maxz, and the minimum value is minz, then the z-direction interval range of the second bounding box is [minz, maxz].
[0011] 3.2) Get the intersection line: Set the initial vector The first plane formed by the origin O(0,0,0) intersects the transformed rotation surface to obtain two intersection lines; determine whether the z-direction ranges of the two intersection lines continuously cover the z-direction range of the second bounding box;
[0012] If it is not covered continuously, the initial vector Rotate a set angle around the z axis to get the second vector A second plane is formed with the origin O(0,0,0), and two new intersection lines are obtained by intersecting with the transformed rotation surface. Together with the two intersection lines calculated previously, it is determined again whether the z-direction interval range of the two intersection lines continuously covers the z-direction interval range of the second bounding box;
[0013] If it is still not completely and continuously covered, repeat the above steps until it is continuously covered;
[0014] 3.3) Merge the intersection lines; if the z-direction interval range of the second bounding box is successfully and continuously covered, all the intersection lines are rotated around the z-axis to the yoz plane, and all the intersection lines are merged to obtain the first rotation contour line;
[0015] Step 4) Offset the contour line
[0016] 4.1) Rotation: Rotate the first rotated contour line 90° around the y-axis to the xoy plane to obtain the second rotated contour line;
[0017] 4.2) Head-tail extension: the head and tail ends of the second rotation contour line are extended to obtain an extended contour line;
[0018] 4.3) Offset: All points on the extended contour line are offset according to the offset width step to obtain the offset contour line;
[0019] Step 5) Axial Discrete
[0020] 5.1) Refining the contour line: discretizing the offset contour line according to the given axial accuracy to obtain the refined contour line;
[0021] 5.2) Rotation: Rotate the refined contour line by -90° around the y-axis and return it to the yoz plane to obtain the third rotated contour line;
[0022] Step 6) Circumferential Discrete
[0023] 6.1) Determine the circumferential discrete range: The maximum value of the third bounding box of the transformed workpiece in the z direction is maxz', and the minimum value is minz'; let any continuous point p on the third rotation contour line i '、p i+1 ', minimum value minz' in p i '、p i+1 'The z value of the two points is within the range; then the point p with the minimum z value minz' on the third rotation contour line is calculated min and the point p with the maximum z-value maxz' max , p min and p max Insert the points into the third rotation contour line according to the z-direction value as discrete boundary points;
[0024] 6.2) Circumferential discretization: On the third rotation contour line, all contour points with z-values within [minz', maxz'] are discretized circumferentially with the z-axis as the rotation axis to obtain multiple lines of discrete point clouds;
[0025] Step 7) Identification
[0026] Determine whether the discrete point cloud is inside the transformed workpiece, retain the points inside the transformed workpiece, record and store the row number of the internal points in the discrete point cloud and the corresponding sort number in each row to form a storage file sifting_ids;
[0027] Step 8) Block
[0028] 8.1) Determine the type: group the continuous sequence numbers in each row of sifting_ids into one segment, and process all rows in segments. If the number of segments in all rows is the same, it is determined to be a split workpiece; if it is different, it is determined to be a whole workpiece; if the number of segments in all rows is 1, it is determined to be a whole workpiece;
[0029] 8.2) Blocking: All rows are divided into blocks, and each block corresponds to each split workpiece. For split workpieces, each block has multiple rows, each row has only one section, and the block is stored as a whole.
[0030] For the whole workpiece, there is only one block, no need to divide into blocks; each block has multiple rows, a row contains one or more segments, and each row is stored as a whole;
[0031] Step 9) Add boundary points
[0032] For split workpieces, the first and last rows of each piece are stored in the boundary points, and the first and last rows are removed, and the other points are stored in the internal points;
[0033] For the whole workpiece, the first and last rows of the whole workpiece are stored in the boundary points, and the first and last rows are removed, and the other points are stored in the internal points;
[0034] According to the difference between the split workpiece and the whole workpiece, the circumferential boundary interpolation points, the adjacent row interpolation points and the boundary middle interpolation points are performed and stored in the boundary points;
[0035] Step 10) Downsampling and reconstruction of patches
[0036] 10.1) Downsampling: Use the hierarchical downsampling method to downsample the internal points to obtain downsampled internal points;
[0037] 10.2) Reconstruction: Combine the internal points and boundary points into the final point cloud, and use the advancing front surface reconstruction method to jointly reconstruct the surface patch;
[0038] 10.3) Filtering patches: Filter the reconstructed surface patches. If there are triangular patches whose three points are all formed by boundary points in the reconstructed surface patches, they are discarded to obtain filtered patches.
[0039] Step 11) Output the surface
[0040] The filtered patches are first rotated and then translated to obtain the sliced surface.
[0041] Furthermore, in step 4.2), when the head and tail are extended, the extension distance diste is set, and the first point and the second point of the second rotation contour line outline' from the head end are pte0 and pte1 respectively, then the head end extension point spt, The tail extension point is calculated in the same way; the head and tail ends of the second rotated outline 'are extended to obtain the extended outline extend_outline.
[0042] Furthermore, in step 4.3), when offsetting, set the offset width to step, and the tangent vector of any point ptt on the extended contour line extend_outline is The perpendicular vector is Point ptt vertical vector Move the step width in the direction to get the offset point ptt'. All points on the extended contour line extend_outline are offset by the offset width step to obtain the offset contour line offset_line.
[0043] Furthermore, in step 5.1), when refining the contour line, the offset contour line offset_line is discretized according to the given axial precision outline_dist; let any continuous point p on the offset contour line offset_line i 、p i+1 When the distance between these two points d>outline_dist, the interpolation operation is performed; set the number of interpolation points num=d / outline_dist-1, and the interval between points len=d / (num+1); finally, the refined contour line refining_line is obtained.
[0044] Furthermore, in step 6.2), when the circumferential discretization is performed, set point p r The z value is within [minz', maxz'], the contour line is on the yoz plane, and the circumferential radius r is point p r The y-direction value, r = |p r .y|, where p r .y represents point p r The y-direction value of the given rotation precision arc_dist, which corresponds to the angle With r as radius and base point p r_0 (r·sin0,r·cos0,p r .z) as the starting point, rotate counterclockwise around the z axis to calculate the discrete points, then the kth discrete point p r_k The coordinate value of r_k (r·sin(k·θ), r·cos(k·θ), p r.z), k·θ≤2π, where p r .z represents the z-value of point pr; all contour points on the third rotation contour line refining_line' within [minz', maxz'] are discretized, and finally multiple lines of discrete point clouds discrete_points are obtained.
[0045] Furthermore, in step 8.2), when dividing into blocks, for the split workpiece, each row is divided into different segments with the same number of segments, and different segments belong to different split workpieces; suppose that two adjacent rows row j 、row j+1 , the number of segments is m, row j First point of line s row j+1 First point of line t when When the distance is closest, the distance The segments where the two first points of the two segments are located are considered to belong to the same block.
[0046] A 3D printing rotating surface slicing system, comprising the following modules:
[0047] Obtaining a basic data module, which includes a workpiece and a rotational surface;
[0048] A matrix transformation module is used to perform a translation and then a rotation transformation on the rotation surface and the workpiece, respectively, to obtain a transformed rotation surface and a transformed workpiece;
[0049] Get the rotation contour module, including:
[0050] Determine the z-direction interval submodule: the z-direction maximum value of the second bounding box of the transformed rotation surface is maxz, and the minimum value is minz, then the z-direction interval range of the second bounding box is [minz, maxz].
[0051] Get the intersection submodule: Set the initial vector The first plane formed by the origin O(0,0,0) intersects the transformed rotation surface to obtain two intersection lines; determine whether the z-direction ranges of the two intersection lines continuously cover the z-direction range of the second bounding box;
[0052] If it is not covered continuously, the initial vector Rotate a set angle around the z axis to get the second vector A second plane is formed with the origin O(0,0,0), and two new intersection lines are obtained by intersecting with the transformed rotation surface. Together with the two intersection lines calculated previously, it is determined again whether the z-direction interval range of the two intersection lines continuously covers the z-direction interval range of the second bounding box;
[0053] If it is still not completely and continuously covered, repeat the above steps until it is continuously covered;
[0054] Merge intersection line submodule; if the z-direction interval range of the second bounding box is successfully and continuously covered, all intersection lines are rotated around the z-axis to the yoz plane, and all intersection lines are merged to obtain the first rotated contour line;
[0055] Offset contour module, including:
[0056] Rotation submodule: rotate the first rotation contour line 90° around the y axis to the xoy plane to obtain the second rotation contour line;
[0057] Head and tail extension submodule: extending the head and tail ends of the second rotation contour line to obtain an extended contour line;
[0058] Offset submodule: All points on the extended contour line are offset according to the offset width step to obtain the offset contour line;
[0059] Axial discrete modules, including:
[0060] Contour refinement submodule: discretizes the offset contour according to the given axial accuracy to obtain the refined contour;
[0061] Rotation submodule: rotate the refined contour line by -90° around the y-axis and return it to the yoz plane to obtain the third rotated contour line;
[0062] Circumferential discrete modules, including:
[0063] Determine the circumferential discrete range submodule: The maximum value of the third bounding box of the transformed workpiece in the z direction is maxz', and the minimum value is minz'; suppose any continuous point p on the third rotation contour line i '、p i+1 ', minimum value minz' in p i '、p i+1 'The z value of the two points is within the range; then the point p with the minimum z value minz' on the third rotation contour line is calculated min and the point p with the maximum z-value maxz' max , p min and p max Insert the points into the third rotation contour line according to the z-direction value as discrete boundary points;
[0064] Circumferential discretization submodule: On the third rotation contour line, all contour points with z-axis values within [minz', maxz'] are discretized circumferentially with the z-axis as the rotation axis to obtain multiple lines of discrete point clouds;
[0065] The discrimination module is used to judge whether the discrete point cloud is inside the transformed workpiece, retain the points inside the transformed workpiece, record and store the row number of the internal points in the discrete point cloud and the corresponding sort number in each row, and form a storage file sifting_ids;
[0066] Block modules include:
[0067] Type determination submodule: Classify the continuous sorting numbers in each row of sifting_ids into one segment, and process all rows in segments. If the number of segments of all rows is the same, it is determined to be a split workpiece; if it is different, it is determined to be a whole workpiece; if the number of segments of all rows is 1, it is determined to be a whole workpiece;
[0068] Block submodule: all rows are processed into blocks, each block corresponds to each split workpiece; for split workpieces, each block has multiple rows, each row has only one section, and the block is stored as a whole;
[0069] For the whole workpiece, there is only one block, no need to divide into blocks; each block has multiple rows, a row contains one or more segments, and each row is stored as a whole;
[0070] Added boundary point module, for split workpieces, the first and last lines of each piece are stored in the boundary points, the first and last lines are removed, and other points are stored in the internal points;
[0071] For the whole workpiece, the first and last rows of the whole workpiece are stored in the boundary points, and the first and last rows are removed, and the other points are stored in the internal points;
[0072] According to the difference between the split workpiece and the whole workpiece, the circumferential boundary interpolation points, the adjacent row interpolation points and the boundary middle interpolation points are performed and stored in the boundary points;
[0073] Downsampling and reconstruction patch module, including:
[0074] Downsampling submodule: Use the hierarchical downsampling method to downsample the internal points to obtain downsampled internal points;
[0075] Reconstruction submodule: Combine the internal points and boundary points of the down-sampled points into the final point cloud, and use the advancing front surface reconstruction method to jointly reconstruct the surface patches;
[0076] Filter patch submodule: filter the reconstructed surface patches. If there are triangular patches whose three points are all formed by boundary points in the reconstructed surface patches, they will be discarded to obtain the filtered patches.
[0077] The output surface module is used to rotate and then translate the filtered faces to obtain the slice surface.
[0078] A computer device comprises a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement any one of the 3D printing rotational surface slicing methods.
[0079] A computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements any one of the 3D printing rotational surface slicing methods.
[0080] The beneficial effects achieved by the present invention are:
[0081] The rotational surface slicing method of the present invention is mainly aimed at a rotating body model or a workpiece, and can set the precision in both the axial and circumferential directions to achieve controllable precision and avoid self-intersection problems. It also has a fast calculation speed and a good surface generation effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] Figure 1 is a flow chart of the 3D printing rotational surface slicing method of the first embodiment;
[0083] Figure 2 This is a schematic diagram of a split workpiece taking a five-blade impeller as an example;
[0084] Figure 3 This is the final cloud diagram;
[0085] Figure 4 It is a schematic diagram of the reconstructed surface patch. DETAILED DESCRIPTION
[0086] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.
[0087] Embodiment 1
[0088] This embodiment discloses a 3D printing rotation surface slicing method, such as Figure 1 As shown, the specific steps include:
[0089] 1. Get basic data
[0090] Get basic data, including workpiece mesh, rotation surface rotate_surface and workpiece rotation axis axis_z.
[0091] 2. Matrix transformation
[0092] Calculate the center point cpt(x cpt ,y cpt ,z cpt ), xcpt ,y cpt 、z cp t are the x, y, and z axis coordinates corresponding to the center point, respectively, and the translation matrix H = [-x cpt -y cpt -z cpt ] T . Calculate the rotation matrix Rot that transforms the workpiece rotation axis axis_z to the point (0,0,1).
[0093] The rotation surface rotate_surface and the workpiece mesh are respectively subjected to translation and then rotation transformation to obtain the transformed rotation surface rotate_surface' and the transformed workpiece mesh'.
[0094] rotate_surface'=Rot·H·rotate_surface;
[0095] mesh'=Rot·H·mesh.
[0096] 3. Get the rotation contour
[0097] 3.1. Determine the z-interval. The maximum value of the second bounding box bbox′ of the transformed rotation surface rotate_surface' in the z-direction is maxz, and the minimum value is minz, so the z-interval range of the second bounding box z_interval is [minz, maxz].
[0098] 3.2. Get the intersection line. Initial vector The first plane Plane is formed with the origin O(0,0,0), and the first plane Plane intersects with the transformed rotation surface rotate_surface' to calculate two intersection lines. It is determined whether the z-direction range of the two intersection lines continuously covers the z-direction interval range z_intervel of the second bounding box, that is, whether the z-direction union of the two intersection lines covers the z-direction interval range z_intervel of the second bounding box.
[0099] If it is not covered continuously, the initial vector Rotate a set angle around the z axis to get the second vector The second plane Plane' is formed with the origin O(0,0,0), and two new intersection lines between the second plane Plane' and the transformed rotation surface rotate_surface' are calculated. Together with the two intersection lines calculated previously, it is determined again whether the z-direction range continuously covers the z-direction interval range z_interval of the second bounding box.
[0100] If it is still not completely and continuously covered, repeat the above steps until it is continuously covered.
[0101] 3.3. Merge intersection lines. If the second bounding box z-interval is successfully and continuously covered, all intersection lines are rotated around the z-axis to the yoz plane (y>0), thereby merging all intersection lines to obtain the first rotated outline.
[0102] 4. Offset Contour
[0103] 4.1. Rotation. Rotate the first rotated contour line outline on the yoz surface by 90° around the y axis to the xoy surface to obtain the second rotated contour line outline'.
[0104] 4.2. Head and tail extension. Set the extension distance diste, the first and second points of the second rotation contour line outline' from the head end are pte0 and pte1 respectively, then the head end extension point spt, The first extension point spt is the extension point that extends the distance diste according to the direction from pte1 to pte0, so it can be used as the first point of the extended contour line extend_outline. The tail extension point can be calculated in the same way. After the head and tail are extended, the extended contour line extend_outline is obtained.
[0105] 4.3. Offset. The required slice height is the offset width. Let the offset width be step, and the tangent vector of any point ptt on the extended contour line extend_outline is The perpendicular vector is Point to the right side of the extended outline extend_outline. Point ptt extends the vertical vector Move the step width in the direction to get the offset point ptt'. All points on the extended contour line extend_outline are offset to obtain the offset contour line offset_line.
[0106] 5. Axial Discrete
[0107] 5.1. Thin the outline. Thin the offset outline offset_line according to the given axial precision outline_dist, so as to achieve the axial discrete effect. Suppose any continuous point p on the offset outline offset_line i 、p i+1 When the distance between the two points d> outline_dist, the point insertion operation is performed. Assume the number of inserted points num, num = d / outline_dist-1, the interval between points len = d / (num+1), then the point coordinates of the inserted kth point p k , Finally, the refined contour line refining_line is obtained.
[0108] 5.2. Rotation. Rotate the refined contour line refining_line by -90° around the y axis and return it to the yoz plane to obtain the third rotated contour line refining_line'.
[0109] 6. Circumferential Discrete
[0110] 6.1. Determine the circumferential discrete range. The maximum value of the third bounding box bbox'' of the transformed workpiece mesh' in the z direction is maxz', and the minimum value is minz'. Suppose any continuous point p on the third rotation contour line refining_line' i '、p i+1 ', minimum value minz' in p i '、p i+1 'Within the range of z values of two points, that is, p i '.z <minz'<p i+1 '.z, where p i '.z is point p i 'z-direction value, p i+1 '.z is point p i+1 'z-direction value; then the point with the minimum z-direction value minz' on the third rotation contour line refining_line' Similarly, we can calculate the point p with the maximum value maxz' in the z direction max . p min and p max According to the size of the z-value, it is inserted into the third rotation contour line 'refining_line' as a discrete boundary point.
[0111] 6.2. Circumferential discretization. On the third rotation contour line refining_line', the points whose z-axis values are within [minz', maxz'] are discretized circumferentially with the z-axis as the rotation axis. Assume that point p r The z value is within [minz',maxz'], because the contour line is on the yoz surface, the circumferential radius r is point p r The y-direction value, r = |p r .y|, where p r .y represents point p r The y-axis value of the given rotation precision arc_dist, which corresponds to the angle With r as radius and base point p r_0 (r·sin0,r·cos0,p r .z) as the starting point, rotate counterclockwise around the z axis to calculate the discrete points, then the kth discrete point p r_k The coordinate value ofr_k (r·sin(k·θ), r·cos(k·θ), p r .z)(k·θ≤2π), where p r .z represents point p r All contour points on the third rotation contour line refining_line' in [minz', maxz'] are discretized, and finally multiple lines of discrete point clouds discrete_points are obtained, such as Figure 2 shown.
[0112] 7. Discrimination
[0113] Determine whether the discrete point cloud discrete_points is inside the transformed workpiece mesh'. Set the points inside the transformed workpiece to 1, and the points outside the transformed workpiece to 0. Keep the points inside the transformed workpiece mesh', record the row number col of the internal points in the discrete point cloud discrete_points and the corresponding sort number index in each row, and form the storage file sifting_ids.
[0114] 8. Block
[0115] 8.1. Determine the type. Because the workpiece may be a whole or composed of multiple parts (such as Figure 2 As shown in the figure, it is necessary to first determine the type of the transformed workpiece mesh' and then process it separately. The continuous sort number index in each row of sifting_ids is classified as a segment, and all rows are processed in segments. If the number of segments of all rows is the same, it is determined to be a split workpiece; if it is different, it is determined to be a whole workpiece; but if the number of segments of all rows is 1, it is determined to be a whole workpiece.
[0116] 8.2. Blocking.
[0117] For split workpieces, each row is divided into different segments with the same number of segments, and different segments belong to different split workpieces. j 、row j+1 , the number of segments is m, row j First point of line s row j+1 First point of line t when When the distance is closest, the distance The segments where the two first points of the two segments are located are considered to belong to the same block. All rows are processed into blocks, and each block corresponds to each split workpiece. For split workpieces, there are multiple rows in each block, and there is only one segment in each row. The block is stored as a whole.
[0118] For the whole workpiece, there is only one block, no need to divide it into blocks. Each block contains multiple lines, a line contains one or more segments, and each line is stored as a whole.
[0119] 9. Add boundary points
[0120] 9.1 Separating Boundary and Interior Points
[0121] For split artifacts, the first and last lines of each block are stored in the boundary points border_pts. After removing the first and last lines, the other points are stored in the internal points block_pts.
[0122] For the whole workpiece, the first and last lines of the workpiece are stored in the boundary points border_pts. After removing the first and last lines, the other points are stored in the internal points block_pts.
[0123] 9.2. Circumferential Boundary Interpolation Points
[0124] For split workpieces, there is only one segment in each row in each block, and the circumferential boundary interpolation points are performed on the first and last points of each segment using the binary search method.
[0125] Assume that the first point of one segment is p in , then the row center o p (0,0,p in .z), radius r b =|o p p in |, find the discrete point cloud discrete_points in p in The previous continuous point p out , then the point is outside the workpiece. The angle between the vector (1,0,0) and the vector (1,0,0) is α in , (0≤α in <2π), The angle between the vector (1,0,0) and the vector (1,0,0) is α out , (0≤α out <2π), p in and p out The angle between them is Δθ=|α in -α out |, calculate p in 、p out Midpoint p m , In the formula, p in .z represents point p in The z-direction value of m Is it inside the workpiece? If it is inside the workpiece, then end. If it is outside the workpiece, then let p m becomes the previous continuous point p out ', calculate p in 、pout 'The new middle point between them is determined again, and the above steps are repeated until the new middle point p m Inside the workpiece.
[0126] According to the previous step, we get the new middle point p m , and calculate p in the same way m 、p out ' Between the internal points p of the workpiece m ', the calculated p m 'It will be closer to the actual workpiece boundary. Perform circumferential boundary interpolation points on all row endpoints in all blocks and store them in the boundary point border_pts.
[0127] For the whole workpiece, since each row contains one or more segments, if there is only one segment in a row, it is necessary to first determine whether the first and last points of the segment are continuous in the discrete point cloud discrete_points. If they are continuous, that is, the whole circle is retained, no point insertion is required; if they are not continuous, circumferential boundary interpolation is required. If there are multiple segments, the endpoints of each segment need to be interpolated circumferentially. The method is the same as the circumferential boundary point interpolation of the split workpiece, that is, to find continuous points with endpoints outside the workpiece, use the dichotomy method to calculate the insertion point between the two points, and store it in the boundary point border_pts.
[0128] 9.3. Adjacent row insertion points
[0129] In order to make the boundaries clearer, it is necessary to insert points between adjacent rows.
[0130] For split workpieces, since each row of the split workpiece has only one section, each row has only two endpoints. Assume that the uth endpoint in the jth row is pt u , endpoint u=0,1, the vth endpoint pt in the j+1th row v , endpoint v=0,1, when d min =min(d(pt u ,pt v )) u pt v For the closest point pair, points are inserted between the closest point pairs according to the specified distance and stored in the boundary point border_pts.
[0131] For the whole workpiece, since there may be multiple segments in a row, the insertion points of adjacent rows need to match the corresponding endpoints first. Assuming that the number of endpoints in the jth row is w, then the uth endpoint is p u (u∈[0,w)); the number of endpoints in the j+1th row is n, then the vth endpoint is p v (v∈[0,n)). If p u and p v If they are the closest points to each other, they are matched into pairs, that is, d min= min(d(p u , p v )) = min(d(p v , p u ))。Among the paired p u p v interpolate points according to the given distance and store them in the boundary points border_pts.
[0132] 9.4. Interpolation in the middle of the boundary
[0133] For the overall workpiece, the number of line segments between rows may change. If it changes, for adjacent rows with different numbers of segments, interpolation operations need to be performed on the redundant endpoints of the row with more segments. Assume that the number of endpoints in the j-th row is w, and the u-th endpoint is p u (u ∈ [0, w)); the number of endpoints in the (j + 1)-th row is n, and the v-th endpoint is p v (v ∈ [0, n)), where w < n. First, vertically match the endpoints. p u and p v are the closest points in distance to each other and are matched together. Since w < n, exclude the already matched endpoints in the (j + 1)-th row, and match the remaining endpoints again according to the principle of the closest distance. Between the paired endpoints obtained from the re-matching, interpolate points according to the given distance to further improve the boundary points and store them in the boundary points border_pts. The given distance needs to be configured according to the actual workpiece. If the distance between the redundant endpoints is less than the given value, no interpolation is performed. The main reason is that no interpolation is done between the redundant endpoints, and if the distance is too large, it will affect the reconstructed surface patches.
[0134] For split workpieces, no interpolation in the middle of the boundary is required.
[0135] 10. Downsampling and reconstructing surface patches
[0136] In the above steps, the boundary points border_pts and the internal points block_pts have been extracted and stored separately.
[0137] 10.1. Downsampling. Use the hierarchical downsampling method to perform downsampling on the internal points block_pts to obtain the downsampled internal points block_pts'.
[0138] 10.2. Reconstruction. Combine the downsampled internal points block_pts' and the boundary points border_pts into the final point cloud, as Figure 3 shown, and use the existing advancing front surface reconstruction method to jointly reconstruct the surface patches facets.
[0139] 10.3. Filtering facets. The reconstructed surface facets need to be filtered, because the triangular facets composed of three points that are all boundary points are redundant, so they need to be filtered again. If there are triangular facets in the surface facets whose three points are all boundary points border_pts, they will be discarded, and the filtered facets are fmesh. Figure 4 shown.
[0140] 11. Output Surface
[0141] The filtered face fmesh needs to be transformed into the original coordinate system.
[0142] Calculate the inverse matrix Rot_inv of the rotation matrix Rot in step 2, and translate from the origin O(0,0,0) back to the center point cpt(x cpt ,y cpt ,z cpt ), so the translation matrix H'=[x cpt y cpt z cpt ] T . Rotate fmesh first and then translate it to obtain the slice surface fmesh'.
[0143] fmesh'=H'·Rot_inv·fmesh.
[0144] The rotational surface slicing method of the present invention is mainly aimed at a rotating body model or a workpiece, and can set the precision in both the axial and circumferential directions to achieve controllable precision, and has a fast calculation speed and a good surface generation effect.
[0145] Embodiment 2
[0146] This embodiment discloses a 3D printing rotating surface slicing system, including the following modules:
[0147] Obtaining a basic data module, which includes a workpiece and a rotational surface;
[0148] A matrix transformation module is used to perform a translation and then a rotation transformation on the rotation surface and the workpiece, respectively, to obtain a transformed rotation surface and a transformed workpiece;
[0149] Get the rotation contour module, including:
[0150] Determine the z-direction interval submodule: the z-direction maximum value of the second bounding box of the transformed rotation surface is maxz, and the minimum value is minz, then the z-direction interval range of the second bounding box is [minz, maxz].
[0151] Get the intersection submodule: Set the initial vector The first plane formed by the origin O(0,0,0) intersects the transformed rotation surface to obtain two intersection lines; determine whether the z-direction ranges of the two intersection lines continuously cover the z-direction range of the second bounding box;
[0152] If it is not covered continuously, the initial vector Rotate a set angle around the z axis to get the second vector A second plane is formed with the origin O(0,0,0), and two new intersection lines are obtained by intersecting with the transformed rotation surface. Together with the two intersection lines calculated previously, it is determined again whether the z-direction interval range of the two intersection lines continuously covers the z-direction interval range of the second bounding box;
[0153] If it is still not completely and continuously covered, repeat the above steps until it is continuously covered;
[0154] Merge intersection line submodule; if the z-direction interval range of the second bounding box is successfully and continuously covered, all intersection lines are rotated around the z-axis to the yoz plane, and all intersection lines are merged to obtain the first rotated contour line;
[0155] Offset contour module, including:
[0156] Rotation submodule: rotate the first rotation contour line 90° around the y axis to the xoy plane to obtain the second rotation contour line;
[0157] Head and tail extension submodule: extending the head and tail ends of the second rotation contour line to obtain an extended contour line;
[0158] Offset submodule: All points on the extended contour line are offset according to the offset width step to obtain the offset contour line;
[0159] Axial discrete modules, including:
[0160] Contour refinement submodule: discretizes the offset contour according to the given axial accuracy to obtain the refined contour;
[0161] Rotation submodule: rotate the refined contour line by -90° around the y-axis and return it to the yoz plane to obtain the third rotated contour line;
[0162] Circumferential discrete modules, including:
[0163] Determine the circumferential discrete range submodule: The maximum value of the third bounding box of the transformed workpiece in the z direction is maxz', and the minimum value is minz'; suppose any continuous point p on the third rotation contour line i '、p i+1 ', minimum value minz' in p i '、p i+1 'The z value of the two points is within the range; then the point p with the minimum z value minz' on the third rotation contour line is calculatedmin and the point p with the maximum z-value maxz' max , p min and p max Insert the points into the third rotation contour line according to the z-direction value as discrete boundary points;
[0164] Circumferential discretization submodule: On the third rotation contour line, all contour points with z-axis values within [minz', maxz'] are discretized circumferentially with the z-axis as the rotation axis to obtain multiple lines of discrete point clouds;
[0165] The discrimination module is used to judge whether the discrete point cloud is inside the transformed workpiece, retain the points inside the transformed workpiece, record and store the row number of the internal points in the discrete point cloud and the corresponding sort number in each row, and form a storage file sifting_ids;
[0166] Block modules include:
[0167] Type determination submodule: Classify the continuous sorting numbers in each row of sifting_ids into one segment, and process all rows in segments. If the number of segments of all rows is the same, it is determined to be a split workpiece; if it is different, it is determined to be a whole workpiece; if the number of segments of all rows is 1, it is determined to be a whole workpiece;
[0168] Block submodule: all rows are processed into blocks, each block corresponds to each split workpiece; for split workpieces, each block has multiple rows, each row has only one section, and the block is stored as a whole;
[0169] For the whole workpiece, there is only one block, no need to divide into blocks; each block has multiple rows, a row contains one or more segments, and each row is stored as a whole;
[0170] Added boundary point module, for split workpieces, the first and last lines of each piece are stored in the boundary points, the first and last lines are removed, and other points are stored in the internal points;
[0171] For the whole workpiece, the first and last rows of the whole workpiece are stored in the boundary points, and the first and last rows are removed, and the other points are stored in the internal points;
[0172] According to the difference between the split workpiece and the whole workpiece, the circumferential boundary interpolation points, the adjacent row interpolation points and the boundary middle interpolation points are performed and stored in the boundary points;
[0173] Downsampling and reconstruction patch module, including:
[0174] Downsampling submodule: Use the hierarchical downsampling method to downsample the internal points to obtain downsampled internal points;
[0175] Reconstruction submodule: Combine the internal points and boundary points of the down-sampled points into the final point cloud, and use the advancing front surface reconstruction method to jointly reconstruct the surface patches;
[0176] Filter patch submodule: filter the reconstructed surface patches. If there are triangular patches whose three points are all formed by boundary points in the reconstructed surface patches, they will be discarded to obtain the filtered patches.
[0177] The output surface module is used to rotate and then translate the filtered faces to obtain the slice surface.
[0178] Embodiment 3
[0179] This embodiment discloses a computer device, which includes a processor and a memory. The memory stores a computer program, and the computer program is loaded and executed by the processor to implement the 3D printing rotation surface slicing method described in the first embodiment.
[0180] Embodiment 4
[0181] This embodiment discloses a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the 3D printing rotational surface slicing method as described in the first embodiment is implemented.
[0182] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0183] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0184] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0185] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0186] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A 3D printing rotational surface slicing method, characterized in that: The following steps are involved: Step 1) obtaining basic data, including workpiece and rotational surface; Step 2) Matrix transformation The rotation surface and the workpiece are respectively subjected to translation and then rotation transformation to obtain a transformed rotation surface and a transformed workpiece; Step 3) Get the rotation contour Step 3.1) Determine the z-direction interval: the maximum value of the second bounding box of the transformed rotation surface in the z-direction is maxz, and the minimum value is minz, then the z-direction interval range of the second bounding box is [minz, maxz]; Step 3.2) Get the intersection line: Set the initial vector The first plane formed by the origin O(0,0,0) intersects the transformed rotation surface to obtain two intersection lines; determine whether the z-direction ranges of the two intersection lines continuously cover the z-direction range of the second bounding box; If it is not covered continuously, the initial vector Rotate a set angle around the z axis to get the second vector A second plane is formed with the origin O(0,0,0), and two new intersection lines are obtained by intersecting with the transformed rotation surface. Together with the two intersection lines calculated previously, it is determined again whether the z-direction interval range of the two intersection lines continuously covers the z-direction interval range of the second bounding box; If it is still not completely and continuously covered, repeat the above steps until it is continuously covered; Step 3.3) Merge the intersection lines; if the z-direction interval range of the second bounding box is successfully and continuously covered, all the intersection lines are rotated around the z-axis to the yoz plane, and all the intersection lines are merged to obtain the first rotated contour line; Step 4) Offset the contour Step 4.1) Rotation: Rotate the first rotated contour line 90° around the y-axis to the xoy plane to obtain the second rotated contour line; Step 4.2) Head and tail extension: Extend the head and tail ends of the second rotation contour line to obtain an extended contour line; Step 4.3) Offset: All points on the extended contour line are offset by the offset width step to obtain the offset contour line; Step 5) Axial Discrete Step 5.1) Refining the contour line: discretizing the offset contour line according to the given axial accuracy to obtain the refined contour line; Step 5.2) Rotation: Rotate the refined contour line by -90° around the y-axis and return it to the yoz plane to obtain the third rotated contour line; Step 6) Circumferential Discrete Step 6.1) Determine the circumferential discrete range: The maximum value of the third bounding box of the transformed workpiece in the z direction is maxz', and the minimum value is minz'; let Any continuous point p on the third rotation contour i '、p i+1 ', minimum value minz' in p i '、p i+1 'The z value of the two points is within the range; then the point p with the minimum z value minz' on the third rotation contour line is calculated min and point p with the maximum z-value maxz' max , p min and pmax are inserted into the third rotation contour according to the z-direction value as discrete boundary points; Step 6.2) Circumferential discretization: On the third rotation contour line, all contour points whose z-direction values are within [minz', maxz'] are discretized circumferentially with the z-axis as the rotation axis to obtain multiple lines of discrete point clouds; Step 7) Identification Determine whether the discrete point cloud is inside the transformed workpiece, retain the points inside the transformed workpiece, record and store the row number of the internal points in the discrete point cloud and the corresponding sort number in each row to form a storage file sifting_ids; Step 8) Block Step 8.1) Determine the type: group the continuous sequence numbers in each row of sifting_ids into one segment, and process all rows in segments. If the number of segments in all rows is the same, it is determined to be a split workpiece; if it is different, it is determined to be a whole workpiece; if the number of segments in all rows is 1, it is determined to be a whole workpiece; Step 8.2) Blocking: All rows are divided into blocks, and each block corresponds to each split workpiece; for a split workpiece, each block has multiple rows, each row has only one section, and the block is stored as a whole; For the whole workpiece, there is only one block, no need to divide into blocks; each block has multiple rows, a row contains one or more segments, and each row is stored as a whole; Step 9) Add boundary points For split workpieces, the first and last rows of each piece are stored in the boundary points, and the first and last rows are removed, and the other points are stored in the internal points; For the whole workpiece, the first and last rows of the whole workpiece are stored in the boundary points, and the first and last rows are removed, and the other points are stored in the internal points; According to the difference between the split workpiece and the whole workpiece, the circumferential boundary interpolation points, the adjacent row interpolation points and the boundary middle interpolation points are performed and stored in the boundary points; Step 10) Downsampling and reconstruction of patches Step 10.1) Downsampling: Downsample the internal points using a hierarchical downsampling method to obtain downsampled internal points; Step 10.2) Reconstruction: Combine the internal points and boundary points into the final point cloud, and reconstruct the surface patches together using the advancing front surface reconstruction method; Step 10.3) Screening patches: Screen the reconstructed surface patches. If there are triangular patches whose three points are all formed by boundary points in the reconstructed surface patches, they are discarded to obtain screened patches. Step 11) Output the surface The filtered patches are first rotated and then translated to obtain the sliced surface.
2. The 3D printing rotational surface slicing method according to claim 1, characterized in that: Step 4.2) When the head and tail are extended, set the extension distance diste. The first and second points of the second rotation contour line outline' from the head end are pte0 and pte1 respectively. Then the head end extension point spt, The tail extension point is calculated in the same way; the first and tail ends of the second rotated outline 'are extended to obtain the extended outline extend_outline.
3. The 3D printing rotational surface slicing method according to claim 1, characterized in that: Step 4.3) When offsetting, set the offset width to step, and the tangent vector of any point ptt on the extended contour line extend_outline is The perpendicular vector is Point ptt extends perpendicular to the vector Move the step width in the direction to get the offset point ptt'. All points on the extended contour line extend_outline are offset by the offset width step to obtain the offset contour line offset_line.
4. The 3D printing rotational surface slicing method according to claim 1, characterized in that: Step 5.1) When thinning the contour line, discretize the offset contour line offset_line according to the given axial precision outline_dist; let any continuous point p on the offset contour line offset_line i 、p i+1 When the distance between these two points d>outline_dist, the interpolation operation is performed; set the number of interpolation points num=d / outline_dist-1, and the interval between points len=d / (num+1); finally, the refined contour line refining_line is obtained.
5. The 3D printing rotational surface slicing method according to claim 1, characterized in that: Step 6.2) When discretizing in the circumferential direction, set point p r The z value is within [minz', maxz'], the contour line is on the yoz plane, and the circumferential radius r is point p r The y-direction value, r = |p r .y|, where p r .y represents point p r The y-direction value of the given rotation precision arc_dist, which corresponds to the angle With r as radius and base point p r_0 (r·sin0,r·cos0,p r .z) as the starting point, rotate counterclockwise around the z axis to calculate the discrete points, then the discrete kth point p r_k The coordinate value of r_k (r·sin(k·θ), r·cos(k·θ), p r .z), k·θ≤2π, where p r .z represents the z-value of point pr; all contour points on the third rotation contour line refining_line' within [minz', maxz'] are discretized, and finally multiple lines of discrete point clouds discrete_points are obtained.
6. The 3D printing rotational surface slicing method according to claim 1, characterized in that: Step 8.2) When dividing into blocks, for split workpieces, each row is divided into different segments with the same number of segments, and different segments belong to different split workpieces; suppose two adjacent rows row j 、row j+ 1, the number of segments is m, row j First point of line s row j+ First dot of paragraph t in line 1 when When the distance is closest, the distance The segments where the two first points of the two segments are located are considered to belong to the same block.
7. A 3D printing rotating surface slicing system, characterized in that: Includes the following modules: Obtaining a basic data module, which includes a workpiece and a rotational surface; A matrix transformation module is used to perform a translation and then a rotation transformation on the rotation surface and the workpiece, respectively, to obtain a transformed rotation surface and a transformed workpiece; Get the rotation contour module, including: Determine the z-direction interval submodule: the z-direction maximum value of the second bounding box of the transformed rotation surface is maxz, and the minimum value is minz, then the z-direction interval range of the second bounding box is [minz, maxz]; Get the intersection submodule: Set the initial vector The first plane formed by the origin O(0,0,0) intersects the transformed rotation surface to obtain two intersection lines; determine whether the z-direction ranges of the two intersection lines continuously cover the z-direction range of the second bounding box; If it is not covered continuously, the initial vector Rotate a set angle around the z axis to get the second vector A second plane is formed with the origin O(0,0,0), and two new intersection lines are obtained by intersecting with the transformed rotation surface. Together with the two intersection lines calculated previously, it is determined again whether the z-direction interval range of the two intersection lines continuously covers the z-direction interval range of the second bounding box; If it is still not completely and continuously covered, repeat the above steps until it is continuously covered; Merge intersection line submodule; if the z-direction interval range of the second bounding box is successfully and continuously covered, all intersection lines are rotated around the z-axis to the yoz plane, and all intersection lines are merged to obtain the first rotated contour line; Offset contour module, including: Rotation submodule: rotate the first rotation contour line 90° around the y axis to the xoy plane to obtain the second rotation contour line; Head and tail extension submodule: extending the head and tail ends of the second rotation contour line to obtain an extended contour line; Offset submodule: All points on the extended contour line are offset according to the offset width step to obtain the offset contour line; Axial discrete modules, including: Contour refinement submodule: discretizes the offset contour according to the given axial accuracy to obtain the refined contour; Rotation submodule: rotate the refined contour line by -90° around the y-axis and return it to the yoz plane to obtain the third rotated contour line; Circumferential discrete modules, including: Determine the circumferential discrete range submodule: The maximum value of the third bounding box of the transformed workpiece in the z direction is maxz', and the minimum value is minz'; suppose any continuous point p on the third rotation contour line i '、p i+1 ', minimum value minz' in p i '、p i+1 'The z value of the two points is within the range; then the point p with the minimum z value minz' on the third rotation contour line is calculated min and point p with the maximum z-value maxz' max , p m i n and p max Insert the value in the z direction into the third rotation contour as a discrete boundary point; Circumferential discretization submodule: On the third rotation contour line, all contour points with z-axis values within [minz', maxz'] are discretized circumferentially with the z-axis as the rotation axis to obtain multiple lines of discrete point clouds; The discrimination module is used to judge whether the discrete point cloud is inside the transformed workpiece, retain the points inside the transformed workpiece, record and store the row number of the internal points in the discrete point cloud and the corresponding sort number in each row, and form a storage file sifting_ids; Block modules include: Type determination submodule: Classify the continuous sorting numbers in each row of sifting_ids into one segment, and process all rows in segments. If the number of segments of all rows is the same, it is determined to be a split workpiece; if it is different, it is determined to be a whole workpiece; if the number of segments of all rows is 1, it is determined to be a whole workpiece; Block submodule: all rows are processed into blocks, each block corresponds to each split workpiece; for split workpieces, each block has multiple rows, each row has only one section, and the block is stored as a whole; For the whole workpiece, there is only one block, no need to divide into blocks; each block has multiple rows, a row contains one or more segments, and each row is stored as a whole; Added boundary point module, for split workpieces, the first and last lines of each piece are stored in the boundary points, the first and last lines are removed, and other points are stored in the internal points; For the whole workpiece, the first and last rows of the whole workpiece are stored in the boundary points, and the first and last rows are removed, and the other points are stored in the internal points; According to the difference between the split workpiece and the whole workpiece, the circumferential boundary interpolation points, the adjacent row interpolation points and the boundary middle interpolation points are performed and stored in the boundary points; Downsampling and reconstruction patch module, including: Downsampling submodule: Use the hierarchical downsampling method to downsample the internal points to obtain downsampled internal points; Reconstruction submodule: Combine the internal points and boundary points of the down-sampled points into the final point cloud, and use the advancing front surface reconstruction method to jointly reconstruct the surface patches; Filter patch submodule: filter the reconstructed surface patches. If there are triangular patches whose three points are all formed by boundary points in the reconstructed surface patches, they will be discarded to obtain the filtered patches. The output surface module is used to rotate and then translate the filtered faces to obtain the slice surface.
8. A computer device, characterized in that: The computer device includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the 3D printing rotational surface slicing method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the 3D printing rotational surface slicing method as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Cutter path planning method for avoiding over-cutting of cutter
CN115185236A
3D printing turning plane slicing method and device, electronic equipment and storage medium
CN117261240A