Method and system based on the association between topological objects and discrete geometry in model lightweighting
By grouping and integrating topological structures and discrete data in 3D CAD software, the problem that topological objects cannot be associated with discrete geometry is solved, and surface or edge highlighting and attribute acquisition are realized to meet users' measurement and assembly needs.
Patent Information
- Application Number
- CN202311264136.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2043-09-28
AI Technical Summary
In the existing technology, the topological object of the model cannot be associated with the discrete geometry, resulting in the inability to directly highlight the surface or obtain the attribute information corresponding to the surface, and cannot meet the user's measurement and assembly needs.
Obtain the topological structure through the secondary development SDK package of the 3D CAD software, group the faces/edges according to their colors, extract and merge the discrete data, integrate it into the total face array/total edge array, store it as a topology binary file, and combine the faces with the same color / The discrete data of edges are stored in the same discrete data binary file and split into sub-discrete data according to the starting index to realize the association between topological objects and discrete geometry.
This enables users to determine the corresponding topological object and its attributes when selecting a face or edge, which facilitates subsequent operations such as highlighting and measurement, and meets the user's assembly and measurement needs.
Smart Images

Figure CN117313470B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of CAD technology, and in particular to a method and system based on the association of topological objects and discrete geometry in model lightweighting. Background Art
[0002] Discrete geometry and topological objects are different representations of a model. Topological objects are the basic units of model representation, such as faces and edges. Discrete geometry is a collection of triangular meshes / polyline segments of a model, which is an approximate representation of topological objects and is used for graphics rendering.
[0003] In the lightweight format, the model's topological objects and discrete geometry are stored separately. Therefore, when the user needs to select a face on the screen to highlight it, the system background cannot immediately determine which topological object the triangle on the face selected by the user is associated with. Since the topological object corresponding to the triangle cannot be obtained, the face associated with the topological object cannot be directly highlighted, and information such as the area corresponding to the face cannot be obtained, which cannot meet subsequent measurement or assembly needs.
[0004] Based on this, this patent provides a method and system for associating topological objects and discrete geometry in model lightweighting. By associating discrete geometry and topological objects, when the user selects discrete geometry on the screen, the topological object associated with it can be obtained, and the attribute information of the object can be obtained, which is convenient for the user's subsequent operations. Summary of the invention
[0005] The present invention provides a method and system for associating topological objects and discrete geometry in model lightweighting, so as to solve the defect that the prior art cannot associate topological objects with discrete geometry and thus cannot meet the operation requirements of users, and realize the measurement and assembly requirements of users.
[0006] The present invention provides a method for associating topological objects and discrete geometric objects in model lightweighting, comprising:
[0007] Obtaining the topological structure of the three-dimensional model through the secondary development SDK package of the three-dimensional CAD software, wherein the topological structure includes all faces and edges of the three-dimensional model;
[0008] Grouping the faces / edges according to their colors, respectively, so that faces / edges of the same color are grouped into the same group;
[0009] For each group, the discrete data of all faces / edges are extracted and merged to obtain a discrete data; wherein the discrete data includes a vertex data object, a vertex index array, a topological object ID set, and a starting index of the topological object set in the vertex index array; the vertex data object records all vertices in the current group, the vertex index array records the indexes of all triangles / line segments in the current group, the topological object ID set records the IDs of all faces / edges in the current group, the starting index of the topological object set in the vertex index array, records the starting index of the first triangle of all faces in the current group in the vertex index array, or records the starting index of the first line segment of all edges in the current group in the vertex index array; the face is composed of a plurality of triangles, the edge is composed of a plurality of line segments, and the vertex is the vertex of the triangle / line segment;
[0010] Integrate the faces / edges in the topological structure into a total face array / total edge array, store it into a topological binary file, and record a first index; the first index is the index of the ID of each face / edge in the total face array / total edge array;
[0011] The discrete data of faces / edges of the same color are stored in the same discrete data binary file, and the starting index of each set of topological objects in the vertex index array is recorded;
[0012] According to the starting index, the discrete data is split into a plurality of sub-discrete data, and according to the first index, each topological object in the total face array / total edge array is associated with corresponding discrete data.
[0013] According to a method based on the association of topological objects and discrete geometric elements in model lightweighting provided by the present invention, after grouping the faces / edges according to their colors respectively, and before extracting the discrete data of all faces / edges in each group, the method further includes: converting the faces / edges in each grouped group into faces / edges in a lightweight format.
[0014] According to a method based on associating topological objects and discrete geometry in model lightweighting provided by the present invention, the three-dimensional CAD software includes Tiangong CAD.
[0015] The present invention also provides a system based on the association of topological objects and discrete geometry in model lightweighting, comprising:
[0016] A topology structure acquisition module is used to acquire the topology structure of the three-dimensional model through the secondary development SDK package of the three-dimensional CAD software, and the topology structure includes all faces and edges of the three-dimensional model;
[0017] A grouping module, used for grouping the faces / edges according to their colors, so as to group faces / edges of the same color into the same group;
[0018] A merging module is used to extract the discrete data of all faces / edges for each group and merge them to obtain a discrete data; wherein the discrete data includes a vertex data object, a vertex index array, a topological object ID set, and a starting index of the topological object set in the vertex index array; the vertex data object records all vertices in the current group, the vertex index array records the indexes of all triangles / line segments in the current group, the topological object ID set records the IDs of all faces / edges in the current group, the starting index of the topological object set in the vertex index array, records the starting index of the first triangle of all faces in the current group in the vertex index array, or records the starting index of the first line segment of all edges in the current group in the vertex index array; the face is composed of a plurality of triangles, the edge is composed of a plurality of line segments, and the vertex is the vertex of the triangle / line segment;
[0019] A first index recording module is used to integrate the faces / edges in the topological structure into a total face array / total edge array, store it into a topological binary file, and record a first index; the first index is the index of the ID of each face / edge in the total face array / the total edge array;
[0020] A starting index recording module is used to store the discrete data of faces / edges of the same color in the same discrete data binary file, and record the starting index of each set of topological objects in the vertex index array;
[0021] The topological data and discrete data corresponding module is used to split the discrete data into multiple sub-discrete data according to the starting index. According to the first index, each topological object of the total face array / total edge array is associated with corresponding discrete data.
[0022] According to the present invention, a system based on the association of topological objects and discrete geometry in model lightweighting also includes:
[0023] A lightweight module is used to convert the faces / edges in each group into lightweight format after grouping the faces / edges according to their colors and before extracting the discrete data of all faces / edges in each group.
[0024] According to a system based on the association of topological objects and discrete geometry in model lightweighting provided by the present invention, the three-dimensional CAD software includes Tiangong CAD.
[0025] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for associating topological objects and discrete geometric elements in model lightweighting based on any one of the above items is implemented.
[0026] The method and system based on the association of topological objects and discrete geometry in model lightweighting provided by the present invention obtain the topological structure of a three-dimensional model through a secondary development SDK package of a three-dimensional CAD software; group the faces / edges according to the colors of the faces / edges respectively, so that the faces / edges of the same color are divided into the same group; for each group, the discrete data of all faces / edges are extracted and merged to obtain a discrete data; all faces / edges in the topological structure are integrated into a total face array / total edge array, stored as a topological binary file, and a first index is recorded; the first index is the index of the ID of each face / edge in the total face array / total edge array; according to the color of the face / edge, the discrete data are stored in discrete data binary files respectively, so that the discrete data of the faces / edges of the same color are stored in the same discrete data binary file, and the starting index of each group of topological object sets in the vertex index array is recorded; according to the starting index, the discrete data is split into a plurality of sub-discrete data, wherein each face / edge in the discrete data corresponds to a sub-discrete data, and according to the first index, each topological object in the total face array / total edge array is associated with the corresponding discrete data. Through the above method, the topological object and discrete geometry are associated, which can be applied to operations such as selection and highlighting of the topological object in the WEB preview, making it easier to realize subsequent measurement and assembly functions. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0028] Figure 1 It is a flow chart of the method based on the association of topological objects and discrete geometry in model lightweighting provided by the present invention;
[0029] Figure 2 It is a structural diagram of a system based on topological objects and discrete geometric associations in model lightweighting provided by the present invention. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0031] Combine the following Figure 1-Figure 2 The present invention describes a method and system for associating topological objects and discrete geometric objects in model lightweighting.
[0032] Figure 1 A flowchart of a method for associating topological objects and discrete geometry in model lightweighting provided by the present invention is illustrated;
[0033] like Figure 1 As shown, the method based on the association of topological objects and discrete geometry in model lightweighting provided by the present invention includes:
[0034] S1. Obtain the topological structure of the three-dimensional model through the three-dimensional CAD software secondary development SDK package (Software Development Kit software development tool kit), and the topological structure includes all the faces and edges of the three-dimensional model.
[0035] Specifically, a three-dimensional model is first obtained, and then the three-dimensional model is analyzed using secondary developed three-dimensional CAD software to obtain a topological structure of the three-dimensional model.
[0036] Optionally, the 3D CAD software in step S1 includes Tiangong CAD.
[0037] S2. Group the faces / edges according to their colors, so that faces / edges of the same color are grouped into the same group.
[0038] The topological structure obtained in step S1 also includes attributes such as the color of the face or edge. The faces are grouped according to the color of the face, and the edges are grouped according to the color of the edge, so that the faces of the same color are grouped into the same group, and the edges of the same color are grouped into the same group. For example, when there are faces of three colors, red, green, and blue, three groups of faces are obtained after grouping, and the same is true for the edges, which will not be repeated here.
[0039] As an optional implementation, after step S2 and before step S3, the method further includes: converting the faces / edges in each group after grouping into faces / edges in a lightweight format.
[0040] For example, convert all faces in the red face group to lightweight format faces.
[0041] S3. For each group, extract the discrete data of all faces / edges and merge them to obtain a discrete data; wherein the discrete data includes a vertex data object, a vertex index array, a topological object ID set, and a starting index of the topological object set in the vertex index array; the vertex data object records all vertices in the current group, the vertex index array records the indexes of all triangles / line segments in the current group, the topological object ID set records the IDs of all faces / edges in the current group, the starting index of the topological object set in the vertex index array, records the starting index of the first triangle of all faces in the current group in the vertex index array, or records the starting index of the first line segment of all edges in the current group in the vertex index array; a face is composed of a number of triangles, an edge is composed of a number of line segments, and a vertex is a vertex of a triangle / line segment.
[0042] In step S3, for each group, the discrete data of all faces / edges are extracted and merged to obtain a discrete data, which means that the discrete data of all faces / edges of each group are extracted respectively, and each group is merged into a discrete data. The merged discrete data (TessellationData) includes a vertex data object (VertexData), a vertex index array (Indices), a topological object ID set (brepEntitis), and a starting index (brepPrimitiveGroup) of the topological object set in the vertex index array.
[0043] It should be noted that the discrete geometry (Tessellation) of a face is generally composed of multiple triangles (Triangle), and a triangle is composed of 3 xyz space points (Point3D). The discrete geometry of an edge (Edge) is generally composed of multiple line segments, and a line segment is composed of 2 xyz space points. Because many space points are repeated, an index (Index) is introduced to remove repeated xyz space points. That is, the xyz of non-repeated space points are stored in an array, and the discrete geometry of the face will only record the index of the 3 vertices of each triangle in the array, and the discrete geometry of the edge will only record the index of the 2 vertices of each line segment in the array. The discrete geometry of faces and edges is a mature solution for computer rendering.
[0044] The vertex index array records the indices of all triangles / line segments in the current group, where the number of indices is determined by the number of vertices. A triangle contains three vertices, so it contains three indices, and a line segment has two vertices, so it contains two indices.
[0045] The topological object ID set records the IDs of all faces / edges in the current group. If the current group is a face group, the IDs of all faces in the group are continuous; if the current group is an edge group, the IDs of all edges in the group are continuous. It should be noted that a discrete data (TessellationData) contains only one of faces or edges.
[0046] The starting index of the topological object collection in the vertex index array records the starting index of the first triangle of all faces in the current group in the vertex index array.
[0047] S4. Integrate the faces / edges in the topological structure into a total face array / total edge array, store it into a topological binary file, and record the first index; the first index is the index of the ID of each face / edge in the total face array / total edge array.
[0048] For example, integrate the red, green, and blue faces into a total face array, and record the index of each face ID in the total face array (FaceId-FaceIndex). Integrate the red, green, and blue edges into a total edge array, and record the index of each edge ID in the total edge array.
[0049] S5. Store the discrete data of faces / edges of the same color in the same discrete data binary file, and record the starting index of each set of topological objects in the vertex index array.
[0050] In the present invention, grouping is performed according to the color of faces / edges, which not only prevents the discrete data binary file from being too large, making it inconvenient to write files in parallel and read files by the rendering end, but also facilitates direct graphics rendering on the WEB end, that is, directly rendering faces / edges of the same color.
[0051] S6. Split the discrete data into multiple sub-discrete data according to the starting index. According to the first index, each topological object in the total face array / total edge array is associated with corresponding discrete data.
[0052] According to the starting index of the topological object set in the vertex index array, the discrete data can be split into multiple sub-discrete data. According to the index of each topological object ID in the total array of the corresponding type (face / edge), each face or edge corresponds to a sub-discrete data. Since the discrete data corresponding to each face (Face) and the discrete data corresponding to each edge (Edge) are obtained, and the face or edge belongs to the topological structure, the corresponding relationship between the topological structure and the discrete data is obtained, thereby realizing the correspondence between the topological structure and the discrete data.
[0053] The method for associating topological objects and discrete geometry in model lightweighting provided by the present invention can associate topological objects with discrete geometry, so that when a user needs to select a certain face on the screen for highlighting, after the user clicks the screen, the background will determine which triangle face the user has selected, and obtain which topological object the triangle face is associated with, thereby obtaining its topological object and its attributes, such as area, perimeter, normal and other information, to facilitate user operation.
[0054] In addition, when the user needs to measure the area of a certain face, he first clicks on the screen. The system background can know which triangle face the clicked position belongs to, and then determine which topological object it belongs to. The geometric information of the corresponding topological object can be obtained, and then the topological object can be highlighted.
[0055] Figure 2 An example of a structural diagram of a system based on topological objects and discrete geometric associations in model lightweighting provided by the present invention is provided;
[0056] like Figure 2 As shown, the system based on the association of topological objects and discrete geometry in model lightweighting provided by the present invention includes:
[0057] The topology structure acquisition module M1 is used to obtain the topology structure of the three-dimensional model through the secondary development SDK package of the three-dimensional CAD software. The topology structure includes all the faces and edges of the three-dimensional model.
[0058] A grouping module M2, for grouping faces / edges according to their colors, so that faces / edges of the same color are grouped into the same group;
[0059] The merging module M3 is used to extract the discrete data of all faces / edges for each group and merge them to obtain a discrete data; wherein the discrete data includes a vertex data object, a vertex index array, a topological object ID set, and a starting index of the topological object set in the vertex index array; the vertex data object records all vertices in the current group, the vertex index array records the indexes of all triangles / line segments in the current group, the topological object ID set records the IDs of all faces / edges in the current group, the starting index of the topological object set in the vertex index array, records the starting index of the first triangle of all faces in the current group in the vertex index array, or records the starting index of the first line segment of all edges in the current group in the vertex index array; a face is composed of a number of triangles, an edge is composed of a number of line segments, and a vertex is a vertex of a triangle / line segment;
[0060] The first index recording module M4 is used to integrate the faces / edges in the topological structure into a total face array / total edge array, store it into a topological binary file, and record the first index; the first index is the index of the ID of each face / edge in the total face array / total edge array;
[0061] A starting index recording module M5 is used to store the discrete data of the faces / edges of the same color in the same discrete data binary file, and record the starting index of each group of topological objects in the vertex index array;
[0062] The topological data and discrete data corresponding module M6 is used to split the discrete data into multiple sub-discrete data according to the starting index. According to the first index, each topological object of the total face array / total edge array is associated with the corresponding discrete data.
[0063] Optionally, the system based on the association of topological objects and discrete geometric shapes in model lightweighting provided by the present invention also includes a lightweight module for converting the faces / edges in each group into lightweight format faces / edges after grouping the faces / edges according to their colors and before extracting discrete data of all faces / edges in each group.
[0064] In some embodiments, the three-dimensional CAD software described in the topology structure acquisition module includes Tiangong CAD.
[0065] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method based on the association between topological objects and discrete geometry in model lightweighting as described in any one of the above items is implemented, and the method comprises:
[0066] The topological structure of the 3D model is obtained through the secondary development SDK package of the 3D CAD software. The topological structure includes all the faces and edges of the 3D model.
[0067] Group faces / edges according to their colors respectively, so that faces / edges of the same color are grouped into the same group;
[0068] For each group, the discrete data of all faces / edges are extracted and merged to obtain a discrete data; wherein the discrete data includes a vertex data object, a vertex index array, a topological object ID set, and a starting index of the topological object set in the vertex index array; the vertex data object records all vertices in the current group, the vertex index array records the indexes of all triangles / line segments in the current group, the topological object ID set records the IDs of all faces / edges in the current group, the starting index of the topological object set in the vertex index array, records the starting index of the first triangle of all faces in the current group in the vertex index array, or records the starting index of the first line segment of all edges in the current group in the vertex index array; a face is composed of a number of triangles, an edge is composed of a number of line segments, and a vertex is a vertex of a triangle / line segment;
[0069] Integrate the faces / edges in the topological structure into a total face array / total edge array, store it into a topological binary file, and record the first index; the first index is the index of the ID of each face / edge in the total face array / total edge array;
[0070] The discrete data of faces / edges of the same color are stored in the same discrete data binary file, and the starting index of each set of topological objects in the vertex index array is recorded;
[0071] According to the starting index, the discrete data is split into multiple sub-discrete data. According to the first index, each topological object of the total face array / total edge array is associated with the corresponding discrete data.
[0072] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method based on the association between topological objects and discrete geometry in model lightweighting, characterized in that: include: Obtaining the topological structure of the three-dimensional model through the secondary development SDK package of the three-dimensional CAD software, wherein the topological structure includes all faces and edges of the three-dimensional model; Group faces / edges according to their colors respectively, so that faces / edges of the same color are grouped into the same group; For each group, the discrete data of all faces / edges are extracted and merged to obtain a discrete data; wherein the discrete data includes a vertex data object, a vertex index array, a topological object ID set, and a starting index of the topological object set in the vertex index array; the vertex data object records all vertices in the current group, the vertex index array records the indexes of all triangles / line segments in the current group, the topological object ID set records the IDs of all faces / edges in the current group, the starting index of the topological object set in the vertex index array, records the starting index of the first triangle of all faces in the current group in the vertex index array, or records the starting index of the first line segment of all edges in the current group in the vertex index array; the face is composed of a plurality of triangles, the edge is composed of a plurality of line segments, and the vertex is the vertex of the triangle / line segment; Integrate the faces / edges in the topological structure into a total face array / total edge array, store it into a topological binary file, and record a first index; the first index is the index of the ID of each face / edge in the total face array / total edge array; The discrete data of faces / edges of the same color are stored in the same discrete data binary file, and the starting index of each set of topological objects in the vertex index array is recorded; According to the starting index, the discrete data is split into a plurality of sub-discrete data, and according to the first index, each topological object of the total face array / total edge array is associated with corresponding discrete data; After grouping the faces / edges according to their colors respectively and before extracting discrete data of all faces / edges in each group, the method further includes: converting the faces / edges in each group into faces / edges in a lightweight format.
2. The method based on the association between topological objects and discrete geometry in model lightweighting according to claim 1, characterized in that: The three-dimensional CAD software includes Tiangong CAD.
3. A system based on the association of topological objects and discrete geometry in model lightweighting, characterized in that: include: A topology structure acquisition module is used to acquire the topology structure of the three-dimensional model through the secondary development SDK package of the three-dimensional CAD software, and the topology structure includes all faces and edges of the three-dimensional model; A grouping module, used for grouping the faces / edges according to their colors, so as to group faces / edges of the same color into the same group; A merging module is used to extract the discrete data of all faces / edges for each group and merge them to obtain a discrete data; wherein the discrete data includes a vertex data object, a vertex index array, a topological object ID set, and a starting index of the topological object set in the vertex index array; the vertex data object records all vertices in the current group, the vertex index array records the indexes of all triangles / line segments in the current group, the topological object ID set records the IDs of all faces / edges in the current group, the starting index of the topological object set in the vertex index array, records the starting index of the first triangle of all faces in the current group in the vertex index array, or records the starting index of the first line segment of all edges in the current group in the vertex index array; the face is composed of a plurality of triangles, the edge is composed of a plurality of line segments, and the vertex is the vertex of the triangle / line segment; A first index recording module is used to integrate the faces / edges in the topological structure into a total face array / total edge array, store it into a topological binary file, and record a first index; the first index is the index of the ID of each face / edge in the total face array / the total edge array; A starting index recording module is used to store the discrete data of faces / edges of the same color in the same discrete data binary file, and record the starting index of each set of topological objects in the vertex index array; A topological data and discrete data corresponding module is used to split the discrete data into multiple sub-discrete data according to the starting index, and each topological object of the total face array / total edge array is associated with corresponding discrete data according to the first index; Also includes: A lightweight module is used to convert the faces / edges in each group into lightweight format after grouping the faces / edges according to their colors and before extracting the discrete data of all faces / edges in each group.
4. The system based on the association of topological objects and discrete geometry in model lightweighting according to claim 3, characterized in that: The three-dimensional CAD software includes Tiangong CAD.
5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method based on the association between topological objects and discrete geometry in model lightweighting according to any one of claims 1 to 2 is implemented.
Citation Information
Patent Citations
Three-dimensional model lightweight method for web terminal, electronic equipment and storage medium
CN108230439A
Article recommendation method based on semi-discrete matrix factorization
CN111552852A
Indoor space three-dimensional topological relation construction method and system
CN114648618A
Geometric model processing method and device, electronic equipment and storage medium
CN115828349A
Anti-aliasing two-dimensional vector graphics using a compressed vertex buffer
US20230038647A1
