CAD model curved surface cutting method, device and equipment and medium
By establishing a watertight mesh data structure in the CAD model, determining and correcting discrete points of feature lines, and mapping them to a two-dimensional plane and inversely mapping them back to a three-dimensional space, the problems of high computational complexity and poor adaptability in complex surface cutting are solved, and high-efficiency and high-precision surface cutting are achieved.
Patent Information
- Application Number
- CN202510581464.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-07
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2045-05-07
AI Technical Summary
The prior art has high computational complexity, poor adaptability and high operating threshold when handling complex surface cutting, making it difficult to meet the comprehensive demand for high precision, high efficiency and user-friendliness in industrial scenarios.
By importing and repairing the initial CAD model, establishing a watertight mesh data structure, determining the discrete points of the feature line, and inserting it into the composite surface for correction processing, mapping to a two-dimensional plane to extract feature line segments, and inversely mapping back to the three-dimensional space, dividing the three-dimensional discrete mesh into multiple mesh patches, and generating a cropped watertight surface based on the virtual edge object.
It realizes low computational volume and high efficiency and precise cropping of surfaces of different types of CAD model, ensuring that the cropped surface inherits the original geometric properties, ensuring watertightness and topological integrity, simplifying complex three-dimensional operations, and reducing computational complexity.
Smart Images

