Geometric constraint solving method and device, electronic equipment and storage medium
By defining the general interface layer and plug-in manager, flexible selection and switching of different geometric constraint solution engines is achieved, which solves the problem of high engine switching costs in the existing technology and improves the real-time and stability of geometric constraint solution.
Patent Information
- Application Number
- CN202510220010.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-07-11
AI Technical Summary
In the prior art, the switching and adjustment of geometric constraint solution engines is high, and the system framework adjustment needs to be made according to the design characteristics of a specific engine, resulting in an increase in development costs and difficulty.
By defining the general interface layer and plug-in manager, flexible selection and switching of different geometric constraint solution engines are realized, the general interface layer is used to traverse the loaded engine, match the target engine identifier, and execute solution commands through the target engine, supporting function callbacks and data format conversion.
It realizes flexibility and real-time solution of geometric constraints, improves response speed and system stability, and reduces the cost of engine switching.
Smart Images

Figure CN120295686A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of geometric constraint solving, and particularly to a geometric constraint solving method and apparatus, an electronic device, and a storage medium. Background Art
[0002] The geometric constraint solving engine is one of the bases and cores for developing industrial software products. For example, in application fields such as CAD, CAE, and CAM, the geometric constraint solving engine is the most basic core component.
[0003] Different geometric constraint solving engines have different data structures and kernel functions, and the requirements for the data format input before solving and the data update method after solving are also different. For example, the D-Cubed (DCM) geometric constraint solving engine opens the format of geometric constraint data to users. Users can define various types of geometric constraint classes according to their own needs, such as points, lines, circles, ellipses, etc. Through function callbacks, users can decide how to pass the geometric constraint class object data to the kernel and update the geometric constraint class object data after solving; while other engines may require specific geometric constraint data classes to pass the geometric constraint data to the kernel.
[0004] However, in the related art, when performing geometric constraint solving, the data format of a specific geometric constraint solving engine is generally directly used, which is deeply bound to the specific engine. If another geometric constraint solving engine is selected or switched, adjustments need to be made again according to the design characteristics of the engine. Even the existing system framework needs to be comprehensively adjusted according to the design characteristics of the called geometric constraint solving engine, and the development cost and price are extremely high. Summary of the Invention
[0005] In view of the above problems, a geometric constraint solving method and apparatus, an electronic device, and a storage medium are provided to overcome or at least partially solve the above problems, including:
[0006] A geometric constraint solving method, the method includes:
[0007] In response to a user's geometric constraint solving command, determine a target general interface carrying a target geometric constraint solving engine identifier according to the geometric constraint solving command;
[0008] Traverse the loaded geometric constraint solving engines according to the target general interface through a predefined general interface layer, and determine whether there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the target geometric constraint solving engine identifier;
[0009] In the case that there is a target geometric constraint solving engine in the loaded geometric constraint solving engine that matches the target geometric constraint solving engine identifier, execute the geometric constraint solving command through the target geometric constraint solving engine.
[0010] Optionally, before determining the target general interface carrying the target geometric constraint solving engine identifier according to the geometric constraint solving command in response to the user's geometric constraint solving command, it further includes:
[0011] Determine the geometric constraint solving engine to be loaded and define the general interface of the geometric constraint solving engine to be loaded;
[0012] Define the general interface layer according to the general interface and load the geometric constraint solving engine to be loaded.
[0013] Optionally, the executing the geometric constraint solving command through the target geometric constraint solving engine includes:
[0014] Determine whether the target geometric constraint solving engine needs to perform a function callback;
[0015] In the case that the target geometric constraint solving engine needs to perform a function callback, execute the callback function of the target geometric constraint solving engine and execute the geometric constraint solving command through the specific implementation of the callback function;
[0016] In the case that the target geometric constraint solving engine does not need to perform a function callback, perform data format conversion on the geometric constraint object corresponding to the geometric constraint solving command through the target general interface, and execute the geometric constraint solving command through the target geometric constraint solving engine according to the geometric constraint object after data format conversion.
[0017] Optionally, after defining the general interface of the geometric constraint solving engine to be loaded, it further includes:
[0018] Define the general geometric constraint data format as a geometric constraint data class and pass the geometric constraint data class into the general interface; wherein, the general geometric constraint data format includes at least one or more of points, lines, circles, ellipses, equations, spline curves, and parametric curves.
[0019] Optionally, the loading of the geometric constraint solving engine to be loaded includes:
[0020] Load the geometric constraint solving engine to be loaded in the form of a plug-in and define a corresponding plug-in identifier for each geometric constraint solving engine to be loaded.
[0021] Optionally, determining whether there is a target geometric constraint solving engine that matches the target geometric constraint solving engine identifier in the loaded geometric constraint solving engine includes:
[0022] Based on the target geometric constraint solving engine identifier and the plug-in identifier, determining whether there is a target geometric constraint solving engine that matches the target geometric constraint solving engine identifier in the loaded geometric constraint solving engine.
[0023] Optionally, after executing the geometric constraint solving command through the target geometric constraint solving engine, further includes:
[0024] Stop executing the operation of traversing the loaded geometric constraint solving engines according to the target general interface through the predefined general interface layer.
[0025] A geometric constraint solving device, the device includes:
[0026] A container generation module, configured to respond to a user's geometric constraint solving command, and determine a target general interface carrying a target geometric constraint solving engine identifier according to the geometric constraint solving command;
[0027] A geometric constraint solving engine matching module, configured to traverse the loaded geometric constraint solving engines according to the target general interface through a predefined general interface layer, and determine whether there is a target geometric constraint solving engine that matches the target geometric constraint solving engine identifier in the loaded geometric constraint solving engines;
[0028] A geometric constraint solving command execution module, configured to execute the geometric constraint solving command through the target geometric constraint solving engine when there is a target geometric constraint solving engine that matches the target geometric constraint solving engine identifier in the loaded geometric constraint solving engines.
[0029] An electronic device, including a processor, a memory, and a computer program stored on the memory and capable of running on the processor, where the computer program, when executed by the processor, implements the geometric constraint solving method as described above.
[0030] A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and the computer program, when executed by a processor, implements the geometric constraint solving method as described above.
[0031] A computer program product, including a computer program, where the computer program, when executed by a processor, implements the geometric constraint solving method as described above.
[0032] The embodiments of the present invention have the following advantages:
[0033] The present invention provides a geometric constraint solving method. By responding to a user's geometric constraint solving command, a target general interface carrying the target geometric constraint solving engine identifier is determined according to the geometric constraint solving command. Subsequently, through a predefined general interface layer, the loaded geometric constraint solving engines are traversed according to the target general interface to determine whether there is a target geometric constraint solving engine that matches the target geometric constraint solving engine identifier among the loaded geometric constraint solving engines. Thus, in the case where there is a target geometric constraint solving engine that matches the target geometric constraint solving engine identifier among the loaded geometric constraint solving engines, the geometric constraint solving command is executed by the target geometric constraint solving engine. The flexible selection of the geometric constraint solving engine during geometric constraint solving is realized, and the corresponding geometric constraint solving engine can be selected in real time according to the user's geometric constraint solving command to execute the geometric constraint solving command, improving the real-time performance of geometric constraint solving, enhancing the response speed and stability of the geometric constraint solving system, and reducing the selection and switching cost of the geometric constraint solving engine. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions of the present invention, the accompanying drawings required for the description of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.
[0035] Figure 1 It is a flowchart of the steps of a geometric constraint solving method provided by some embodiments of the present invention;
[0036] Figure 2 It is an example diagram of a geometric constraint solving engine matching process provided by some embodiments of the present invention;
[0037] Figure 3 It is a schematic structural diagram of a geometric constraint solving device provided by some embodiments of the present invention;
[0038] Figure 4 It is a block diagram of an electronic device provided by some embodiments of the present invention;
[0039] Figure 5 It is a schematic diagram of a computer-readable medium provided by some embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0040] To make the above objects, features, and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are part of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the scope of protection of the present invention.
[0041] In the embodiments of the present application, terms such as "first" and "second" are used to distinguish the same items or similar items with basically the same functions and effects, only for clearly describing the technical solutions of the embodiments of the present application, and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features.
[0042] In the embodiments of the present application, the orientation or positional relationship indicated by terms such as "upper" and "lower" is based on the orientation or positional relationship shown in the drawings, only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the indicated device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation to the present application.
[0043] The geometric constraint solving engine is one of the bases and cores for developing industrial software products. For example, in application fields such as CAD, CAE, and CAM, the geometric constraint solving engine is the most basic core component.
[0044] Different geometric constraint solving engines have different data structures and kernel functions, and the requirements for the data format input before solving and the data update method after solving are also different. For example, the D-Cubed (DCM) geometric constraint solving engine opens the format of geometric constraint data to users, and users can define various types of geometric constraint classes according to their own needs, such as points, lines, circles, ellipses, etc. The user decides how to transfer the geometric constraint class object data to the kernel and update the geometric constraint class object data after solving through function callbacks; while other engines may require specific geometric constraint data classes to transfer the geometric constraint data to the kernel.
[0045] However, in the related art, when performing geometric constraint solving, the data format of a specific geometric constraint solving engine is generally directly used, which is deeply bound to the specific engine. If another geometric constraint solving engine is selected or switched, adjustments need to be made again according to the design characteristics of the engine. Even the existing system framework needs to be comprehensively adjusted according to the design characteristics of the called geometric constraint solving engine, and the development cost and price are extremely high.
[0046] To solve the above problems, based on the core technical concept of selecting and switching the geometric constraint solving engine according to the user's geometric constraint solving command and the engine general interface, the present invention improves the geometric constraint solving method in the related art. The present invention will be described in detail below with reference to the accompanying drawings:
[0047] Referring to Figure 1 , a step flowchart of a geometric constraint solving method provided by some embodiments of the present invention is shown, which may specifically include the following steps:
[0048] Step 101, in response to the user's geometric constraint solving command, determine a target general interface carrying a target geometric constraint solving engine identifier according to the geometric constraint solving command;
[0049] In specific implementation, the capabilities and data requirements required for the geometric constraint solving process can be summarized according to the characteristics of geometric constraints. A set of general interfaces and geometric constraint data classes adapted to multiple geometric constraint solving engines can be defined respectively, that is, a general interface layer can be predefined, and each general interface in the general interface layer corresponds to a geometric constraint solving engine. Each geometric constraint solving engine can be accessed into the system in the form of a plug-in, and a plug-in identifier can be customized for each geometric constraint solving engine. By implementing the general interface, the capabilities of the engine can be accessed into the system, and can be respectively encapsulated into dynamic link libraries to realize the decoupling of the system and the specific geometric constraint solving engine.
[0050] When starting the system, the dynamic link libraries corresponding to each engine plug-in can be loaded into the system by reading the configuration. When loading, the system can automatically construct a plug-in layer object for different geometric constraint solving engines and automatically load it into the corresponding engine plug-in layer of the plug-in manager.
[0051] Furthermore, all general interfaces can be defined in one class. Each general interface can contain a container object parameter, and the container object parameter can contain a geometric constraint solving engine identifier. And the currently constructed class object can be loaded into the geometric constraint solving engine plug-in manager in the constructor of the general interface class; for example, a container with a geometric constraint solving engine identifier can be created in each general interface and passed as a parameter into the general interface function; in addition, each geometric constraint solving engine can define a class and inherit the general interface class, and then define a global object of this class to ensure that when the dynamic link library of the geometric constraint solving engine plug-in is loaded, the plug-in layer class object is created and initialized, and this object will also be loaded into the geometric constraint solving engine plug-in manager in the constructor; and each geometric constraint solving engine plug-in layer should ensure that it inherits and implements each general interface, and calls its own kernel function to implement the interface method in the interface implementation.
[0052] On this basis, when the user gives a geometric constraint solving command, a target general interface carrying the target geometric constraint solving engine identifier can be determined according to the user's geometric constraint solving command, so as to determine the target geometric constraint solving engine plug-in layer in the plug-in manager through the target general interface and the target geometric constraint solving engine identifier in subsequent steps, and call the target geometric constraint solving engine required by the user to execute the geometric constraint solving command.
[0053] In some embodiments of the present invention, before responding to the user's geometric constraint solving command and determining the target general interface carrying the target geometric constraint solving engine identifier according to the geometric constraint solving command, it further includes:
[0054] Determine the geometric constraint solving engine to be loaded, and define the general interface of the geometric constraint solving engine to be loaded;
[0055] Define the general interface layer according to the general interface, and load the geometric constraint solving engine to be loaded.
[0056] In practical applications, the geometric constraint solving engine to be loaded into the plug-in manager can be determined according to the capabilities and data requirements required for the geometric constraint solving process, and a set of general interfaces and geometric constraint data classes adapted to multiple geometric constraint solving engines can be defined respectively. That is, after defining the general interfaces of the geometric constraint solving engines to be loaded, the general interface layer can be defined according to these general interfaces to ensure that each general interface in the general interface layer corresponds to a geometric constraint solving engine. Subsequently, each geometric constraint solving engine can be loaded into the system in the form of a plug-in, and a plug-in identifier can be customized for each geometric constraint solving engine. By implementing the general interface, the capabilities of the engine can be connected to the system, and they can be respectively encapsulated into dynamic link libraries to achieve the decoupling of the system from the specific geometric constraint solving engine.
[0057] When starting the system, the dynamic link libraries corresponding to each engine plug-in can be loaded into the system by reading the configuration. When loading, the system can automatically construct a plug-in layer object for different geometric constraint solving engines and automatically load it into the corresponding engine plug-in layer of the plug-in manager.
[0058] It should be emphasized that when defining the general interface layer, it should be ensured that each geometric constraint engine implements the general interface. The relevant functions of the geometric constraint solving engine are called within the general interface to implement the interface methods, and they are respectively encapsulated into dynamic link libraries; when the dynamic link libraries are loaded, each geometric constraint solving engine plug-in will be loaded into the plug-in manager.
[0059] Further, all general interfaces can be defined in a class. Each general interface may contain a container object parameter, and the container object parameter may contain an identifier of a geometric constraint solving engine. The class object being constructed can be loaded into the geometric constraint solving engine plug-in manager in the constructor of the general interface class; for example, a container with an identifier of a geometric constraint solving engine can be created in each general interface and passed as a parameter into the general interface function; in addition, each type of geometric constraint solving engine can define a class that inherits from the general interface class, and then define a global object of this class to ensure that when the dynamic link library of the geometric constraint solving engine plug-in is loaded, the plug-in layer class object is created and initialized, and this object will also be loaded into the geometric constraint solving engine plug-in manager in the constructor; and each geometric constraint solving engine plug-in layer should ensure that it inherits and implements each general interface, and calls its respective kernel functions in the interface implementation to implement the interface methods.
[0060] Step 102, traverse the loaded geometric constraint solving engines according to the target general interface through a predefined general interface layer, and determine whether there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the target geometric constraint solving engine identifier.
[0061] In a specific implementation, all geometric constraint solving engine plug-in layer objects in the plug-in manager can be traversed through the target general interface in the general interface layer. When the engine identifier passed in by the general interface matches the plug-in identifier defined in the engine plug-in layer, the geometric constraint solving engine in this engine plug-in layer can be determined as the target geometric constraint solving engine.
[0062] In some embodiments of the present invention, after defining the general interface for the geometric constraint solving engine to be loaded, it further includes:
[0063] Define the general geometric constraint data format as a geometric constraint data class, and pass the geometric constraint data class into the general interface; wherein, the general geometric constraint data format includes at least one or more of points, lines, circles, ellipses, equations, spline curves, and parametric curves.
[0064] In practical applications, a set of general geometric constraint data formats, such as points, lines, circles, ellipses, equations, spline curves, parametric curves, etc., can be defined as geometric constraint data classes, and all geometric constraint data can be stored in these class objects for transfer and update; specifically, various object classes required for constraint solving can be created, such as geometric classes like points, lines, circles, ellipses, conic curves, spline curves, and parametric curves, as well as a constraint system class, etc. These class objects will be passed into the general interface as data carriers and parameters; thereby, the parameter storage structure of geometric objects can be unified, and solving errors caused by data format differences can be avoided.
[0065] In some embodiments of the present invention, the loading of the geometric constraint solving engine to be loaded includes:
[0066] Loading the geometric constraint solving engine to be loaded in the form of a plug-in, and defining a corresponding plug-in identifier for each geometric constraint solving engine to be loaded.
[0067] In practical applications, each geometric constraint solving engine can be loaded and accessed into the system in the form of a plug-in, and a plug-in identifier can be customized for each geometric constraint solving engine. By implementing a general interface, the capabilities of the engine can be connected to the system, and they can be respectively encapsulated into dynamic link libraries to achieve decoupling between the system and the specific geometric constraint solving engine.
[0068] When starting the system, the dynamic link libraries corresponding to each engine plug-in can be loaded into the system by reading the configuration. When loading, the system can automatically construct a plug-in layer object for different geometric constraint solving engines and automatically load it into the corresponding engine plug-in layer of the plug-in manager.
[0069] In some embodiments of the present invention, determining whether there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the target geometric constraint solving engine identifier includes:
[0070] Determining whether there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the target geometric constraint solving engine identifier according to the target geometric constraint solving engine identifier and the plug-in identifier.
[0071] In practical applications, as Figure 2 shown, all geometric constraint solving engine plug-in layer objects in the plug-in manager can be traversed through the target general interface in the general interface layer. When the target geometric constraint solving engine identifier passed by the target general interface matches the plug-in identifier defined in the engine plug-in layer, the geometric constraint solving engine in this engine plug-in layer can be determined as the target geometric constraint solving engine, thereby improving the matching accuracy through a dual-identifier matching mechanism.
[0072] Specifically, to ensure that the corresponding interface under each engine plugin layer can be called when each general interface is invoked, each general interface can define a global function with the same name, and traverse the corresponding interfaces in all engine plugin layers in the plugin manager in the global function. The system ensures that all engine plugin layers are traversed by calling the global function. Before each general interface method calls the kernel function, it can first determine whether the plugin identifier in the current plugin layer matches the engine identifier in the passed container parameter. If so, it continues to execute the specific implementation of the geometric constraint solving engine interface, and marks the interface as executed in the return value, and the remaining engine plugin layers are no longer traversed. If not, it does not execute the specific implementation of the interface, and the geometric constraint solving engine interface is still marked as unexecuted.
[0073] For example, during the running phase, when a geometric constraint-related operation command is received, the corresponding interfaces in all engine plugin layers can be traversed by calling the global function with the same name as the general interface, so as to implement the capability call of the geometric constraint solving engine. At the same time, it may also be accompanied by the creation of relevant geometric constraint objects, such as geometric objects like points, lines, and circles (based on the definition of the aforementioned geometric constraint data class), as the data basis for geometric constraint solving.
[0074] Step 103, in the case that there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the target geometric constraint solving engine identifier, execute the geometric constraint solving command through the target geometric constraint solving engine.
[0075] In specific implementation, the user's geometric constraint solving command can be executed through the matched target geometric constraint solving engine; the passed geometric constraint data can be converted into the data format required by the geometric constraint solving engine in the engine plugin layer so that the geometric constraint solving engine can execute the user's geometric constraint solving command; for the above process engine that needs to be implemented through function callback, it can be passed to the engine in the callback function. Otherwise, it can be passed to the kernel function of the geometric constraint solving engine after data format conversion within the general interface. For data update operations, the engine that processes data in a callback manner can also update the data in the callback function. Otherwise, data format conversion can also be performed.
[0076] Specifically, different geometric constraint solving engines have different data processing and result return mechanisms. Different methods can be customized according to the characteristics of different geometric constraint solving engines for reading and updating geometric constraint data. For example, for an engine that reads and updates geometric constraint data using function callbacks, callback functions can be defined in the engine plugin layer, and the callback functions can be registered with the geometric constraint solving engine when creating the general interface for the constraint system. For example, the D-Cubed (DCM) geometric constraint solving engine reads and updates the data and status of geometric constraint objects using function callbacks. Other geometric constraint solving engines may not use function callbacks. When calling the general interface, the relevant geometric constraint objects are passed as parameters, and the data reading and updating of geometric constraint objects are implemented within the interface function.
[0077] The following takes the D-Cubed (DCM) geometric constraint solving engine as an example to illustrate how to implement the data reading and updating of geometric constraint objects through function callbacks:
[0078] A set of callback functions can be defined in the engine plugin layer according to the requirements of the engine's callback functions. The DCM kernel provides a way to register callback functions. By setting each function pointer of the DCM_frustum_functions structure to point, the callback functions can be registered with the created constraint system object when creating the general interface for the constraint system, and the specific implementation of each callback function can be determined.
[0079] When the general interface is called, the interface function will call the DCM kernel function internally, and the DCM kernel function will trigger relevant callback functions. The triggered callback functions are determined by the DCM kernel itself and cannot be interfered with externally. However, the specific implementation of each callback function can be determined. Therefore, the data returned to the DCM kernel and the update of the geometric constraint object after solving can be determined through the specific implementation of the callback function, so that the geometric constraint solving engine can execute the geometric constraint solving command according to the corresponding data.
[0080] For other geometric constraint solving engines that do not use callbacks to read and update the data and status of geometric constraint objects, the data format conversion of the geometric constraint data object created according to the geometric constraint solving command can be directly performed within the interface through the parameters passed in by the general interface, so as to ensure the kernel's reading and updating of geometric constraint data. Through these two methods, it is ensured that the geometric constraint solving engine can obtain the necessary data before solving and update the geometric constraint data after solving, so that the user's geometric constraint solving command can be correctly executed.
[0081] In some embodiments of the present invention, executing the geometric constraint solving command by the target geometric constraint solving engine includes:
[0082] Determine whether the target geometric constraint solving engine needs to perform a function callback;
[0083] In the case where the target geometric constraint solving engine needs to perform a function callback, execute the callback function of the target geometric constraint solving engine, and execute the geometric constraint solving command through the specific implementation of the callback function;
[0084] In the case where the target geometric constraint solving engine does not need to perform a function callback, perform data format conversion on the geometric constraint object corresponding to the geometric constraint solving command through the target general interface, and execute the geometric constraint solving command by the target geometric constraint solving engine according to the geometric constraint object after data format conversion.
[0085] In practical applications, the user's geometric constraint solving command can be executed through the matched target geometric constraint solving engine; the incoming geometric constraint data can be converted into the data format required by the geometric constraint solving engine in the engine plugin layer so that the geometric constraint solving engine can execute the user's geometric constraint solving command; for the process engine that needs to be implemented by means of function callback, it can be passed to the engine in the callback function, and in other cases, the data format can be converted in the general interface and then passed to the kernel function of the geometric constraint solving engine; for the operation of data update, the engine that processes data in the callback manner can also update the data in the callback function, and in other cases, the data format can also be converted.
[0086] Specifically, different geometric constraint solving engines have different data processing and result return mechanisms, and different methods can be customized according to the characteristics of reading and updating geometric constraint data of different geometric constraint solving engines. For example, for an engine that reads and updates geometric constraint data in the way of function callback, a callback function can be defined in the engine plugin layer, and the callback function can be registered to the geometric constraint solving engine when creating the general interface of the constraint system. For example, the D-Cubed (DCM) geometric constraint solving engine reads and updates the data and status of geometric constraint objects in the way of function callback. While other geometric constraint solving engines may not adopt the way of function callback, when calling the general interface, the relevant geometric constraint objects are passed as parameters, and the data reading and updating of geometric constraint objects are implemented in the interface function.
[0087] The following takes the D-Cubed (DCM) geometric constraint solving engine as an example to illustrate how to read and update the data of geometric constraint objects through function callback:
[0088] A set of callback functions can be defined in the engine plugin layer according to the requirements of the engine's callback functions. The DCM kernel provides a registration method for callback functions. By setting each function pointer of the DCM_frustum_functions structure to point, the callback functions can be registered into the created constraint system object in the general interface for creating the constraint system, and thus the specific implementation of each callback function can be determined;
[0089] When the general interface is called, the interface function will internally call the DCM kernel function, and the DCM kernel function will trigger relevant callback functions. The triggered callback functions are determined by the DCM kernel itself and cannot be interfered with externally. However, the specific implementation of each callback function can be determined. Therefore, the data returned to the DCM kernel and the update of the geometric constraint object after solution can be determined through the specific implementation of the callback function, and then the geometric constraint solving engine can execute the geometric constraint solving command according to the corresponding data.
[0090] For other geometric constraint solving engines that read and update the data and status of geometric constraint objects in a non-callback manner, the data format conversion of the geometric constraint data object created according to the geometric constraint solving command can be directly performed in the interface through the parameters passed in by the general interface, so as to ensure the kernel's reading and updating of geometric constraint data. Through these two methods, it is ensured that the geometric constraint solving engine can obtain the necessary data before solving and update the geometric constraint data after solving, so that the user's geometric constraint solving command can be correctly executed.
[0091] In some embodiments of the present invention, after the geometric constraint solving command is executed by the target geometric constraint solving engine, it further includes:
[0092] Stop executing the operation of traversing the loaded geometric constraint solving engines through the predefined general interface layer according to the target general interface.
[0093] In a specific implementation, in order to ensure that the corresponding interface under each engine plugin layer can be called when each general interface is called, each general interface can define a global function with the same name, and traverse the corresponding interfaces of all engine plugin layers in the plugin manager in the global function. The system ensures that all engine plugin layers are traversed by calling the global function; before each general interface method calls the kernel function, it can first determine whether the plugin identifier in the current plugin layer matches the engine identifier in the passed-in container parameter. If so, continue to execute the specific implementation of the geometric constraint solving engine interface, and mark the interface as executed in the return value, and the remaining engine plugin layers will no longer be traversed; if not, do not execute the specific implementation of the interface, and the geometric constraint solving engine interface is still marked as in an unexecuted state. Thus, the invalid engine calls are avoided and the average request processing time is shortened by terminating the traversal after successful matching.
[0094] It should be noted that, for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of the present invention are not limited by the described action sequences, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential for the embodiments of the present invention.
[0095] Referring to Figure 3 , a structural schematic diagram of a geometric constraint solving device provided by some embodiments of the present invention is shown; specifically, it may include the following modules:
[0096] A container generation module 301, configured to respond to a geometric constraint solving command of a user, and determine a target general interface carrying a target geometric constraint solving engine identifier according to the geometric constraint solving command.
[0097] A geometric constraint solving engine matching module 302, configured to traverse the loaded geometric constraint solving engines according to the target general interface through a predefined general interface layer, and determine whether there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the target geometric constraint solving engine identifier.
[0098] A geometric constraint solving command execution module 303, configured to execute the geometric constraint solving command through the target geometric constraint solving engine when there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the target geometric constraint solving engine identifier.
[0099] In some embodiments of the present invention, the device further includes:
[0100] A general interface definition module, configured to determine a geometric constraint solving engine to be loaded, and define a general interface of the geometric constraint solving engine to be loaded.
[0101] An engine loading module, configured to define the general interface layer according to the general interface, and load the geometric constraint solving engine to be loaded.
[0102] In some embodiments of the present invention, the geometric constraint solving command execution module 303 includes:
[0103] A function callback determination sub-module, configured to determine whether the target geometric constraint solving engine needs to perform a function callback.
[0104] The first execution sub-module of the geometric constraint solving command is used to execute the callback function of the target geometric constraint solving engine when the target geometric constraint solving engine needs to perform a function callback, and execute the geometric constraint solving command through the specific implementation of the callback function;
[0105] The second execution sub-module of the geometric constraint solving command is used to perform data format conversion on the geometric constraint object corresponding to the geometric constraint solving command through the target general interface when the target geometric constraint solving engine does not need to perform a function callback, and execute the geometric constraint solving command through the target geometric constraint solving engine according to the geometric constraint object after data format conversion.
[0106] In some embodiments of the present invention, the device further includes:
[0107] The geometric constraint data class definition module is used to define the general geometric constraint data format as a geometric constraint data class and pass the geometric constraint data class into the general interface; wherein, the general geometric constraint data format includes at least one or more of points, lines, circles, ellipses, equations, spline curves, and parametric curves.
[0108] In some embodiments of the present invention, the engine loading module includes:
[0109] The plug-in identifier definition sub-module is used to load the geometric constraint solving engine to be loaded in the form of a plug-in and define a corresponding plug-in identifier for each geometric constraint solving engine to be loaded.
[0110] In some embodiments of the present invention, the geometric constraint solving engine matching module 302 includes:
[0111] The geometric constraint solving engine matching sub-module is used to determine whether there is a target geometric constraint solving engine that matches the target geometric constraint solving engine identifier among the loaded geometric constraint solving engines according to the target geometric constraint solving engine identifier and the plug-in identifier.
[0112] In some embodiments of the present invention, the device further includes:
[0113] The traversal stop module is used to stop the operation of traversing the loaded geometric constraint solving engines according to the target general interface through the predefined general interface layer.
[0114] Some embodiments of the present invention also provide a computer program product, including a computer program, and the computer program realizes the above geometric constraint solving method when executed by a processor.
[0115] In addition, embodiments of the present invention also provide an electronic device, such as Figure 4As shown, it includes a processor 401, a communication interface 402, a memory 403, and a communication bus 404. Among them, the processor 401, the communication interface 402, and the memory 403 complete their mutual communication through the communication bus 404.
[0116] The memory 403 is used to store computer programs.
[0117] When the processor 401 is used to execute the program stored on the memory 403, the following steps are implemented:
[0118] In response to the user's geometric constraint solving command, determine a target general interface carrying the target geometric constraint solving engine identifier according to the geometric constraint solving command.
[0119] Traverse the loaded geometric constraint solving engines according to the target general interface through a predefined general interface layer, and determine whether there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the target geometric constraint solving engine identifier.
[0120] In the case where there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the target geometric constraint solving engine identifier, execute the geometric constraint solving command through the target geometric constraint solving engine.
[0121] In an alternative embodiment of the present invention, before the step of determining a target general interface carrying the target geometric constraint solving engine identifier according to the geometric constraint solving command in response to the user's geometric constraint solving command, the following steps are further included:
[0122] Determine the geometric constraint solving engine to be loaded, and define the general interface of the geometric constraint solving engine to be loaded.
[0123] Define the general interface layer according to the general interface, and load the geometric constraint solving engine to be loaded.
[0124] In an alternative embodiment of the present invention, the step of executing the geometric constraint solving command through the target geometric constraint solving engine includes:
[0125] Determine whether the target geometric constraint solving engine needs to perform a function callback.
[0126] In the case where the target geometric constraint solving engine needs to perform a function callback, execute the callback function of the target geometric constraint solving engine, and execute the geometric constraint solving command through the specific implementation of the callback function.
[0127] In the case where the target geometric constraint solving engine does not need to perform function callbacks, the data format of the geometric constraint object corresponding to the geometric constraint solving command is converted through the target general interface, and the geometric constraint solving command is executed by the target geometric constraint solving engine according to the geometric constraint object after the data format conversion.
[0128] In an alternative embodiment of the present invention, after defining the general interface for the geometric constraint solving engine to be loaded, it further includes:
[0129] Define the general geometric constraint data format as a geometric constraint data class, and pass the geometric constraint data class into the general interface; wherein, the general geometric constraint data format includes at least one or more of points, lines, circles, ellipses, equations, spline curves, and parametric curves.
[0130] In an alternative embodiment of the present invention, the loading of the geometric constraint solving engine to be loaded includes:
[0131] Load the geometric constraint solving engine to be loaded in the form of a plug-in, and define a corresponding plug-in identifier for each geometric constraint solving engine to be loaded.
[0132] In an alternative embodiment of the present invention, determining whether there is a target geometric constraint solving engine that matches the target geometric constraint solving engine identifier in the loaded geometric constraint solving engines includes:
[0133] According to the target geometric constraint solving engine identifier and the plug-in identifier, determine whether there is a target geometric constraint solving engine that matches the target geometric constraint solving engine identifier in the loaded geometric constraint solving engines.
[0134] In an alternative embodiment of the present invention, after executing the geometric constraint solving command through the target geometric constraint solving engine, it further includes:
[0135] Stop the operation of traversing the loaded geometric constraint solving engines through the predefined general interface layer according to the target general interface.
[0136] The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, only a thick line is shown in the figure, but it does not mean that there is only one bus or one type of bus.
[0137] The communication interface is used for communication between the above-mentioned terminal and other devices.
[0138] The memory may include a random access memory (RAM) and may also include a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0139] The aforementioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0140] As Figure 5 shown, in another embodiment provided by the present invention, a computer-readable storage medium 501 is further provided. Instructions are stored in the computer-readable storage medium. When it runs on a computer, it causes the computer to execute the geometric constraint solving method described in the above embodiment.
[0141] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For the relevant parts, refer to the partial description of the method embodiment.
[0142] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data that have been authorized by the user or fully authorized by all parties. And the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.
[0143] Each embodiment in this specification is described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other.
[0144] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, apparatus, or computer program product. Therefore, the embodiments of the present invention can take the form of an all-hardware embodiment, an all-software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) that contain computer-usable program code.
[0145] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing terminal devices generate a device for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0146] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0147] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, such that a series of operation steps are executed on the computer or other programmable terminal device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0148] Although the preferred embodiments of the embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications to these embodiments once they know the basic creative concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications that fall within the scope of the embodiments of the present invention.
[0149] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or terminal device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or terminal device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the existence of additional identical elements in the process, method, article or terminal device comprising the above elements.
[0150] The above provides a detailed introduction to a geometric constraint solving method, apparatus, electronic device, and storage medium. Specific examples are used in this text to elaborate on the principles and implementation manners of the present invention. The descriptions of the above embodiments are only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present invention.
Claims
1. A geometric constraint solving method, characterized in that, The method includes: In response to a user's geometric constraint solving command, determining a target general interface carrying a target geometric constraint solving engine identifier according to the geometric constraint solving command; Traversing the loaded geometric constraint solving engines according to the target general interface through a predefined general interface layer, and determining whether there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the target geometric constraint solving engine identifier; When there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the target geometric constraint solving engine identifier, executing the geometric constraint solving command through the target geometric constraint solving engine.
2. The method according to claim 1, wherein Before the step of determining a target general interface carrying a target geometric constraint solving engine identifier according to the geometric constraint solving command in response to the user's geometric constraint solving command, the method further includes: Determining a geometric constraint solving engine to be loaded, and defining a general interface of the geometric constraint solving engine to be loaded; Defining the general interface layer according to the general interface, and loading the geometric constraint solving engine to be loaded.
3. The method according to claim 1, wherein The step of executing the geometric constraint solving command through the target geometric constraint solving engine includes: Determining whether the target geometric constraint solving engine needs to perform a function callback; When the target geometric constraint solving engine needs to perform a function callback, executing the callback function of the target geometric constraint solving engine, and executing the geometric constraint solving command through the specific implementation of the callback function; When the target geometric constraint solving engine does not need to perform a function callback, converting the data format of the geometric constraint object corresponding to the geometric constraint solving command through the target general interface, and executing the geometric constraint solving command according to the geometric constraint object after data format conversion through the target geometric constraint solving engine.
4. The method according to claim 2, wherein After the step of defining the general interface of the geometric constraint solving engine to be loaded, the method further includes: Defining a general geometric constraint data format as a geometric constraint data class, and passing the geometric constraint data class into the general interface; wherein, the general geometric constraint data format includes at least one or more of points, lines, circles, ellipses, equations, spline curves, and parametric curves.
5. The method according to claim 2, wherein The step of loading the geometric constraint solving engine to be loaded includes: Loading the geometric constraint solving engine to be loaded in the form of a plugin, and defining a corresponding plugin identifier for each geometric constraint solving engine to be loaded.
6. The method according to claim 5, wherein The step of determining whether there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the target geometric constraint solving engine identifier includes: Determining whether there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the target geometric constraint solving engine identifier according to the target geometric constraint solving engine identifier and the plugin identifier.
7. The method according to claim 1, wherein After the step of executing the geometric constraint solving command through the target geometric constraint solving engine, the method further includes: Stop the operation of traversing the loaded geometric constraint solving engine according to the target general interface through a predefined general interface layer.
8. A geometric constraint solving device, characterized in that The device includes: A container generation module, configured to, in response to a user's geometric constraint solving command, determine a target general interface carrying an identifier of a target geometric constraint solving engine according to the geometric constraint solving command; A geometric constraint solving engine matching module, configured to traverse the loaded geometric constraint solving engines according to the target general interface through a predefined general interface layer, and determine whether there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the identifier of the target geometric constraint solving engine; A geometric constraint solving command execution module, configured to, when there is a target geometric constraint solving engine in the loaded geometric constraint solving engines that matches the identifier of the target geometric constraint solving engine, execute the geometric constraint solving command through the target geometric constraint solving engine.
9. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored on the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the geometric constraint solving method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, it implements the geometric constraint solving method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Modeling method and system adaptive to various geometric engines
CN117150588A
Distributed geometric constraint solving engine based on cloud environment
CN117950837A
Custom equation method and system based on variable description and storage medium
CN117951419A
Method and apparatus for manipulating geometric constraints of a mechanical design
US6441837B1