A CAD model surface clipping method, device, equipment and medium

By establishing watertight mesh data structure and feature line slice processing in the CAD model, the problems of high computational complexity and poor adaptability of the existing surface cutting methods are solved, and efficient and accurate surface cutting is achieved, ensuring the geometric consistency and topological integrity of the cropped surface.

CN120088443BActive Publication Date: 2025-07-11CALCULATION AERODYNAMICS INST CHINA AERODYNAMICS RES & DEV CENT
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510581464.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-07
Publication Date
2025-07-11
Estimated Expiration
2045-05-07

AI Technical Summary

Technical Problem

The existing surface cutting methods have high computational complexity, poor adaptability and high operating threshold when dealing with complex surfaces, making it difficult to meet the comprehensive needs of high precision, high efficiency and user-friendliness in industrial scenarios.

Method used

By importing and repairing the initial CAD model, establishing a watertight mesh data structure, determining the discrete points of the feature lines, performing mesh correction and mapping, dividing them into multiple mesh patches, and generating a cropped watertight surface.

Benefits of technology

It realizes accurate cropping with low computational effort and high efficiency, ensuring that the cropped surface inherits the original geometric properties, avoids the computational burden of complex topological relationships, and ensures the geometric consistency and topological integrity of the crop boundary.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120088443B_ABST
    Figure CN120088443B_ABST
Patent Text Reader

Abstract

The present application discloses a CAD model surface clipping method, device, equipment and medium, which relates to the technical field of computer-aided design and includes: importing and repairing an initial CAD model, establishing a watertight grid data structure to obtain a composite surface; determining each discrete point based on the feature line information of the composite surface and the discrete size information of the discrete surface; inserting each discrete point into the discrete grid closest to the discrete point in the composite surface, performing correction processing on each discrete grid, obtaining and mapping the corrected three-dimensional grid to a two-dimensional plane, extracting and restoring two-dimensional feature line segments, inverse mapping each two-dimensional feature line segment back to the three-dimensional space to generate three-dimensional feature line segments and three-dimensional discrete grids; dividing the three-dimensional discrete grids into multiple grid patches by using the attribute information of the three-dimensional feature line segments; creating virtual edge objects based on each three-dimensional feature line segment, and generating a clipped watertight surface based on the virtual edge objects and the grid patches. It realizes accurate surface clipping with low computational complexity and high efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer-aided design, and particularly relates to a method, device, equipment and medium for trimming the surface of a CAD model. Background Art

[0002] In fields such as automobile manufacturing, aerospace, and mold manufacturing, the precise trimming of complex surfaces (such as car bodies, aircraft hulls, and injection mold cavities) is a key requirement to ensure design matching, functionality, and safety. For example, car doors need to be trimmed to fit the body to ensure airtightness; the trimming of aircraft hulls needs to meet the requirements of aerodynamics. Traditional trimming methods rely on solid operations or Boolean operations of three-dimensional modeling software (such as SolidWorks), but there are significant limitations when dealing with surfaces with high precision and complex topological structures.

[0003] Among them, for rectangular trimming, the surface is divided into rectangular regions. The operation is simple but cannot adapt to irregular curves, resulting in loss of details and insufficient accuracy. For equidistant trimming, the equidistant relationship between the trimmed surface and the original surface is maintained, but the calculation is complex, sensitive to curvature changes, and prone to errors. For manifold parameterization trimming, complex topological surfaces (such as multi-hole and self-intersecting surfaces) are processed through parameterization, but the parameterization process is cumbersome, requires professional knowledge, and is inefficient. For curve-based trimming, free trimming is performed along polynomial curves, which has high flexibility, but involves a large amount of curve calculations, consumes a lot of resources, and is difficult to debug.

[0004] In summary, the above conventional trimming schemes generally have problems such as high computational complexity, poor adaptability, high operation threshold, and difficulty in balancing accuracy and efficiency, and are difficult to meet the comprehensive requirements of high precision, high efficiency, and user-friendliness in industrial scenarios. Summary of the Invention

[0005] In view of this, the purpose of the present invention is to provide a method, device, equipment and medium for trimming the surface of a CAD model, which can achieve low-computation and high-efficiency precise trimming of different types of CAD model surfaces. The specific scheme is as follows:

[0006] In the first aspect, the present application discloses a method for trimming the surface of a CAD model, including:

[0007] Import and repair the initial CAD model, and establish a watertight grid data structure to obtain a composite surface including discrete surfaces and continuous surfaces;

[0008] Determine each discrete point of the feature line based on the feature line information of the composite surface and the discrete dimension information of the discrete surface;

[0009] Insert each of the discrete points into the discrete grid in the composite surface that is closest to the discrete point, and then perform a correction process on each of the discrete grids to obtain a corrected three-dimensional grid;

[0010] Map the corrected three-dimensional grid to a two-dimensional plane to extract and restore two-dimensional feature line segments, and then inverse-map each of the two-dimensional feature line segments back to three-dimensional space to generate three-dimensional feature line segments and a three-dimensional discrete grid;

[0011] Divide the three-dimensional discrete grid into multiple grid patches using the attribute information of the three-dimensional feature line segments;

[0012] Create virtual edge objects based on the three-dimensional feature line segments of each of the grid patches, and generate a trimmed watertight surface based on the virtual edge objects and the grid patches.