Figure CN120088443A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer-aided design, and particularly to a method, device, equipment and medium for trimming the surface of a CAD model. Background Art
[0002] In the fields of automobile manufacturing, aerospace and mold manufacturing, etc., the precise trimming of complex surfaces (such as car bodies, aircraft hulls, 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 3D modeling software (such as SolidWorks), but there are significant limitations when dealing with surfaces with high precision and complex topological structures.
[0003] Among them, using rectangular trimming to divide the surface into rectangular regions is simple to operate but cannot adapt to irregular curves, resulting in loss of details and insufficient accuracy. Using equidistant trimming: maintaining the equidistant relationship between the trimmed surface and the original surface, but the calculation is complex, sensitive to curvature changes, and prone to errors. Using manifold parameterization trimming: parameterizing complex topological surfaces (such as multi-hole and self-intersecting surfaces), but the parameterization process is cumbersome, requires professional knowledge, and is inefficient. Curve-based trimming: freely trimming along polynomial curves, with 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 computational complexity and high-efficiency precise trimming of different types of CAD model surfaces. The specific solutions are 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 mesh data structure to obtain a composite surface including a discrete surface and a continuous surface;
[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 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 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 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 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 grid to a two-dimensional plane to obtain a triangular grid and two-dimensional feature line segments;
[0023] Adjust the triangular grids 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 grid boundaries of the triangular grids in the two-dimensional plane.
[0024] Optionally, dividing the three-dimensional discrete grid into multiple grid 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 grids 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 grids until the diffusion stops when reaching the grid boundary marked by the attribute, and extract the three-dimensional discrete grids colored by diffusion in the current round as grid patches;
[0027] 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 the three-dimensional discrete grids are successfully segmented to obtain the grid patches.
[0028] Optionally, 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 includes:
[0029] Create virtual edge objects corresponding to the discrete point types based on the three-dimensional feature line segments of each of the grid patches;
[0030] Use the attribute information of the virtual edge objects to re-divide the three-dimensional discrete grids in the grid patches to generate new grid patches, and generate a trimmed watertight surface according to each of the new grid 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 grid 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 mesh correction module, which is 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;
[0035] A mapping module, which is configured to 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;
[0036] A patch division module, which is configured to divide the three-dimensional discrete mesh into multiple mesh patches by using the attribute information of the three-dimensional feature line segments;
[0037] A surface generation module, which is configured to create virtual edge objects 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 objects and the mesh patches.
[0038] In a third aspect, the present application discloses an electronic device, including:
[0039] A memory, which is configured to store a computer program;
[0040] A processor, which is configured 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 configured 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 mesh 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 mesh in the composite surface that is closest to the discrete point, and then performing correction processing 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 mesh into multiple 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, and generating a trimmed watertight surface based on the virtual edge objects and the mesh 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 surfaces with high curvature 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 restored and 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 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 according to 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 drawing of feature line drawing disclosed in the present application;
[0047] Figure 2(b) is another example drawing of feature line drawing disclosed in the present application;
[0048] Figure 3(a) is an example drawing of discrete point position optimization disclosed in the present application;
[0049] Figure 3(b) is another example drawing of discrete point position optimization disclosed in the present application;
[0050] Figure 3(c) is yet another example drawing 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 technical solutions in the embodiments of the present application will be clearly and completely described below with reference to 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 airtightness of the car's appearance. In the aerospace field, extremely high requirements are placed on the accuracy and performance of components. The curved surfaces of the aircraft hull 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] The existing surface clipping algorithms can be roughly divided into the following categories: 1. Rectangular clipping. This method divides the surface into rectangular shapes, and the processing is relatively simple. In some cases where the requirements for the surface shape are not particularly complex, it is easy to implement and operate, can meet the 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 performing 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 and effectively achieve clipping, and has strong adaptability in dealing with complex surface topological structures. 4. Curve-based clipping. It generalizes the 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 the designs with high requirements for the clipped shape.
[0058] The disadvantages of the 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 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, the 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. Moreover, 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 the calculation and processing of curves, 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 surface clipping solution for CAD models, which 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 a 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 including 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 part 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, which are not specifically limited herein. 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 outer shells, which are not specifically limited herein. When the surface trimming requirements are for aircraft structural parts, if there are surface trimming requirements in the CAD models of any one or several of the wing rib ends, fuselage corners, inner and outer edges in the aircraft structural parts, after the initial CAD model is obtained, after repairing the gaps, a repaired target CAD model is obtained.
[0063] Further, perform meshing and generation processing on the target CAD model to obtain a composite surface that includes discrete surfaces and continuous surfaces. It can be understood that after the initial CAD model is repaired by the gap repair method to obtain the target CAD model, the watertight mesh data structure of the target CAD model is further generated by 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 connection between meshes is 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 establishing the data structure of the target CAD model 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 its 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 for surface cutting of the wing rib end. 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 size information of the discrete surface.
[0065] In this embodiment, draw a feature line 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, determine boundary points from the boundaries of the discrete meshes of the discrete surface respectively, and then the user starts from a boundary point on the surface and randomly draws a feature line until it ends at another boundary point on the surface. As shown in Figure 2(a) below, this is the drawing result of the random feature line drawing.
[0067] In another specific embodiment, according to two boundary points on the 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 cutting 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 (dashed line).
[0068] In this way, by drawing the feature line, the cutting 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 different complexity cutting requirements.
[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 preservation, 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, obtain the solid geometry object (surface data on the continuous surface) on the current composite surface, project the discrete points onto the solid geometry for accuracy correction, so that the constructed feature line completely fits the current surface, complete the feature line correction, and obtain the corrected feature line, avoiding the influence of geometric errors on subsequent operations and achieving the purpose of conformal preservation.
[0072] In this embodiment, based on the position information of each of the discrete points in the corresponding discrete grid, select to perform edge splitting, moving points, or face splitting operations on each of the discrete grids to obtain a corrected three-dimensional grid. It can be understood that traverse each discrete point on the modified feature line and calculate each discrete point 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 plane 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 corrected three-dimensional grid is mapped to a two-dimensional plane using a conformal mapping algorithm to obtain a triangular grid and two-dimensional feature line segments; the triangular grids intersecting on the two-dimensional plane are adjusted using an edge swapping algorithm to control each of the two-dimensional feature line segments to be restored to 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 the two-dimensional plane, a triangular grid and two-dimensional grid points corresponding to the three-dimensional discrete points forming 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 below, 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 and slicing, 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, guaranteeing 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, preserving the topological consistency of the three-dimensional geometry and avoiding 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, the attributes of each of the three-dimensional feature line segments are marked, and any one of the three-dimensional discrete grids is selected as the initial coloring unit based on the attributes of the three-dimensional feature line segments; diffusion coloring is performed 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 the three-dimensional discrete grids colored by diffusion in the current round are extracted as grid patches; the uncolored three-dimensional discrete grids are used as the initial coloring unit, and the step of performing diffusion coloring starting from the initial coloring unit is jumped to and executed until all the three-dimensional discrete grids are successfully sliced to obtain the grid patches. It can be understood that the grid is sliced 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 perform diffusion coloring to the surrounding using this unit. Stop diffusion when encountering the marked grid boundary during coloring. When the coloring in this round can no longer diffuse, all the three-dimensional discrete grids colored in this round are extracted 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 are successfully sliced. In this way, the original surface is divided into independent regions according to the feature lines to achieve the cutting effect. The slicing process is efficient and non-overlapping, 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 grid patches; the grid patches in the grid patches are re-divided into grid patches by using the attribute information of the virtual edge objects to generate new grid patches, and a trimmed watertight surface is generated according to each of the new grid patches and the virtual edge objects. It can be understood that, according to the three-dimensional feature line segments on each current grid patch, a virtual edge object of the discrete point type is created , and then each grid in the grid patches after patching is associated with a new virtual surface by using the created virtual edge object, inheriting the original entity geometry and updating the topological relationship. Specifically, the current virtual surface (the current composite surface) is patched according to the aforementioned grid patching method to obtain a plurality of discrete grids . 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 grids are respectively . If two new virtual surfaces and share the previous virtual edge object, then add the virtual edge to the loop of the new virtual surface and create the topological relationship between the virtual edge and the virtual surface. After the above steps of cutting, 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 grid 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 dimension 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 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 inverse 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 a plurality of 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, so as to generate a trimmed watertight surface based on the virtual edge objects and the grid 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 surfaces with high curvature can be accurately processed. Moreover, the discrete point projection corrects the geometric error 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 dealing with complex topological relationships in the three-dimensional space. After the two-dimensional feature line segments are recovered and then inverse mapped back to three dimensions, it further ensures the geometric consistency and topological integrity of the trimming boundary. By dividing the three-dimensional discrete mesh into multiple patches, it is ensured that the patching process is efficient and non-overlapping.
[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, so as 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 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.
[0091] It can be seen that the present application discloses importing and repairing an initial CAD model, establishing a watertight grid 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 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 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.
[0092] It can be seen that through the generation of the composite surface, it is ensured that the trimmed surface inherits the original geometric properties and the watertightness (seamlessness) 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 feature line recovery and boundary processing algorithms 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 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 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. The content in the figure should not be regarded as any limitation on the scope of use of the present application.
[0094] Figure 6 is a schematic structural 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 various hardware devices 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 specific limitations thereof are not provided 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 specific limitations thereof are not provided 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 hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or 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, or an optical disc, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.
[0098] Among them, the operating system 221 is used to manage and control each hardware device and computer program 222 on the electronic device 20, 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 the external device 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, it implements the CAD model surface trimming method disclosed above. 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] The various embodiments in this specification 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 method part for relevant details.
[0101] Those skilled in the art may further realize that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their 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 to exceed the scope of this application. The steps of the methods or algorithms described in connection with the embodiments disclosed herein can be directly implemented by hardware, software modules executed by a processor, or a combination of the two. 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 art.
[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 includes not only those elements but also 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 has introduced the solution provided by the present invention in detail. 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 on the present invention.
Claims
1. A CAD model surface cutting method, characterized in that: include: 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 characteristic line based on the characteristic line information of the composite surface and the discrete size information of the discrete surface; Inserting each of the discrete points into a 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 modified 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 a three-dimensional space to generate three-dimensional feature line segments and a three-dimensional discrete grid; Dividing the three-dimensional discrete grid into a plurality of grid patches using the attribute information of the three-dimensional feature line segments; A virtual edge object is created based on the three-dimensional characteristic line segment of each mesh surface patch, so as to generate a trimmed watertight surface based on the virtual edge object and the mesh surface patch.
2. The CAD model surface cutting method according to claim 1, characterized in that: The step of importing and repairing the initial CAD model and establishing a watertight mesh data structure to obtain a composite surface including a discrete surface and a continuous surface includes: The initial CAD model is processed for model surface gaps to obtain a target CAD model without surface gaps, and then the target CAD model is meshed and generated to obtain a composite surface including discrete surfaces and continuous surfaces.
3. The CAD model surface cutting method according to claim 1, characterized in that: The step of 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 includes: drawing feature lines in the composite surface; Calculating an average discrete size according to size information of all discrete grids in the discrete surface to obtain the discrete size information; A corresponding discrete point sequence is generated based on the length information of the characteristic line and the discrete size information to determine each discrete point.
4. The CAD model surface cutting method according to claim 1, characterized in that: The performing of correction processing on each of the discrete grids to obtain a corrected three-dimensional grid includes: Based on the position information of each discrete point in the corresponding discrete grid, edge segmentation, moving point or surface segmentation operation is selected to be performed on each discrete grid to obtain a corrected three-dimensional grid.
5. The CAD model surface cutting method according to claim 1, characterized in that: Mapping the modified three-dimensional grid to a two-dimensional plane to extract and restore two-dimensional feature line segments includes: Mapping the modified three-dimensional mesh to a two-dimensional plane using a conformal mapping algorithm to obtain a triangular mesh and two-dimensional feature line segments; The intersecting triangular meshes on the two-dimensional plane are adjusted by an edge exchange algorithm to control each of the two-dimensional feature line segments to be restored to a mesh boundary of the triangular mesh in the two-dimensional plane.
6. The CAD model surface cutting method according to claim 1, characterized in that: The method of dividing the three-dimensional discrete grid into a plurality of grid patches by using the attribute information of the three-dimensional feature line segments comprises: Marking the attributes of each of the three-dimensional feature line segments, and selecting any one of the three-dimensional discrete grids as an initial coloring unit based on the attributes of each of the three-dimensional feature line segments; By diffusion coloring, the initial coloring unit is used as a starting point to diffusely color the surrounding three-dimensional discrete grids until the diffusion reaches the grid boundary marked with the attribute, and the diffusion stops, and the three-dimensional discrete grid diffusely colored in the current round is extracted as a grid face; An uncolored three-dimensional discrete grid is used as an initial shading unit, and the step of performing the shading by diffusion and starting from the initial shading unit is jumped to be executed until all three-dimensional discrete grids are successfully fragmented to obtain grid facets.
7. The CAD model surface cutting method according to claim 1, characterized in that: The step of creating a virtual edge object based on the three-dimensional feature line segments of each mesh surface patch to generate a clipped watertight surface based on the virtual edge object and the mesh surface patch includes: Creating virtual edge objects corresponding to discrete point types based on the three-dimensional feature line segments of each of the mesh facets; The three-dimensional discrete grids in the grid patch are re-divided into grid patches by using the attribute information of the virtual edge object to generate new grid patches, and a clipped watertight surface is generated according to each of the new grid patches and the virtual edge object.
8. A CAD model surface cutting device, characterized in that: include: The surface generation module is used to 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; A discrete point determination module, used to determine each discrete point of the characteristic line based on the characteristic line information of the composite surface and the discrete size information of the discrete surface; A mesh correction module, used for inserting each of the discrete points into a discrete mesh in the composite surface that is closest to the discrete point, and then performing correction processing on each of the discrete meshes to obtain a corrected three-dimensional mesh; A mapping module, used for mapping the modified three-dimensional grid to a two-dimensional plane to extract and restore the two-dimensional feature line segments, and then inversely mapping 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 grid; A patch division module, used for dividing the three-dimensional discrete grid into a plurality of grid patches by using the attribute information of the three-dimensional feature line segments; A surface generation module is used to create virtual edge objects based on the three-dimensional characteristic line segments of each mesh surface patch, so as to generate a trimmed watertight surface based on the virtual edge objects and the mesh surface patch.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the steps of the CAD model surface clipping method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the CAD model surface clipping method as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
T-spline and isogeometric analysis-based die surface springback compensation method
CN107122510A
Efficient generation method of porous scaffold with complex morphology
CN109977507A
Rapid discretization method and device for any boundary complex curved surface and storage medium
CN113538695A
Method for creating watertight model by using framework based on watertight Boolean operation
CN117494242A
Grid discretization method for boundary representation model
CN117576347A