A method for analyzing and identifying geometric topological features of a three-dimensional model
By converting .STEP format models to .Brep format and parsing topological feature information, combined with ray detection, the problem of difficult model feature recognition in digital twin software is solved, enabling rapid selection and recognition of key features and improving the efficiency of simulation scene construction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU BINGYOU INFORMATION TECH CO LTD
- Filing Date
- 2023-09-15
- Publication Date
- 2026-04-21
AI Technical Summary
In existing digital twin industrial software, the model format defined by triangular meshes makes it difficult to identify and select key features of the model, resulting in a long time consumption in the process of building simulation scenes.
By converting .STEP format model files to .Brep format, the geometric topological feature information of the model is parsed, and the BRepTools class and Open Cascade library are used for data conversion to store the topological relationship hierarchy data of the features. Combined with ray detection, feature recognition and selection are achieved.
Without altering the triangular mesh rendering process, the identification and selection of key model features has been simplified, shortening the time required to build the simulation scene.
Smart Images

Figure CN117290290B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of geometric feature recognition of three-dimensional models, specifically a method for analyzing and recognizing the geometric topological features of three-dimensional models. Background Technology
[0002] Virtual simulation in digital twin technology requires 3D models to build visualized scenes. However, unlike CAD software used for industrial design (such as Autodesk and SolidWorks) which uses formats like step, stl, and brep to describe topological features to define 3D models, virtual simulation has higher requirements for the efficiency and quality of model and scene rendering. It generally uses model formats defined by triangular meshes, such as obj and gltf. Triangular meshes only store the geometric data of the model's appearance and do not store related topological information. This results in existing digital twin industrial software generally not supporting feature operations on the model. For example, key features of the model (points, lines, surfaces, etc.) are difficult to identify and select, making it time-consuming to build simulation scenes. Summary of the Invention
[0003] To address the aforementioned shortcomings, this invention proposes a method for analyzing and identifying the geometric topological features of a 3D model. The aim is to solve the problem that existing digital twin industrial software uses a model format defined by triangular meshes, which makes it difficult to identify and select key features of the model, resulting in a long time required to build the simulation scene.
[0004] To achieve this objective, the present invention adopts the following technical solution:
[0005] A method for analyzing and identifying geometric topological features of a 3D model, comprising the following steps:
[0006] Step S1: Import the .STEP format model file;
[0007] Step S2: Convert and export the .STEP format model file to a .Brep format model file;
[0008] Step S3: Parse the geometric and topological feature information of the model stored in the .Brep format model file, where the geometric and topological feature information of the model includes the geometric information and the topological information of the model;
[0009] Step S4: Import the feature data of the model, wherein the feature data includes the geometric data of the features and the topological relationship hierarchy data of the features;
[0010] Step S5: Store the topological relationship hierarchy data of the features;
[0011] Step S6: Convert the geometric data of the features into a mesh and set the display mode of the mesh to notdisplay mode;
[0012] Step S7: Visualize and render the Mesh.
[0013] Step S8: Obtain the position coordinates of the mouse on the screen, and perform ray detection based on the mouse position coordinates;
[0014] Step S9: Determine whether the ray has detected a mesh. If so, determine the selected feature based on the topological relationship hierarchy data of the feature. If not, continue detection until a mesh is detected.
[0015] Step S10: Based on the selected feature, set its mesh display mode to display mode to complete the identification of the model's geometric topology feature information.
[0016] Preferably, in step S2, the model file in .STEP format is converted to a model file in .Brep format, which specifically includes the following sub-steps:
[0017] Step S21: Create the STEPControl_Reader class in the CAD open-source library Open Cascade (OCC) and call the application programming interface (API) of the ReadFile function to read .STEP format files;
[0018] Step S22: Call the TransferRoot() and Shape() methods from OCC to convert the data stored in the .STEP format file into entities defined by OCC;
[0019] Step S23: Call the Write() method of the BRepTools class from OCC to write the parsed and converted entity geometry topology data into a .Brep file in ASCII format, thus completing the conversion.
[0020] Preferably, in step S3, the geometric topological feature information of the model stored in the .Brep format model file is parsed, including parsing the geometric information of the model, specifically including the following steps:
[0021] Step S31: Perform string segmentation based on the geometric information of the curves and surfaces of all constituent entities in the model. The geometric information of the curves and surfaces of all constituent entities in the model includes three main categories: two-dimensional modeling curves (Curve2ds), three-dimensional modeling curves (Curves), and curved planes (Surfaces).
[0022] Step S32: Read the detailed data for each major category;
[0023] Step S33: Read the identifier of a subdivided data and determine which major category the subdivided data belongs to, and obtain the determination result;
[0024] Step S34: Create the corresponding data structure based on the judgment result. The data structure is used to read and store subsequent feature geometry expression data.
[0025] Step S35: Add data structures of the same category to the same list in the order they are read, so that they can find the corresponding feature geometric expressions based on the index.
[0026] Preferably, in step S31, the three-dimensional modeling curves include lines, circles, and B-spline curves;
[0027] The mathematical expression for a straight line is:
[0028] C(u)=P1+u·D1, u∈(-∞,+∞)
[0029] Where C(u) represents the mathematical expression of a straight line; P1 represents the coordinates of a three-dimensional point; D1 represents the three-dimensional direction; and u is a variable parameter.
[0030] The mathematical expression for a circle is:
[0031] C(a)=P2+r·(cos(a)·D x +sin(a)·D y ), a∈[0, 2π)
[0032] Where C(a) represents the mathematical expression for a circle; P2 represents the coordinates of the center point in space; r represents the radius of the circle; D x and D y All directions are three-dimensional; 'a' is a variable parameter;
[0033] The mathematical expression for a B-spline curve is:
[0034]
[0035] Where C(b) represents the mathematical expression of the B-spline curve; m represents the degree; n represents the number of segments; B i h represents the i-th point of the B-spline curve; i N represents the weight of the i-th point of the B-spline curve; i,m+1 (b) represents the node vector value of the i-th point of the B-spline curve; b represents the variable parameter; b1 and b k These represent the starting and ending values of the curve, respectively; k represents the node vector;
[0036] Surfaces include planes, spheres, and cylinders;
[0037] The mathematical expression for a plane is:
[0038] S(c, d) = P³ + c·D c +d·D d , (c, d)∈(-∞, +∞)×(-∞, +∞)
[0039] Where S(c, d) represents the mathematical expression for the plane; P3 represents the coordinates of a three-dimensional point; D c and D d Both represent three-dimensional directions; c and d represent D respectively. c and D d Variable parameters in two three-dimensional directions;
[0040] The mathematical expression for a cylindrical surface is:
[0041] S(e, f) = P⁴ + r·(cos(e)·D) x +sin(e)·D y )+f·D f , (e, f)∈[0, 2π)×(-∞, +∞)
[0042] Where S(e, f) represents the mathematical expression for the cylindrical surface; P4 represents the coordinates of a three-dimensional point; r represents the radius of the circle; D x D y D e and D f Both are three-dimensional; e and f are D respectively. e and D f Variable parameters in two three-dimensional directions;
[0043] The mathematical expression for a sphere is:
[0044] S(g,h)=P5+r·(h)·(cos(g)·D x +sin(g)·D y )·r·sin(h)·D z , (g, h)∈[0, 2π)×[-π / 2, π / 2]
[0045] Where S(g, h) represents the mathematical expression for the sphere; P5 represents the coordinates of a three-dimensional point; r represents the radius of the circle; D x D y D z D g and D h Both are three-dimensional, with g and h being D and H, respectively.g and D h Variable parameters in two three-dimensional directions.
[0046] Preferably, in step S3, parsing the geometric topological feature information of the model stored in the .Brep format model file further includes parsing the topological information of the model, specifically including the following steps:
[0047] Step S36: Read the key fields in the TShape field in the specified order, where the key fields include Fa, Wi, Ed and Ve fields;
[0048] Step S37: Determine which field the key field in the TShape field belongs to, and perform the corresponding operation, as follows:
[0049] If the key field is Ve, then read the 3D coordinate information; create an array of Points;
[0050] When the key field is the Ed field, the Geom index with identifier 1 is read; the corresponding curve data structure is found in the list of Geom indexes in the storage Geom; the boundary min and max values of variable u are read; the indexes of the points that make up the edge are read; and different types of curve entities are created based on the geometric expression in the curve data structure, the boundary min and max values of variable u, and the indexes of the points that make up the edge.
[0051] When the key field is the Wi field, the indexes of the Ed fields that make up the ring are read; a list is created to store these indexes as ring entities;
[0052] When the key field is Fa, the index of the stored Wi field is read to find the corresponding ring entity; the list within the ring entity is traversed to find the index of all Ed fields; all Ed fields are found based on the index of the Ed field and the Geom index with identifier 2 is read; the corresponding surface data structure and the boundary min and max values of variable u are found based on the list of Geom indexes in the stored Geom; different types of surface entities are created based on the geometric representation within the surface data structure and the boundary min and max values of variable u.
[0053] Preferably, step S8 specifically includes the following sub-steps:
[0054] Step S81: Obtain the position coordinates of the mouse on the screen;
[0055] Step S82: Emit a ray from the three-dimensional spatial position corresponding to the mouse position coordinates on the screen;
[0056] Step S83: Traverse the bounding boxes of all model nodes in the space;
[0057] Step S84: Determine whether the bounding box intersects with the ray. If so, obtain the first model that intersects with the ray, which is the 3D model selected by the mouse position.
[0058] Preferably, in step S9, the selected feature is determined based on the topological relationship hierarchy data of the features, specifically including the following sub-steps:
[0059] Step S91: Traverse and find intersections in the Mesh mesh at the surface feature level. If an intersection between a surface feature and a ray is detected, update the temporary Mesh mesh to the Mesh mesh of that surface feature.
[0060] Step S92: Traverse and find intersections of the mesh on the edge features formed by the face features. If an edge feature is found to intersect with a ray, update the temporary mesh to the mesh of that edge feature.
[0061] Step S93: Traverse and find intersections of the mesh grid on the point features formed by the edge features. If a point feature is found to intersect with a ray, update the temporary mesh grid to the mesh grid of that point feature.
[0062] The technical solutions provided in this application embodiment may include the following beneficial effects:
[0063] This solution, without altering the CAD software's rendering of 3D models using triangular meshes (Mesh), leverages the .Brep format to parse and identify key features of the 3D model. This makes the model's critical features easier to identify and select, reducing the time spent building simulation scenes. Attached Figure Description
[0064] Figure 1 This is a flowchart illustrating the steps involved in analyzing and recognizing the geometric topological features of a 3D model. Detailed Implementation
[0065] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0066] A method for analyzing and identifying geometric topological features of a 3D model, comprising the following steps:
[0067] Step S1: Import the .STEP format model file;
[0068] Step S2: Convert and export the .STEP format model file to a .Brep format model file;
[0069] Step S3: Parse the geometric and topological feature information of the model stored in the .Brep format model file, where the geometric and topological feature information of the model includes the geometric information and the topological information of the model;
[0070] Step S4: Import the feature data of the model, wherein the feature data includes the geometric data of the features and the topological relationship hierarchy data of the features;
[0071] Step S5: Store the topological relationship hierarchy data of the features;
[0072] Step S6: Convert the geometric data of the features into a mesh and set the display mode of the mesh to notdisplay mode;
[0073] Step S7: Visualize and render the Mesh.
[0074] Step S8: Obtain the position coordinates of the mouse on the screen, and perform ray detection based on the mouse position coordinates;
[0075] Step S9: Determine whether the ray has detected a mesh. If so, determine the selected feature based on the topological relationship hierarchy data of the feature. If not, continue detection until a mesh is detected.
[0076] Step S10: Based on the selected feature, set its mesh display mode to display mode to complete the identification of the model's geometric topology feature information.
[0077] This scheme proposes a method for analyzing and identifying the geometric topological features of a 3D model, such as... Figure 1As shown, the first step is to import the .STEP format model file. Specifically, the .STEP format model file is a common data exchange intermediate format for CAD. The second step is to convert and export the .STEP format model file to a .Brep format model file. Specifically, because the .STEP format model file sacrifices flexibility and agility to accommodate various information, its data storage is relatively large and redundant. Therefore, directly parsing the .STEP format is quite complex. This solution uses the CAD open-source library OpenCascade (OCC) to convert the .STEP file to a .Brep format file, whose geometric and topological relationships are clear and easy to parse. The third step is to parse the geometric and topological feature information of the model stored in the .Brep format model file. This geometric and topological feature information includes the model's geometric information and topological information. Specifically, the .Brep format clearly stores the model's geometric and topological feature information in layers: geometric information and topological information. The geometric information stores the specific expressions of various topological structures of the model, while the topological information stores the topological hierarchy and specific topological values, which are used to substitute into the expressions of the geometric information. The fourth step is to import the model's feature data. This feature data includes the geometric data and the topological hierarchy of the features. Specifically, the .Brep format model file stores the model's feature data, which includes vertices, edges, loops, and faces. Importing this model feature data facilitates subsequent feature extraction and identification. The fifth step is to store the topological hierarchy of the features, allowing for easy retrieval later. The sixth step is to convert the geometric data of the features into a mesh and set its display mode to "not display." Specifically, the mesh is a triangular mesh, and the mesh structure is the data structure class ultimately input into a typical 3D engine for visualization and rendering. "Not display" is one of the status flags for the mesh, meaning it is not displayed. Feature visualization is generally not shown on the screen; the mesh is only displayed when a feature is detected using raycasting based on the mouse position. The seventh step is to visualize and render the mesh, specifically displaying it on the screen. This process is handled by the 3D engine. The eighth step is to obtain the mouse position coordinates on the screen and perform raycasting based on these coordinates. Raycasting is a common method used in 3D engines to select objects using the mouse. The ninth step is to determine if the raycasting detects a mesh. If so, the selected feature is determined based on the topological hierarchy of the features. If not, detection continues until a mesh is detected. Specifically, the model detects specific features at the user's mouse position to facilitate selection and other operations.The tenth step is to set the display mode of the selected feature's mesh to "display" mode to complete the identification of the model's geometric topological feature information. Specifically, this is done by updating the display state of the selected feature's mesh to "display." "Display" is one of the mesh's status markers, meaning "shown," to clearly indicate to the user that the feature has been selected. Further explanation is that the selected feature is highlighted on the screen, proving that the feature has been recognized.
[0078] This solution, without altering the CAD software's rendering of 3D models using triangular meshes (Mesh), leverages the .Brep format to parse and identify key features of the 3D model. This makes the model's critical features easier to identify and select, reducing the time spent building simulation scenes.
[0079] Preferably, in step S2, the model file in .STEP format is converted to a model file in .Brep format, which specifically includes the following sub-steps:
[0080] Step S21: Create the STEPControl_Reader class in the CAD open-source library Open Cascade (OCC) and call the application programming interface (API) of the ReadFile function to read .STEP format files;
[0081] Step S22: Call the TransferRoot() and Shape() methods from OCC to convert the data stored in the .STEP format file into entities defined by OCC;
[0082] Step S23: Call the Write() method of the BRepTools class from OCC to write the parsed and converted entity geometry topology data into a .Brep file in ASCII format, thus completing the conversion.
[0083] In this embodiment, the .Brep format model file clearly stores various topological information data that make up the three-dimensional model entity. In this solution, these data are only used for the identification and extraction of key model features. Although the OCC library also provides an application programming interface (API) for triangular meshing of .STEP format files, it is relatively easy to convert .STEP format files to .obj format files, and most CAD software can export them. Therefore, this solution does not perform additional triangular mesh data parsing through the .Brep format.
[0084] Preferably, in step S3, the geometric topological feature information of the model stored in the .Brep format model file is parsed, including parsing the geometric information of the model, specifically including the following steps:
[0085] Step S31: Perform string segmentation based on the geometric information of the curves and surfaces of all constituent entities in the model. The geometric information of the curves and surfaces of all constituent entities in the model includes three main categories: two-dimensional modeling curves (Curve2ds), three-dimensional modeling curves (Curves), and curved planes (Surfaces).
[0086] Step S32: Read the detailed data for each major category;
[0087] Step S33: Read the identifier of a subdivided data and determine which major category the subdivided data belongs to, and obtain the determination result;
[0088] Step S34: Create the corresponding data structure based on the judgment result. The data structure is used to read and store subsequent feature geometry expression data.
[0089] Step S35: Add data structures of the same category to the same list in the order they are read, so that they can find the corresponding feature geometric expressions based on the index.
[0090] Specifically, the .Brep format model file divides the geometric and topological information of the model into two parts. Therefore, it is necessary to first split the .Brep format model file into two parts by using "TShape" as the keyword. The geometric information stores the geometric information of all the curves and surfaces that make up the entities in the model, including three major categories: two-dimensional modeling curves (Curve2ds), three-dimensional modeling curves (Curves), and surface surfaces (Surfaces). Each major category of geometric information has its own subcategories. Curves are divided into lines (Line), circles (Circle), Bezier curves (Bezier Curve), and B-spline curves (B-Spline Curve), etc., while Surfaces are divided into planes (Plane), spheres (Sphere), and cylinders (Cylinder), etc. In each geometric information, the first character is the identifier, which indicates what category the geometry is (e.g., in Curves, 1 indicates a straight line and 2 indicates a circle). The subsequent characters are the mathematical definition expression of the geometry. In this scheme, the topological feature data is only used for reading and recognition and not for modeling. Therefore, it is only necessary to parse common and general simple features, such as the four important topological features of the model: faces, loops, edges and vertices.
[0091] Preferably, in step S31, the three-dimensional modeling curves include lines, circles, and B-spline curves;
[0092] The mathematical expression for a straight line is:
[0093] C(u)=P1+u·D1, u∈(-∞,+∞)
[0094] Where C(u) represents the mathematical expression of a straight line; P1 represents the coordinates of a three-dimensional point; D1 represents the three-dimensional direction; and u is a variable parameter.
[0095] The mathematical expression for a circle is:
[0096] C(a)=P2+r·(cos(a)·D x +sin(a)·D y ), a∈[0, 2π)
[0097] Where C(a) represents the mathematical expression for a circle; P2 represents the coordinates of the center point in space; r represents the radius of the circle; D x and D y All directions are three-dimensional; 'a' is a variable parameter;
[0098] The mathematical expression for a B-spline curve is:
[0099]
[0100] Where C(b) represents the mathematical expression of the B-spline curve; m represents the degree; n represents the number of segments; B i h represents the i-th point of the B-spline curve; i N represents the weight of the i-th point of the B-spline curve; i,m+1 (b) represents the node vector value of the i-th point of the B-spline curve; b represents the variable parameter; b1 and b k These represent the starting and ending values of the curve, respectively; k represents the node vector;
[0101] Surfaces include planes, spheres, and cylinders;
[0102] The mathematical expression for a plane is:
[0103] S(c, d) = P³ + c·D c +d·D d , (c, d)∈(-∞, +∞)×(-∞, +∞)
[0104] Where S(c, d) represents the mathematical expression for the plane; P3 represents the coordinates of a three-dimensional point; D c and D d Both represent three-dimensional directions; c and d represent D respectively. c and D d Variable parameters in two three-dimensional directions;
[0105] The mathematical expression for a cylindrical surface is:
[0106] S(e,f)=P4+r·(cOs(e)·D) x +sin(e)·D y )+f·D f , (e, f)∈[0, 2π)×(-∞, +∞)
[0107] Where S(e, f) represents the mathematical expression for the cylindrical surface; P4 represents the coordinates of a three-dimensional point; r represents the radius of the circle; D x D y D e and D f Both are three-dimensional; e and f are D respectively. e and D f Variable parameters in two three-dimensional directions;
[0108] The mathematical expression for a sphere is:
[0109] S(g,h)=P5+r·(h)·(cos(g)·D x +sin(g)·D y )·r·sin(h)·D z , (g, h)∈[0, 2π)×[-π / 2, π / 2]
[0110] Where S(g, h) represents the mathematical expression for the sphere; P5 represents the coordinates of a three-dimensional point; r represents the radius of the circle; D x D y D z D g and D h Both are three-dimensional, with g and h being D and H, respectively. g and D h Variable parameters in two three-dimensional directions.
[0111] In this embodiment, the geometric information stores the specific mathematical expressions of various topological structures of the model, and the topological information stores the topological hierarchy and specific topological values. When calculating a feature of a certain 3D model, it is necessary to traverse the topological information to obtain the hierarchy, and then substitute each specific feature data of the hierarchy back into the mathematical expression of the geometric information to obtain the feature.
[0112] Preferably, in step S3, parsing the geometric topological feature information of the model stored in the .Brep format model file also includes parsing the topological information of the model, specifically including the following steps:
[0113] Step S36: Read the key fields in the TShape field in the specified order, where the key fields include Fa, Wi, Ed and Ve fields;
[0114] Step S37: Determine which field the key field in the TShape field belongs to, and perform the corresponding operation, as follows:
[0115] If the key field is Ve, then read the 3D coordinate information; create an array of Points;
[0116] When the key field is the Ed field, the Geom index with identifier 1 is read; the corresponding curve data structure is found in the list of Geom indexes in the storage Geom; the boundary min and max values of variable u are read; the indexes of the points that make up the edge are read; and different types of curve entities are created based on the geometric expression in the curve data structure, the boundary min and max values of variable u, and the indexes of the points that make up the edge.
[0117] When the key field is the Wi field, the indexes of the Ed fields that make up the ring are read; a list is created to store these indexes as ring entities;
[0118] When the key field is Fa, the index of the stored Wi field is read to find the corresponding ring entity; the list within the ring entity is traversed to find the index of all Ed fields; all Ed fields are found based on the index of the Ed field and the Geom index with identifier 2 is read; the corresponding surface data structure and the boundary min and max values of variable u are found based on the list of Geom indexes in the stored Geom; different types of surface entities are created based on the geometric representation within the surface data structure and the boundary min and max values of variable u.
[0119] In one embodiment, in a .Brep format model file, an entity consists of multiple faces, a face consists of one or more loops, a loop consists of multiple edges, and an edge is defined by multiple vertices. Multiple key fields, Fa, Wi, Ed, and Ve, are used to mark the corresponding information. The entire file is stored in the order Ve-Ed-Wi-Fa. Specifically, each Fa stores the indexes of the Wi of all loops constituting the face and the Geom index of the surface; each Wi stores the indexes of the Ed of all loops constituting the rings; each Ed stores the indexes of the Ve vertices constituting the edges; and also stores the Geom indexes representing the Curve2d and Curve3d of the edges (distinguished by identifiers, where 1 represents Curve3d and 2 represents Curve2d) and the boundary min and max values of the variable u. Ve stores the three-dimensional coordinates of the vertices.
[0120] Preferably, step S8 specifically includes the following sub-steps:
[0121] Step S81: Obtain the position coordinates of the mouse on the screen;
[0122] Step S82: Emit a ray from the three-dimensional spatial position corresponding to the mouse position coordinates on the screen;
[0123] Step S83: Traverse the bounding boxes of all model nodes in the space;
[0124] Step S84: Determine whether the bounding box intersects with the ray. If so, obtain the first model that intersects with the ray, which is the 3D model selected by the mouse position.
[0125] In this embodiment, ray detection is a common method used in 3D engines to select objects with the mouse. A ray is emitted from the mouse position, and it is determined whether the ray intersects with any objects. The model with the closest intersection is the 3D object obtained by clicking the mouse.
[0126] Preferably, in step S9, the selected feature is determined based on the topological relationship hierarchy data of the features, specifically including the following sub-steps:
[0127] Step S91: Traverse and find intersections in the Mesh mesh at the surface feature level. If an intersection between a surface feature and a ray is detected, update the temporary Mesh mesh to the Mesh mesh of that surface feature.
[0128] Step S92: Traverse and find intersections of the mesh on the edge features formed by the face features. If an edge feature is found to intersect with a ray, update the temporary mesh to the mesh of that edge feature.
[0129] Step S93: Traverse and find intersections of the mesh grid on the point features formed by the edge features. If a point feature is found to intersect with a ray, update the temporary mesh grid to the mesh grid of that point feature.
[0130] In this embodiment, due to the hierarchical relationship of the feature topology, this scheme stores the created meshes of various features using the corresponding hierarchical structure during the recognition process. When performing ray detection at the mouse position, a temporary mesh variable is maintained simultaneously. By traversing and finding the meshes on all levels of features (faces, edges, and points), the last updated temporary mesh should be the mesh of the smallest level of the identified feature in the current intersection result, i.e., the mesh of the point feature. At this point, the mesh of this feature is rendered on the screen, representing the feature identified at the current mouse position.
[0131] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0132] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for analyzing and identifying the geometric topological features of a three-dimensional model, characterized in that: Includes the following steps: Step S1: Import the .STEP format model file; Step S2: Convert and export the .STEP format model file to a .Brep format model file; Step S3: Parse the geometric and topological feature information of the model stored in the .Brep format model file, where the geometric and topological feature information of the model includes the geometric information and the topological information of the model; Step S4: Import the feature data of the model, wherein the feature data includes the geometric data of the features and the topological relationship hierarchy data of the features; Step S5: Store the topological relationship hierarchy data of the features; Step S6: Convert the geometric data of the features into a mesh and set the display mode of the mesh to notdisplay mode; Step S7: Visualize and render the Mesh. Step S8: Obtain the position coordinates of the mouse on the screen, and perform ray detection based on the mouse position coordinates; Step S9: Determine whether the ray detects a mesh. If yes, determine the selected feature based on the topological relationship hierarchy data of the feature. If no, continue detection until a mesh is detected. Step S10: Based on the selected feature, set its mesh display mode to display mode to complete the identification of the model's geometric topology feature information; In step S9, the selected features are determined based on the topological relationship hierarchy data of the features, specifically including the following sub-steps: Step S91: Traverse and find intersections in the Mesh mesh at the surface feature level. If an intersection between a surface feature and a ray is detected, update the temporary Mesh mesh to the Mesh mesh of that surface feature. Step S92: Traverse and find intersections of the mesh on the edge features formed by the face features. If an edge feature is found to intersect with a ray, update the temporary mesh to the mesh of that edge feature. Step S93: Traverse and find intersections of the mesh grid on the point features formed by the edge features. If a point feature is found to intersect with a ray, update the temporary mesh grid to the mesh grid of that point feature.
2. The method for analyzing and recognizing the geometric topological features of a three-dimensional model according to claim 1, characterized in that: In step S2, the .STEP format model file is converted to the .Brep format model file, which specifically includes the following sub-steps: Step S21: Create the STEPControl_Reader class in the CAD open-source library OCC and call the ReadFile function (Application Programming Interface API) to read .STEP format files; Step S22: Call the TransferRoot() and Shape() methods from OCC to convert the data stored in the .STEP format file into entities defined by OCC; Step S23: Call the Write() method of the BRepTools class from OCC to write the parsed and converted entity geometry topology data into a .Brep file in ASCII format, thus completing the conversion.
3. The method for analyzing and recognizing the geometric topological features of a three-dimensional model according to claim 1, characterized in that: In step S3, the geometric and topological feature information of the model stored in the .Brep format model file is parsed, including parsing the geometric information of the model, specifically including the following steps: Step S31: Perform string segmentation based on the geometric information of the curves and surfaces of all constituent entities in the model. The geometric information of the curves and surfaces of all constituent entities in the model includes three categories: two-dimensional modeling curves Curve2ds, three-dimensional modeling curves Curves, and curved planes Surfaces. Step S32: Read the detailed data for each major category; Step S33: Read the identifier of a subdivided data and determine which major category the subdivided data belongs to, and obtain the determination result; Step S34: Create the corresponding data structure based on the judgment result. The data structure is used to read and store subsequent feature geometry expression data. Step S35: Add data structures of the same category to the same list in the order they are read, so that they can find the corresponding feature geometric expressions based on the index.
4. The method for analyzing and recognizing the geometric topological features of a three-dimensional model according to claim 3, characterized in that: In step S31, the three-dimensional modeling curves include lines, circles, and B-spline curves. The mathematical expression for a straight line is: in, The mathematical expression for a straight line; Represents the coordinates of a three-dimensional point; Indicates three-dimensional direction; These are variable parameters; The mathematical expression for a circle is: ) in, The mathematical expression for a circle; Represents the coordinates of the center point in space; Indicates the radius of the circle; and All are three-dimensional; These are variable parameters; The mathematical expression for a B-spline curve is: C = ,b in, C The mathematical expression for a B-spline curve; m represents the degree; n represents the number of segments; This represents the i-th point of the B-spline curve; This represents the weight of the i-th point of the B-spline curve; This represents the node vector value of the i-th point of the B-spline curve; b Indicates a variable parameter; These represent the starting and ending values of the curve, respectively; k represents the node vector; Surfaces include planes, spheres, and cylinders.
5. The method for analyzing and recognizing the geometric topological features of a three-dimensional model according to claim 3, characterized in that: In step S3, the geometric and topological feature information of the model stored in the .Brep format model file is parsed, which also includes parsing the topological information of the model, specifically including the following steps: Step S36: Read the key fields in the TShape field in the specified order, where the key fields include Fa, Wi, Ed and Ve fields; Step S37: Determine which field the key field in the TShape field belongs to, and perform the corresponding operation, as follows: When the key field is the Ve field, read the 3D coordinate information; create an array of vertices Point; When the key field is the Ed field, the Geom index with identifier 1 is read; the corresponding curve data structure is found in the list of Geom indexes in the storage Geom; the boundary min and max values of variable u are read; the indices of the vertices that make up the edge are read; and different types of curve entities are created based on the geometric expression in the curve data structure, the boundary min and max values of variable u, and the indices of the vertices that make up the edge. When the key field is the Wi field, the indexes of the Ed fields that make up the ring are read; a list is created to store these indexes as ring entities; When the key field is Fa, the index of the stored Wi field is read to find the corresponding ring entity; the list within the ring entity is traversed to find the index of all Ed fields; all Ed fields are found based on the index of the Ed field and the Geom index with identifier 2 is read; the corresponding surface data structure and the boundary min and max values of variable u are found based on the list of Geom indexes in the stored Geom; different types of surface entities are created based on the geometric representation within the surface data structure and the boundary min and max values of variable u. Here, identifier 1 refers to the category identifier of the three-dimensional curve Curve3d data structure in the Geom list, and identifier 2 refers to the category identifier of the two-dimensional curve Curve2d data structure in the Geom list.
6. The method for analyzing and recognizing the geometric topological features of a three-dimensional model according to claim 1, characterized in that: Step S8 specifically includes the following sub-steps: Step S81: Obtain the position coordinates of the mouse on the screen; Step S82: Emit a ray from the three-dimensional spatial position corresponding to the mouse position coordinates on the screen; Step S83: Traverse the bounding boxes of all model nodes in the space; Step S84: Determine whether the bounding box intersects with the ray. If so, obtain the first model that intersects with the ray, which is the 3D model selected by the mouse position.
Citation Information
Patent Citations
Geometry based search method for 3D CAx / PDM repositories
US20060012597A1
Method for recognizing feature of 3D solid model
US20080126307A1