A modeling method and system suitable for multiple geometry engines
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PERA
- Filing Date
- 2023-08-15
- Publication Date
- 2026-07-03
Smart Images

Figure CN117150588B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of geometric modeling technology, and in particular to a modeling method and system adapted to multiple geometric engines. Background Technology
[0002] Geometry engines in CAD and CAE software are used for the creation and editing of two-dimensional / three-dimensional geometric models. Different geometry engines have different advantages. How to take into account the characteristics and advantages of multiple geometry engines and flexibly switch between geometry engines during geometric modeling to improve modeling efficiency and flexibility is an increasingly important issue.
[0003] Since different geometry engines have different data structures and kernel functions, current modeling methods that adapt to multiple geometry engines include: ① using middleware software to realize the conversion between different geometry engines, and then using the interface provided by the middleware in the application; ② using polymorphism or reflection mechanisms to realize the switching between different geometry engines; ③ saving the parameters and configuration information of different geometry engines in configuration files, and then loading different configuration files in the application as needed to switch geometry engines.
[0004] However, using middleware software has high development costs and consumes a lot of memory, and the conversion process can also cause performance loss; using polymorphism or reflection mechanisms requires writing a lot of complex code in the application, which is difficult to maintain and can also lead to performance loss; using configuration files requires manual editing of the configuration files, and different geometry engines have different configuration file formats, and after the configuration file is modified, it can only take effect after a restart, which affects the actual geometric modeling operation. Summary of the Invention
[0005] Based on the above analysis, the embodiments of the present invention aim to provide a modeling method and system that is compatible with multiple geometry engines, so as to solve the problems of existing geometry modeling methods that cannot flexibly switch between multiple geometry engines and have poor performance and maintainability.
[0006] On one hand, embodiments of the present invention provide a modeling method adaptable to multiple geometry engines, including the following steps:
[0007] By implementing the data interface and general operation interface in the general interface layer, a geometry adaptation layer for each geometry engine is constructed and encapsulated into a dynamic link library; the dynamic link library of the default geometry engine is loaded through the constructed geometry engine manager.
[0008] During the modeling process, when operation commands and geometric topology data for the geometric model are received, the geometry engine manager identifies whether the default geometry engine is the one to be executed. If not, it switches to the geometry engine to be executed; otherwise, the default geometry engine is used. The geometry adaptation layer of the geometry engine to be executed reads the geometric topology data, calls the corresponding kernel function in the geometry adaptation layer interface method corresponding to the operation command, writes the result to the geometric topology data, and then switches back to the default geometry engine, which reads the updated geometric topology data to complete the operation.
[0009] Based on the further improvement of the above method, different enumeration values are defined for each geometry engine in the geometry engine manager. In the currently running instance, the dynamic link library of the corresponding geometry engine is loaded according to the set engine enumeration value, and used as the default geometry engine.
[0010] Further improvements to the above method include: unloading the dynamic link library of the default geometry engine, setting the enumeration value of the geometry engine to be executed, and loading the dynamic link library of the geometry engine to be executed.
[0011] Based on further improvements to the above method, a geometry adaptation layer for each geometry engine is constructed by implementing the data interface and general operation interface in the general interface layer, including:
[0012] Each geometry engine defines an interface in its respective geometry adaptation layer that inherits each data interface in the general interface layer; based on the advantages of each geometry engine, it defines an interface that inherits the corresponding general operation interface in the general interface layer; and in each interface method, it calls its respective kernel function to implement the method in the interface.
[0013] Based on further improvements to the above method, the data interfaces in the general interface layer include: geometric data interface and topological data interface, both of which inherit from the same entity base class, which is used to generate unique identifiers.
[0014] Based on further improvements to the above methods, a general operation interface is used to define geometry and topology editing functions, including: Boolean operation interface, projection interface, extension interface, and imprinting interface.
[0015] Based on further improvements to the above method, the geometric data interface includes a geometric base class that inherits from the solid base class, a curve base class and a surface base class that inherit from the geometric base class, as well as various curve interfaces that inherit from the curve base class and various surface interfaces that inherit from the surface base class.
[0016] Based on further improvements to the above method, the topology data interface is used to define the topological connection relationships of geometry, including: vertex data interface, edge data interface, common edge data interface, ring data interface, face data interface, shell data interface, block data interface and volume data interface, all of which inherit from the entity base class.
[0017] Based on a further improvement of the above method, the surface data interface references a surface base class, and the edge data interface references a curve base class.
[0018] On the other hand, embodiments of the present invention provide a modeling system adapted to multiple geometry engines, including:
[0019] The generic interface layer is used to define unified data interfaces and generic operation interfaces.
[0020] The geometry adaptation layer is used to build the geometry adaptation layer for each geometry engine by implementing the data interface and general operation interface in the general interface layer, and encapsulate them into dynamic link libraries respectively; and to read the geometry topology data, call the corresponding kernel function in the interface method, and write the result into the geometry topology data.
[0021] The geometry engine manager is used to load the dynamic link library of the default geometry engine. During the modeling process, when an operation command for the geometric model and geometric topology data are received, it identifies whether the default geometry engine is the geometry engine to be executed. If not, it switches to the geometry engine to be executed; otherwise, the default geometry engine is used as the geometry engine to be executed. After the geometry engine to be executed writes the results into the geometric topology data, it switches back to the default geometry engine.
[0022] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects: it adapts to multiple geometry engines through different adaptation layers, each adaptation layer can be optimized according to the characteristics of the specific geometry engine, while ensuring high compatibility; it makes full use of the advantages of multiple geometry engines to enhance the convenience of geometry modeling; and it achieves the switching of geometry engines through dynamic loading and unloading, avoiding the impact of switching between different engines on geometry modeling, improving flexibility and scalability, while also ensuring the independence of each geometry engine.
[0023] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description
[0024] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.
[0025] Figure 1 This is a flowchart of a modeling method adapted to multiple geometry engines in Embodiment 1 of the present invention;
[0026] Figure 2 This is a block diagram of a modeling system adapted to multiple geometry engines in Embodiment 2 of the present invention. Detailed Implementation
[0027] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.
[0028] Example 1
[0029] One specific embodiment of the present invention discloses a modeling method adapted to multiple geometry engines, such as... Figure 1 As shown, it includes the following steps:
[0030] S11. By implementing the data interface and general operation interface in the general interface layer, construct the geometry adaptation layer for each geometry engine and encapsulate them into dynamic link libraries respectively; load the dynamic link library of the default geometry engine through the constructed geometry engine manager.
[0031] S12. During the modeling process, when an operation command and geometric topology data for the geometric model are received, the geometry engine manager identifies whether the default geometry engine is the geometry engine to be executed. If not, it switches to the geometry engine to be executed; otherwise, the default geometry engine is used as the geometry engine to be executed. The geometry adaptation layer of the geometry engine to be executed reads the geometric topology data, calls the corresponding kernel function in the geometry adaptation layer interface method corresponding to the operation command, writes the result to the geometric topology data, switches back to the default geometry engine, and the default geometry engine reads the updated geometric topology data to complete the operation.
[0032] During the development phase, the general interface layer defines a general interface class and determines the number, type, and return type of input parameters for the interface methods within that class. Each geometry engine defines its own interface class in its respective geometry adaptation layer, inheriting from the general interface class. The kernel function is called within the corresponding interface method of each geometry engine, and optimizations are performed based on the specific requirements of each engine. Each geometry engine corresponds to one geometry adaptation layer, operating independently and converting engine-specific method calls into general interface method calls.
[0033] During the runtime phase, a geometry engine is set as the default geometry engine. During the geometric modeling process, when using other geometry engines to operate the geometric model has higher performance or better results, flexible switching can be achieved by loading and unloading the dynamic link library of the geometry engine, so as to maximize the value of the geometry engine.
[0034] It should be noted that in step S11, by implementing the data interface and general operation interface in the general interface layer, a geometry adaptation layer for each geometry engine is constructed, including:
[0035] Each geometry engine defines an interface in its respective geometry adaptation layer that inherits each data interface in the general interface layer; based on the advantages of each geometry engine, it defines an interface that inherits the corresponding general operation interface in the general interface layer; and in each interface method, it calls its respective kernel function to implement the method in the interface.
[0036] Specifically, the data interfaces in the general interface layer include: geometric data interface and topology data interface, both of which inherit from the same entity base class, which is used to generate unique identifiers.
[0037] Furthermore, the geometric data interface includes a geometry base class that inherits from the solid base class, a curve base class and a surface base class that inherit from the geometry base class, as well as various curve interfaces that inherit from the curve base class and various surface interfaces that inherit from the surface base class. The geometry base class includes methods for defining the geometric type, obtaining the bounding box, and performing geometric space transformations; the curve base class includes methods for obtaining the value, length, direction, whether it is closed, the starting parameter, and the starting point; the surface base class includes methods for obtaining the value, normal, and parameter range.
[0038] In this embodiment, curves include: straight lines, circular arcs, elliptical curves, and B-spline curves; surfaces include: planes, cylinders, cones, spheres, tori, and B-spline surfaces. Each curve and surface interface defines the methods for setting and retrieving the corresponding curve and surface attribute values. Based on class inheritance, the curve and surface interfaces also inherit from the entity base class, automatically generating unique identifiers when creating curves and surfaces, which are then associated with attribute data, facilitating the querying, editing, and analysis of geometric topology data.
[0039] Specifically, the interface for straight lines includes methods for setting and obtaining reference points, direction, start parameters, and end parameters; the interface for circular curves includes methods for setting and obtaining center, X-axis, Y-axis, radius, start angle, end angle, and clockwise / counterclockwise indicators; the interface for elliptical curves includes methods for setting and obtaining center, X-axis, Y-axis, major axis radius, minor axis radius, start angle, end angle, and clockwise / counterclockwise indicators; and the interface for B-spline curves includes methods for setting and obtaining order, node vectors, control vertices, and weights.
[0040] The interface for a plane includes methods for setting and obtaining the reference point, U direction, V direction, U direction start and end parameters, and V direction start and end parameters; the interface for a cylinder includes methods for setting and obtaining the reference point, X-axis, Y-axis, Z-axis, radius, and height; the interface for a cone includes methods for setting and obtaining the vertex, X-axis, Y-axis, Z-axis, radius, and height; the interface for a sphere includes methods for setting and obtaining the center, X-axis, Y-axis, Z-axis, and radius; the interface for a torus includes methods for setting and obtaining the reference point, X-axis, Y-axis, Z-axis, large radius, and small radius; and the interface for a B-spline surface includes methods for setting and obtaining the u-order, v-order, u-node vector, v-node vector, control vertices, and weights.
[0041] It should be noted that the topology data interface is used to define the topological connections in geometry, including: vertex data interface, edge data interface, common edge data interface, ring data interface, face data interface, shell data interface, block data interface, and volume data interface, all of which inherit from the entity base class. That is, topology data objects include: volume, block, shell, face, ring, common edge, edge, and vertex. A volume contains multiple blocks, a block contains multiple shells, a shell contains multiple faces, a face contains surface data and multiple rings, a ring contains multiple common edge data, common edges reference edge data, and edges contain a start vertex and an end vertex, and are adjacent to one or two faces. The face data interface references the surface base class, and the edge data interface references the curve base class.
[0042] Furthermore, the general operation interfaces in the general interface layer are used to define geometry and topology editing functions, including: Boolean operation interface, projection interface, extension interface, and imprinting interface.
[0043] For example, the Boolean operation interface is `BooleanOperation`, which includes the Boolean intersection method (`intersect`), the Boolean union method (`unite`), and the Boolean difference method (`substract`). There are three geometry engines, A, B, and C. Geometry engine A does not support Boolean operations or Boolean operations are resource-intensive; therefore, the geometry adaptation layer of geometry engine A does not need to implement the Boolean operation interface. Geometry engines B and C both support Boolean operations, so interfaces `B_BooleanOperation` and `C_BooleanOperation` are defined respectively, inheriting from the Boolean operation interface `BooleanOperation`. The three methods of the `B_BooleanOperation` interface call the Boolean intersection, Boolean union, and Boolean difference kernel functions of geometry engine B to implement the Boolean operations. The three methods of the `C_BooleanOperation` interface pass the enumerated values corresponding to the Boolean intersection, Boolean union, and Boolean difference to the Boolean operation kernel function of geometry engine C to implement the Boolean operations.
[0044] It should be noted that in this embodiment, a geometry engine manager is constructed to manage and switch between multiple geometry engines. Different enumeration values are defined for each geometry engine. In the currently running instance, the dynamic link library of the corresponding geometry engine is loaded according to the set engine enumeration value, and it is used as the default geometry engine.
[0045] In step S12, during the geometric modeling process, when an operation command for the geometric model and geometric topology data are received, the geometric engine manager identifies whether the default geometric engine is the geometric engine to be executed based on the set engine enumeration value and the enumeration value of the geometric engine to be executed. If it is, the default geometric engine is used as the geometric engine to be executed; otherwise, the geometric engine to be executed is switched. This includes: unloading the dynamic link library of the default geometric engine, setting the enumeration value of the geometric engine to be executed, and loading the dynamic link library of the geometric engine to be executed.
[0046] Preferably, the default geometry engine, as well as the geometry engine for each operation of the geometric model, supports dynamic settings by the user.
[0047] Furthermore, the geometric topology data is geometric model data stored in a unified format. Each geometry engine's geometry adaptation layer includes interface methods for reading and writing geometric topology data. After loading the dynamic link library of the geometry engine to be executed, the geometry adaptation layer of that engine reads the geometric topology data, calls the corresponding kernel function in the geometry adaptation layer interface method corresponding to the operation command, writes the result to the geometric topology data, and then switches back to the default geometry engine, which reads the updated geometric topology data to complete the operation.
[0048] Compared with existing technologies, this embodiment provides a modeling method that adapts to multiple geometry engines. It adapts to multiple geometry engines through different adaptation layers. Each adaptation layer can be optimized according to the characteristics of a specific geometry engine while ensuring high compatibility. It makes full use of the advantages of multiple geometry engines to enhance the convenience of geometry modeling. It achieves switching between geometry engines through dynamic loading and unloading, avoiding the impact of switching between different engines on geometry modeling, improving flexibility and scalability, and ensuring the independence of each geometry engine.
[0049] Example 2
[0050] Another embodiment of the present invention discloses a modeling system adapted to multiple geometry engines, thereby implementing the modeling method adapted to multiple geometry engines in Embodiment 1. The specific implementation of each module is described in the corresponding description in Embodiment 1. Figure 2 As shown, the system includes:
[0051] The general interface layer 101 is used to define a unified data interface and a general operation interface;
[0052] The geometry adaptation layer 102 is used to construct the geometry adaptation layer for each geometry engine by implementing the data interface and general operation interface in the general interface layer, and encapsulate them into dynamic link libraries respectively; and to read the geometry topology data, call the corresponding kernel function in the interface method, and write the result into the geometry topology data.
[0053] The geometry engine manager 103 is used to load the dynamic link library of the default geometry engine. During the modeling process, when an operation command for the geometric model and geometric topology data are received, it identifies whether the default geometry engine is the geometry engine to be executed. If not, it switches to the geometry engine to be executed; otherwise, the default geometry engine is used as the geometry engine to be executed. After the geometry engine to be executed writes the result to the geometric topology data, it switches back to the default geometry engine.
[0054] Since this embodiment and the aforementioned modeling method adaptable to multiple geometry engines can be mutually referenced, and this is a repetition of the previous description, they will not be repeated here. Because this system embodiment shares the same principle as the above method embodiment, it also possesses the corresponding technical effects of the above method embodiment.
[0055] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.
[0056] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A modeling method adaptable to multiple geometry engines, characterized in that, Includes the following steps: By implementing the data interface and general operation interface in the general interface layer, a geometry adaptation layer for each geometry engine is constructed and encapsulated into a dynamic link library respectively. The default geometry engine's dynamic link library is loaded through the constructed geometry engine manager; During the modeling process, when operation commands and geometric topology data for the geometric model are received, the geometry engine manager identifies whether the default geometry engine is the geometry engine to be executed. If not, it switches to the geometry engine to be executed; otherwise, the default geometry engine is used as the geometry engine to be executed. The geometry adaptation layer of the geometry engine to be executed reads the geometry topology data, calls the corresponding kernel function in the geometry adaptation layer interface method corresponding to the operation command, writes the result to the geometry topology data, switches back to the default geometry engine, and the default geometry engine reads the updated geometry topology data to complete the operation.
2. The modeling method adaptable to multiple geometry engines according to claim 1, characterized in that, The geometry engine manager defines different enumeration values for each geometry engine. In the currently running instance, the dynamic link library of the corresponding geometry engine is loaded according to the set engine enumeration value, and used as the default geometry engine.
3. The modeling method adaptable to multiple geometry engines according to claim 2, characterized in that, The switching to the geometry engine to be executed includes: unloading the dynamic link library of the default geometry engine, setting the enumeration value of the geometry engine to be executed, and loading the dynamic link library of the geometry engine to be executed.
4. The modeling method adaptable to multiple geometry engines according to claim 1, characterized in that, The process involves constructing a geometry adaptation layer for each geometry engine by implementing the data interface and general operation interface in the general interface layer, including: Each geometry engine defines an interface in its respective geometry adaptation layer that inherits each data interface in the general interface layer; based on the advantages of each geometry engine, it defines an interface that inherits the corresponding general operation interface in the general interface layer; and in each interface method, it calls its respective kernel function to implement the method in the interface.
5. The modeling method adaptable to multiple geometry engines according to claim 1, characterized in that, The data interfaces in the general interface layer include a geometric data interface and a topology data interface, both of which inherit from the same entity base class, which is used to generate unique identifiers.
6. The modeling method adaptable to multiple geometry engines according to claim 1, characterized in that, The general operation interface is used to define geometry and topology editing functions, including: Boolean operation interface, projection interface, extension interface and imprinting interface.
7. The modeling method adaptable to multiple geometry engines according to claim 5, characterized in that, The geometric data interface includes a geometric base class that inherits from the solid base class, a curve base class and a surface base class that inherit from the geometric base class, as well as various curve interfaces that inherit from the curve base class and various surface interfaces that inherit from the surface base class.
8. The modeling method adaptable to multiple geometry engines according to claim 7, characterized in that, The topology data interface is used to define the topological connection relationships of geometry, including: vertex data interface, edge data interface, common edge data interface, ring data interface, face data interface, shell data interface, block data interface and volume data interface, all of which inherit from the entity base class.
9. The modeling method adaptable to multiple geometry engines according to claim 8, characterized in that, The surface data interface references a surface base class, and the edge data interface references a curve base class.
10. A modeling system adaptable to multiple geometry engines, characterized in that, include: The generic interface layer is used to define unified data interfaces and generic operation interfaces. The geometry adaptation layer is used to build the geometry adaptation layer for each geometry engine by implementing the data interface and general operation interface in the general interface layer, and encapsulate them into dynamic link libraries respectively. Additionally, it reads geometric topology data, calls the corresponding kernel function in the interface method, and writes the result into the geometric topology data; The geometry engine manager is used to load the dynamic link library of the default geometry engine. During the modeling process, when an operation command for the geometric model and geometric topology data are received, it is determined whether the default geometric engine is the geometric engine to be executed. If not, it is switched to the geometric engine to be executed; otherwise, the default geometric engine is used as the geometric engine to be executed. Once the geometry engine to be executed has written the results to the geometry topology data, switch back to the default geometry engine.