[0013] Optionally, the importing and repairing of the initial CAD model and establishing a watertight grid data structure to obtain a composite surface including a discrete surface and a continuous surface includes:

[0014] Perform a model surface gap process on the initial CAD model to obtain a target CAD model without surface gaps, and then perform a mesh division and generation process on the target CAD model to obtain a composite surface including a discrete surface and a continuous surface.

[0015] Optionally, the determining of each discrete point of the feature line based on the feature line information of the composite surface and the discrete dimension information of the discrete surface includes:

[0016] Draw a feature line in the composite surface;

[0017] Calculate the average discrete dimension based on the dimension information of all discrete grids in the discrete surface to obtain the discrete dimension information;

[0018] Generate a corresponding discrete point sequence based on the length information of the feature line and the discrete dimension information to determine each discrete point.

[0019] Optionally, the performing of a correction process on each of the discrete grids to obtain a corrected three-dimensional grid includes:

[0020] Based on the position information of each discrete point in the corresponding discrete grid, select to perform an edge splitting, point moving, or face splitting operation on each of the discrete grids to obtain a corrected three-dimensional grid.

[0021] Optionally, the mapping of the corrected three-dimensional grid to a two-dimensional plane to extract and restore two-dimensional feature line segments includes:

[0022] Use the conformal mapping algorithm to map the corrected three-dimensional mesh to a two-dimensional plane to obtain a triangular mesh and two-dimensional feature line segments;

[0023] Adjust the triangular meshes intersecting on the two-dimensional plane through an edge swapping algorithm to control each of the two-dimensional feature line segments to be restored to the mesh boundaries of the triangular meshes in the two-dimensional plane.

[0024] Optionally, dividing the three-dimensional discrete mesh into multiple mesh patches by using the attribute information of the three-dimensional feature line segments includes:

[0025] Mark the attributes of each of the three-dimensional feature line segments, and based on the attributes of the three-dimensional feature line segments, select any one of the three-dimensional discrete meshes as the initial coloring unit;

[0026] Perform diffusion coloring starting from the initial coloring unit and diffuse the coloring to the surrounding three-dimensional discrete meshes until the diffusion stops when reaching the mesh boundary marked by the attribute, and extract the three-dimensional discrete meshes colored by diffusion in the current round as the mesh patches;

[0027] Use the uncolored three-dimensional discrete meshes as the initial coloring unit, and jump to execute the step of performing diffusion coloring starting from the initial coloring unit until all the three-dimensional discrete meshes are successfully segmented to obtain the mesh patches.

[0028] Optionally, creating virtual edge objects based on the three-dimensional feature line segments of each of the mesh patches, and generating a trimmed watertight surface based on the virtual edge objects and the mesh patches includes:

[0029] Create virtual edge objects corresponding to the discrete point types based on the three-dimensional feature line segments of each of the mesh patches;

[0030] Use the attribute information of the virtual edge objects to re-divide the three-dimensional discrete meshes in the mesh patches to generate new mesh patches, and generate a trimmed watertight surface according to each of the new mesh patches and the virtual edge objects.

[0031] In a second aspect, the present application discloses a CAD model surface trimming device, including:

[0032] A surface generation module, configured to import and repair an initial CAD model, establish a watertight mesh data structure to obtain a composite surface including a discrete surface and a continuous surface;

[0033] A discrete point determination module, configured to determine each discrete point of the feature line based on the feature line information of the composite surface and the discrete size information of the discrete surface;

[0034] A grid correction module, which is used to insert each of the discrete points into the discrete grid in the composite surface that is closest to the discrete point, and then perform correction processing on each of the discrete grids to obtain a corrected three-dimensional grid;

[0035] A mapping module, which is used to map the corrected three-dimensional grid to a two-dimensional plane to extract and restore two-dimensional feature line segments, and then inverse-map each of the two-dimensional feature line segments back to the three-dimensional space to generate three-dimensional feature line segments and three-dimensional discrete grids;

[0036] A patch division module, which is used to divide the three-dimensional discrete grid into multiple grid patches by using the attribute information of the three-dimensional feature line segments;

[0037] A surface generation module, which is used to create virtual edge objects based on the three-dimensional feature line segments of each of the grid patches, and generate a trimmed watertight surface based on the virtual edge objects and the grid patches.

[0038] In a third aspect, the present application discloses an electronic device, including:

[0039] A memory, which is used to store a computer program;

[0040] A processor, which is used to execute the computer program to implement the steps of the CAD model surface trimming method disclosed above.

[0041] In a fourth aspect, the present application discloses a computer-readable storage medium, which is used to store a computer program; wherein, when the computer program is executed by a processor, the steps of the CAD model surface trimming method disclosed above are implemented.

[0042] It can be seen that the present application discloses a CAD model surface trimming method, including: importing and repairing an initial CAD model, establishing a watertight grid data structure to obtain a composite surface including a discrete surface and a continuous surface; determining each discrete point of a feature line based on the feature line information of the composite surface and the discrete size information of the discrete surface; inserting each of the discrete points into the discrete grid in the composite surface that is closest to the discrete point, and then performing correction processing on each of the discrete grids to obtain a corrected three-dimensional grid; mapping the corrected three-dimensional grid to a two-dimensional plane to extract and restore two-dimensional feature line segments, and then inverse-map each of the two-dimensional feature line segments back to the three-dimensional space to generate three-dimensional feature line segments and three-dimensional discrete grids; dividing the three-dimensional discrete grid into multiple grid patches by using the attribute information of the three-dimensional feature line segments; creating virtual edge objects based on the three-dimensional feature line segments of each of the grid patches, and generating a trimmed watertight surface based on the virtual edge objects and the grid patches.

