3D printing slicing method for large-size complex model
Through the method of segmented processing of the model and intersecting scanning lines, combined with the boundary compensation algorithm, the memory limit and geometric continuity problems of large-size complex models are solved, and efficient slice processing is achieved.
Patent Information
- Application Number
- CN202510940722.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-09
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2045-07-09
AI Technical Summary
Existing 3D printing slicing technology has problems such as excessive memory usage, risk of geometric continuity and ineconomic small-scale models when dealing with large-scale complex models. In particular, Autodesk Netfabb's distributed slicing engine is inefficient when dealing with high aspect ratio structures and non-uniform detail models.
The segmentation processing technology is used to dynamically group the models by height intervals, and accurately intersect with the triangular facets through the scanning line array, and the boundary compensation algorithm is used to ensure inter-layer continuity, and memory multiplexing technology is used to optimize memory utilization.
It effectively reduces memory consumption, improves slicing efficiency, ensures the processing accuracy of large and small models, and adapts to the intelligent slicing needs of multi-scale models.
Smart Images

Figure CN120495580A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of 3D printing, and in particular relates to a 3D printing slicing method for large-scale complex models. Background Art
[0002] 3D printing slicing is the core preprocessing process of converting a three-dimensional model (such as STL or OBJ format) into layer-by-layer instructions that can be executed by the printer. Its technical challenges mainly focus on the following aspects: (1) Model complexity: Industrial-grade models usually contain millions or even hundreds of millions of triangles, and directly loading them into memory will result in huge overhead. (2) Geometric computation load: The slicing process requires frequent operations such as calculating the intersection between the model and the cutting plane, generating support structures, and filling paths. The computational complexity is O(N), where N is the number of triangles. (3) Memory management bottleneck: Traditional slicing software usually loads the entire model data at once, resulting in memory overflow when processing ultra-large-scale models.
[0003] Autodesk Netfabb's current distributed slicing engine uses block processing technology to divide the model into multiple sub-blocks by space, loading and slicing them block by block, avoiding loading the entire model at once and reducing memory usage to the level of a single block of data, making it suitable for scenarios with limited GPU video memory.
[0004] While Autodesk Netfabb's distributed slicing engine significantly reduces memory usage and improves computational efficiency when processing large, complex models, its distributed architecture and block processing strategy also introduce some technical limitations and practical application challenges. The following are its core shortcomings and detailed analysis: (1) Risk of geometric continuity at the block boundary: After the model is divided into multiple sub-blocks, the geometric features across the blocks (such as curved surfaces and thin-walled structures) may be misaligned or discontinuous between layers due to incomplete boundary data when slicing independently. (2) Uneconomical for small-scale models: When the model volume is less than 500MB or the number of facets is less than 5 million, the startup and scheduling overhead of the distributed engine may exceed the slicing time of a single machine. (3) Compatibility limitations for specific geometric types: For high-aspect-ratio structures (such as slender rods), when the block direction conflicts with the structural direction, a single block may still need to load the complete long rod data, and memory saving fails; Non-uniform detail models: If the high-detail area is concentrated (such as the teeth of a gear), the block granularity is difficult to adjust adaptively, resulting in overload of some nodes. Summary of the Invention
[0005] In response to the defects of the existing technology, the present invention provides a 3D printing slicing method for large-scale complex models, which can effectively solve the above problems.
[0006] The technical solution adopted in the present invention is as follows: The present invention provides a 3D printing slicing method for a large-scale complex model, comprising the following steps: Step S1, importing the model to be printed into the slicing system; Step S2, optimizing the triangular facets of the model, dynamically grouping the triangular facets of the model according to height intervals, and obtaining triangular facets corresponding to each height interval; Step S3, establishing a scan line array in the z direction according to the bounding box of the model; Step S4: finding basic intersections between the triangular facets corresponding to each height interval and the scan line array, and calculating and marking compensated intersections using a compensation algorithm to obtain a layer intersection point set corresponding to each height interval, and saving the result to a local disk; wherein the layer intersection points in the layer intersection point set include the basic intersection points and the compensated intersection points; Step S5: generating slice data based on the slice intersection point sets corresponding to each height interval.
[0007] Preferably, step S2 is specifically as follows: Step S2.1, establish an XYZ three-dimensional space coordinate system; the X and Y directions are the horizontal and vertical directions of the plane, and the Z direction is the direction perpendicular to the ground; Assume the total height of the model is H, and define the segment height as H_F. Then divide the model into N height intervals, where N = ceil( H / H_F ), ceil() represents rounding up. From bottom to top, they are called the 0th height interval, the 1st height interval, ..., the N-1th height interval. Among them, the heights of the 0th height interval, the 1st height interval, ..., the N-2th height interval are all H_F, and the height of the N-1th height interval is H-( N-1)*H_F. Step S2.2, creating an array Triangle; the array Triangle has N groups of storage areas, represented as Triangle[k], k∈[0,N-1]; Step S2.3, traverse the triangular facets of the model, and for each triangular facet traversed, obtain the minimum value z of the vertex coordinates of the triangular facet in the Z-axis direction. min and the maximum value z max , if z is satisfied min ≤ (k+1)*H_F and z max ≥k * H_F, where k∈[0,N-1], the position of the triangle in the model is stored in the k-th storage area Triangle[k] of the array Triangle; Step S2.4, after the traversal of the triangular facets of the model is completed, the triangular facets stored in the k-th storage area of the array Triangle are the triangular facets corresponding to the k-th height interval of the model.
[0008] Preferably, step S3 is specifically as follows: Project the bounding box of the model to be printed onto the XY plane of the XYZ three-dimensional space coordinate system, and use point A (x min ,y min ) is the starting point, in the plane area [x min , x max ]×[y min ,y max ] creates a Z-direction scan line array with the pixel size as the spacing; where A(x min ,y min ) is the projection coordinate of the minimum vertex of the bounding box box in the XY plane; (x max ,y max ) is the projection coordinate of the maximum vertex of the bounding box box in the XY plane; each scan line in the scan line array is identified by its intersection point (x, y) with the XY plane.
[0009] Preferably, step S4 is specifically as follows: The triangles stored in each group of storage areas of the array Triangle are scanned in groups in a forward-to-backward order. For the triangles stored in the scanned kth group of storage area Triangle[k], the basic intersections are first calculated with the scan line array; then, if it is identified that the triangles stored in the current group of storage areas are only missing the upper closed plane, the top surface compensation algorithm is used to calculate the top surface compensation intersection and mark the top surface attributes; if it is identified that the triangles stored in the current group of storage areas are simultaneously missing the upper closed plane and the lower closed plane, the bottom surface compensation algorithm and the top surface compensation algorithm are executed in sequence; if it is identified that the triangles stored in the current group of storage areas are only missing the lower closed plane, the bottom surface compensation algorithm is executed; for each group of storage areas, the corresponding layer intersection set is obtained and stored in the corresponding main data file MainData_[k].dat.
[0010] Preferably, step S4 is specifically as follows: Step S4.1, in the initial processing stage, that is, when k=0, the following method is used: Step S4.1.1, using the basic intersection algorithm, directly calculate the basic intersection points of the triangles stored in the k-th storage area Triangle[k] and the scan line array to obtain a basic intersection set, and mark the attributes of each basic intersection in the basic intersection set. The marking method is: if the normal vector of the triangle where the basic intersection point is located is negative, it is marked as the bottom surface attribute; if the normal vector of the triangle where the basic intersection point is located is positive, it is marked as the top surface attribute; Step S4.1.2, it is recognized that the triangular patches stored in the k-th storage area Triangle[k] are the bottommost triangular patches and lack the upper closed plane. Therefore, the top surface compensation algorithm is used to calculate the top surface compensation intersection points and mark the top surface attributes: Top surface compensation algorithm: Traverse each scan line in the scan line array. For each traversed scan line, obtain all intersection points between it and the triangular patches stored in the k-th storage area Triangle[k], and extract the extreme intersection point P_max in the Z direction. Analyze the attributes of the extreme intersection point P_max. If it is marked as the bottom surface attribute, add a top surface compensation intersection point at the position of the maximum height value within the k-th height interval of the same scan line and mark the top surface attribute; if it is already marked as the top surface attribute, no top surface compensation is performed. Step S4.1.3, store all the basic intersection points obtained in the current k-th height interval and the top surface compensation intersection points obtained by using the top surface compensation algorithm into the main data file MainData_[k].dat; Step S4.1.④, extract all the top surface compensation intersection points from the main data file MainData_[k].dat, modify their attributes from the top surface attribute to the bottom surface attribute, and generate an independent temporary file TEMP.dat; Step S4.1.⑤, release all the current memory, clear all the intersection points on the scan line, set k = k + 1, and process the triangular patches stored in the next storage area Triangle[k]; Step S4.2, in the intermediate processing stage, for the k-th storage area Triangle[k], where 0 < k < N - 1, adopt an iterative processing strategy, and process the triangular patches of each storage area in ascending order of the k value, complete the basic intersection operation and complete the algorithm compensation for it. The specific process is as follows: Step S4.2.1, use the basic intersection algorithm to directly find the basic intersection points between the triangular patches stored in the k-th storage area Triangle[k] and the scan line array, obtain the basic intersection point set, and mark the attributes of each basic intersection point in the basic intersection point set; Step S4.2.2, it is recognized that the triangular patches stored in the k-th storage area Triangle[k] lack the upper closed plane and the lower closed plane. Therefore, the bottom surface compensation algorithm and the top surface compensation algorithm are executed in sequence: Bottom surface compensation algorithm: Load the temporary file TEMP.dat generated in the k - 1 step, and use the compensation intersection points with the bottom surface attribute loaded as the reference bottom surface for the current processing; Top surface compensation algorithm: Use the same top surface compensation algorithm as in Step S4.1.2 to obtain the top surface compensation intersection points and mark the top surface attributes; Step S4.2.3, storing all basic intersection points obtained in the current k-th height interval, the compensated intersection points with bottom surface attributes obtained using the bottom surface compensation algorithm, and the top surface compensated intersection points obtained using the top surface compensation algorithm into the main data file MainData_[k].dat; Step S4.2.4: Extract all top surface compensation intersection points from the main data file MainData_[k].dat, and modify their attributes from top surface attributes to bottom surface attributes. The top surface compensation intersection points of this step are stored in the same temporary file TEMP.dat using the temporary file overwrite update mechanism. Step S4.2.5, release all current memory, clear all intersection points on the scan line, set k = k + 1, and process the triangle stored in the next storage area Triangle[k] until the processing of the N-2 group of storage areas Triangle[N-2] is completed; Step S4.3, in the final processing stage, for the k-th group of storage areas Triangle[k], k=N-1, the following processing flow is performed: Step S4.3.1, using a basic intersection algorithm, directly calculate the basic intersection points of the triangles stored in the k-th storage area Triangle[k] and the scan line array to obtain a basic intersection point set, and mark the attributes of each basic intersection point in the basic intersection point set; Step S4.3.2: It is recognized that the triangle facet stored in the k-th storage area Triangle[k] is missing the lower closed plane, so the bottom surface compensation algorithm is executed: Bottom surface compensation algorithm: load the temporary file TEMP.dat generated in step k-1, and use the loaded compensation intersection with bottom surface attributes as the reference bottom surface currently being processed; Step S4.3.3, storing all basic intersection points obtained in the current k-th height interval and the compensated intersection points with bottom surface attributes obtained by the bottom surface compensation algorithm into the main data file MainData_[k].dat; Step S4.3.4, release all current memory, clear all intersection points on the scan line, and cancel the temporary file TEMP.dat.
[0011] Preferably, in step S4.1.1, when using the basic intersection algorithm to directly calculate the basic intersection points of the triangle facets stored in the kth group storage area Triangle[k] and the scan line array, the original basic intersection points obtained are screened by height intervals, and only the basic intersection points whose z coordinates are within the kth height interval are retained, and the rest are eliminated to obtain a basic intersection set.
[0012] Preferably, step S5 is specifically as follows: Step S5.1, when printing a specified slice with a height value of H of the model, calculate the main data file index according to the height value H of the specified slice , is the floor function; Step S5.2, according to the main data file index k, locate the corresponding main data file MainData_[k].dat and load it into the memory buffer; Step S5.3, create a two-dimensional image buffer. The size of the two-dimensional image buffer is consistent with the printing plane resolution. The pixel values at each pixel position (x, y) in the two-dimensional image buffer are initialized to 0; Step S5.4, for the main data file MainData_[k].dat loaded into the memory buffer, display the corresponding layer intersection points and the scan line array at the same time; traverse all scan lines row by row. For each traversed scan line (x i ,y i ), analyze all layer intersection points located on this scan line (x i ,y i ). If there are two adjacent layer intersection points P1(x i , y i ,z1) and P2 (x i , y i ,z2), check their attributes and height relationship: If it satisfies: z1 < H < z2, and the layer intersection point P1 is the bottom surface attribute, and the layer intersection point P2 is the top surface attribute, then set the two-dimensional image buffer at (x i ,y i ) to have pixels, indicating the solid area; otherwise, set it to have no pixels, indicating the airspace or non-printing area; Step S5.5, after traversing all scan line arrays, the two-dimensional image buffer displays the slice image at the height value of H.
[0013] The 3D printing slicing method for large-size complex models provided by the present invention has the following advantages: (1) The segmented processing technology of the present invention creatively transforms the segmented object into the intersection process of scan lines and triangular facets. By establishing a dynamic division of the Z-axis height range, the scan line array and the triangular facet group in each segment are accurately intersected, and a boundary compensation algorithm is used to ensure inter-layer continuity. This method fundamentally avoids the risk of seams caused by geometric block segmentation; (2) The present invention can manually adjust the single fixed processing height according to the model size and current memory status. This mechanism ensures that both large industrial models at the GB level and small parts at the MB level can achieve optimal memory utilization while ensuring processing accuracy. (3) The scan line intersection method used by the present invention can operate normally as long as the triangular facets of the model are correct, even if the geometric type of the model is complex. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 A flow chart of a 3D printing slicing method for large-scale complex models provided by the present invention; Figure 2 This is a diagram showing the principle of processing triangular facets in height intervals provided by the present invention; Figure 3 A schematic diagram of a row of the scan line array provided by the present invention; Figure 4 This is a schematic diagram of the layer intersection provided by the present invention. DETAILED DESCRIPTION
[0015] In order to make the technical problems, technical solutions and beneficial effects solved by the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0016] In response to the inherent defects of existing distributed slicing technology, the present invention discloses a 3D printing slicing method for large-scale complex models. For the triangular facets of large-scale complex models, segmentation processing technology and memory reuse technology are used to reduce memory consumption and improve slicing efficiency, solving the memory limit problem caused by excessive slicing data volume.
[0017] Specifically, the present invention proposes an innovative Z-segment processing technology, which achieves technological innovation through breakthrough improvements in the following three aspects: (1) Unlike traditional block processing of model geometry (such as the distributed spatial segmentation used by Autodesk Netfabb), the segmentation processing technology of the present invention creatively transforms the segmented object into an intersection process between scan lines and triangular facets. By establishing a dynamic division of the Z-axis height range, the scan line array and the triangular facet group in each segment are accurately intersected, and a boundary compensation algorithm is used to ensure inter-layer continuity. This method fundamentally avoids the risk of seams caused by geometric segmentation; (2) The present invention can manually adjust the single fixed processing height according to the model size and the current memory status. This mechanism enables both large industrial models at the GB level and small parts at the MB level to achieve optimal memory utilization while ensuring processing accuracy.
[0018] (3) The scan line intersection method used in the present invention can operate normally even if the geometric type of the model is complex as long as the triangular facets of the model are correct.
[0019] This shift in technological paradigm not only solves the inherent geometric continuity problem of distributed processing, but also establishes a new intelligent slicing framework that adapts to multi-scale models, providing a new solution for 3D printing preprocessing technology.
[0020] like Figure 1 As shown, the present invention provides a 3D printing slicing method for a large-scale complex model, comprising the following steps: Step S1, importing the model to be printed into the slicing system; Step S2, optimizing the triangular facets of the model, dynamically grouping the triangular facets of the model according to height intervals, and obtaining triangular facets corresponding to each height interval; Step S3, establishing a scan line array in the z direction according to the bounding box of the model; Step S4: finding basic intersections between the triangular facets corresponding to each height interval and the scan line array, and calculating and marking compensated intersections using a compensation algorithm to obtain a layer intersection point set corresponding to each height interval, and saving the result to a local disk; wherein the layer intersection points in the layer intersection point set include the basic intersection points and the compensated intersection points; Step S5: generating slice data based on the slice intersection point sets corresponding to each height interval.
[0021] The following describes each step in detail: The present invention provides a 3D printing slicing method for large-scale complex models, and the implementation process is as follows: First, the triangles are optimized, then dynamically grouped by height, and scanline intersection calculations are performed on each group. Because the obtained intersection data is incomplete, the present invention adds compensation points. After the addition is complete, all processed intersection data is serialized and stored in a local file. Slicing and printing are then performed based on this stored local file.
[0022] The present invention is defined as Figure 2 The variables shown are: H_L represents the minimum height value within the specified height range; H_H represents the maximum height value within the specified height range; H_F represents the fixed height of one treatment; Point represents the intersection of the scan line and the triangle; Point_Hand indicates the compensation point.
[0023] The main idea of the present invention is: Dynamically group triangles by height and create a scan line array.
[0024] The intersection of the grouped triangles and the scan lines is calculated. At this point, the intersection data is stored in memory, but due to incomplete information, it cannot be directly used for layer cutting. Therefore, the missing intersection points need to be supplemented in subsequent steps.
[0025] Perform intersection point screening and compensation point addition operations, and use the compensation point set as the top surface of the current processing layer. Taking the triangle patch intersections within the height interval [H_L,H_H] mm as an example: First, traverse the scan line intersection set, retaining the intersection data that satisfies z∈[H_L,H_H], and remove redundant data outside the interval; then extract the z_max intersection point of each scan line within the valid interval, analyze its geometric properties and height parameters, and finally determine whether manual intersection compensation needs to be added.
[0026] Save all intersection points within the current height range to the local computer.
[0027] Save the manually added intersection points locally and use them as the bottom surface for the next intersection determination.
[0028] To make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be described in further detail below.
[0029] Step S1, importing the model to be printed into the slicing system; This step involves model loading and platform adaptation: The 3D model file (STL format) to be printed is imported into the slicing system. The coordinate system is aligned, with the platform base as the XY plane and the Z coordinate of the bottom vertex of the model set to zero. The model is automatically rotated to the optimal printing orientation.
[0030] The optimized triangular facets of the model mentioned in this article refer to the optimization that simplifies and repairs the model using third-party software.
[0031] Step S2, optimizing the triangular facets of the model, dynamically grouping the triangular facets of the model according to height intervals, and obtaining triangular facets corresponding to each height interval; This step is to dynamically group the triangles of the 3D printing model based on the Z axis.
[0032] Step S2.1, establish an XYZ three-dimensional space coordinate system; the X and Y directions are the horizontal and vertical directions of the plane, and the Z direction is the direction perpendicular to the ground; Height interval division: Assume the total height of the model is H mm and the segment height is defined as H_F mm. Then the model is divided into N height intervals, where N = ceil(H / H_F). Ceil() represents rounding up. From bottom to top, the height intervals are called the 0th height interval, the 1st height interval, ..., the N-1th height interval. The heights of the 0th height interval, the 1st height interval, ..., the N-2th height interval are all H_F, and the height of the N-1th height interval is H-(N-1)*H_F. Step S2.2, creating an array Triangle to store the grouped triangles; the array Triangle has N groups of storage areas, represented as Triangle[k], k∈[0,N-1]; Step S2.3, facet grouping rule: traverse the triangular facets of the model, and for each triangular facet traversed, obtain the minimum value z of the vertex coordinates of the triangular facet in the Z axis direction. min and the maximum value z max , if z is satisfied min ≤ (k+1)*H_F and z max ≥k * H_F, where k∈[0,N-1], the position of the triangle in the model is stored in the k-th storage area Triangle[k] of the array Triangle; The facet grouping rules of this step are used to process overlapping areas, allowing faces to be distributed across adjacent height intervals (such as overhanging structures) to ensure contour closure during subsequent layered slicing.
[0033] Step S2.4, after the traversal of the triangular facets of the model is completed, the triangular facets stored in the k-th storage area of the array Triangle are the triangular facets corresponding to the k-th height interval of the model.
[0034] Step S3, establishing a scan line array in the z direction according to the bounding box of the model; The scan line intersection algorithm is used to scan the 3D printing model corresponding to the object to be printed and store the scan intersection points.
[0035] The specific steps of this step are: Create a scan line array, such as Figure 3 As shown, taking the Z direction as an example, the bounding box of the model to be printed is projected onto the XY plane of the XYZ three-dimensional space coordinate system, and the point A (x min ,y min ) is the starting point, in the plane area [x min , x max ]×[y min ,y max ] creates a Z-direction scan line array with the pixel size as the spacing, which is called the Z-direction buffer, z-buffer; where A(x min ,y min ) is the projection coordinate of the minimum vertex of the bounding box box in the XY plane; (x max ,y max ) is the projection coordinate of the maximum vertex of the bounding box box in the XY plane; each scan line in the scan line array is identified by its intersection point (x, y) with the XY plane.
[0036] Specifically, in 3D printing, the bounding box of the model to be printed is a geometric tool that quickly describes the spatial range of the object. It is usually a cube aligned with the coordinate axis. The bounding box is defined by two vertices, the minimum vertex P min (x min, y min, z min ) is the minimum value of the object on all coordinate axes, the maximum vertex P max (x max, y max, z max ) is the maximum value of the object on all coordinate axes, and the entire 3D printed model is located in this cube.
[0037] Step S4: finding basic intersections between the triangular facets corresponding to each height interval and the scan line array, and calculating and marking compensated intersections using a compensation algorithm to obtain a layer intersection point set corresponding to each height interval, and saving the result to a local disk; wherein the layer intersection points in the layer intersection point set include the basic intersection points and the compensated intersection points; This step is specifically as follows: The triangles stored in each group of storage areas of the array Triangle are scanned in groups in a forward-to-backward order. For the triangles stored in the scanned kth group of storage area Triangle[k], the basic intersections are first calculated with the scan line array; then, if it is identified that the triangles stored in the current group of storage areas are only missing the upper closed plane, the top surface compensation algorithm is used to calculate the top surface compensation intersection and mark the top surface attributes; if it is identified that the triangles stored in the current group of storage areas are simultaneously missing the upper closed plane and the lower closed plane, the bottom surface compensation algorithm and the top surface compensation algorithm are executed in sequence; if it is identified that the triangles stored in the current group of storage areas are only missing the lower closed plane, the bottom surface compensation algorithm is executed; for each group of storage areas, the corresponding layer intersection set is obtained and stored in the corresponding main data file MainData_[k].dat.
[0038] Specifically, since triangles are scanned in groups (Triangle[k], k∈[0,N-1]), the intersection point (Point) data recorded by the scan line array during traversal is naturally divided into corresponding N groups.
[0039] In the process of group scanning triangular facets, if a group of facets (such as the kth group) fails to form a closed geometric body, the intersection information of the group will be incomplete, which will eventually affect the integrity of the cross-sectional image obtained by layer cutting processing.
[0040] Therefore, if Figure 2 As shown, the above intersection process needs to be supplemented, that is, a compensation point (Point_Hand) needs to be added. For this purpose, two compensation algorithms need to be executed: A top surface compensation algorithm, this method is to compensate for the missing intersection points of the current group of intersection points with the attribute of "top surface"; B Bottom surface compensation algorithm: This method compensates for the missing intersection points of the current group with the attribute of "bottom surface".
[0041] These two algorithms will be described in detail below. Different compensation algorithms are used in different altitude ranges.
[0042] The detailed implementation of this step is as follows: Step S4.1, in the initial processing stage, that is, when k=0, the following method is used: Step S4.1.1, using the basic intersection algorithm, directly calculate the basic intersection points of the triangles stored in the k-th storage area Triangle[k] and the scan line array to obtain the basic intersection point set of the model scan lines, and mark the attributes of each basic intersection point in the basic intersection point set. The marking method is: if the normal vector of the triangle where the basic intersection point is located is negative, it is marked as the bottom surface attribute; if the normal vector of the triangle where the basic intersection point is located is positive, it is marked as the top surface attribute; In actual implementation, when the basic intersection algorithm is used to directly calculate the basic intersection points of the triangle facets stored in the k-th storage area Triangle[k] and the scan line array, the original basic intersection points obtained are screened by height intervals, and only the basic intersection points whose z coordinates are within the k-th height interval are retained, that is, valid intersection points, and the rest are eliminated to obtain a basic intersection point set.
[0043] Step S4.1.2 identifies that the triangles stored in the kth storage area Triangle[k] are the bottom-level triangles, lacking the upper closed plane (commonly known as the "cap"). This results in the basic intersection data only existing in the triangle distribution area. Therefore, the top surface compensation algorithm needs to be executed: the top surface compensation algorithm is used to calculate the top surface compensation intersection and mark the top surface attributes: Top surface compensation algorithm: Scan line extreme point extraction: traverse each scan line in the scan line array, and for each traversed scan line, obtain all its intersections with the triangle facets stored in the k-th storage area Triangle[k], and extract the extreme intersection point P_max in the Z direction; attribute analysis: parse the geometric properties (position coordinate h_z and facet attributes) of the extreme intersection point P_max. If it is marked as a bottom surface attribute, add a top surface compensation intersection point Point_Hand at the position of the maximum height value in the k-th height interval at the same scan line height, and mark it as a top surface attribute; if it has been marked as a top surface attribute, do not perform top surface compensation, and keep the current intersection point set unchanged; After completing all processing for the current altitude interval, perform data storage operations, i.e., execute step S4.1.3; Step S4.1.3, main data storage: all basic intersection points obtained in the current k-th height interval and the top surface compensation intersection points obtained by the top surface compensation algorithm are stored in the main data file MainData_[k].dat; Specifically, the complete intersection point set within the current height interval [H_L, H_H] is serialized into a data file and stored persistently, with the naming rule of MainData_[k].dat (k=0); Step S4.1.4, compensation data processing: extract all top surface compensation intersection points Point_Hand from the main data file MainData_[k].dat, and change their attributes from top surface attributes to bottom surface attributes, generating an independent temporary file TEMP.dat; After processing is complete, release all current memory, clear all intersections on the scan line, and update the upper and lower limits of the current height interval: H_L = H_L + H_F and H_H = H_H + H_F. The same steps are repeated when the height interval needs to be updated in the following steps. Set k = k + 1 and process the triangle stored in the next storage area Triangle[k]. Step S4.2, in the intermediate processing stage, for the k-th group of storage areas Triangle[k], where 0 < k < N - 1, an iterative processing strategy is adopted. The triangular patches of each group of storage areas are processed in ascending order of the k value to complete the basic intersection operation and algorithm compensation for it, ensuring that the processing process meets the requirements of data dependence. The specific process is as follows: Step S4.2.1, using the basic intersection algorithm, directly find the basic intersections between the triangular patches stored in the k-th group of storage areas Triangle[k] and the scan line array to obtain a set of basic intersections, and mark the attributes of each basic intersection in the set of basic intersections; Step S4.2.2, it is recognized that the triangular patches stored in the k-th group of storage areas Triangle[k] lack the upper and lower closed planes ("lid" and "bottom"). Therefore, the bottom surface compensation algorithm and the top surface compensation algorithm are executed in sequence: Bottom surface compensation algorithm: Load the temporary file TEMP.dat generated in the (k - 1)-th step (the previous step), and use the compensation intersections with bottom surface attributes loaded as the reference bottom surface for the current processing; Top surface compensation algorithm: Use the same top surface compensation algorithm as in Step S4.1.2 to obtain the top surface compensation intersections and mark the top surface attributes; Step S4.2.3, store all the basic intersections obtained in the current k-th height interval, the compensation intersections with bottom surface attributes obtained by the bottom surface compensation algorithm, and the top surface compensation intersections obtained by the top surface compensation algorithm into the main data file MainData_[k].dat; Step S4.2.4, extract all the top surface compensation intersections from the main data file MainData_[k].dat, modify their attributes from top surface attributes to bottom surface attributes, and store the top surface compensation intersections of this step into the same temporary file TEMP.dat using the temporary file overwrite update mechanism; Step S4.2.5, release all the current memory, clear all the intersections on the scan line, set k = k + 1, and process the triangular patches stored in the next storage area Triangle[k] until the processing of the (N - 2)-th group of storage areas Triangle[N - 2] is completed; Through this step, a total of N - 2 standardized data files are generated, named according to the rule of the main data file MainData_[k].dat (k ∈ [1, N - 2]), and only one temporary file is generated. The upper and lower limits of the height interval need to be updated in each loop and all the current memory is released, and all the intersections on the scan line are cleared.
[0044] Step S4.3, in the final processing stage, for the k-th group of storage areas Triangle[k], where k = N - 1, execute the following processing process: Step S4.3.1, using a basic intersection algorithm, directly calculate the basic intersection points of the triangles stored in the k-th storage area Triangle[k] and the scan line array to obtain a basic intersection point set, and mark the attributes of each basic intersection point in the basic intersection point set; Step S4.3.2: It is recognized that the triangle facet stored in the k-th storage area Triangle[k] is missing the lower closed plane, so the bottom surface compensation algorithm is executed: Bottom surface compensation algorithm: load the temporary file TEMP.dat generated in step k-1, and use the loaded compensation intersection with bottom surface attributes as the reference bottom surface currently being processed; Step S4.3.3, storing all basic intersection points obtained in the current k-th height interval and the compensated intersection points with bottom surface attributes obtained by the bottom surface compensation algorithm into the main data file MainData_[k].dat; Step S4.3.4: Free all current memory, clear all intersections on the scan line, and write out the temporary file TEMP.dat. This completes the entire processing flow and allows for slicing.
[0045] When executing step S4, the present invention performs storage optimization when performing scan line intersection on each height interval in turn, adopts a single dynamic temporary file architecture, and significantly reduces storage overhead through a temporary file overwriting and updating mechanism.
[0046] Step S5: generating slice data based on the slice intersection point sets corresponding to each height interval.
[0047] The main data file is read using a dynamic loading mechanism, and its specific implementation process is as follows: Step S5.1, when it is necessary to print a specified slice with a height value H of the model, calculate the master data file index according to the height value H (unit: mm) of the specified slice , To round down; Step S5.2, according to the main data file index k, locate the corresponding main data file MainData_[k].dat and load it into the memory buffer; Specifically, after loading the master data file, the algorithm displays all slice intersections within the height range corresponding to the specified slice. These slice intersections are then sequentially inserted into the scan lines. The slice intersections on each scan line are sorted in ascending order by their z-coordinate values, which then drives the subsequent slice algorithm execution. This on-demand loading design significantly reduces memory usage and is particularly suitable for processing large-scale 3D model data.
[0048] Step S5.3: Initialize the image buffer. Create a two-dimensional image buffer that is used to store the slice data of the current layer. The size of the two-dimensional image buffer is consistent with the printing plane resolution, and the pixel values at each pixel position (x, y) in the two-dimensional image buffer are initialized to 0. Step S5.4: Scan line processing. For the main data file MainData_[k].dat loaded into the memory buffer, display the corresponding layer intersection points and the scan line array at the same time. Traverse all scan lines row by row. For each traversed scan line (x i ,y i ), as Figure 4 shown, analyze all layer intersection points located on this scan line (x i ,y i ). If there are two adjacent layer intersection points P1(x i , y i ,z1) and P2(x i , y i ,z2), check their attributes and height relationship: If it satisfies: z1 < H < z2, and the layer intersection point P1 has the bottom surface attribute (model entry point), and the layer intersection point P2 has the top surface attribute (model exit point), then set the two-dimensional image buffer at (x i ,y i ) to have pixels, indicating the solid area; otherwise, set it to have no pixels, indicating the airspace or non-printing area. A print image can be generated according to actual printing requirements.
[0049] Step S5.5: After traversing all scan line arrays, the two-dimensional image buffer displays the slice image at the position with the height value of H.
[0050] Slice data output: Encode the data in the image buffer into a format recognizable by the printing system, such as PNG, BMP, or a dedicated slice file, and store it in the output file.
[0051] The 3D printing slicing method for large-size complex models provided by the present invention has the following advantages: 1. The present invention solves the problem of memory overflow caused by excessive slicing data volume for large-size complex models through the height interval processing technology and memory reuse technology, and proposes a new method for 3D printing slicing of large-size complex models. 2. The present invention uses a boundary compensation algorithm to ensure interlayer continuity. 3. The height interval processing technology of the present invention stores the intersection point information in height intervals. 4. The present invention can obtain a slice image by specifying the height.
[0052] 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 principles of the present invention. These improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A 3D printing slicing method for large-scale complex models, characterized in that: The following steps are involved: Step S1, importing the model to be printed into the slicing system; Step S2, optimizing the triangular facets of the model, dynamically grouping the triangular facets of the model according to height intervals, and obtaining triangular facets corresponding to each height interval; Step S3, establishing a scan line array in the z direction according to the bounding box of the model; Step S4: finding basic intersections between the triangular facets corresponding to each height interval and the scan line array, and calculating and marking compensated intersections using a compensation algorithm to obtain a layer intersection point set corresponding to each height interval, and saving the result to a local disk; wherein the layer intersection points in the layer intersection point set include the basic intersection points and the compensated intersection points; Step S5: generating slice data based on the slice intersection point sets corresponding to each height interval.
2. The 3D printing slicing method for a large-scale complex model according to claim 1, characterized in that: Step S2 is specifically as follows: Step S2.1, establish an XYZ three-dimensional space coordinate system; the X and Y directions are the horizontal and vertical directions of the plane, and the Z direction is the direction perpendicular to the ground; Assume the total height of the model is H and the segment height is defined as H_F. Then the model is divided into N height intervals, where N = ceil(H / H_F). Ceil() represents rounding up. From bottom to top, the height intervals are called the 0th height interval, the 1st height interval, ..., the N-1th height interval. The heights of the 0th height interval, the 1st height interval, ..., the N-2th height interval are all H_F, and the height of the N-1th height interval is H-(N-1)*H_F. Step S2.2, creating an array Triangle; the array Triangle has N groups of storage areas, represented as Triangle[k], k∈[0,N-1]; Step S2.3, traverse the triangular facets of the model, and for each triangular facet traversed, obtain the minimum value z of the vertex coordinates of the triangular facet in the Z-axis direction. min and the maximum value z max , if z is satisfied min ≤ (k+1)*H_F and z max ≥k *H_F, where k∈[0,N-1], the position of the triangle in the model is stored in the k-th storage area Triangle[k] of the array Triangle; Step S2.4, after the traversal of the triangular facets of the model is completed, the triangular facets stored in the k-th storage area of the array Triangle are the triangular facets corresponding to the k-th height interval of the model.
3. The 3D printing slicing method for a large-scale complex model according to claim 2, characterized in that: Step S3 is specifically as follows: Project the bounding box of the model to be printed onto the XY plane of the XYZ three-dimensional space coordinate system, and use point A (x min ,y min ) is the starting point, in the plane area [x min , x max ]×[y min ,y max ] creates a Z-direction scan line array with the pixel size as the spacing; where A(x min ,y min ) is the projection coordinate of the minimum vertex of the bounding box box in the XY plane; (x max ,y max ) is the projection coordinate of the maximum vertex of the bounding box box in the XY plane; each scan line in the scan line array is identified by its intersection point (x, y) with the XY plane.
4. The 3D printing slicing method for a large-scale complex model according to claim 3, characterized in that: Step S4 is specifically as follows: Scan the triangles stored in each group of storage areas of the Triangle array in a forward-to-backward order, and for the triangle stored in the kth group of storage area Triangle[k], first find the basic intersection point with the scan line array; Then, if it is identified that the triangle face stored in the current group storage area is only missing the upper closed plane, the top surface compensation algorithm is used to calculate the top surface compensation intersection and mark the top surface attributes; if it is identified that the triangle face stored in the current group storage area is missing both the upper closed plane and the lower closed plane, the bottom surface compensation algorithm and the top surface compensation algorithm are executed in sequence; if it is identified that the triangle face stored in the current group storage area is only missing the lower closed plane, the bottom surface compensation algorithm is executed; for each group of storage areas, the corresponding layer intersection set is obtained and stored in the corresponding main data file MainData_[k].dat.
5. The 3D printing slicing method for a large-scale complex model according to claim 4, characterized in that: Step S4 is specifically as follows: Step S4.1, in the initial processing stage, that is, when k=0, the following method is used: Step S4.1.1: Using the basic intersection algorithm, directly find the basic intersection points between the triangular patches stored in the k-th group storage area Triangle[k] and the scanning line array, obtain the basic intersection point set, and mark the attributes of each basic intersection point in the basic intersection point set. The marking method is as follows: If the normal vector of the triangular patch where the basic intersection point is located is negative, mark it with the bottom surface attribute; if the normal vector of the triangular patch where it is located is positive, mark it with the top surface attribute. Step S4.1.2: It is recognized that the triangular patches stored in the k-th group storage area Triangle[k] are the bottommost triangular patches and lack the upper closed plane. Therefore, use the top surface compensation algorithm to calculate the top surface compensation intersection points and mark the top surface attribute: Top surface compensation algorithm: Traverse each scanning line in the scanning line array. For each traversed scanning line, obtain all intersection points between it and the triangular patches stored in the k-th group storage area Triangle[k], and extract the extreme intersection point P_max in the Z direction. Analyze the attribute of the extreme intersection point P_max. If it is marked with the bottom surface attribute, add a top surface compensation intersection point at the position of the maximum height value within the k-th height interval of the same scanning line and mark the top surface attribute; If it is already marked with the top surface attribute, no top surface compensation is performed. Step S4.1.3: Store all the basic intersection points obtained in the current k-th height interval and the top surface compensation intersection points obtained using the top surface compensation algorithm into the main data file MainData_[k].dat. Step S4.1.4: Extract all the top surface compensation intersection points from the main data file MainData_[k].dat, and modify their attributes from the top surface attribute to the bottom surface attribute to generate an independent temporary file TEMP.dat. Step S4.1.5: Release all current memory, clear all intersection points on the scanning line, set k = k + 1, and process the triangular patches stored in the next storage area Triangle[k]. Step S4.2: In the intermediate processing stage, for the k-th group storage area Triangle[k], where 0 < k < N - 1, adopt an iterative processing strategy, and process the triangular patches in each group storage area in ascending order of the k value, complete the basic intersection operation and perform algorithm compensation for it. The specific process is as follows: Step S4.2.1: Using the basic intersection algorithm, directly find the basic intersection points between the triangular patches stored in the k-th group storage area Triangle[k] and the scanning line array, obtain the basic intersection point set, and mark the attributes of each basic intersection point in the basic intersection point set. Step S4.2.2: It is recognized that the triangular patches stored in the k-th group storage area Triangle[k] lack the upper closed plane and the lower closed plane. Therefore, sequentially execute the bottom surface compensation algorithm and the top surface compensation algorithm: Bottom surface compensation algorithm: Load the temporary file TEMP.dat generated in the k - 1 step, and use the compensated intersection points with the bottom surface attribute loaded as the reference bottom surface for the current processing. Top surface compensation algorithm: Use the same top surface compensation algorithm as in Step S4.1.2 to obtain the top surface compensation intersection points and mark the top surface attribute. Step S4.2.3, storing all basic intersection points obtained in the current k-th height interval, the compensated intersection points with bottom surface attributes obtained using the bottom surface compensation algorithm, and the top surface compensated intersection points obtained using the top surface compensation algorithm into the main data file MainData_[k].dat; Step S4.2.4: Extract all top surface compensation intersection points from the main data file MainData_[k].dat, and modify their attributes from top surface attributes to bottom surface attributes. The top surface compensation intersection points of this step are stored in the same temporary file TEMP.dat using the temporary file overwrite update mechanism. Step S4.2.5, release all current memory, clear all intersection points on the scan line, set k = k + 1, and process the triangle stored in the next storage area Triangle[k] until the processing of the N-2 group of storage areas Triangle[N-2] is completed; Step S4.3, in the final processing stage, for the k-th group of storage areas Triangle[k], k=N-1, the following processing flow is performed: Step S4.3.1, using a basic intersection algorithm, directly calculate the basic intersection points of the triangles stored in the k-th storage area Triangle[k] and the scan line array to obtain a basic intersection point set, and mark the attributes of each basic intersection point in the basic intersection point set; Step S4.3.2: It is recognized that the triangle facet stored in the k-th storage area Triangle[k] is missing the lower closed plane, so the bottom surface compensation algorithm is executed: Bottom surface compensation algorithm: load the temporary file TEMP.dat generated in step k-1, and use the loaded compensation intersection with bottom surface attributes as the reference bottom surface currently being processed; Step S4.3.3, storing all basic intersection points obtained in the current k-th height interval and the compensated intersection points with bottom surface attributes obtained by the bottom surface compensation algorithm into the main data file MainData_[k].dat; Step S4.3.4, release all current memory, clear all intersection points on the scan line, and cancel the temporary file TEMP.dat.
6. The 3D printing slicing method for large-scale complex models according to claim 5, characterized in that: In step S4.1.1, when using the basic intersection algorithm to directly calculate the basic intersection points of the triangle facets stored in the kth group storage area Triangle[k] and the scan line array, the original basic intersection points obtained are screened by height intervals, and only the basic intersection points whose z coordinates are within the kth height interval are retained, and the rest are eliminated to obtain the basic intersection point set.
7. The 3D printing slicing method for a large-scale complex model according to claim 5, characterized in that: Step S5 is specifically as follows: Step S5.1, when it is necessary to print a specified slice with a height value H of the model, calculate the master data file index according to the height value H of the specified slice , To round down; Step S5.2, according to the main data file index k, locate the corresponding main data file MainData_[k].dat and load it into the memory buffer; Step S5.3, creating a two-dimensional image buffer, the size of which is consistent with the resolution of the printing plane, and initializing the pixel value of each pixel position (x, y) in the two-dimensional image buffer to 0; Step S5.4: For the main data file MainData_[k].dat loaded into the memory buffer, display the corresponding slice intersection point and the scan line array; traverse all scan lines line by line, and for each scan line (x i ,y i ), analyze the position of the scan line (x i ,y i ) of all the intersection points of the layers, if there are two adjacent intersection points P1(x i , y i ,z1) and P2 (x i ,y i ,z2), check its properties and height relationship: If the following conditions are met: z1 < H < z2, and the layer cutting intersection point P1 has the bottom surface attribute, and the layer cutting intersection point P2 has the top surface attribute, then set the two-dimensional image buffer area (x i , y i ) to have pixels, representing the solid area; otherwise, set it to have no pixels, representing the airspace or non-printing area; Step S5.5: After all scan line arrays are traversed, the two-dimensional image buffer displays the slice image at the position with a height value H.
Citation Information
Patent Citations
3d print slice rapid generation method
CN106200559A
Efficient slicing method for three-dimensional scene
CN110633517A
Interactive variable layer thickness slicing method in three-dimensional printing
CN112182677A
Model size compensation zooming method and device, equipment and storage medium
CN117863562A
Three-dimensional object surface compensation method and device, electronic equipment and storage medium
CN118024585A
Cited By
Model slice image generation method and device, electronic equipment and storage medium
CN121246236A