Method of detecting defects in a three-dimensional model, non-volatile storage medium
Patent Information
- Application Number
- CN202511070948.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-31
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2045-07-31
AI Technical Summary
其缺点是检测速度很慢,导致缺陷检测具有局限性、效率较低
[0018] In this embodiment of the invention, a method for detecting defects in a 3D model is employed. This involves acquiring the 3D model; performing GPU slicing on the 3D model to obtain multiple slice layer images; using a voxel diffusion algorithm to detect the rim of an inverted cup based on these multiple slice layer images, and determining the rim detection result; or determining the large cross-section detection result based on the number of pixels of a preset color in the multiple slice layer images; or determining the cross-sectional abrupt change detection result based on the difference image between adjacent slice layer images, where the difference image represents the shape difference in adjacent slice layer images; and determining the corresponding defect detection result for the 3D model based on the rim detection result, the large cross-section detection result, and the cross-sectional abrupt change detection result. This achieves the goal of performing different defect detections on the slice images, thereby improving the speed and efficiency of model defect detection and solving the current technical problems of limited detection speed and low efficiency in defect detection.
Smart Images

Figure CN120953216B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of 3D printing technology, and more specifically, to a method for detecting defects in a three-dimensional model and a non-volatile storage medium. Background Technology
[0002] If the model has an inverted cup opening, resin may not be able to drain properly during printing, potentially causing deformation. Large interfaces or abrupt changes in cross-section can prevent the model from being lifted during printing, leading to issues like printout failure. Therefore, it is essential to detect these defects in the model before printing.
[0003] Current technical solutions are based on mesh or CPU slicing. This involves slicing the mesh in the cgal (Computational GeometryAlgorithms Library) at a specific z-value, resulting in a set of slices. Each slice produces a 2D polygon. For detecting inverted cup rims, large cross-sections, and abrupt cross-section changes, it's necessary not only to compare and analyze the inclusion relationships between 2D polygons in upper and lower slices but also to consider the relationships between 2D polygons and their areas. The drawback is its slow detection speed, leading to limitations and low efficiency in defect detection.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This invention provides a method for detecting defects in a three-dimensional model and a non-volatile storage medium, to at least solve the technical problems of current defect detection, such as limitations, slow detection speed, and low efficiency.
[0006] According to one aspect of the present invention, a method for detecting defects in a three-dimensional model is provided, comprising: acquiring a three-dimensional model; performing GPU slicing on the three-dimensional model to obtain multiple slice layer images; performing inverted cup rim detection using a voxel diffusion algorithm based on the multiple slice layer images to determine the inverted cup rim detection result; or determining a large cross-section detection result based on the number of pixels of a preset color in the multiple slice layer images; or determining a cross-sectional abrupt change detection result based on a difference image between adjacent slice layer images in the multiple slice layer images, wherein the difference image characterizes the shape difference in adjacent slice layer images; and determining a defect detection result corresponding to the three-dimensional model based on the inverted cup rim detection result, the large cross-section detection result, and the cross-sectional abrupt change detection result.
[0007] In some embodiments, based on multiple slice layer images, a voxel diffusion algorithm is used to detect the rim of the cup and determine the detection result. This includes: for each slice layer image, marking target pixels outside the slice pattern as a first state and marking basic pixels within the slice pattern as a second state; for the first slice layer image among the multiple slice layer images, changing the target pixels in the first state to a third state, wherein the first slice layer image is used to solidify the first layer of the 3D model; for any slice layer image among the multiple slice layer images, for each target pixel: when the target pixel corresponding to the coordinates in the previous slice layer image is in the third state, changing the target pixel in any slice layer image to the third state; when the target pixel corresponding to the coordinates in the previous slice layer image is not in the third state, but any slice layer image has a target pixel in the third state adjacent to it, changing the target pixel in any slice layer image to the third state.
[0008] In some embodiments, targeting any one of the multiple slice layer images includes: sequentially targeting the slice layer images of the multiple slice layer images in the order of curing.
[0009] In some embodiments, the large cross-section detection result is determined based on the number of pixels of a preset color in multiple slice layer images, including: counting the number of pixels of a preset color in multiple slice layer images; traversing multiple slices, determining the slice layer image with the number of pixels of the preset color exceeding a preset number threshold as the large cross-section, until the traversal is completed, and obtaining the large cross-section detection result.
[0010] In some embodiments, determining the cross-sectional abrupt change detection result based on the difference image between adjacent slice layer images in multiple slice layer images includes: traversing multiple slice layer images, calculating the difference image between the current slice layer image and the next slice layer image to obtain multiple difference images; performing contour analysis on the multiple difference images to determine the contour area corresponding to each of the multiple difference images; and determining the existence of a cross-sectional abrupt change if there is a difference image in the multiple difference images whose contour area exceeds a preset area change threshold.
[0011] In some embodiments, if the cup opening detection result indicates the presence of a cup opening, the drilling position and drilling direction corresponding to the cup opening are determined; based on the drilling position and drilling direction, a hole is generated on the three-dimensional model according to Boolean operations.
[0012] In some embodiments, determining the drilling position and direction corresponding to the inverted cup opening includes: if the inverted cup opening detection result indicates the presence of an inverted cup opening, determining the lowest point of the inverted cup opening; emitting rays from the lowest point of the inverted cup opening in multiple directions; identifying the ray that passes through the interior of the three-dimensional model and intersects with the outer surface of the three-dimensional model as the target ray; measuring the path length of the target ray passing through the interior of the three-dimensional model; and determining the direction corresponding to the ray with the shortest path length as the drilling direction.
[0013] In some embodiments, when the large cross-section detection result indicates the existence of a large cross-section, a list of pose matrices is created, wherein the matrices in the list represent the rotational pose of the 3D model; based on the matrices in the pose matrix list, the 3D model is rotated accordingly to obtain 3D models corresponding to multiple rotation angles; the 3D models corresponding to the multiple rotation angles are sequentially processed to determine the large cross-section detection result based on the number of pixels of preset colors in multiple slice layer images, to obtain the large cross-section detection result corresponding to the 3D model corresponding to the multiple rotation angles; based on the large cross-section detection result corresponding to the 3D model corresponding to the multiple rotation angles, the target rotation angle corresponding to the 3D model is determined.
[0014] In some embodiments, the defect detection results corresponding to the 3D model are determined based on the inverted cup rim detection results, large cross-section detection results, and cross-sectional abrupt change detection results. This includes: identifying contours in multiple slice layer images; traversing multiple slice layer images and checking whether the contour of the currently processed slice layer image is connected to the contour of the previous slice layer image, until the traversal is completed, to obtain the island detection results. In the case that the contour of the currently processed slice layer image is not connected to the contour of the previous slice layer image, the island detection result is determined to indicate that there are islands in the 3D model; and determining the defect detection results corresponding to the 3D model based on the inverted cup rim detection results, large cross-section detection results, cross-sectional abrupt change detection results, and island detection results.
[0015] According to another aspect of the present invention, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored program, wherein, when the program is running, the device where the non-volatile storage medium is located is controlled to execute any of the above-described methods for detecting defects in a three-dimensional model.
[0016] According to another aspect of the present invention, a method for processing a three-dimensional model is also provided, wherein the method for detecting defects in a three-dimensional model is applied using any of the above-mentioned methods, and the three-dimensional model is processed based on the detected defects; the processing includes: drilling holes in the three-dimensional model based on the detected inverted cup rim result to obtain a target three-dimensional model; and adjusting the placement of the three-dimensional model based on the large cross-section detection result and the cross-section abrupt change detection result to obtain the target three-dimensional model.
[0017] According to another aspect of the present invention, a method for manufacturing a three-dimensional object is also provided, comprising: obtaining a target three-dimensional model according to the above-described method for processing a three-dimensional model; slicing the target three-dimensional model to obtain multiple slice images of the target three-dimensional model; and performing three-dimensional printing based on the multiple slice images to obtain a three-dimensional object.
[0018] In this embodiment of the invention, a method for detecting defects in a 3D model is employed. This involves acquiring the 3D model; performing GPU slicing on the 3D model to obtain multiple slice layer images; using a voxel diffusion algorithm to detect the rim of an inverted cup based on these multiple slice layer images, and determining the rim detection result; or determining the large cross-section detection result based on the number of pixels of a preset color in the multiple slice layer images; or determining the cross-sectional abrupt change detection result based on the difference image between adjacent slice layer images, where the difference image represents the shape difference in adjacent slice layer images; and determining the corresponding defect detection result for the 3D model based on the rim detection result, the large cross-section detection result, and the cross-sectional abrupt change detection result. This achieves the goal of performing different defect detections on the slice images, thereby improving the speed and efficiency of model defect detection and solving the current technical problems of limited detection speed and low efficiency in defect detection. Attached Figure Description
[0019] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0020] Figure 1 A hardware block diagram of a computer terminal for implementing a method for detecting defects in a 3D model is shown.
[0021] Figure 2 This is a flowchart illustrating a method for detecting defects in a three-dimensional model according to an embodiment of the present invention.
[0022] Figure 3 This is a schematic diagram of GPU slicing provided according to an optional embodiment of the present invention;
[0023] Figure 4 This is a GPU slicing flowchart provided according to an optional embodiment of the present invention;
[0024] Figures 5A-5F This is a schematic diagram of cup inversion detection provided by an optional embodiment of the present invention;
[0025] Figure 6 This is a schematic diagram of the large cross-section and cross-section abrupt change detection process provided by an optional embodiment of the present invention;
[0026] Figure 7 This is a schematic diagram of negative z-axis drilling provided by an optional embodiment of the present invention;
[0027] Figure 8 This is a schematic diagram of an automatic punching process provided by an optional embodiment of the present invention;
[0028] Figure 9 This is a schematic diagram of the lowest point of the cup opening provided by an optional embodiment of the present invention;
[0029] Figure 10 This is a schematic diagram of ray emission from a hole with minimum wall thickness provided by an optional embodiment of the present invention;
[0030] Figure 11 This is a schematic diagram of the intersection point in the minimum wall thickness drilling according to an optional embodiment of the present invention;
[0031] Figure 12 This is a schematic diagram of drilling with minimum wall thickness provided by an optional embodiment of the present invention;
[0032] Figure 13 This is a flowchart of the cup-pouring process provided by an optional embodiment of the present invention;
[0033] Figure 14 These are diagrams illustrating various drilling scenarios provided by optional embodiments of the present invention;
[0034] Figure 15 This is a schematic diagram of drilling in a model with concavity provided according to an optional embodiment of the present invention;
[0035] Figure 16 This is a schematic diagram of drilling a frustum template according to an optional embodiment of the present invention;
[0036] Figure 17 This is a schematic diagram of the drilling optimization process provided by an optional embodiment of the present invention;
[0037] Figure 18 This is a flowchart of an automatic placement algorithm for large cross-sections / cross-section mutations provided by an optional embodiment of the present invention;
[0038] Figure 19 This is a structural block diagram of a model defect detection device provided according to an embodiment of the present invention;
[0039] Figure 20 This is a flowchart illustrating a method for processing a three-dimensional model according to an embodiment of the present invention;
[0040] Figure 21 This is a flowchart illustrating a method for manufacturing a three-dimensional object according to an embodiment of the present invention. Detailed Implementation
[0041] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0042] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0043] First, some nouns or terms that appear in the description of the embodiments of this application shall be interpreted as follows:
[0044] In the field of 3D printing, especially in technologies such as stereolithography (SLA), digital light processing (DLP), and liquid crystal displays (LCDs) that use dynamic masks to selectively transmit ultraviolet light for liquid resin curing, the term "inverted cup opening" refers to a special geometric structure inside a 3D model. This structure resembles an inverted cup, with its opening facing inwards rather than outwards, causing liquid resin to flow into but not freely out of this area during printing.
[0045] According to an embodiment of the present invention, a method for detecting defects in a three-dimensional model is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0046] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal for implementing a method for detecting defects in a 3D model is shown. Figure 1As shown, the computer terminal 10 may include one or more processors (shown as 102a, 102b, ..., 102n in the figure) (the processor may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0047] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be implemented wholly or partially as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be wholly or partially integrated into any other element in the computer terminal 10. As involved in the embodiments of this application, the data processing circuits serve as processor control (e.g., selection of a variable resistor termination path connected to an interface).
[0048] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the method for detecting defects in a 3D model in this embodiment of the invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the method for detecting defects in a 3D model as described above. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0049] The display may be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10.
[0050] Figure 2 This is a flowchart illustrating a method for detecting defects in a three-dimensional model according to an embodiment of the present invention, as shown below. Figure 2 As shown, the method includes the following steps:
[0051] Step S202: Obtain the 3D model.
[0052] In this step, the obtained 3D model is the model to be 3D printed. Because the model may have defects such as inverted cup mouth, large cross section, and abrupt cross section changes, it is necessary to perform printability testing before printing in order to eliminate defects and improve the quality of 3D printing.
[0053] Step S204: Perform GPU slicing on the 3D model to obtain multiple slice layer images.
[0054] In this step, the 3D model is sliced, resulting in multiple slice images. Slicing can be performed using a GPU. GPUs have parallel computing capabilities, enabling them to process large amounts of data simultaneously, making the slicing process much faster than on a CPU. Furthermore, for high-polygon models, GPU slicing significantly improves slicing speed and reduces preprocessing time. GPUs also support high-resolution image generation, meaning they can generate more detailed slice images. This is crucial for detecting subtle defects in the model (such as small islands or tiny rims), contributing to improved printing quality and success rate. Moreover, slicing on a CPU may encounter the problem of illegal polygons, where polygon edges may intersect or form irregular shapes, interfering with subsequent processing (such as Boolean operations). GPU slicing transforms this problem into image processing, bypassing the illegal polygon challenge and providing simpler and more reliable slicing results.
[0055] Figure 3 This is a GPU slicing schematic diagram provided according to an optional embodiment of the present invention, such as... Figure 3 As shown, the entire model is rendered on the GPU each time. Orthographic projection can be used during rendering. Slicing is mainly done in the fragment shader, and blending needs to be enabled, depth testing disabled, and cull mode set to none (both front and back sides are rendered, counterclockwise is the front side, and clockwise is the back side). Looking at the model from the top down, a cutoff value is set on the z-axis (which is the slice position). If fragment.z is less than the cutoff value, the fragment is discarded; otherwise, for each pixel, the number of front and back sides rendered to that pixel is recorded. Finally, for each pixel, if the number of front fragments is greater than or equal to the number of back fragments, it is a point outside the model and is set to black; otherwise, it is set to white.
[0056] Assuming that points inside the model are white and points outside the model are black in the obtained slice image, the color settings are used for subsequent analysis of large sections and abrupt changes in sections.
[0057] Analyze pixel 1 to obtain the slice color at the position of slice 1: when the entire model is rendered, among the final rendering result, there are three fragments that contribute to the position of pixel 1, namely p1, p2 and p3. In the fragment shader, if fragment.z < cutoff, this fragment will be discarded. Since the fragment.z of p2 and p3 are both less than cutoff 1, they are discarded, leaving only fragment p1 contributing to the final result, and fragment p1 belongs to the back face, so this pixel is finally white. Analyze pixel 1 to obtain the slice color at the position of slice 2: the entire model is also rendered, and there are three points p1, p2 and p3 that may contribute to pixel 1. Since p3.z < cutoff2, p3 is discarded. When viewed from the position of pixel 1, p1 is on the back face and p2 is on the front face, the number of front faces is equal to the number of back faces, so this point is determined to be outside the model and thus set to black.
[0058] In some embodiments, a 3D model file (usually in .STL or .OBJ format) can be first loaded into slicing software or a system, then slicing parameters are set, including layer thickness (slicing interval), resolution, printing platform size, etc. These parameters will directly affect the precision and quality of the final sliced image. Configure the GPU environment and set the position of the slicing plane (that is, a specific height on the Z axis). Figure 4 is a GPU slicing flowchart provided according to an optional embodiment of the present invention, as Figure 4 shown, GPU slicing performs layered rendering on the model, and orthographic projection is used during rendering. Each layer of rendering generates a 2D image, which displays the contour information of the model at the height of this layer. Points inside the model are represented as white, and points outside the model are represented as black. Difference images of upper and lower slices can also be obtained by rendering to facilitate subsequent section mutation detection. The GPU stores the rendering results in an image queue, and defects can be detected by taking images out of the image queue. For example, three threads can be set to detect inverted openings, large sections and section mutations, and isolated islands respectively.
[0059] Through the above steps, the target 3D model can be sliced efficiently, and a series of sliced images that accurately reflect the model structure can be obtained, so as to analyze and optimize the printability of the model, ensuring the smooth progress of the printing process and the quality of the printed finished product.
[0060] Step S206, based on a plurality of sliced layer images, a voxel diffusion algorithm is used for inverted opening detection, and an inverted opening detection result is determined.
[0061] In this step, based on multiple slice layer images, the voxel diffusion algorithm is used to detect the rim of the cup. Each slice layer image can be converted into a two-dimensional array, with each pixel representing a voxel. Figures 5A-5F This is a schematic diagram of cup inversion detection provided by an optional embodiment of the present invention, such as... Figure 5A As shown, the 3D model 510 has an inverted cup opening 520 inside, and the 3D model 510 is connected to the base plate 550 via a support 540. GPU slicing of the 3D model 510 yields a set of sliced layer image files, such as sliced layer images 531 and 532.
[0062] Voxel diffusion algorithm is used for cup inversion detection, such as Figure 5B As shown, for the slice layer image 531, the target pixels in the outer region of the cross section (slice pattern) of the 3D model 510 are marked as 0 (first state), and the target pixels in the inner region A of the cross section (slice pattern) of the 3D model 510 are marked as 1 (second state). Figure 5C As shown, when slice layer image 531 is the first slice layer image of 3D model 510 (i.e., the first layer used to solidify 3D model 510), the target pixels in the outer region of the cross section (slice pattern) of 3D model 510 are marked as 2 (that is, the target pixels in the first state are changed to the third state). For the next slice layer image 532, as... Figure 5D As shown, similarly, the target pixels in the outer region of the cross-section (slice pattern) of the 3D model 510 are marked as 0, and the target pixels in the inner region B of the cross-section (slice pattern) of the 3D model 510 are marked as 1. Next, voxel diffusion detection of the inverted cup rim is performed, as shown... Figure 5E As shown, when the target pixel corresponding to the coordinates in the previous slice layer image 531 is in the third state (i.e., the pixel marked as 2 in slice layer image 531), the target pixel in slice layer image 532 is changed to the third state (i.e., marked as 2). Figure 5F As shown, when the target pixel corresponding to the coordinates in the previous slice layer image 531 is not in the third state (i.e., the pixel marked as 1 in slice layer image 531), and there is a target pixel in slice layer image 532 that is adjacent to it in the third state (marked as 2), the target pixel in slice layer image 532 is changed from the first state (marked as 0) to the third state (marked as 2), and the area in slice layer image 532 that has not been changed in the first state (point marked as 0) is determined as the inverted cup mouth area.
[0063] Similarly, for the next layer of slice image 532, when the target pixel corresponding to the coordinates in the previous slice image 532 is not in the third state (i.e., the pixel marked as 1 in slice image 532), and the next slice image has a target pixel in the third state (marked as 2) that is adjacent to it, the target pixel in the next slice image is changed from the first state (marked as 0) to the third state (marked as 2), and the area in the next slice image that has not been changed in the first state (point marked as 0) is determined as the inverted cup rim area.
[0064] In this way, all slice images are traversed to complete the detection and labeling of the inverted cup rim.
[0065] In some embodiments, multiple slice images of the 3D model are first labeled to determine a first state and / or a second state. For example, target pixels in slice images 531 and 532 are simultaneously determined, referring to... Figure 5B and 5D .
[0066] In some embodiments, on the bottommost slice layer image, all voxels marked as 0 (external points) are remarked as 2, while all voxels marked as 1 (internal points) are retained. Starting from the bottom, all slice images are traversed layer by layer until the top of the model. For each voxel in the current layer, the voxel directly below it (i.e., the voxel in the previous layer at the same x,y coordinates) is checked. If the voxel directly below it has a value of 2, the current voxel is also marked as 2, indicating that the diffusion condition is met. In the same layer, if any neighboring voxels (front, back, left, right) of the current voxel have a value of 2, the current voxel is also marked as 2 to expand the known external region of the model. Through the above steps, connected regions consisting of voxels with a value of 2 are constructed, these regions being outside the model. Regions of voxels not marked as 2, i.e., closed regions inside the model, are identified; these regions are identified as the inverted cup rim. In the finally marked slice image, white regions still marked as 1 (inside the model) but completely surrounded by the external region of the model (marked as 2) are examined. It is also possible to calculate the number of voxels (or area) of each suspected inverted cup rim area to determine its volume.
[0067] Using a voxel diffusion algorithm for cup rim detection can effectively handle complex 3D models, avoiding the illegal polygon problem that may occur in traditional polygon analysis. Furthermore, this algorithm boasts high computational efficiency, significantly improving the speed and accuracy of 3D printing preprocessing. This method is particularly suitable for liquid resin curing technologies such as solid-state laser technology (SLA) and digital light processing (DLP), significantly reducing the risk of printing failures and improving model printing success and quality.
[0068] Step S208: Determine the large cross-section detection result based on the number of pixels of preset colors in multiple slice layer images.
[0069] In this step, the number of pixels of a preset color (usually representing the interior of the model) in each slice layer image can be counted. This step can be accomplished using image processing library functions, such as OpenCV's pixel counting function. The number of pixels inside each slice layer image is stored in a list or array for later analysis. A threshold can be set to determine whether a slice is a large section. This threshold can be determined based on factors such as the characteristics of the 3D model, the size of the printing platform, and the flow characteristics of the resin. The pixel count of each slice is iterated through, and each value is compared with the preset threshold. If the number of pixels inside any slice exceeds the threshold, then this slice is marked as a large section. The positions (i.e., Z-axis heights) of all slices marked as large sections, as well as the number of pixels inside these slices, are recorded as a basis for subsequent processing.
[0070] By following the steps above, based on the number of pixels of a preset color in the GPU slice image, large cross-section problems can be effectively detected and processed, thereby avoiding risks such as model falling or deformation that may occur during 3D printing, and ensuring the stability of printing and the quality of printed parts.
[0071] Step S210: Based on the difference image between adjacent slice layer images in multiple slice layer images, determine the cross-sectional abrupt change detection result, wherein the difference image characterizes the shape difference in adjacent slice layer images.
[0072] In this step, the detection results of cross-sectional abrupt changes are determined based on the difference image between adjacent slice images in multiple slice layer images. This can identify sudden changes in the shape of the model between different layers, which is crucial for optimizing the 3D printing process. Any two consecutive slice images can be selected, and the difference image between them can be calculated using image processing techniques, such as pixel-by-pixel subtraction or other contrast algorithms. The difference image will highlight the shape changes between the two layers, i.e., which regions are added, disappeared, or have changed shape between the upper and lower layers. Image processing algorithms (such as the edge detection algorithm Canny, etc.) can be used to extract the contours of the changed regions from the difference image. The area of the region enclosed by each contour is measured. Large area changes usually indicate significant cross-sectional abrupt changes. Based on practical experience, an area threshold for cross-sectional abrupt changes can be set to determine whether a change is considered an abrupt change. The area of each region calculated above is compared with the set area threshold. If the area of any region is greater than the threshold, then this is considered a cross-sectional abrupt change. The slice image with the cross-sectional abrupt change and its corresponding model layer height are recorded.
[0073] By utilizing the efficient slice images and their difference images generated by the GPU through the above steps, abrupt changes in cross-sections within the 3D model can be accurately identified. This is crucial for preventing potential failures or quality issues during the printing process. This method is particularly suitable for preparing 3D models with complex geometries or non-uniform cross-sections for printing.
[0074] It should be noted that the detection processes for the above three types of defects can be carried out simultaneously, which greatly shortens the defect detection time and improves detection efficiency.
[0075] Step S212: Based on the inverted cup rim detection results, large cross-section detection results, and cross-section abrupt change detection results, determine the defect detection results corresponding to the three-dimensional model.
[0076] In this step, the results of the inverted cup rim detection, large cross-section detection, and cross-sectional abrupt change detection are comprehensively analyzed to determine the defect detection results of the target model. This is a crucial step to ensure the smooth progress of the 3D printing process. The location, shape, and volume of all detected inverted cup rim areas are collected. The locations of all large cross-sections are recorded, i.e., slice layers where the number of internal pixels exceeds a preset threshold. All slice layers with sudden increases in cross-sectional area or drastic shape changes are marked, including the location and degree of change. Then, it is checked whether inverted cup rims, large cross-sections, and cross-sectional abrupt changes occur in the same region or adjacent layers of the model. It is also possible to assess how different defects affect each other; for example, large cross-sections may exacerbate the effect of cross-sectional abrupt changes, while inverted cup rims may require additional holes at large cross-sections or cross-sectional abrupt changes. For each type of detected defect, its severity is assessed based on its location, size, and potential impact on the printing process. Finally, all detected defect information is summarized into a report, including the specific defect type, location, size, and its potential impact on the printing process. Based on the test results, possible optimization solutions can be proposed, such as solving the problem of the cup tipping by drilling holes, adjusting the placement angle to optimize large cross-sections and abrupt changes in cross-section, or adding support structures in necessary areas.
[0077] These steps ensure that the target model has been thoroughly inspected before 3D printing, eliminating or minimizing defects that could affect print quality and stability. This not only increases the success rate of printing but also reduces material waste and printing time.
[0078] Through the above steps, the goal of performing different defect detections on sliced images can be achieved, thereby improving the speed and efficiency of model defect detection and solving the current technical problems of limited defect detection, slow detection speed, and low efficiency.
[0079] As an optional embodiment, based on multiple slice layer images, a voxel diffusion algorithm is used to detect the inverted cup rim and determine the detection result. This includes: for each slice layer image, marking target pixels outside the slice pattern as a first state and marking basic pixels within the slice pattern as a second state; for the first slice layer image among the multiple slice layer images, changing the target pixels in the first state to a third state, where the first slice layer image is used to solidify the first layer of the 3D model; for any slice layer image among the multiple slice layer images, for each target pixel: if the target pixel corresponding to the coordinates in the previous slice layer image is in the third state, changing the target pixel in any slice layer image to the third state; if the target pixel corresponding to the coordinates in the previous slice layer image is not in the third state, but any slice layer image has an adjacent target pixel in the third state, changing the target pixel in any slice layer image to the third state. For detailed detection methods, please refer to the aforementioned... Figures 5A-5F The explanation will not be repeated here.
[0080] In some embodiments, pixels in each slice image that are in contact with the outside world can be marked as a first state (e.g., value 0, representing the outside of the model), and pixels inside the model can be marked as a second state (e.g., value 1). Then, all pixels in the bottom slice image marked as first state (i.e., outside of the model) are updated to a third state (e.g., value 2). This step prepares the starting point for the diffusion algorithm. The algorithm iterates upwards layer by layer from the bottom slice image until the top of the model. The following logic is executed for the pixels in each layer image:
[0081] For each pixel marked as being in the first state (outside the model), check the state of the pixel directly below it (inside the model). If the pixel directly below it is in the third state (i.e., it has been confirmed as an external point), the current pixel is also updated to the third state, indicating that this point also belongs to the outside of the model or has been confirmed as being in contact with the outside through diffusion.
[0082] Within the same layer, if any of the current pixel's neighboring points (front, back, left, right) are in the third state, the current pixel's state is also updated to the third state to ensure that all areas in contact with the outside are correctly marked.
[0083] The diffusion algorithm terminates after traversing the top-level slice image and updating all diffusing states. It then iterates through all slice images, searching for pixels still marked as second state (value 1). These pixels represent areas within the model that are not in contact with the outside world through diffusion. For all pixels marked as second state, connected regions are constructed, i.e., closed regions formed by pixels not in contact with the outside world are identified through neighborhood relationships. All constructed connected regions that are completely surrounded by pixels marked as third state (value 2) and have no direct path to the outside world are identified as inverted cup rim regions. The location information of each detected inverted cup rim is output, typically including its specific coordinates and volume within the model. Based on the detection results, solutions can be proposed, such as drilling holes at the lowest point of the inverted cup rim or the thinnest part of the wall, to ensure smooth drainage of liquid resin during printing.
[0084] Through the steps described above, the voxel diffusion algorithm can effectively detect inverted cup structures in 3D models, which is crucial for avoiding defects during the 3D printing process and ensuring printing success. This method is particularly suitable for liquid resin curing technologies such as solid-state laser (SLA), digital light processing (DLP), and liquid crystal displays (LCDs) using dynamic masks to selectively transmit ultraviolet light, because these technologies are especially sensitive to the internal enclosed spaces of the model, and inverted cup structures can lead to resin residue problems.
[0085] As an optional embodiment, targeting any one of the multiple slice layer images includes: sequentially targeting the slice layer images of the multiple slice layer images according to the order of curing.
[0086] In some embodiments, the sliced layer images can be analyzed starting from the bottom first layer, following the order of curing (i.e., from bottom to top or from top to bottom, depending on the print settings).
[0087] By analyzing and processing slice images layer by layer according to the order of solidification, printing operators or automated software can more systematically and meticulously inspect every part of the model, promptly identify and resolve potential printing problems, and greatly improve the success rate of 3D printing and the final quality of the model.
[0088] As an optional embodiment, the large cross-section detection result is determined based on the number of pixels of a preset color in multiple slice layer images, including: counting the number of pixels of a preset color in multiple slice layer images; traversing multiple slices, determining the slice layer image with the number of pixels of the preset color exceeding a preset threshold as the large cross-section, until the traversal is completed, and obtaining the large cross-section detection result.
[0089] In some embodiments, regions inside the model in multiple slice images can be marked with a specific preset color (e.g., white), while the exterior of the model is marked with another color (e.g., black) for easier differentiation in subsequent processing. For each slice image layer, image processing techniques, such as OpenCV or other similar libraries, are used to count the number of pixels of the preset color (representing the interior of the model). The statistical results are stored for subsequent analysis and comparison. A preset number threshold can be set based on the specific requirements and experience of 3D printing. This threshold is used to determine whether a slice constitutes a large cross-section. The threshold setting should consider factors such as the size of the model, material properties, and the load-bearing capacity of the printing platform. Starting from the bottom layer, all slice images are traversed layer by layer. For each layer, the statistical number of pixels of the preset color in that layer is compared with the preset number threshold. If the counted number of pixels exceeds the threshold, the slice image is marked as a large cross-section. The slice layer number and the corresponding number of pixels for all large cross-sections are recorded as part of the detection results. After traversing all slice images, the detection results of large cross-sections are output, including the location of the large cross-section (i.e., the slice layer number), the number of pixels of the preset color, and possible processing suggestions. This information is crucial for adjusting subsequent printing parameters, optimizing model posture, and adding support structures.
[0090] The test results can be fed back to the user or system for adjusting the model's orientation, adding support structures, or modifying printing parameters such as layer thickness. Multiple iterations can be performed, with adjustments made and the test repeated until all slices meet the printing requirements.
[0091] By following the steps above, large cross-sections in the 3D model can be accurately identified, and optimization schemes can be proposed based on this to ensure the smooth progress of the printing process and avoid problems such as printing failure or model damage caused by excessively large model cross-sections.
[0092] As an optional embodiment, the cross-sectional abrupt change detection result is determined based on the difference image between adjacent slice layer images in multiple slice layer images, including: traversing multiple slice layer images, calculating the difference image between the current slice layer image and the next slice layer image to obtain multiple difference images; performing contour analysis on the multiple difference images to determine the contour area corresponding to each of the multiple difference images; and determining the existence of a cross-sectional abrupt change when there is a difference image in the multiple difference images whose contour area exceeds a preset area change threshold.
[0093] In some embodiments, the cross-sectional abrupt change detection result is determined based on the difference image between adjacent slice images in multiple slice graphics. This involves image processing and contour analysis techniques, and can be applied to any two adjacent slice images. n and Image n+1 Calculate the difference image between them. The difference image reflects the image...n+1 Relative to Image n Changes in shape and size. For each difference image, an edge detection algorithm (such as Canny edge detection, Sobel operator, etc.) is applied to extract the contours of the changed regions in the image. The area of each extracted contour is calculated. This can be achieved using contour analysis functions in image processing libraries such as OpenCV. Based on the specific requirements and experience of 3D printing, an area change threshold is set. This threshold is used to determine whether the change in contour area is sufficient to constitute a cross-sectional abrupt change. Starting from the bottom layer, all generated difference images are traversed. For each difference image, its contour area is compared with the preset area change threshold. If the contour area of any difference image exceeds the threshold, this layer is marked as having a cross-sectional abrupt change with the next layer. Detailed information on the changes between all layers marked as cross-sectional abrupt changes is recorded, including the slice layer number, contour area, etc. The detection results of cross-sectional abrupt changes are output, including the number of each pair of adjacent layers with abrupt changes, the contour area, and possible processing suggestions. The detection results are fed back to the user or system, and necessary model adjustments are made based on the feedback, such as changing the placement angle, adding supports, or modifying printing parameters. If the model is adjusted, repeat the above process of slicing, difference image generation and mutation detection until the cross-sectional changes between all slices are within an acceptable range.
[0094] Figure 6 This is a schematic diagram of the large cross-section and cross-section abrupt change detection process provided by an optional embodiment of the present invention, as shown below. Figure 6 As shown, slice images and difference images can be retrieved from the queue. The slice images are analyzed to determine if the total area exceeds a threshold for oversized solid bodies. If it does, contours are extracted from the slice images to obtain information about the oversized solid bodies, i.e., large cross-sections. The difference images are analyzed to determine if the total area of the differences exceeds a threshold for the area of abrupt changes in the cross-section. If it does, contours are extracted from both the slice and difference images, and the two sets of contours are analyzed to obtain information about abrupt changes in the cross-section.
[0095] By following the steps above, we can effectively detect large cross-sections and abrupt changes in cross-sections that may be encountered during the printing process of 3D models, allowing for timely optimization to ensure print quality and reduce the failure rate. This method is particularly suitable for 3D printing applications that require high precision and smooth layer transitions.
[0096] As an optional embodiment, if the cup opening detection result indicates the presence of a cup opening, the drilling position and drilling direction corresponding to the cup opening are determined; based on the drilling position and drilling direction, a hole is generated on the three-dimensional model according to Boolean operations.
[0097] In some embodiments, if the detection result of an inverted cup rim indicates the presence of an inverted cup rim, it can be optimized. This can be achieved by adjusting the model's pose to reduce the volume of the inverted rim or completely eliminate it. For example, a matrix array can be prepared, with each matrix representing a pose. The inverted cup rim information for each pose can be calculated. If the inverted cup rim disappears in any pose, the process is stopped; if no pose has an inverted cup rim that disappears, the pose with the smallest total inverted cup rim volume is selected, and then a hole-punching method is used to optimize it out. However, this method is relatively time-consuming.
[0098] Resin can also be drained from the model by drilling holes. Based on the results of the inverted cup rim detection algorithm, the specific location and volume of the closed cavity in the model can be determined. Analyzing the wall thickness distribution in the inverted cup rim region identifies the thinnest or near-thinnest wall location as potential drilling sites. Selecting the lowest point of the inverted cup rim or the thinnest wall location as the drilling site ensures that the hole can smoothly drain the internal resin while minimizing the impact on the model's structural strength. Figure 7 This is a schematic diagram of negative z-axis drilling provided by an optional embodiment of the present invention, as shown below. Figure 7 As shown. If the wall thickness distribution is uniform, the negative Z-axis can be chosen as the drilling direction, which is also the most intuitive and common direction. If the model structure is complex and the wall thickness distribution is uneven, the direction from the drilling position to the thinnest area should be chosen. This can be determined by emitting a ray at that position and calculating the distance between the ray and the intersection point of the model. Based on the selected drilling position and direction, create a hole model (such as a cylinder or frustum). Ensure that the bottom of the hole model is precisely aligned with the selected drilling position, and that the orientation of the model is consistent with the determined drilling direction. You can use the Boolean operation function in the 3D model processing library to perform the difference operation between the target model and the hole model. This step essentially "cuts out" the volume corresponding to the hole model from the target model, thereby generating a hole on the target model. After generating the hole on the target model, re-execute the inverted cup detection algorithm to confirm whether the generated hole effectively solves the inverted cup problem. You can also check whether the position and orientation of the hole meet expectations and whether the appearance of the model is affected through a 3D model viewer. For cases with multiple inverted cups, it may be necessary to repeat the above steps multiple times to solve all inverted cup problems one by one. This method significantly reduces the time required to optimize the cup opening and improves optimization efficiency.
[0099] It should be noted that if the hole is too small, it may not be able to effectively drain the resin, while if it is too large, it may affect the model structure. Therefore, the size of the hole needs to be adjusted according to the actual test results.
[0100] By following the steps described above, the drilling position and direction of the inverted cup rim can be precisely determined, and holes can be generated on the target model, effectively solving problems that may be encountered in 3D printing, such as resin not being able to escape and model deformation. This method helps improve the printing success rate and model quality.
[0101] As an optional embodiment, determining the drilling position and direction corresponding to the inverted cup opening includes: if the inverted cup opening detection result indicates the existence of an inverted cup opening, determining the lowest point of the inverted cup opening; emitting rays from the lowest point of the inverted cup opening in multiple directions; identifying the ray that passes through the interior of the three-dimensional model and intersects with the outer surface of the three-dimensional model as the target ray; measuring the path length of the target ray passing through the interior of the three-dimensional model; and determining the direction corresponding to the ray with the shortest path length as the drilling direction.
[0102] In some embodiments, all inverted cup rim areas in the model can be located based on the results of the inverted cup rim detection algorithm. For each detected inverted cup rim, its lowest point in the Z-axis direction is found. This point will be the starting position for drilling. Rays are emitted in multiple directions from the lowest point of the inverted cup rim. These directions can cover a complete sphere to ensure that all possible drilling directions can be scanned. The ray directions should cover 360 degrees of horizontal and vertical planes to ensure that all paths from the lowest point to the model surface can be checked. For each ray, it is checked whether it passes through the interior of the target model until it intersects the outer surface of the model. Those rays that intersect the outer surface of the model are retained, i.e., target rays. These rays are potential drilling paths. For each target ray, starting from the lowest point of the inverted cup rim, the ray is traced until it intersects the outer surface of the model. The path length of the ray passing through the interior of the model is recorded, which will be used to determine the optimal drilling direction later. The path lengths of all target rays passing through the interior of the model are compared, and the shortest ray is found. The direction corresponding to this target ray with the shortest path length is determined as the drilling direction. The shortest path was chosen to minimize damage to the model while ensuring resin could drain from the inverted cup opening. The final drilling point was confirmed to be the lowest point of the inverted cup opening, with the drilling direction aligned with the ray direction of the shortest path. Based on the determined drilling point and direction, Boolean operations were performed to generate holes in the model. The size and shape of the holes should be adjusted according to actual needs and model characteristics to ensure effective problem-solving without compromising the overall aesthetics and structural integrity of the model.
[0103] Figure 8 This is a schematic diagram of an automatic punching process provided by an optional embodiment of the present invention, such as... Figure 8 The diagram illustrates the specific process of automatic punching. When an inverted cup rim is detected, the lowest point of all inverted cup rims on the model can be obtained through printability detection. Figure 9This is a schematic diagram of the lowest point of the inverted cup rim provided by an optional embodiment of the present invention, as shown below. Figure 9 Find the lowest point in the model. Then, emit a ray from the lowest point of the inverted cup's rim and find its intersection with the model. Figure 10 This is a schematic diagram of emitting rays in a hole with minimum wall thickness provided by an optional embodiment of the present invention, as shown below. Figure 10 As shown, rays can be emitted from the lowest point of the inverted cup opening in different directions, and the search range is a conical region at an angle θ to the negative Z-axis. Figure 11 This is a schematic diagram of the intersection points in minimum wall thickness drilling according to an optional embodiment of the present invention, such as... Figure 11 As shown, to ensure that the hole can reach the outer surface, the midpoint between the nth intersection point and the (n+1)th intersection point of the model is calculated, and it is determined whether the point is inside the model: if the point is inside the model, it means that the nth intersection point is inside the model cavity and has not penetrated to the outer surface of the model; otherwise, it is treated as a point on the outer surface, and distance screening is performed. If the distance is the minimum, this point is taken as the drilling point with the minimum wall thickness. Figure 12 This is a schematic diagram of drilling with minimum wall thickness provided by an optional embodiment of the present invention, such as... Figure 12 As shown, after determining the drilling direction and drilling point corresponding to the minimum distance and then drilling, you can obtain... Figure 12 The hole shown.
[0104] Figure 13 This is a flowchart of the cup-pouring process provided by an optional embodiment of the present invention; such as Figure 13 As shown, when using relevant software to create holes, you can upload relevant parameters, set and adjust the hole-making template. In the 3D printing field, the hole-making template refers to a preset three-dimensional geometric shape, a design element used to create precise holes in a 3D model. This template is usually a simple geometric shape, such as a cylinder, cone, prism, or other object that can define the shape and size of the hole. When creating holes using a hole-making template, factors such as the direction, size, and depth of the hole are usually considered to meet specific functional requirements or aesthetic standards. Therefore, the hole-making template can be dynamically adjusted to adapt to the needs of different models, achieving more precise hole positioning and size control. For example, when dealing with the problem of an inverted cup rim, the hole-making template may need to be precisely adjusted in the Z-axis direction to ensure that the hole can penetrate the enclosed space of the model without affecting the overall structural strength and appearance.
[0105] After adjusting the punch template, you can control the model to move to the corresponding position. Once the option to guarantee penetration is configured, you can check if the punch template passes through the paired surfaces. A paired surface refers to two surfaces with opposite normal directions. After the punch template passes through the paired surfaces, you can call `uf_boolean` to perform a Boolean subtraction operation to punch a hole. If it doesn't pass through, extend the punching direction to check if it can still intersect with the main model. If it can, extend the punching depth to the next intersection position and check again if the punching end passes through the paired surfaces. This continues until penetration is achieved. Figure 14 These are various drilling scenarios provided by optional embodiments of the present invention, such as... Figure 14 As shown, this illustrates several scenarios where the drilling depth needs to be increased under the guaranteed penetration mode, and several scenarios where the drilling depth does not need to be increased under the guaranteed penetration mode. The four images in A represent the scenarios where the drilling depth needs to be increased under the guaranteed penetration mode, while the four images in B represent the scenarios where the drilling depth does not need to be increased under the guaranteed penetration mode. Figure 15 This is a schematic diagram of drilling in a model with concavity provided according to an optional embodiment of the present invention, such as... Figure 15 As shown, the current hole shape is determined by the template file provided by the process. All templates have a bounding box of 1*1*1 size. The front end constructs a scaling matrix to adapt to the user-defined hole depth and diameter, which is then passed to the algorithm. Based on this, since the model surface may have concavities, such as... Figure 15 As shown, where, Figure 15 The circled area in the left-hand image clearly shows that the hole wasn't punched through, so the punch template needs to be extended outwards. Figure 15 The image on the right. Figure 16 This is a schematic diagram of drilling a frustum template according to an optional embodiment of the present invention, such as... Figure 16 As shown, this approach works perfectly for prism-type templates (the cylindrical template is actually an approximation of a 72 prism). However, for frustums, the aperture at the intersection of the template and the model will be smaller than the set value. Directly enlarging the template diameter will also cause the bottom radius to not meet the process requirements (the process requires the ratio of the top to the bottom of the frustum to be fixed at 2:1, the top diameter of the frustum template = 1mm, and the bottom diameter = 0.5mm). Therefore, the algorithm needs to know the accurate distance the front end extends to the top of the template to produce the correct result. Thus, relevant parameters need to be uploaded to ensure that the hole can be punched through. Figure 16As shown, the top can be compressed along the punching axis while the bottom remains unchanged to obtain the image of (2). Then, the punching template is determined by extending outward along the edge tangent direction. The current punching algorithm requires the use of Boolean operations. The most time-consuming process of the previously used IGL Boolean operation is to perform self-intersection judgment on all the faces after merging the two models and perform remesh on the intersection position. Assuming that the two models contain M faces and N faces respectively, the complexity of handling self-intersection during Boolean operation can be recorded as O((M+N)^2). The Boolean algorithm used in this optional embodiment only needs to calculate the intersection between the two models, and the complexity can be recorded as O(MN). Therefore, when the model is very large, a fairly high efficiency improvement can be achieved.
[0106] Further optimization is possible for drilling along the minimum wall thickness direction. For example, the loop detection drilling can be optimized by calling a new interface for detecting the inverted cup rim, detecting all inverted cup rim points and drilling them each time. Before optimization, the interface needed to be called multiple times for drilling; after optimization, the interface is called only once to drill all inverted cup rim structures. The search method for the minimum wall thickness is optimized, and the issue of sudden hole blockage during frustum drilling is fixed. The drilling length is based on the distance from the inverted cup rim to the drilling point, which leads to a problem where the drilling model's plane does not completely intersect with the uneven surface of the model, causing the hole to fail to penetrate. The bottom of the drilling model can be extended until it completely intersects with the model surface. Figure 17 This is a schematic diagram of the drilling optimization process provided by an optional embodiment of the present invention, such as... Figure 17 As shown, the process involves inputting the punching point and calculating a plane perpendicular to the punching direction. Then, within a preset radius on this plane, centered on the punching point, n sampling points are searched. This radius should be predetermined based on factors such as model wall thickness and process requirements, aiming to cover the area around the hole and find the exact path from the hole's edge to the outside of the model. The process checks if each sampling point is within the model; if not, the distance is recorded as 0; otherwise, the first intersection of the sampling point with the model in the punching direction is calculated. The furthest distance from all sampling points to the model is calculated, and this furthest distance is used as the extension length to ensure the punch can penetrate the entire model, thus resolving the defect of an inverted cup rim.
[0107] Through this series of steps, the optimal drilling position and direction for the inverted cup rim can be precisely determined, thus solving 3D printing problems caused by the inverted rim while maintaining the integrity of the model structure. This ray-tracing-based method effectively avoids blindly drilling holes directly on complex models, providing a more intelligent and precise solution.
[0108] As an optional embodiment, if the large cross-section detection result indicates the existence of a large cross-section, a list of pose matrices is created, where the matrices in the list represent the rotational pose of the 3D model. Based on the matrices in the pose matrix list, the 3D model is sequentially rotated and adjusted accordingly to obtain 3D models corresponding to multiple rotation angles. The 3D models corresponding to the multiple rotation angles are then sequentially processed to determine the large cross-section detection result based on the number of pixels of preset colors in multiple slice layer images, resulting in large cross-section detection results for the 3D models corresponding to the multiple rotation angles. Based on the large cross-section detection results for the 3D models corresponding to the multiple rotation angles, the target rotation angle corresponding to the 3D model is determined.
[0109] In some embodiments, when large cross-section detection results indicate the presence of large cross-sections, the model's pose can be adjusted to reduce or eliminate them to optimize printability. For example, an array of matrices can be prepared, each representing a pose. Each pose is iterated through, large cross-section information is calculated, and the pose with the smallest large cross-section volume is selected. Similarly, this method can be used for abrupt cross-section changes. An array of matrices can be prepared, each representing a pose. Each pose is iterated through, abrupt cross-section change information is calculated, and the pose with the smallest abrupt change area is selected. Considering that large cross-sections are usually related to the model's placement angle, different rotational poses can be created around the X and Y axes (Z-axis rotation generally does not affect the cross-section size, so it can be temporarily disregarded). A reasonable angle increment (e.g., 5° or 10°) is set from -90° to 90° to generate a series of rotational poses. Each rotation angle corresponds to a pose matrix, and these matrices are organized into a list. The pose matrix represents the model's rotational state around the X and Y axes. The first matrix is taken from the pose matrix list and applied to the target model for corresponding rotational adjustments. The pose adjustment is repeated for each matrix in the pose matrix list to obtain pose views of the target model at multiple rotation angles. Each rotated model is sliced, and the number of pixels of a preset color (usually white representing the model's interior) is counted in each slice. The counted pixel count is compared with a preset large cross-section threshold to identify which slices are large cross-sections. The large cross-section detection results for each rotation angle are recorded, including the location of slices with large cross-sections and the corresponding pixel count. The large cross-section detection results for all rotation angles are summarized, and the total volume or number of large cross-sections at different rotation angles is compared. The rotation angle with the smallest total volume or the fewest number of large cross-sections is selected as the target rotation angle. If an angle can completely eliminate large cross-sections, that angle is naturally the optimal choice. Based on the determined target rotation angle, the target model undergoes final pose adjustment to optimize its 3D printing performance. Large cross-section detection can be performed again after the model is adjusted to the target rotation angle to confirm whether the problem has been effectively solved or significantly improved.
[0110] Figure 18 This is a flowchart of an automatic placement algorithm for large cross-sections / cross-section abrupt changes provided by an optional embodiment of the present invention, such as... Figure 18 As shown, the first step is to perform a printability test on the model to determine if there are large cross-section / cross-section abrupt changes. The second step, based on the printability test results, automatically positions the model with large cross-section / cross-section abrupt changes by rotating it around the X and Y axes from -90° to 90° (the Z-axis direction does not affect the cross-section projection and can be ignored). After each rotation, the model is re-tested to see if large cross-section / cross-section abrupt changes still exist, until a position is found where the large cross-section / cross-section abrupt change problem is eliminated. The rotation parameters at this point are then returned as the automatic placement position of the model.
[0111] Through the above process, the printing posture of the model can be systematically analyzed and adjusted, effectively reducing the impact of large cross sections on the 3D printing process, ensuring that the model can be printed stably, and avoiding falling and other quality problems during the printing process.
[0112] As an optional embodiment, based on the inverted cup rim detection results, large cross-section detection results, and cross-sectional abrupt change detection results, the defect detection results corresponding to the 3D model are determined, including: identifying contours in multiple slice layer images; traversing multiple slice layer images and checking whether the contour of the currently processed slice layer image is connected to the contour of the previous slice layer image, until the traversal is completed, to obtain the island detection results. Wherein, if the contour of the currently processed slice layer image is not connected to the contour of the previous slice layer image, the island detection result is determined to indicate that there are islands in the 3D model; based on the inverted cup rim detection results, large cross-section detection results, cross-sectional abrupt change detection results, and island detection results, the defect detection results corresponding to the 3D model are determined.
[0113] In some embodiments, defect identification can also include island identification. Islands refer to model parts or supporting structures within a printed slice layer that are not connected to the layer above or below. These could be small details within the model, overhanging sections, or isolated small parts on the printed layer. During 3D printing, the material of each layer must bond correctly to the layers above and below to maintain the structural stability of the entire model. If islands exist—meaning certain parts are not connected to other layers during printing—these parts may not bond correctly to the platform or other parts of the model, leading to printing failure or model damage. For overhanging or steeply tilted model parts, supporting structures are typically added to ensure these parts are correctly formed during printing. Failure to detect islands may result in these parts being overlooked, affecting print quality and success rate.
[0114] Island detection begins with examining the contours of the lowest-level slice image. Moving upwards layer by layer, for each slice image, the contour of the current layer is checked for connections to the contours identified in the previous layer. If the contour of the current layer shares at least one common point with the contour of the previous layer, or is spatially continuous without breaks, it is considered connected. After processing all slice images, it is checked whether the contours of all layers can be traced back to the first layer, forming a continuous chain. If any layer's contour cannot form a continuous connection with the contours of the previous or next layer, that layer or its corresponding portion is considered an island. The locations and related information of all detected islands are output, including the slice layer number where the island is located and detailed contour information. All results from inverted cup rim detection, large cross-section detection, abrupt cross-section detection, and island detection are collected and fed back to the user or design team for necessary model adjustments. Based on the model adjustments, the above detection process is repeated until all defects are properly addressed and the model reaches the ideal printing state.
[0115] Island detection helps users quickly identify isolated islands or unsupported overhangs in the model after slicing, reducing the risk of printing failures. This detection allows users to know the number of islands, their layer number, and to choose whether to delete them or add support structures to ensure model integrity and printing success rate, ultimately guaranteeing high-quality printing of the final model.
[0116] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.
[0117] Through the above description of the embodiments, those skilled in the art can clearly understand that the method for detecting defects in a 3D model according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0118] According to embodiments of the present invention, a model defect detection apparatus for implementing the above-described method for detecting defects in a three-dimensional model is also provided. Figure 19 This is a structural block diagram of a model defect detection device provided according to an embodiment of the present invention, such as... Figure 19 As shown, the model defect detection device includes: acquisition module 1902, slicing module 1904, inverted cup rim detection module 1906, large cross-section detection module 1908, cross-section abrupt change detection module 1910, and determination module 1912. The model defect detection device will be described below.
[0119] Module 1902 is used to acquire the target model.
[0120] The slicing module 1904, connected to the acquisition module 1902, is used to slice the target model to obtain multiple slice images.
[0121] The inverted cup rim detection module 1906 is connected to the slicing module 1904 and is used to detect the inverted cup rim based on multiple slice images using a voxel diffusion algorithm, and to determine the inverted cup rim detection result.
[0122] The large cross-section detection module 1908, connected to the inverted cup rim detection module 1906, is used to determine the large cross-section detection result based on the number of pixels of preset colors in multiple slice images.
[0123] The cross-sectional abrupt change detection module 1910, connected to the large cross-section detection module 1908, is used to determine the cross-sectional abrupt change detection result based on the difference image between adjacent slice images in multiple slice graphics, wherein the difference image represents the shape difference in adjacent slice images.
[0124] The determination module 1912, connected to the cross-sectional abrupt change detection module 1910, is used to determine the defect detection results corresponding to the target model based on the inverted cup rim detection results, large cross-section detection results, and cross-sectional abrupt change detection results.
[0125] It should be noted that the acquisition module 1902, slicing module 1904, inverted cup rim detection module 1906, large cross-section detection module 1908, cross-section abrupt change detection module 1910, and determination module 1912 mentioned above correspond to steps S202 to S212 in the embodiments. Multiple modules and their corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the above embodiments. It should also be noted that the above modules, as part of the device, can run on the computer terminal 10 provided in the embodiments.
[0126] Figure 20 This is a flowchart illustrating a method for processing three-dimensional models according to an embodiment of the present invention, as shown below. Figure 20As shown, according to an embodiment of the present invention, a method for processing a three-dimensional model is also provided, which involves detecting defects in the three-dimensional model using any of the above-described methods for detecting defects in a three-dimensional model, and processing the three-dimensional model based on the detected defects; the processing includes:
[0127] Step S2002: Based on the detected cup opening, punch holes in the 3D model to obtain the target 3D model.
[0128] Step S2004: Based on the large cross-section detection results and the cross-section abrupt change detection results, the three-dimensional model is adjusted to obtain the target three-dimensional model.
[0129] Figure 21 This is a flowchart illustrating a method for manufacturing a three-dimensional object according to an embodiment of the present invention, as shown below. Figure 21 As shown, according to another aspect of the present invention, a method for manufacturing a three-dimensional object is also provided, comprising:
[0130] Step S2102: Obtain the target three-dimensional model according to the above method for processing three-dimensional models.
[0131] Step S2104: Slice the target 3D model to obtain multiple slice images of the target 3D model.
[0132] Step S2106: Perform 3D printing based on multiple slice images to obtain a 3D object.
[0133] This invention provides a method for detecting defects in a 3D model. The method involves acquiring a 3D model; performing GPU slicing on the 3D model to obtain multiple slice layer images; using a voxel diffusion algorithm to detect the rim of an inverted cup based on these multiple slice layer images, and determining the rim detection result; or determining the large cross-section detection result based on the number of pixels of a preset color in the multiple slice layer images; or determining the cross-sectional abrupt change detection result based on the difference image between adjacent slice layer images, where the difference image represents the shape difference in adjacent slice layer images; and determining the corresponding defect detection result of the 3D model based on the rim detection result, the large cross-section detection result, and the cross-sectional abrupt change detection result. This achieves the goal of performing different defect detections on the slice images, thereby improving the speed and efficiency of model defect detection and solving the current technical problems of limited detection speed and low efficiency in defect detection.
[0134] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a non-volatile storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc.
[0135] Embodiments of the present invention also provide a non-volatile storage medium. Optionally, in this embodiment, the aforementioned non-volatile storage medium can be used to store the program code executed by the method for detecting defects in a three-dimensional model provided in the above embodiments.
[0136] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0137] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0138] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0139] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0140] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0141] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a non-volatile storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0142] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for detecting defects in a three-dimensional model, characterized in that, include: Obtain the 3D model; The 3D model is sliced using GPU to obtain multiple slice layer images; Based on the multiple sliced images, the voxel diffusion algorithm is used to detect the inverted cup rim and determine the detection result. The large cross-section detection result is determined based on the number of pixels of a preset color in the multiple slice layer images; Based on the difference image between adjacent slice layer images in the plurality of slice layer images, the cross-sectional abrupt change detection result is determined, wherein the difference image characterizes the shape difference in adjacent slice layer images; Based on the inverted cup rim detection results, the large cross-section detection results, and the cross-section abrupt change detection results, the defect detection results corresponding to the three-dimensional model are determined. The defect detection results include: the type, location, and size of each type of detected defect, as well as the possible impact of each type of detected defect on the printing process. Specifically, based on the multiple sliced images, a voxel diffusion algorithm is used to detect the inverted cup rim, and the detection result is determined, including: For each slice layer image, the target pixels outside the slice pattern are marked as the first state, and the basic pixels inside the slice pattern are marked as the second state; For the first slice layer image in multiple slice layer images, the target pixel in the first state is changed to the third state, where the first slice layer image is used to solidify the first layer of the 3D model; The process iterates through the first slice layer image to the last slice layer image, performing layer-by-layer iteration on the marked state of each pixel.
2. The method according to claim 1, characterized in that, Based on the multiple sliced images, a voxel diffusion algorithm is used to detect the rim of the inverted cup, and the detection result is determined. The method also includes: For any slice image among multiple slice image layers, for each target pixel: When the target pixel corresponding to the coordinates in the previous slice layer image is in the third state, the target pixel of any slice layer image is changed to the third state. If the target pixel corresponding to the coordinates in the previous slice layer image is not in the third state, but there is a target pixel in the third state adjacent to it in any slice layer image, then the target pixel of the any slice layer image is changed to the third state.
3. The method according to claim 2, characterized in that, The phrase "targeting any one of the multiple slice layer images" includes: sequentially targeting the slice layer images among the multiple slice layer images according to the order in which they were solidified.
4. The method according to claim 1, characterized in that, Based on the number of pixels of a preset color in the multiple sliced images, the large cross-section detection result is determined, including: Count the number of pixels of the preset color in the multiple sliced image layers; The process involves traversing the multiple slices and identifying slice layers where the number of pixels of the preset color exceeds a preset threshold as large cross sections. This process continues until the traversal ends, yielding the large cross section detection result.
5. The method according to claim 1, characterized in that, Based on the difference image between adjacent slice layer images in the plurality of slice layer images, the cross-sectional abrupt change detection result is determined, including: By traversing the multiple slice layer images, the difference image between the current slice layer image and the next slice layer image is calculated to obtain multiple difference images; Contour analysis is performed on the multiple difference images to determine the contour area corresponding to each of the multiple difference images; If, among the plurality of difference images, there is a difference image whose contour area exceeds a preset area change threshold, a cross-sectional abrupt change is determined to exist.
6. The method according to claim 1, characterized in that, Also includes: If the cup inversion detection result indicates the presence of a cup inversion, determine the drilling position and drilling direction corresponding to the cup inversion. Based on the drilling location and the drilling direction, holes are generated on the three-dimensional model according to Boolean operations.
7. The method according to claim 6, characterized in that, Determining the drilling position and direction corresponding to the inverted cup opening includes: If the cup inversion detection result indicates that a cup inversion exists, determine the lowest point of the cup inversion. Rays are emitted in multiple directions from the lowest point of the inverted cup opening; The ray that passes through the interior of the three-dimensional model and intersects with the outer surface of the three-dimensional model among multiple rays is identified as the target ray; Measure the path length of the target ray as it travels within the three-dimensional model; The direction corresponding to the ray with the shortest path length is determined as the drilling direction.
8. The method according to claim 1, characterized in that, Also includes: If the large cross-section detection result indicates the existence of a large cross-section, a list of attitude matrices is created, wherein the matrices in the list represent the rotational attitude of the 3D model. Based on the matrices in the posture matrix list, the three-dimensional model is rotated and adjusted accordingly to obtain three-dimensional models corresponding to multiple rotation angles. The large cross-section detection results are determined by sequentially processing the three-dimensional models corresponding to the multiple rotation angles based on the number of pixels of preset colors in the multiple slice layer images, so as to obtain the large cross-section detection results corresponding to the three-dimensional models corresponding to the multiple rotation angles. Based on the large-section detection results of the three-dimensional models corresponding to the multiple rotation angles, the target rotation angle corresponding to the three-dimensional model is determined.
9. The method according to any one of claims 1 to 8, characterized in that, The step of determining the defect detection results corresponding to the three-dimensional model based on the inverted cup rim detection results, the large cross-section detection results, and the cross-section abrupt change detection results includes: Identify contours in the multiple sliced layer images; The process iterates through the multiple slice images, checking whether the contour of the currently processed slice image is connected to the contour of the previous slice image, until the traversal ends, and obtains the island detection result. If the contour of the currently processed slice image is not connected to the contour of the previous slice image, the island detection result is determined to indicate that the 3D model has an island. Based on the inverted cup rim detection results, the large cross-section detection results, the cross-section abrupt change detection results, and the isolated island detection results, the defect detection results corresponding to the three-dimensional model are determined.
10. A non-volatile storage medium, characterized in that, The non-volatile storage medium includes a stored program, wherein, when the program is executed, the device containing the non-volatile storage medium is controlled to perform the method for detecting defects in a three-dimensional model as described in any one of claims 1 to 9.
11. A method for processing three-dimensional models, characterized in that, The method for detecting defects in a three-dimensional model as described in any one of claims 1-9 is used to detect defects in the three-dimensional model, and the three-dimensional model is processed based on the detected defects; the processing includes: Based on the detected cup inverted rim, the three-dimensional model is punched to obtain the target three-dimensional model; Based on the large cross-section detection results and the cross-section abrupt change detection results, the three-dimensional model is adjusted and placed to obtain the target three-dimensional model.
12. A method for manufacturing a three-dimensional object, characterized in that, include: According to the method for processing a three-dimensional model as described in claim 11, a target three-dimensional model is obtained; The target 3D model is sliced to obtain multiple slice images of the target 3D model; Based on the multiple slice images, a three-dimensional object is obtained through 3D printing.
Citation Information
Patent Citations
Detection method and device, electronic equipment and storage medium
CN116228718A
CT three-dimensional reconstruction and defect detection method and device based on incremental learning and storage medium
CN117274165A