[0043] It can be seen that through the generation of the composite surface, it is ensured that the surface after trimming inherits the original geometric properties and the watertightness (seamlessness) is ensured. Through discrete point projection and mesh correction, irregular curves and high-curvature surfaces can be precisely processed. Moreover, the discrete point projection corrects geometric errors to ensure that the feature lines perfectly fit the original surface. Mapping the three-dimensional mesh to the two-dimensional plane simplifies complex three-dimensional operations, significantly reduces the computational complexity, and the algorithms for feature line recovery and boundary processing in the two-dimensional plane are mature and efficient, avoiding the computational burden of directly dealing with complex topological relationships in the three-dimensional space. After the two-dimensional feature line segments are recovered and inversely mapped back to the three-dimensional space, the geometric consistency and topological integrity of the trimming boundary are further ensured. By dividing the three-dimensional discrete mesh into multiple patches, it is ensured that the patching process is efficient and non-overlapping. Description of the Drawings

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on the provided drawings.

[0045] Figure 1 It is a flowchart of a method for trimming a CAD model surface disclosed in the present application;

[0046] Figure 2(a) is an example diagram of feature line drawing disclosed in the present application;

[0047] Figure 2(b) is another example diagram of feature line drawing disclosed in the present application;

[0048] Figure 3(a) is an example diagram of discrete point position optimization disclosed in the present application;

[0049] Figure 3(b) is another example diagram of discrete point position optimization disclosed in the present application;

[0050] Figure 3(c) is yet another example diagram of discrete point position optimization disclosed in the present application;

[0051] Figure 4 It is a schematic diagram of feature line recovery disclosed in the present application;

[0052] Figure 5 It is a schematic diagram of the structure of a device for trimming a CAD model surface disclosed in the present application;

[0053] Figure 6 It is a structural diagram of an electronic device disclosed in the present application. Detailed Embodiments

[0054] The following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0055] In automobile manufacturing, the surface shapes of many components such as the body and parts of an automobile are complex, and the curved surfaces need to be trimmed into specific shapes to meet the design and assembly requirements. For example, the curved surface of a car door needs to be precisely trimmed to perfectly fit with other parts of the body, ensuring the smoothness and sealing of the car's appearance. In the aerospace field, the requirements for the accuracy and performance of components are extremely high. The curved surfaces of the aircraft shell and some complex curved surfaces in the internal structure all need to be trimmed to obtain shapes that meet the design standards, so as to ensure the aerodynamic performance, structural strength and safety of the aircraft. In mold manufacturing, in order to produce products of various shapes, the curved surfaces of the molds often need to be trimmed and adjusted. For example, the cavity curved surface of an injection mold must be precisely trimmed to ensure that the shape of the injection-molded product is accurate.

[0056] Existing curved surface trimming algorithms basically operate based on solid geometry. In many 3D modeling software, there are dedicated curved surface trimming functions. For example, in SolidWorks, a trimming surface can be created first and then the trimming command can be used to achieve the trimming of the curved surface. In addition, some software supports using Boolean operations to achieve the trimming of curved surfaces. For example, by performing a Boolean difference operation between a curved surface and another solid or curved surface used for trimming, the trimming effect can be achieved. Just like using a cube to "cut" the curved surface of a cylinder, the shape of the cylinder after a part is cut off can be obtained through the Boolean difference operation.

[0057] Existing surface clipping algorithms can be generally divided into the following categories: 1. Rectangular clipping. This method divides the surface into rectangular shapes, with relatively simple processing. In some cases where the requirements for the surface shape are not particularly complex, it is easy to implement and operate, can meet basic clipping requirements, and is applicable to some simple surface models. 2. Isometric clipping. It can ensure that the clipped surface maintains an isometric relationship with the original surface at a certain distance, which has a certain effect on designs that require maintaining a specific spacing or undergoing isometric deformation, and can better control the relative position relationship between the shape after clipping and the original shape. 3. Manifold parameterization clipping. It can handle surfaces with complex topological structures well. For some surfaces that are difficult to clip in traditional ways, such as surfaces with multiple holes, self-intersections, etc., manifold parameterization clipping can process the parametric representation of the surface to effectively achieve clipping, and has strong adaptability in dealing with complex surface topological structures. 4. Curve-based clipping. It generalizes line-based clipping to polynomial curve-based clipping, making the clipping method more flexible and the clipped area more free. It is applicable not only to polynomial-form surfaces but also to rational-form surfaces, can clip the surface more precisely along the curve, adapt to various complex curve shape requirements, and can meet designs with high requirements for the clipped shape.

