3D printing slicing method for large-size complex model
By segmenting the triangular facets of large, complex models and finding the intersection of Z-axis scan lines, combined with a compensation algorithm, the problems of memory overflow and geometric continuity in existing technologies are solved, achieving efficient and accurate slicing processing.
Patent Information
- Application Number
- CN202510940722.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-09
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2045-07-09
AI Technical Summary
Existing technologies suffer from memory overflow, high computational complexity, and geometric continuity issues when processing large and complex models. In particular, distributed slicing engines suffer from geometric feature discontinuities caused by block processing and insufficient economy for small-scale models.
The model employs a segmented processing technique to dynamically group triangular facets according to height intervals. The intersection of the triangular facets with the Z-axis scan line array is then calculated. A compensation algorithm is used to ensure interlayer continuity, and a boundary compensation algorithm is employed to address the issue of missing boundaries, thereby achieving accurate intersection point calculation and storage.
It effectively reduces memory consumption, improves slicing efficiency, ensures the geometric continuity and adaptability of the model, is suitable for efficient processing of both large and small models, and achieves optimal memory utilization.
Smart Images

Figure CN120495580B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of 3D printing, and particularly relates to a 3D printing slicing method for large-size complex models. BACKGROUND
[0002] 3D printing slicing is a core preprocessing process of converting a three-dimensional model (such as STL, OBJ format) into layer-by-layer instructions executable by a printer. The technical challenges mainly focus on the following aspects: (1) model complexity: industrial models usually contain millions or even hundreds of millions of triangular facets, and direct loading into memory will cause huge overhead. (2) Geometric calculation load: During the slicing process, operations such as intersection line calculation between model and slicing plane, support structure generation, path filling, etc. are frequently performed, with a computational complexity of O(N), where N is the number of triangular facets. (3) Memory management bottleneck: Traditional slicing software usually loads complete model data at one time, resulting in memory overflow when processing large-scale models.
[0003] The current distributed slicing engine of Autodesk Netfabb uses block processing technology to divide the model into multiple sub-blocks according to space, loads and slices each block, avoids loading the entire model at one time, reduces memory occupation to the level of single block data, and is suitable for GPU memory limited scenarios.
[0004] Although the distributed slicing engine of Autodesk Netfabb significantly reduces memory occupation and improves computing efficiency when processing large-size complex models, its distributed architecture and block processing strategy also brings some technical limitations and challenges in practical applications. The following are the core shortcomings and detailed analysis:
[0005] (1) Geometric continuity risk at block boundaries: After the model is divided into multiple sub-blocks, the geometric features (such as curved surfaces, thin-walled structures) across the blocks may be misaligned or discontinuous between layers due to incomplete boundary data when slicing independently. (2) Not economical 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 single-machine slicing time. (3) Compatibility limitations for specific geometric types: For high aspect ratio structures (such as thin rods), if the block direction conflicts with the structure orientation, the single block may still need to load the complete rod data, and the memory saving is ineffective; for 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
[0006] In view of the defects in the prior art, the present application provides a 3D printing slicing method for large-size complex models, which can effectively solve the above problems.
[0007] The technical solution adopted by the present application is as follows:
[0008] The application provides a 3D printing slicing method for a large-size complex model, comprising the following steps:
[0009] Step S1, importing a model to be printed into a slicing system;
[0010] Step S2, optimizing triangular facets of the model, dynamically grouping the triangular facets of the model according to height intervals to obtain triangular facets corresponding to each height interval;
[0011] Step S3, establishing a scanning line array in the z direction according to a bounding box of the model;
[0012] Step S4, calculating basic intersection points of the triangular facets corresponding to each height interval and the scanning line array, simultaneously calculating and marking compensation intersection points by using a compensation algorithm to obtain a layer-cut intersection point set corresponding to each height interval, and saving to a local disk; wherein, layer-cut intersection points in the layer-cut intersection point set include the basic intersection points and the compensation intersection points;
[0013] Step S5, generating slicing data based on the layer-cut intersection point sets corresponding to each height interval.
[0014] Preferably, step S2 specifically comprises:
[0015] Step S2.1, establishing an XYZ three-dimensional space coordinate system; the X direction and the Y direction are the horizontal direction and the vertical direction of the plane, and the Z direction is the direction perpendicular to the ground;
[0016] Supposing that the total height of the model is H, and the segmented height is defined as H_F, the model is divided into N height intervals, wherein N = ceil( H / H_F ), ceil() represents rounding up, and in the direction from bottom to top, the intervals are respectively referred to as the 0th height interval, the 1st height interval, …, and the (N-1)th height interval; wherein the heights of the 0th height interval, the 1st height interval, …, and the (N-2)th height interval are all H_F, and the height of the (N-1)th height interval is H-(N-1)*H_F;
[0017] Step S2.2, creating an array Triangle; the array Triangle has N groups of storage areas, denoted as Triangle[k], k ∈ [0, N-1];
[0018] Step S2.3, traversing the triangular facets of the model, and for each triangular facet traversed, obtaining the minimum value z min and the maximum value z max of the vertex coordinates of the triangular facet in the Z axis direction, and if z min ≤ (k+1)*H_F and z maxif H_F ≥ k * H_F, where k ∈ [0, N-1], then the pose of the triangle in the model is stored in the kth group of storage areas Triangle[k] of the array Triangle;
[0019] Step S2.4, after the traversal of the triangles of the model is completed, the triangles stored in the kth group of storage areas of the array Triangle are the triangles corresponding to the kth height interval of the model.
[0020] Preferably, step S3 is specifically:
[0021] The bounding box box of the model to be printed is projected onto the XY plane of the XYZ three-dimensional space coordinate system, and a point A(x min , y min ) is taken as the starting point, and a scanning line array in the Z direction is created on the plane area [x min , x max ]x[y min , y max ] with a pixel size as the interval; wherein A(x min , y min ) is the projection coordinate of the minimum vertex of the bounding box box on the XY plane; (x max , y max ) is the projection coordinate of the maximum vertex of the bounding box box on the XY plane; each scanning line in the scanning line array is identified by its intersection point (x, y) with the XY plane.
[0022] Preferably, step S4 is specifically:
[0023] The triangles stored in each group of storage areas of the array Triangle are grouped and scanned in the order from front to back. For the triangles stored in the kth group of storage areas Triangle[k] scanned, first, the basic intersection point is calculated with the scanning line array; then, if it is identified that the triangles stored in the current group of storage areas are missing only the upper enclosing plane, the top compensation algorithm is used to calculate the top compensation intersection point and mark the top attribute; if it is identified that the triangles stored in the current group of storage areas are missing both the upper enclosing plane and the lower enclosing plane, the bottom compensation algorithm and the top compensation algorithm are executed in turn; if it is identified that the triangles stored in the current group of storage areas are missing only the lower enclosing plane, the bottom compensation algorithm is executed; for each group of storage areas, the corresponding layer intersection point set is obtained and stored in the corresponding main data file MainData_[k].dat.
[0024] Preferably, step S4 is specifically:
[0025] Step S4.1, in the initial processing stage, when k=0, the following method is used for processing:
[0026] 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 scan 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 as the bottom surface attribute; if the normal vector of the triangular patch where it is located is positive, mark it as the top surface attribute.
[0027] 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 attributes:
[0028] 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 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 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.
[0029] 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.
[0030] 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.
[0031] Step S4.1.5: Release all current memory, clear all intersection points on the scan line, set k = k + 1, and process the triangular patches stored in the next storage area Triangle[k].
[0032] 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 in sequence, complete the basic intersection operation and perform algorithm compensation for it. The specific process is as follows:
[0033] 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 scan line array, obtain the basic intersection point set, and mark the attributes of each basic intersection point in the basic intersection point set.
[0034] Step S4.2.2, it is identified that the upper and lower closing planes are missing from the triangular patches stored in the kth group of storage areas Triangle[k], therefore, the bottom surface compensation algorithm and the top surface compensation algorithm are executed in turn:
[0035] Bottom surface compensation algorithm: the temporary file TEMP.dat generated in the k-1th step is loaded, and the compensation intersection point with the bottom surface attribute loaded is taken as the reference bottom surface for the current processing;
[0036] Top surface compensation algorithm: the same top surface compensation algorithm as that in step S4.1.2 is adopted to obtain the top surface compensation intersection point and mark the top surface attribute;
[0037] Step S4.2.3, all the base intersection points obtained in the current kth height interval, the compensation intersection points with the bottom surface attribute obtained by using the bottom surface compensation algorithm, and the top surface compensation intersection points obtained by using the top surface compensation algorithm are stored in the main data file MainData_[k].dat;
[0038] Step S4.2.4, all the top surface compensation intersection points are extracted from the main data file MainData_[k].dat, and the attribute thereof is modified from the top surface attribute to the bottom surface attribute, and the top surface compensation intersection points in this step are stored in the same temporary file TEMP.dat by using the temporary file overwriting update mechanism;
[0039] Step S4.2.5, all the current memories are released, all the intersection points on the scanning line are emptied, k=k+1, and the triangular patches stored in the kth group of storage areas Triangle[k] are processed until the processing of the N-2th group of storage areas Triangle[N-2] is completed;
[0040] Step S4.3, in the final processing stage, for the kth group of storage areas Triangle[k], k=N-1, the following processing procedure is executed:
[0041] Step S4.3.1, the base intersection points are directly obtained by using the base intersection algorithm for the triangular patches stored in the kth group of storage areas Triangle[k] and the scanning line array, the base intersection point set is obtained, and the attribute of each base intersection point in the base intersection point set is marked;
[0042] Step S4.3.2, it is identified that the lower closing plane is missing from the triangular patches stored in the kth group of storage areas Triangle[k], therefore, the bottom surface compensation algorithm is executed:
[0043] Bottom surface compensation algorithm: the temporary file TEMP.dat generated in the k-1th step is loaded, and the compensation intersection point with the bottom surface attribute loaded is taken as the reference bottom surface for the current processing;
[0044] Step S4.3.3, store all the base intersection points and the compensation intersection points with the floor attribute obtained by the floor compensation algorithm into the main data file MainData_[k].dat;
[0045] Step S4.3.4, release all the current memory, clear all the intersection points on the scanning line, and unregister the temporary file TEMP.dat.
[0046] Preferably, in step S4.1.1, when the base intersection points are obtained by directly using the base intersection algorithm to intersect the triangular patches stored in the kth group of storage areas Triangle[k] with the scanning line array, the original base intersection points are subjected to height interval screening, and only the base intersection points with the z coordinate located in the kth height interval are retained, and the rest are discarded, to obtain the base intersection point set.
[0047] Preferably, step S5 is specifically:
[0048] Step S5.1, when a specified slice with the height value H of the model to be printed is needed, the main data file index k is calculated according to the height value H of the specified slice , is rounded down;
[0049] Step S5.2, according to the main data file index k, the corresponding main data file MainData_[k].dat is located and loaded into the memory buffer;
[0050] Step S5.3, a two-dimensional image buffer is created, the size of the two-dimensional image buffer is consistent with the resolution of the printing plane, and the pixel value of each pixel position (x, y) in the two-dimensional image buffer is initialized to 0;
[0051] Step S5.4, for the main data file MainData_[k].dat loaded into the memory buffer, the corresponding layer intersection points are displayed, and the scanning line array is also displayed; all the scanning lines are traversed row by row, and for each scanning line (x i ,y i ) traversed, all the layer intersection points located on the scanning line (x i ,y i ) are analyzed, and if there are two adjacent layer intersection points P1(x i , y i ,z1) and P2(x i , y i ,z2), the attributes and height relationship thereof are checked:
[0052] If z1<H<z2 is met, and the layer intersection point P1 has the floor attribute and the layer intersection point P2 has the ceiling attribute, then the pixel value of the two-dimensional image buffer (x i ,y i) is set as having a pixel, indicating a solid area; otherwise, set as having no pixel, indicating an empty area or a non-printing area;
[0053] Step S5.5, after the traversal of all the scan line arrays is completed, the two-dimensional image buffer displays the slice image at the height value H position.
[0054] The 3D printing slice method for large-size complex models provided by the application has the following advantages:
[0055] (1) The segmentation processing technology of the application creatively converts the segmented objects into an intersection process of scan lines and triangular facets. By establishing dynamic division of the Z-direction height interval, accurate intersection operation of the scan line array and the triangular facet group in each segment is performed, and a boundary compensation algorithm is used to ensure layer continuity. This method fundamentally avoids the risk of seams caused by geometric blocking; (2) The application can manually adjust the single fixed processing height according to the model size and the current memory state. This mechanism enables both large industrial models of GB level and small parts of MB level to achieve optimal memory utilization while ensuring processing accuracy. (3) The scan line intersection method used by the application can still operate normally even if the model geometry is complex, as long as the triangular facets of the model are correct. BRIEF DESCRIPTION OF DRAWINGS
[0056] Figure 1 A flowchart of the 3D printing slice method for large-size complex models provided by the application;
[0057] Figure 2 A triangular facet height interval processing principle diagram provided by the application;
[0058] Figure 3 A schematic diagram of a row of scan line arrays provided by the application;
[0059] Figure 4 A layer intersection point schematic diagram provided by the application. DETAILED DESCRIPTION
[0060] In order to make the technical problems, technical solutions and beneficial effects of the application clearer and more apparent, the application will be further described in detail below in combination with the drawings and examples. It should be understood that the specific examples described herein are only used to explain the application and do not limit the application.
[0061] In view of the inherent defects of the existing distributed slicing technology, the application discloses a 3D printing slice method for large-size complex models. For triangular facets of large-size complex models, the segmentation processing technology and memory reuse technology are used to reduce memory consumption and improve slicing efficiency, solving the problem of memory overrun caused by excessive slice data volume.
[0062] Specifically, the application proposes an innovative Z-direction segmentation processing technology, which realizes technological innovation through the following three breakthrough improvements:
[0063] (1) Unlike the block processing of model geometry in traditional schemes (such as the distributed space segmentation adopted by Autodesk Netfabb), the segmentation processing technology of the application creatively converts the segmented object into an intersection process of scan lines and triangular facets. By establishing dynamic division of Z-direction height intervals, accurate intersection operation is performed between scan line arrays and triangular facet groups within each segment, and a boundary compensation algorithm is used to ensure layer continuity. This method fundamentally avoids the risk of seams caused by geometric blocking;
[0064] (2) The application can manually adjust the fixed processing height at a time according to the model size and the current memory state. This mechanism enables both large industrial models of GB level and small parts of MB level to achieve optimal memory utilization while ensuring processing accuracy.
[0065] (3) The scan line intersection method used by the application can still operate normally even if the model geometry is complex, as long as the triangular facets of the model are correct.
[0066] This change in technical paradigm not only solves the geometric continuity problem inherent in 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.
[0067] As shown in Figure 1 , the application provides a 3D printing slicing method for large-size complex models, including the following steps:
[0068] Step S1, importing the model to be printed into the slicing system;
[0069] Step S2, optimizing the triangular facets of the model, dynamically grouping the triangular facets of the model according to height intervals to obtain triangular facets corresponding to each height interval;
[0070] Step S3, establishing a scan line array in the Z-direction according to the bounding box of the model;
[0071] Step S4, calculating the basic intersection points of each height interval corresponding to the triangular facets and the scan line array, and using a compensation algorithm to calculate and mark the compensation intersection points to obtain a layer-cut intersection point set corresponding to each height interval, and saving it to the local disk; wherein the layer-cut intersection points in the layer-cut intersection point set include the basic intersection points and the compensation intersection points;
[0072] Step S5, generating slicing data based on the layer-cut intersection point set corresponding to each height interval.
[0073] The following describes each step in detail:
[0074] The 3D printing slicing method for large-size complex models provided by the application has the following implementation process:
[0075] First, the triangular facets are optimized, then the triangular facets are dynamically grouped according to height, and then the scan line intersection calculation is performed according to the group. Since the obtained intersection point data is incomplete, the application adds compensation points. After the supplement is completed, all the processed intersection point data is serialized into a local file for storage. Then, based on the stored local file, slicing and printing are performed.
[0076] The application defines variables as shown in Figure 2
[0077] H_L represents the minimum height value in the specified height interval;
[0078] H_H represents the maximum height value in the specified height interval;
[0079] H_F represents the fixed height of one processing;
[0080] Point represents the intersection of the scan line and the triangular facet;
[0081] Point_Hand represents the compensation point.
[0082] The main idea of the application is:
[0083] The triangular facets are dynamically grouped according to height, and a scan line array is established.
[0084] The intersection calculation is performed on the grouped triangular facets and the scan line. At this time, the intersection point data has been stored in the memory, but due to incomplete information, it cannot be directly used for layer cutting processing. Therefore, the missing intersection points need to be supplemented in the subsequent steps.
[0085] The intersection point screening and compensation point adding operation is performed, and the compensation point set is used as the top surface of the current processing layer. Taking the triangular facet intersection points in the height interval [H_L, H_H] mm as an example: first, traverse the scan line intersection point set, retain the intersection point data that satisfies z∈[H_L, H_H], and eliminate the redundant data outside the interval; then extract the z_max intersection point of each scan line in the valid interval, analyze its geometric properties and height parameters, and finally determine whether manual intersection point compensation is needed.
[0086] Save all intersection points in the current height interval to the local.
[0087] Save the manually added intersection points to the local as the bottom surface for the next intersection point judgment.
[0088] In order to make the purpose, technical solutions and advantages of the present application more clear, the embodiments of the present application will be described in further detail below.
[0089] Step S1, importing a model to be printed into a slicing system;
[0090] This step is model loading and platform adaptation: importing a three-dimensional model file (STL format) to be printed into a slicing system, performing coordinate system alignment, taking the platform base surface as the XY plane, and setting the Z coordinate of the bottom vertex of the model to zero. The model is automatically rotated to the optimal printing direction.
[0091] The triangular facets of the optimized model referred to herein refer to optimization of the model by simplifying and repairing the model using third-party software.
[0092] Step S2, optimizing the triangular facets of the model, dynamically grouping the triangular facets of the model according to height intervals to obtain triangular facets corresponding to each height interval;
[0093] This step is dynamic grouping of 3D printing model triangular facets based on the Z axis.
[0094] Step S2.1, establishing an XYZ three-dimensional space coordinate system; the X direction and the Y direction are the horizontal and vertical directions of the plane, and the Z direction is the direction perpendicular to the ground;
[0095] Height interval division: assuming that the total height of the model is H millimeters and the segmented height is H_F millimeters, the model is divided into N height intervals, where N = ceil(H / H_F), ceil() represents rounding up, and in the direction from bottom to top, they are respectively referred to as the 0th height interval, the 1st height interval, …, and the N-1th height interval; wherein the height of the 0th height interval, the 1st height interval, …, and the N-2th height interval is H_F, and the height of the N-1th height interval is H-(N-1)*H_F;
[0096] Step S2.2, creating an array Triangle for storing the grouped triangular facets; the array Triangle has N groups of storage areas, denoted as Triangle[k], k ∈ [0, N-1];
[0097] Step S2.3, facet grouping rule: traversing the triangular facets of the model, for each triangular facet traversed, obtaining the minimum value z min and the maximum value z max of the vertex coordinates of the triangular facet in the Z axis direction, if z min ≤ (k+1)*H_F and z maxIf k ≥ k * H_F, where k∈[0,N-1], then the pose of the triangular facet in the model is assigned to the kth storage area Triangle[k] of the array Triangle;
[0098] By adopting the patch grouping rules in this step, overlapping areas can be processed, allowing patches to be distributed across adjacent height intervals (such as overhanging structures), ensuring contour closure during subsequent layer slicing.
[0099] Step S2.4: After traversing the triangular faces of the model, the triangular faces stored in the kth storage area of the Triangle array are the triangular faces corresponding to the kth height interval of the model.
[0100] Step S3: Establish a scan line array in the z-direction based on the bounding box of the model;
[0101] 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.
[0102] This step is specifically as follows:
[0103] 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 coordinate system, and the point A(x) is used as the reference point. min y min Starting from ), in the planar region [x] min , x max ]×[y min y max A Z-axis scan line array is created with pixel size as the spacing, called the Z-axis buffer; where A(x min y min (x) represents the projection coordinates of the smallest vertex of the bounding box on the XY plane; max y max ) represents the projected coordinates of the largest vertex of the bounding 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.
[0104] Specifically, in 3D printing, the bounding box of a model to be printed is a geometric tool for quickly describing the spatial extent of an object. It is typically a cube aligned with the coordinate axes, and is defined by two vertices, with the smallest vertex being P. min (x min, y min, z min ) represents the minimum value of the object across all coordinate axes, and the maximum vertex P. max (x max, ymax, z max ) is the maximum value of the object in all coordinate axes, and the entire 3D printing model is located in this cube.
[0105] Step S4, find the basic intersection points of each height interval corresponding triangular patches and the scan line array, and calculate and mark the compensation intersection points by using the compensation algorithm to obtain the layer intersection point set corresponding to each height interval, and save to the local disk; wherein the layer intersection points in the layer intersection point set include the basic intersection points and the compensation intersection points;
[0106] This step is specifically:
[0107] According to the order from front to back, group the triangular patches stored in each group storage area of the array Triangle, for the triangular patches stored in the kth group storage area Triangle[k], first find the basic intersection points with the scan line array; then, if it is identified that the triangular patches stored in the current group storage area are missing only the upper closed plane, then calculate and mark the top surface compensation intersection points by using the top surface compensation algorithm; if it is identified that the triangular patches stored in the current group storage area are missing both the upper closed plane and the lower closed plane, then sequentially execute the bottom surface compensation algorithm and the top surface compensation algorithm; if it is identified that the triangular patches stored in the current group storage area are missing only the lower closed plane, then execute the bottom surface compensation algorithm; for each group storage area, obtain the corresponding layer intersection point set and store it in the corresponding main data file MainData_[k].dat.
[0108] Specifically, since the triangular patches 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.
[0109] In the process of grouping scanning triangular patches, if a group of patches (such as the kth group) fails to form a closed geometric body, it will cause the intersection point information of this group to be incomplete, ultimately affecting the integrity of the cross-sectional image obtained by the layer cutting process.
[0110] Therefore, as shown in Figure 2 , it is necessary to supplement the above intersection finding process, that is, to add compensation points (Point_Hand), for which two compensation algorithms need to be executed:
[0111] A top surface compensation algorithm, which compensates for the intersection points missing the attribute of "top surface" of the current group of intersection points;
[0112] B bottom surface compensation algorithm, which compensates for the intersection points missing the attribute of "bottom surface" of the current group of intersection points.
[0113] These two algorithms will be described in detail below, and the compensation algorithms used for different height intervals are different.
[0114] The detailed implementation of this step is:
[0115] Step S4.1, in the initial processing stage, that is, when k=0, the following method is used for processing:
[0116] Step S4.1.1, using the basic intersection algorithm, the basic intersection points of the triangular patches stored in the kth group of storage areas Triangle[k] and the scan line array are directly calculated, the basic intersection point set of the model scan line is obtained, and each basic intersection point in the basic intersection point set is marked with an attribute. The marking method is: if the normal vector of the triangular patch where the basic intersection point is located is negative, it is marked as a bottom surface attribute; if the normal vector of the triangular patch where the basic intersection point is located is positive, it is marked as a top surface attribute;
[0117] In actual implementation, when the basic intersection algorithm is used to directly calculate the basic intersection points of the triangular patches stored in the kth group of storage areas Triangle[k] and the scan line array, the original basic intersection points obtained are subjected to height interval screening, and only the basic intersection points with z coordinates located in the kth height interval are retained, that is, the effective intersection points, and the rest are excluded, thereby obtaining the basic intersection point set.
[0118] Step S4.1.2, it is identified that the triangular patches stored in the kth group of storage areas Triangle[k] are the bottommost triangular patches, and the upper closed plane (commonly known as "cover") is missing, which results in that the basic intersection point data only exists in the triangular patch distribution area. Therefore, the top surface compensation algorithm needs to be executed: the top surface compensation intersection points are calculated by using the top surface compensation algorithm and marked with a top surface attribute:
[0119] The top surface compensation algorithm: scan line extreme point extraction: traverse each scan line in the scan line array, and for each scan line traversed, obtain all intersection points of the scan line with the triangular patches stored in the kth group of storage areas Triangle[k], and extract the extreme intersection point P_max in the Z direction; attribute analysis: analyze the geometric attribute (position coordinate h_z and patch attribute) of the extreme intersection point P_max. If it is marked as a bottom surface attribute, a top surface compensation intersection point Point_Hand is added at the position of the maximum height value in the kth height interval on the same scan line, and marked with a top surface attribute. If it is already marked as a top surface attribute, no top surface compensation is performed, and the current intersection point set remains unchanged;
[0120] After all the processing in the current height interval is completed, the data storage operation is performed, that is., step S4.1.3 is executed.
[0121] Step S4.1.3, main data storage: all basic intersection points obtained in the current kth height interval and the top surface compensation intersection points obtained by using the top surface compensation algorithm are stored in the main data file MainData_[k].dat.
[0122] Specifically, the complete intersection set in the current height interval [H_L, H_H] is serialized into a data file and stored persistently, with the naming rule MainData_[k].dat (k=0);
[0123] Step S4.1.4, compensation data processing: extracting all top surface compensation intersection points Point_Hand from the main data file MainData_[k].dat, and modifying the attribute of the intersection points from the top surface attribute to the bottom surface attribute to generate an independent temporary file TEMP.dat;
[0124] Step S4.1.5, after the processing is completed, releasing all the current memory, emptying all the intersection points on the scan line, updating the upper limit and lower limit of the current height interval, H_L = H_L + H_F, H_H = H_H + H_F, and the following steps also have the same operation steps when the height interval needs to be updated. Let k=k+1, and process the next group of storage areas Triangle[k] stored in the triangular patches;
[0125] Step S4.2, in the intermediate processing stage, for the kth group of storage areas Triangle[k], 0<k<N-1, an iterative processing strategy is adopted, and each group of storage area triangular patches is processed in order according to the increasing value of k, the basic intersection operation is completed and the algorithm compensation is completed, and the processing process meets the data dependency requirement, and the specific process is as follows:
[0126] Step S4.2.1, using the basic intersection algorithm, the basic intersection set is obtained by directly intersecting the triangular patches stored in the kth group of storage areas Triangle[k] with the scan line array, and the attribute of each basic intersection point in the basic intersection set is marked;
[0127] Step S4.2.2, it is identified that the triangular patches stored in the kth group of storage areas Triangle[k] are missing the upper and lower closed planes ("cover" and "bottom"), therefore, the bottom surface compensation algorithm and the top surface compensation algorithm are executed in turn:
[0128] Bottom surface compensation algorithm: loading the temporary file TEMP.dat generated in the k-1 step (the previous step), and loading the compensation intersection points with the bottom surface attribute as the reference bottom surface for the current processing;
[0129] Top surface compensation algorithm: using the same top surface compensation algorithm as step S4.1.2, top surface compensation intersection points are obtained, and the top surface attribute is marked;
[0130] Step S4.2.3, store all the base intersection points obtained from the current kth height interval, the compensation intersection points with the bottom surface attribute obtained by using the bottom surface compensation algorithm, and the top surface compensation intersection points obtained by using the top surface compensation algorithm into the main data file MainData_[k].dat;
[0131] Step S4.2.4, extract all the top surface compensation intersection points from the main data file MainData_[k].dat, modify the attribute of the top surface compensation intersection points from the top surface attribute to the bottom surface attribute, and store the top surface compensation intersection points of the present step into the same temporary file TEMP.dat by using the temporary file overwriting update mechanism;
[0132] Step S4.2.5, release all the current memory, clear all the intersection points on the scanning line, set k=k+1, and process the next triangular patch stored in the storage area Triangle[k] until the processing of the N-2th group of storage areas Triangle[N-2] is completed;
[0133] Through the present step, a total of N-2 standardized data files are generated, the naming rules are main data files MainData_[k].dat (k∈[1,N-2]), and only one temporary file is generated. The upper limit and the lower limit of the height interval are updated every time the loop is executed, and all the current memory is released, and all the intersection points on the scanning line are cleared.
[0134] Step S4.3, in the final processing stage, for the kth group of storage areas Triangle[k], k=N-1, the following processing flow is executed:
[0135] Step S4.3.1, by using the base intersection algorithm, the base intersection points are directly obtained from the triangular patches stored in the kth group of storage areas Triangle[k] and the scanning line array, the base intersection point set is obtained, and the attribute of each base intersection point in the base intersection point set is marked;
[0136] Step S4.3.2, it is identified that the triangular patches stored in the kth group of storage areas Triangle[k] are missing the lower closed plane, therefore, the bottom surface compensation algorithm is executed:
[0137] The bottom surface compensation algorithm: the temporary file TEMP.dat generated in the k-1th step is loaded, and the compensation intersection points with the bottom surface attribute loaded are taken as the reference bottom surface for the current processing;
[0138] Step S4.3.3, store all the base intersection points obtained from the current kth height interval and the compensation intersection points with the bottom surface attribute obtained by using the bottom surface compensation algorithm into the main data file MainData_[k].dat;
[0139] Step S4.3.4, release all the current memory, empty all the intersection points on the scan line, and unregister the temporary file TEMP.dat. Complete the entire processing flow, and the following is the slicing process.
[0140] When performing step S4, the storage optimization is performed when the scan line intersection is sequentially performed on each height interval, the single dynamic temporary file architecture is adopted, and the storage overhead is significantly reduced through the temporary file overwrite update mechanism.
[0141] Step S5, based on the layer intersection point set corresponding to each height interval, the slice data generation is performed.
[0142] The reading of the main data file adopts a dynamic loading mechanism, and the specific implementation process is as follows:
[0143] Step S5.1, when the specified slice of the height value H of the model needs to be printed, the main data file index k is calculated according to the height value H (unit: mm) of the specified slice , is rounded down;
[0144] Step S5.2, according to the main data file index k, the corresponding main data file MainData_[k].dat is located and loaded into the memory buffer;
[0145] Specifically, after the main data file is loaded, the algorithm displays all the layer intersection points in the height interval corresponding to the specified slice, and each layer intersection point is inserted into the scan line in order. The layer intersection points on each scan line are sorted in ascending order according to their z coordinate values, which drives the subsequent layer algorithm execution. This on-demand loading design significantly reduces the memory occupation, and is particularly suitable for processing large-scale three-dimensional model data.
[0146] Step S5.3, initialize the image buffer, create a two-dimensional image buffer, the two-dimensional image buffer 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 value of each pixel position (x, y) in the two-dimensional image buffer is initialized to 0;
[0147] Step S5.4, scan line processing: for the main data file MainData_[k].dat loaded into the memory buffer, the corresponding layer intersection points are displayed, and the scan line array is also displayed; all scan lines are traversed row by row, and for each scan line (x i ,y i ) traversed, as shown in Figure 4 , all layer intersection points located on the scan line (x i ,y i ) are analyzed, if there are two adjacent layer intersection points P1(x i , y iz1) and P2(x i , y i ,z2), check its attribute and height relationship:
[0148] If it satisfies: z1<H<z2, and the layer intersection point P1 is the bottom attribute (model entry point), and the layer intersection point P2 is the top attribute (model exit point), then the two-dimensional image buffer (x i ,y i ) is set to have pixels, indicating a solid area; otherwise, it is set to have no pixels, indicating an empty area or a non-printing area; a printing image can be generated according to actual printing requirements.
[0149] Step S5.5: After all the scanning line arrays are traversed, the two-dimensional image buffer displays the slice image at the height value H position.
[0150] Slice data output: encode the image buffer data into a format recognizable by the printing system, such as PNG, BMP or a special slice file, and store it to an output file.
[0151] The 3D printing slice method for large-size complex models provided by the present application has the following advantages:
[0152] 1. The present application solves the problem of memory overrun caused by excessive slice data for large-size complex models by using height interval processing technology and memory reuse technology, and proposes a new 3D printing slice method for large-size complex models
[0153] 2. The present application uses a boundary compensation algorithm to ensure layer continuity.
[0154] 3. The height interval processing technology of the present application stores intersection point information in height intervals.
[0155] 4. The present application can specify a height to obtain a slice image.
[0156] The above description is only the preferred embodiment of the present application, and it should be noted that for ordinary skilled persons in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.
Claims
1. A 3D printing slicing method for large size complex models, characterized in that, The method comprises the following steps: Step S1, importing a model to be printed into a slicing system; Step S2, optimizing triangular facets of the model, dynamically grouping the triangular facets of the model according to height intervals to obtain triangular facets corresponding to each height interval; Step S3, establishing a scanning line array in the z direction according to a bounding box of the model; Step S4, calculating basic intersection points of triangular facets corresponding to each height interval and the scanning line array, simultaneously calculating compensation intersection points by using a compensation algorithm and marking the compensation intersection points to obtain a layer-cut intersection point set corresponding to each height interval, and saving the layer-cut intersection point set to a local disk; wherein layer-cut intersection points in the layer-cut intersection point set comprise the basic intersection points and the compensation intersection points; Step S5, generating slicing data based on the layer-cut intersection point set corresponding to each height interval; Step S4 specifically comprises: Grouping triangular facets stored in each group of storage areas of the array Triangle in a front-to-back order, for triangular facets stored in the kth group of storage areas Triangle[k], firstly calculating basic intersection points of the triangular facets and the scanning line array; then, if it is identified that the triangular facets stored in the current group of storage areas are missing only an upper closed plane, calculating a top surface compensation intersection point by using a top surface compensation algorithm and marking a top surface attribute; if it is identified that the triangular facets stored in the current group of storage areas are missing both the upper closed plane and a lower closed plane, sequentially executing a bottom surface compensation algorithm and the top surface compensation algorithm; if it is identified that the triangular facets stored in the current group of storage areas are missing only the lower closed plane, executing the bottom surface compensation algorithm; for each group of storage areas, obtaining a corresponding layer-cut intersection point set and storing the layer-cut intersection point set in a corresponding main data file MainData_[k].dat; Step S4.2 specifically comprises: In the intermediate processing stage, for the kth group of storage areas Triangle[k], 0<k<N-1, triangular facets of each group of storage areas are processed in an order of increasing k values by using an iterative processing strategy, basic intersection operation is completed, and algorithm compensation is completed, and a specific process is as follows: Step S4.2.1, calculating basic intersection points of triangular facets stored in the kth group of storage areas Triangle[k] and the scanning line array directly by using a basic intersection algorithm, obtaining a basic intersection point set, and marking an attribute of each basic intersection point in the basic intersection point set; Step S4.2.2, identifying that the triangular facets stored in the kth group of storage areas Triangle[k] are missing an upper closed plane and a lower closed plane, therefore, sequentially executing a bottom surface compensation algorithm and a top surface compensation algorithm: The bottom surface compensation algorithm: loading a temporary file TEMP.dat generated in the k-1th step, and taking compensation intersection points with a bottom surface attribute loaded as a reference bottom surface for current processing; The top surface compensation algorithm: traversing each scan line in the scan line array, for each scan line traversed, obtaining all intersection points of the scan line with the triangular patches stored in the kth group of storage areas Triangle[k], and extracting the extreme intersection point P_max in the Z direction, analyzing the properties of the extreme intersection point P_max, if it is marked as a bottom surface property, adding a top surface compensation intersection point at the maximum height position in the same scan line in the kth height interval, and marking the top surface property; if it is already marked as a top surface property, no top surface compensation is performed; Step S4.2.3, storing all base intersection points obtained in the current kth height interval, compensation intersection points with a bottom surface property obtained by using the bottom surface compensation algorithm, and top surface compensation intersection points obtained by using the top surface compensation algorithm in the main data file MainData_[k].dat; Step S4.2.4, extracting all top surface compensation intersection points from the main data file MainData_[k].dat, and modifying the properties of the top surface compensation intersection points from top surface properties to bottom surface properties, and storing the top surface compensation intersection points of this step in the same temporary file TEMP.dat using the temporary file overwrite update mechanism; Step S4.2.5, releasing all current memory, clearing all intersection points on the scan line, setting k=k+1, processing the triangular patches stored in the kth group of storage areas Triangle[k], until the processing of the N-2th group of storage areas Triangle[N-2] is completed.
2. The method of claim 1, wherein, Step S2 is specifically: Step S2.1, establishing an XYZ three-dimensional space coordinate system; the X direction and the Y direction are the horizontal and vertical directions of the plane, and the Z direction is the direction perpendicular to the ground; Let the total height of the model be H, and define the segmented height as H_F, then divide the model into N height intervals, where N=ceil(H / H_F ), ceil() represents rounding up, and in the direction from bottom to top, they are called the 0th height interval, the 1st height interval, …, the N-1th height interval; among them, the height of the 0th height interval, the 1st height interval, …, the N-2th height interval is 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, denoted as Triangle[k], k∈[0,N-1]; Step S2.3, traversing the triangular facets of the model, for each triangular facet traversed, obtaining the minimum value z min and the maximum value z max of the vertex coordinates of the triangular facet in the Z-axis direction, if z min ≤ (k+1)*H_F and z max ≥ k*H_F, where k∈[0,N-1], then the pose of the triangular facet in the model is classified into the kth group of storage areas Triangle[k] of the array Triangle. Step S2.4, after traversing the triangular patches of the model, the triangular patches stored in the kth group of storage areas of the array Triangle are the triangular patches corresponding to the kth height interval of the model.
3. The method of claim 2, wherein the method is used for slicing a large complex model for 3D printing. Step S3 is specifically: Project a bounding box box of a model to be printed onto an XY plane of an XYZ three-dimensional space coordinate system, and take a point A(x min , y min ) as a starting point to create an array of scanning lines in the Z direction on a planar region [x min , x max ]x[y min , y max ] with a pixel size as an interval; wherein A(x min , y min ) is a projection coordinate of a minimum vertex of the bounding box box on the XY plane; (x max , y max ) is a projection coordinate of a maximum vertex of the bounding box box on the XY plane; and each scanning line in the array of scanning lines is identified by an intersection (x, y) thereof with the XY plane.
4. The method of claim 1, wherein, Step S4 is specifically: Step S4.1, in the initial processing stage, when k=0, the following method is used for processing: Step S4.1.1, using the basic intersection algorithm, the intersection of the triangular patches stored in the kth group storage area Triangle[k] and the scan line array is directly calculated to obtain a set of basic intersection points, and the attribute of each basic intersection point in the set of basic intersection points is marked. If the normal vector of the triangular patch where the basic intersection point is located is negative, it is marked as a bottom surface attribute; if the normal vector of the triangular patch where the basic intersection point is located is positive, it is marked as a top surface attribute; Step S4.1.2, it is identified that the triangular patches stored in the kth group storage area Triangle[k] are the bottommost triangular patches, and the upper closed plane is missing, so the top surface compensation algorithm is used to calculate the top surface compensation intersection points and mark the top surface attribute: Step S4.1.3, all basic intersection points obtained in the current kth height interval and the top surface compensation intersection points obtained by using the top surface compensation algorithm are stored in the main data file MainData_[k].dat; Step S4.1.4, all top surface compensation intersection points are extracted from the main data file MainData_[k].dat, and the attribute thereof is modified from the top surface attribute to the bottom surface attribute to generate an independent temporary file TEMP.dat; Step S4.1.5, all the current memory is released, all the intersection points on the scan line are emptied, k=k+1, and the triangular patches stored in the next storage area Triangle[k] are processed; Step S4.2, in the intermediate processing stage, for the kth group storage area Triangle[k], 0<k<N-1, an iterative processing strategy is used to process the triangular patches in each group storage area in ascending order of k value, complete the basic intersection operation and complete the algorithm compensation; Step S4.3, in the final processing stage, for the kth group storage area Triangle[k], k=N-1, the following processing flow is executed: Step S4.3.1, using the basic intersection algorithm, the intersection of the triangular patches stored in the kth group storage area Triangle[k] and the scan line array is directly calculated to obtain a set of basic intersection points, and the attribute of each basic intersection point in the set of basic intersection points is marked; Step S4.3.2, it is identified that the triangular patches stored in the kth group storage area Triangle[k] are 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 the k-1th step, and the compensation intersection points with the bottom surface attribute loaded are used as the reference bottom surface for the current processing; Step S4.3.3, all basic intersection points obtained in the current kth height interval and the compensation intersection points with the bottom surface attribute obtained by using the bottom surface compensation algorithm are stored in the main data file MainData_[k].dat; Step S4.3.4, all the current memory is released, all the intersection points on the scan line are emptied, and the temporary file TEMP.dat is unregistered.
5. The method of claim 4, wherein, In step S4.1.1, when the base intersection algorithm is used to directly obtain the base intersection points of the triangular patches stored in the kth group of storage areas Triangle[k] and the scanning line array, the obtained original base intersection points are subjected to height interval screening, only the base intersection points with z coordinates located in the kth height interval are retained, and the rest are removed, thereby obtaining a set of base intersection points.
6. The method of claim 4, wherein, Step S5 is specifically: Step S5.1, when a specified slice with a height value H of the model to be printed is needed, the main data file index k = ⌊H / H_F⌋ is calculated according to the height value H of the specified slice, and ⌊ ⌋ is the floor function; Step S5.2, according to the main data file index k, the corresponding main data file MainData_[k].dat is located and loaded into the memory buffer; Step S5.3, a two-dimensional image buffer is created, the size of the two-dimensional image buffer is consistent with the resolution of the printing plane, and the pixel value of each pixel position (x, y) in the two-dimensional image buffer is 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, while displaying the scan line array; traverse all the scan lines row by row, for each scan line (x i ,y i ) traversed, analyze all the layer intersection points located at the 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 the following conditions are met: z1 < H < z2, and the layer intersection point P1 is a bottom surface attribute, and the layer intersection point P2 is a top surface attribute, then the two-dimensional image buffer (x i ,y i ) is set to have a pixel, indicating a solid area; otherwise, it is set to have no pixel, indicating an empty area or a non-printing area. Step S5.5, after the traversal of all scanning line arrays is completed, 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