[0058] The disadvantages of existing surface clipping are as follows: 1. The disadvantage of rectangular clipping is that for complex surface shapes, especially surfaces with irregular curves, arcs, etc., rectangular clipping may not be able to accurately fit the actual shape of the surface, resulting in inaccurate clipping results, losing some detailed information, and being not very applicable in some scenarios with high requirements for clipping accuracy. 2. The disadvantage of isometric clipping is that the calculation process is relatively complex and may require more computing resources and time. Especially for complex surface structures, isometric calculation may become very cumbersome, and when dealing with some surfaces with special shapes or large curvature changes, it may be difficult to accurately achieve isometric clipping, resulting in errors. 3. The disadvantage of manifold parameterization clipping is that the parameterization process itself may be relatively complex and requires certain professional knowledge and experience to correctly operate and set parameters. Otherwise, it may lead to incorrect results, and for some simple surfaces, using manifold parameterization clipping may seem too complex and cumbersome, with low efficiency. 4. The disadvantage of curve-based clipping is that it involves curve calculation and processing, with a relatively large amount of calculation, high requirements for computing resources and time, and it may be difficult to determine appropriate curve parameters and clipping paths for complex curve and surface combinations, requiring a large amount of debugging and optimization.

[0059] Therefore, the present invention provides a CAD model surface clipping solution that can achieve low-computation and high-efficiency precise clipping of different types of CAD model surfaces.

[0060] Refer toFigure 1 As shown in Figure 1 , an embodiment of the present invention discloses a method for trimming the surface of a CAD model, including:

[0061] Step S11: Import and repair the initial CAD model, and establish a watertight mesh data structure to obtain a composite surface containing discrete surfaces and continuous surfaces.

[0062] In this embodiment, the surface gaps of the initial CAD model are processed to obtain a target CAD model without surface gaps. It can be understood that the initial CAD model generated according to the surface trimming requirements has gaps. In order to obtain accurate surface trimming results, it is necessary to repair the surface gaps of the initial CAD model with gaps to obtain a target CAD model without surface gaps. It should be noted that generating the initial CAD model based on the actual parameter information of the parts in the surface trimming requirements is a conventional generation method, such as the reverse engineering method based on measurement data, the forward design method based on design parameters, and the hybrid design method combining the two. Specific limitations are not made in this regard. The surface trimming requirements can specifically be the surface trimming requirements of parts, where the parts can be mechanical parts in different fields, such as parts with complex surfaces like automobile body parts and aircraft hulls. Specific limitations are not made in this regard. When the surface trimming requirements are for aircraft structural parts, there is a need for surface trimming in the CAD models of any one or several structural parts such as the wing rib ends, fuselage corners, and inner and outer edges. After the initial CAD model is obtained, after repairing the gaps, a repaired target CAD model is obtained.

[0063] Furthermore, the target CAD model is subjected to mesh division and generation processing to obtain a composite surface that includes discrete surfaces and continuous surfaces. It can be understood that after the initial CAD model is repaired for gaps by the gap repair method, the target CAD model is obtained. Then, the watertight mesh data structure of the target CAD model is generated through the watertight mesh generation method. Among them, the watertight mesh generation framework is a tool or method for constructing the data structure of the target CAD model. In the processing of the target CAD model, the mesh is a discrete representation of the model surface. A watertight mesh means that the connections between the meshes are tight and gapless, just like being sealed. This characteristic is crucial for subsequent precise calculations and analyses. Using this framework to establish the data structure can organize each part of the target CAD model in an orderly and standardized manner, facilitating various subsequent operations on the model. Specifically, after the data structure of the target CAD model is established through the watertight mesh generation framework, each obtained composite surface includes two parts: discrete surfaces and continuous surfaces. The discrete surface is obtained by discretizing the continuous surface and is composed of a series of discrete point, line, and surface elements. In subsequent cutting algorithms, it is easier to operate on the discrete surface, such as calculating the average side length of the discrete mesh and drawing feature lines on the discrete surface. The continuous surface is the part of the surface that maintains the original continuous characteristics and reflects the overall shape and geometric features of the surface. The discrete surface and the continuous surface cooperate with each other. The discrete surface provides a quantifiable basis for specific operations, and the continuous surface ensures the overall geometric properties of the surface, jointly constituting the composite surface and providing complete surface information for subsequent cutting, analysis, and other operations. For example: After repairing the CAD model of the wing rib end, there is still a need to cut the surface of the wing rib end. And the corresponding composite surface represents the topological patch on the surface of the repaired CAD model of the wing rib end after gap repair.

[0064] Step S12: Determine each discrete point of the feature line based on the feature line information of the composite surface and the discrete dimension information of the discrete surface.

[0065] In this embodiment, a feature line is drawn on the composite surface; it can be understood that there are two ways to draw a feature line on the composite surface.

[0066] In a specific implementation manner, boundary points are respectively determined from the boundaries of the discrete mesh of the discrete surface, and then the user starts from a boundary point on the surface and randomly draws a feature line until reaching another boundary point on the surface. As shown in Figure 2(a) below, this is the drawing result of random feature line drawing.

[0067] In another specific embodiment, according to two boundary points on a discrete grid specified by the user, a distance calculation algorithm is used to automatically find the shortest path between the two specified boundary points as the trimming feature line. As shown in Figure 2(b) below, after selecting the two boundary points, the shortest path between the two boundary points will be automatically calculated as the feature line (represented by a dashed line).

[0068] In this way, by drawing the feature line, the trimming path is defined, providing a geometric basis for subsequent slicing operations. The above two specific embodiments of feature line drawing take into account both user flexibility and algorithm automation capabilities, adapting to trimming requirements of different complexities.

[0069] In this embodiment, the average discrete size is calculated according to the size information of all discrete grids in the discrete surface to obtain the discrete size information; based on the length information of the feature line and the discrete size information, a corresponding discrete point sequence is generated to determine each discrete point. It can be understood that the length information of all discrete grids in the discrete surface is averaged to obtain the average discrete size as the discrete size information of the entire discrete surface, that is, the average side length of the entire discrete surface. Calculate the length of the current feature line, and obtain the number of discrete points by calculating the ratio of the length to the discrete size , set the number of discrete points on the feature line to , and calculate all discrete points on the current feature line , obtaining a discrete point sequence. In this way, the continuous feature line is converted into a discrete point set, providing a quantitative basis for grid operations. Moreover, by means of adaptive discretization, the balance between accuracy and computational efficiency is ensured, avoiding over-dense or over-sparse discrete point distributions, which is the basis for subsequent projection, conformal protection, and grid segmentation.

[0070] Step S13: Insert each of the discrete points into the discrete grid in the composite surface that is closest to the discrete point, and then perform a correction process on each of the discrete grids to obtain a corrected three-dimensional grid.

[0071] In this embodiment, after obtaining the discrete points, it is necessary to correct the feature line formed by each discrete point. Specifically, the solid geometric object (surface data on the continuous surface) on the current composite surface is obtained, and the discrete points are projected onto the solid geometry for accuracy correction, so that the constructed feature line completely fits the current surface, completing the feature line correction and obtaining the corrected feature line, avoiding the influence of geometric errors on subsequent operations and achieving the purpose of conformal protection.

[0072] In this embodiment, based on the position information of each of the discrete points in the corresponding discrete grid, an edge splitting, moving point, or face splitting operation is selected to be performed on each of the discrete grids to obtain a corrected three-dimensional grid. It can be understood that each discrete point on the modified feature line is traversed, and each discrete point is calculated in the discrete grid the nearest triangle on , and then insert the current discrete point into this triangle. Specifically, if the discrete point is close to the boundary of the triangle, perform an edge splitting operation to split the triangle, as shown in Fig. 3(a); if the discrete point is close to the vertex of the triangle, perform a moving point operation to process the triangle, as shown in Fig. 3(b); if the discrete point is located inside the triangle , perform a splitting surface operation to split the triangle. As shown in Fig. 3(c). By processing the discrete grid in the above manner, the corrected three-dimensional grid is obtained.

[0073] In this way, the feature lines are embedded into each discrete grid, forcing the grid boundaries to align with the feature lines, ensuring the explicit expression of the cutting boundaries in the grid, and avoiding topological errors during subsequent mapping and restoration.

[0074] Step S14: Map the corrected three-dimensional grid to a two-dimensional plane to extract and restore two-dimensional feature line segments, and then inverse-map each of the two-dimensional feature line segments back to the three-dimensional space to generate three-dimensional feature line segments and three-dimensional discrete grids.

[0075] In this embodiment, the conformal mapping algorithm is used to map the corrected three-dimensional grid to a two-dimensional plane to obtain a triangular grid and two-dimensional feature line segments; the edge swapping algorithm is used to adjust the triangular grids intersecting on the two-dimensional plane to control each of the two-dimensional feature line segments to be restored as the grid boundaries of the triangular grids in the two-dimensional plane. It can be understood that using the conformal mapping algorithm to map the corrected three-dimensional grid after inserting discrete points to a two-dimensional plane, a triangular grid and two-dimensional grid points corresponding to the three-dimensional discrete points constituting two-dimensional feature line segments are obtained, and a series of feature line segments are obtained. Perform boundary restoration in the two-dimensional plane, and restore the feature line segments in sequence. As Figure 4 shown, when restoring line segment AB, first calculate the triangles intersecting with the line segment, and then use the edge swapping algorithm for boundary restoration to make the two-dimensional feature line become the grid boundary of the triangular grid.

[0076] In this embodiment, when the current two-dimensional feature line segment already completely belongs to a certain grid boundary of the two-dimensional triangular grid, at this time, the corresponding three-dimensional feature line segment , and the three-dimensional discrete grid after feature constraint can be obtained through the inverse mapping algorithm.

[0077] In this way, by simplifying complex three-dimensional problems into two-dimensional operations, it is convenient for boundary restoration and cutting into pieces, reduces the computational complexity, and improves the efficiency by using mature algorithms for two-dimensional plane operations. The boundary restoration ensures that the feature lines in the two-dimensional plane are complete and free of topological conflicts, guarantees the accuracy and continuity of the cutting boundary when inverse mapping back to three dimensions. Further, the two-dimensional operation results are restored to three-dimensional geometry to complete the final positioning of the cutting path, retain the topological consistency of the three-dimensional geometry, and avoid attribute loss caused by dimensional conversion.

[0078] Step S15: Divide the three-dimensional discrete grid into multiple grid patches by using the attribute information of the three-dimensional feature line segments.

[0079] In this embodiment, mark the attributes of each of the three-dimensional feature line segments, and based on the attributes of the three-dimensional feature line segments, select any one of the three-dimensional discrete grids as the initial coloring unit; perform diffusion coloring starting from the initial coloring unit and diffusing to the surrounding three-dimensional discrete grids until the diffusion stops when reaching the grid boundary marked with attributes, and extract the three-dimensional discrete grids colored by diffusion in the current round as grid patches; use the uncolored three-dimensional discrete grids as the initial coloring unit, and jump to execute the step of performing diffusion coloring starting from the initial coloring unit until all three-dimensional discrete grids are successfully divided into pieces to obtain the grid patches. It can be understood that the grid is divided into pieces by using the half-edge data structure of the grid. The specific operation is as follows: Mark the attributes of the three-dimensional feature line segments as true. Arbitrarily select one of the three-dimensional discrete grids as the initial coloring unit, and use this unit to perform diffusion coloring to the surrounding. Stop the diffusion when encountering the marked grid boundary during coloring. When the coloring in this round can no longer diffuse, extract all the three-dimensional discrete grids colored in this round as a new grid patch. Then continue to repeat the coloring for the remaining three-dimensional discrete grids until all the three-dimensional discrete grids in it are successfully divided into pieces. In this way, the original surface is divided into independent regions according to the feature lines to achieve the cutting effect. The process of dividing into pieces is efficient and without overlap, ensuring the watertightness and reversibility of the surface after cutting.

[0080] Step S16: Create virtual edge objects based on the three-dimensional feature line segments of each of the grid patches, and generate a watertight surface after cutting based on the virtual edge objects and the grid patches.

[0081] In this embodiment, virtual edge objects corresponding to the discrete point types are created based on the three-dimensional feature line segments of each of the mesh patches; the three-dimensional discrete meshes in the mesh patches are re-divided into mesh patches by using the attribute information of the virtual edge objects to generate new mesh patches, and a trimmed watertight surface is generated based on each of the new mesh patches and the virtual edge objects. It can be understood that, based on the three-dimensional feature line segments on each current mesh patch, a virtual edge object of the discrete point type is created. , and then each mesh in the meshed mesh patch is associated with a new virtual surface by using the created virtual edge object, inheriting the original solid geometry and updating the topological relationship. Specifically, the current virtual surface (the current composite surface) is meshed into a plurality of discrete meshes according to the aforementioned mesh meshing method. . Then create new virtual surfaces , and the digital model surfaces associated with each new virtual surface inherit from the original virtual surface , and the discrete meshes are respectively . If two new virtual surfaces and share the previous virtual edge object, the virtual edge is added to the loop of the new virtual surface, and the topological relationship between the virtual edge and the virtual surface is created. After the above-mentioned steps of segmentation, the topological relationship between the virtual surfaces is also updated, and the two virtual surfaces must be watertight at the intersection part. Therefore, the new surface inherits the original geometric properties, ensuring the reversibility, watertightness, and reversibility of the trimming operation.

[0082] It can be seen that the present application discloses a CAD model surface trimming method, including: importing and repairing an initial CAD model, establishing a watertight mesh data structure to obtain a composite surface including a discrete surface and a continuous surface; determining each discrete point of the feature line based on the feature line information of the composite surface and the discrete size information of the discrete surface; inserting each of the discrete points into the discrete mesh in the composite surface that is closest to the discrete point, and then performing a correction process on each of the discrete meshes to obtain a corrected three-dimensional mesh; mapping the corrected three-dimensional mesh to a two-dimensional plane to extract and restore two-dimensional feature line segments, and then inverse mapping each of the two-dimensional feature line segments back to the three-dimensional space to generate three-dimensional feature line segments and three-dimensional discrete meshes; dividing the three-dimensional discrete meshes into a plurality of mesh patches by using the attribute information of the three-dimensional feature line segments; creating virtual edge objects based on the three-dimensional feature line segments of each of the mesh patches, so as to generate a trimmed watertight surface based on the virtual edge objects and the mesh patches.

[0083] It can be seen that through the generation of the composite surface, it is ensured that the surface after trimming inherits the original geometric properties and the watertightness (seamlessness) is ensured. Through discrete point projection and mesh correction, irregular curves and high-curvature surfaces can be accurately processed. Moreover, the discrete point projection corrects geometric errors to ensure that the feature lines fit exactly to the original surface. Mapping the three-dimensional mesh to the two-dimensional plane simplifies complex three-dimensional operations, significantly reduces the computational complexity, and the algorithms for feature line recovery and boundary processing in the two-dimensional plane are mature and efficient, avoiding the computational burden of directly processing complex topological relationships in the three-dimensional space. After the two-dimensional feature line segments are recovered and then inverse mapped back to the three-dimensional space, the geometric consistency and topological integrity of the trimming boundary are further ensured. By dividing the three-dimensional discrete mesh into multiple patches, it is ensured that the patching process is efficient and there is no overlap.

[0084] As shown in Figure 5, the present invention also discloses a CAD model surface trimming device, including:

[0085] A surface generation module 11, configured to import and repair an initial CAD model, establish a watertight mesh data structure to obtain a composite surface including a discrete surface and a continuous surface;

[0086] A discrete point determination module 12, configured to determine each discrete point of the feature line based on the feature line information of the composite surface and the discrete size information of the discrete surface;

[0087] A mesh correction module 13, configured to insert each of the discrete points into the discrete mesh in the composite surface that is closest to the discrete point, and then perform correction processing on each of the discrete meshes to obtain a corrected three-dimensional mesh;

[0088] A mapping module 14, configured to map the corrected three-dimensional mesh to a two-dimensional plane to extract and recover two-dimensional feature line segments, and then inverse map each of the two-dimensional feature line segments back to the three-dimensional space to generate three-dimensional feature line segments and a three-dimensional discrete mesh;

[0089] A patch division module 15, configured to divide the three-dimensional discrete mesh into multiple mesh patches by using the attribute information of the three-dimensional feature line segments;

[0090] A surface generation module 16, configured to create a virtual edge object based on the three-dimensional feature line segments of each of the mesh patches, and generate a trimmed watertight surface based on the virtual edge object and the mesh patches.

[0091] It can be seen that the present application discloses importing and repairing an initial CAD model, establishing a watertight mesh data structure to obtain a composite surface including discrete surfaces and continuous surfaces; determining discrete points of a feature line based on the feature line information of the composite surface and the discrete dimension information of the discrete surface; inserting each of the discrete points into the discrete grid closest to the discrete point in the composite surface, and then performing a correction process on each of the discrete grids to obtain a corrected three-dimensional grid; mapping the corrected three-dimensional grid to a two-dimensional plane to extract and restore two-dimensional feature line segments, and then inversely mapping each of the two-dimensional feature line segments back to three-dimensional space to generate three-dimensional feature line segments and three-dimensional discrete grids; dividing the three-dimensional discrete grids into multiple grid patches by using the attribute information of the three-dimensional feature line segments; creating virtual edge objects based on the three-dimensional feature line segments of each of the grid patches to generate a trimmed watertight surface based on the virtual edge objects and the grid patches.

[0092] Thus, through the generation of the composite surface, it is ensured that the trimmed surface inherits the original geometric properties and the watertightness (no gaps) is ensured. Through discrete point projection and grid correction, irregular curves and high-curvature surfaces can be accurately processed, and the discrete point projection corrects geometric errors to ensure that the feature line fits the original surface completely. Mapping the three-dimensional grid to a two-dimensional plane simplifies complex three-dimensional operations, significantly reduces the computational complexity, and the algorithms for feature line recovery and boundary processing in the two-dimensional plane are mature and efficient, avoiding the computational burden of directly processing complex topological relationships in three-dimensional space. After the two-dimensional feature line segments are recovered and inversely mapped back to three-dimensional space, the geometric consistency and topological integrity of the trimming boundary are further ensured. By dividing the three-dimensional discrete grids into multiple patches, it is ensured that the patching process is efficient and non-overlapping.

[0093] Furthermore, the embodiment of the present application also discloses an electronic device Figure 6 is a structural diagram of an electronic device 20 shown according to an exemplary embodiment, and the content in the figure should not be considered as any limitation to the scope of use of the present application.

[0094] Figure 6 is a structural schematic diagram of an electronic device 20 provided by an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the CAD model surface trimming method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0095] In this embodiment, the power supply 23 is used to provide operating voltages for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and no specific limitation is imposed thereon herein; the input / output interface 25 is used to obtain external input data or output data to the outside, and the specific interface type thereof can be selected according to specific application requirements, and no specific limitation is imposed herein.

[0096] Among them, the processor 21 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. The processor 21 may be implemented in at least one of the following hardware forms: DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may further include an AI (Artificial Intelligence) processor, and the AI processor is used to process computational operations related to machine learning.

[0097] In addition, the memory 22, as a carrier for resource storage, may be a read-only memory, a random access memory, a magnetic disk, an optical disk, etc., and the resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be transient storage or permanent storage.

[0098] Among them, the operating system 221 is used to manage and control each hardware device on the electronic device 20 and the computer program 222, so as to implement the operation and processing of the massive data 223 in the memory 22 by the processor 21. It can be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program that can be used to complete the CAD model surface trimming method executed by the electronic device 20 disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs that can be used to complete other specific tasks. The data 223 may include not only the data transmitted by external devices received by the electronic device, but also the data collected by its own input / output interface 25, etc.

[0099] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the foregoing disclosed CAD model surface trimming method is implemented. For the specific steps of this method, reference can be made to the corresponding content disclosed in the foregoing embodiments, and details will not be repeated here.

[0100] In this specification, the various embodiments are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts between the various embodiments, reference can be made to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and reference can be made to the description in the method part for the relevant parts.

[0101] Those skilled in the art may further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered as exceeding the scope of this application. The steps of the methods or algorithms described in combination with the embodiments disclosed herein can be directly implemented by hardware, software modules executed by a processor, or a combination of both. The software modules can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disk, removable disk, CD-ROM (compact disc read-only memory), or any other form of storage medium known in the technical field.

[0102] Finally, it should also be noted that in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.

[0103] The above provides a detailed introduction to the solution provided by the present invention. Specific examples are used herein to elaborate on the principles and implementation manners of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present invention.

Claims

1. A method for trimming a CAD model surface, characterized in that, Including: Import and repair the initial CAD model, and establish a watertight mesh data structure to obtain a composite surface including discrete surfaces and continuous surfaces; Determine each discrete point of the feature line based on the feature line information of the composite surface and the discrete dimension information of the discrete surface; Insert each of the discrete points into the discrete mesh closest to the discrete point in the composite surface, and then perform a correction process on each of the discrete meshes to obtain a corrected three-dimensional mesh; Map the corrected three-dimensional mesh to a two-dimensional plane to extract and restore two-dimensional feature line segments, and then inverse-map each of the two-dimensional feature line segments back to the three-dimensional space to generate three-dimensional feature line segments and three-dimensional discrete meshes; Divide the three-dimensional discrete mesh into multiple mesh patches using the attribute information of the three-dimensional feature line segments; Create virtual edge objects based on the three-dimensional feature line segments of each of the mesh patches to generate a trimmed watertight surface based on the virtual edge objects and the mesh patches; Among them, the determining each discrete point of the feature line based on the feature line information of the composite surface and the discrete dimension information of the discrete surface includes: Draw a feature line in the composite surface; calculate the average discrete dimension according to the dimension information of all discrete meshes in the discrete surface to obtain the discrete dimension information; generate a corresponding discrete point sequence based on the length information of the feature line and the discrete dimension information to determine each discrete point; The performing a correction process on each of the discrete meshes to obtain a corrected three-dimensional mesh includes: Based on the position information of each of the discrete points in the corresponding discrete mesh, select to perform edge splitting, moving points, or face splitting operations on each of the discrete meshes to obtain a corrected three-dimensional mesh.

2. The CAD model surface clipping method according to claim 1, wherein The importing and repairing the initial CAD model and establishing a watertight mesh data structure to obtain a composite surface including discrete surfaces and continuous surfaces includes: Perform model surface gap processing on the initial CAD model to obtain a target CAD model without surface gaps, and then perform mesh division and generation processing on the target CAD model to obtain a composite surface including discrete surfaces and continuous surfaces.

3. The CAD model surface trimming method according to claim 1, characterized in that The mapping the corrected three-dimensional mesh to a two-dimensional plane to extract and restore two-dimensional feature line segments includes: Use the conformal mapping algorithm to map the corrected three-dimensional mesh to a two-dimensional plane to obtain a triangular mesh and two-dimensional feature line segments; Adjust the triangular meshes intersecting on the two-dimensional plane through an edge swapping algorithm to control each of the two-dimensional feature line segments to be restored to the mesh boundaries of the triangular meshes in the two-dimensional plane.

4. The CAD model surface clipping method according to claim 1, wherein The dividing the three-dimensional discrete mesh into multiple mesh patches using the attribute information of the three-dimensional feature line segments includes: Mark the attributes of each of the three-dimensional feature line segments, and based on the attributes of each of the three-dimensional feature line segments, select any one of the three-dimensional discrete meshes as the initial coloring unit; Perform diffusion coloring starting from the initial coloring unit and diffusing to the surrounding three-dimensional discrete meshes until the diffusion stops when reaching the mesh boundary marked by the attribute, and extract the three-dimensional discrete meshes colored by diffusion in the current round as mesh patches; Use the uncolored three-dimensional discrete grid as the initial coloring unit, and jump to execute the step of diffusion coloring starting from the initial coloring unit until all three-dimensional discrete grids are successfully segmented to obtain the mesh patches.

5. The CAD model surface clipping method according to claim 1, characterized in that Creating virtual edge objects based on the three-dimensional feature line segments of the mesh patches, and generating a trimmed watertight surface based on the virtual edge objects and the mesh patches, including: Create virtual edge objects corresponding to the discrete point types based on the three-dimensional feature line segments of the mesh patches; Use the attribute information of the virtual edge objects to re-divide the three-dimensional discrete grids in the mesh patches to generate new mesh patches, and generate a trimmed watertight surface based on the new mesh patches and the virtual edge objects.

6. A CAD model surface trimming device, characterized in that, Including: A surface generation module for importing and repairing an initial CAD model, establishing a watertight grid data structure to obtain a composite surface including discrete and continuous surfaces; A discrete point determination module for determining the discrete points of the feature line based on the feature line information of the composite surface and the discrete size information of the discrete surface; A grid correction module for inserting each discrete point into the discrete grid closest to the discrete point in the composite surface, and then performing correction processing on each discrete grid to obtain a corrected three-dimensional grid; A mapping module for mapping the corrected three-dimensional grid to a two-dimensional plane, extracting and restoring two-dimensional feature line segments, and then inverse mapping each two-dimensional feature line segment back to three-dimensional space to generate three-dimensional feature line segments and three-dimensional discrete grids; A patch division module for dividing the three-dimensional discrete grids into multiple mesh patches using the attribute information of the three-dimensional feature line segments; A surface generation module for creating virtual edge objects based on the three-dimensional feature line segments of the mesh patches, and generating a trimmed watertight surface based on the virtual edge objects and the mesh patches; The grid correction module is specifically used for drawing feature lines in the composite surface; Calculate the average discrete size based on the size information of all discrete grids in the discrete surface to obtain the discrete size information; generate a corresponding discrete point sequence based on the length information of the feature line and the discrete size information to determine each discrete point; based on the position information of each discrete point in the corresponding discrete grid, select to perform edge splitting, moving points, or face splitting operations on each discrete grid to obtain a corrected three-dimensional grid.

7. An electronic device, characterized in that, Including: A memory for storing a computer program; A processor for executing the computer program to implement the steps of the CAD model surface trimming method according to any one of claims 1 to 6.

8. A computer-readable storage medium, characterized in that, For storing a computer program; wherein, when the computer program is executed by the processor, the steps of the CAD model surface trimming method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Efficient generation method of porous scaffold with complex morphology

    CN109977507A

  • Grid discretization method for boundary representation model

    CN117576347A