Error detection method, device and equipment for geometry modeling engine and medium
By deploying parameter parsing error scripts in the geometric modeling engine and using error detection functions to detect and output abnormal information, the problems of inefficient error reporting mechanisms and inconsistent standards are solved, achieving efficient and intuitive abnormal detection and consistent processing standards.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 粤港澳大湾区(广东)国创中心
- Filing Date
- 2025-03-07
- Publication Date
- 2026-04-17
AI Technical Summary
Existing geometric modeling engines have inefficient and unintuitive error reporting mechanisms, inconsistent processing standards, and poor scalability.
By deploying parameter parsing error scripts in the geometric modeling engine, and utilizing parameter parsing list classes and error detection functions, error test cases are obtained, model parameters are parsed, target error detection functions are extracted, and parameter anomaly information and correction information are detected and output.
It improves the fault tolerance of the error reporting mechanism, realizes efficient and intuitive anomaly detection, and ensures the consistency and scalability of processing standards.
Smart Images

Figure CN120407392B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software testing technology, and in particular to an error detection method for a geometric modeling engine, an error detection device for a geometric modeling engine, an electronic device, and a computer-readable storage medium. Background Technology
[0002] The geometry modeling engine (also known as the geometry kernel) is the core underlying support in industrial software. It provides crucial technical support for 3D modeling, accurately and efficiently handling complex geometric elements and functions. Functional testing is a key step in perfecting the geometry modeling engine's functionality. By using a testing platform and test cases, the functionality of the geometry kernel can be verified to ensure it functions as expected. This testing allows for the discovery of defects and errors in the geometry kernel's modeling capabilities, ensuring the accuracy of the model and the reliability of its functions.
[0003] Among the core functions of the testing platform is the error reporting mechanism of the geometric modeling engine. This mechanism ensures that errors can be detected and addressed promptly during the design and modeling process, leading to improvements in related functionalities. The geometric modeling engine testing platform needs to be able to identify and classify various errors and establish an exception handling mechanism, executing condition checks and exception throwing. However, the testing of the error reporting mechanism for the geometric modeling engine's related geometric modeling functions has revealed problems such as inefficient testing, lack of intuitiveness, inconsistent processing standards, and poor scalability. Summary of the Invention
[0004] This invention provides an error detection method, apparatus, device, and medium for a geometric modeling engine, to solve or partially solve the problems of inefficient testing, lack of intuitiveness, inconsistent processing standards, and poor scalability of the error detection mechanism in the process of testing the error detection mechanism of the geometric modeling engine's related geometric modeling functions.
[0005] This invention discloses an error detection method for a geometric modeling engine. The method is applied to a geometric modeling engine that deploys a parameter parsing error script. The parameter parsing error script includes a parameter parsing list class, which at least includes an error detection function. The method includes:
[0006] Obtain error test cases for execution in the geometry modeling engine;
[0007] The error test cases are parsed to obtain the model parameters corresponding to the error test cases and the number of parameters corresponding to the model parameters;
[0008] Extract at least one target error detection function from the error detection function based on the number of parameters;
[0009] The target error detection function detects parameter anomalies in the model parameters and outputs parameter anomaly information and parameter correction information for the error test cases.
[0010] This invention also discloses an error detection device for a geometric modeling engine, applied to a geometric modeling engine that deploys a parameter parsing error script. The parameter parsing error script includes a parameter parsing list class, which at least includes an error detection function. The device comprises:
[0011] The use case acquisition module is used to acquire erroneous use cases for execution in the geometric modeling engine.
[0012] The parameter determination module is used to parse the error test cases, obtain the model parameters corresponding to the error test cases, and the number of parameters corresponding to the model parameters;
[0013] The function extraction module is used to extract at least one target error detection function from the error detection function according to the number of parameters;
[0014] The detection module is used to detect parameter anomalies in the model parameters through the target error detection function, and output parameter anomaly information and parameter correction information for the error test cases.
[0015] This invention also discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0016] The memory is used to store computer programs;
[0017] When the processor executes a program stored in the memory, it implements the method described in the embodiments of the present invention.
[0018] This invention also discloses a computer-readable storage medium storing instructions that, when executed by one or more processors, cause the processors to perform the methods described in this invention.
[0019] The embodiments of the present invention have the following advantages:
[0020] In this embodiment of the invention, users can deploy corresponding parameter parsing error scripts in the geometric modeling engine. These scripts include a parameter parsing list class, which contains at least an error detection function. During testing of geometric modeling functions using the geometric modeling engine, the engine can obtain error test cases for execution within the engine through these scripts. The error test cases are then parsed to obtain the corresponding model parameters and their quantity. Based on the parameter quantity, at least one target error detection function is extracted from the error detection function. If the target error detection function detects parameter anomalies, it outputs parameter anomaly information and parameter correction information for the error test cases. By constructing these scripts, the error reporting mechanism of the geometric modeling engine is improved, enhancing its fault tolerance. This allows the scripts to detect corresponding error test cases during testing and output parameter anomaly information and correction information when anomalies are detected. This enables users to efficiently and intuitively perceive anomalies, facilitating the discovery of potential risks in parameter parsing. Furthermore, the error detection function ensures consistency and scalability of processing standards, ultimately meeting the user's actual needs. Attached Figure Description
[0021] Figure 1 This is a flowchart of the steps of an error detection method for a geometric modeling engine provided in an embodiment of the present invention;
[0022] Figure 2 This is a schematic diagram of an application scenario provided in an embodiment of the present invention;
[0023] Figure 3 This is a schematic diagram of an application scenario provided in an embodiment of the present invention;
[0024] Figure 4 This is a structural block diagram of an error detection device for a geometric modeling engine provided in an embodiment of the present invention. Detailed Implementation
[0025] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0026] As an example, the geometric modeling engine (also known as the geometric kernel) is a core underlying support in industrial software. It provides key technical support for 3D modeling, accurately and efficiently handling complex geometric elements and functions. Functional testing is a crucial step in perfecting the functionality of the geometric modeling engine. Using a test platform and test cases, it's possible to verify whether the kernel's related functions work as expected, discover defects and errors in the modeling functionality, and ensure the accuracy of the model and the reliability of the functions.
[0027] Among the core functions of a testing platform is the error reporting mechanism for the geometric modeling engine. This mechanism ensures that errors are detected and addressed promptly during the design and modeling process, leading to improvements in functionality. The geometric modeling engine testing platform needs to be able to identify and classify various errors and establish exception handling mechanisms, including condition checks and exception throwing. However, the current testing process for the geometric modeling engine's error reporting mechanism has the following shortcomings:
[0028] (1) Lack of error test cases, and the error reporting mechanism is inefficient and unintuitive in testing.
[0029] Although different geometric modeling engine vendors currently have their own error reporting mechanisms, the testing and verification of these mechanisms are not perfect, resulting in inefficient and unintuitive error reporting mechanisms that are not conducive to discovering potential risks in the parsing of function parameters.
[0030] (2) The error handling standards are not uniform and the error reporting mechanism has poor scalability.
[0031] Due to the large number of functional functions, diverse input parameter types, and numerous test cases, a lack of unified error handling standards and standardized error reporting mechanisms have hindered the parameter parsing error reporting mechanism from fulfilling its testing and verification functions. Furthermore, the absence of unified error standards when extending new functional functions complicates the testing of these new functions, making functional verification difficult and hindering subsequent function maintenance and updates.
[0032] In this invention, a corresponding parameter parsing error script is constructed and used to detect errors in the modeling function of the geometric modeling engine, thereby determining whether there are any anomalies in the modeling function and ensuring its stability. Specifically, users can deploy the corresponding parameter parsing error script in the geometric modeling engine. The parameter parsing error script includes a parameter parsing list class, which at least includes an error detection function. During the user's testing of the geometric modeling function through the geometric modeling engine, the geometric modeling engine can obtain error test cases for execution within the engine through the parameter parsing error script. These error test cases are then parsed to obtain the corresponding model parameters and the number of parameters. Finally, at least one parameter is extracted from the error detection function based on the number of parameters. The target error detection function, if it detects parameter anomalies in the model parameters, outputs parameter anomaly information and parameter correction information for the erroneous test cases. By constructing corresponding parameter parsing error scripts, the error reporting mechanism of the geometric modeling engine is improved, enhancing its fault tolerance. This allows users to detect corresponding erroneous test cases during geometric modeling function testing using the engine, and outputs appropriate parameter anomaly and correction information when anomalies are detected. This enables users to efficiently and intuitively perceive anomalies, facilitating the discovery of potential risks in parameter parsing. Furthermore, the error detection function ensures consistency and scalability of processing standards, ultimately meeting users' actual needs.
[0033] Reference Figure 1 This diagram illustrates a flowchart of an error detection method for a geometric modeling engine, provided in an embodiment of the present invention. The method is applied to a geometric modeling engine, which deploys a parameter parsing error script. The parameter parsing error script includes a parameter parsing list class, which at least includes an error detection function. Specifically, the method may include the following steps:
[0034] Step 101: Obtain error test cases for execution in the geometric modeling engine;
[0035] For a geometric modeling engine, it can be a software library or tool for creating, editing and analyzing geometric models (such as cuboids, cylinders, spheres, etc.). For example, it can be used for creating and editing geometric objects, Boolean operations (such as union, difference and intersection), transformations of geometric objects (such as translation, rotation, scaling, etc.), and calculation of geometric object properties (such as volume, surface area, etc.).
[0036] In order to ensure that the geometry modeling engine can accurately and efficiently handle complex geometric elements and functions, users can perform functional tests on the relevant geometry modeling functions in the geometry modeling engine before formally performing geometry modeling. This verifies whether the geometry modeling functions of the geometry modeling engine can work as expected, thereby discovering defects and errors in the modeling functions, and ensuring the accuracy and reliability of the model objects constructed during the modeling process.
[0037] In this embodiment of the invention, in order to test the error reporting mechanism of the modeling function in the geometric modeling engine, a corresponding parameter parsing error script (hereinafter referred to as the script) can be constructed and deployed in the geometric modeling engine. By inputting the corresponding error test cases, the parameter parsing error script analyzes the parameter anomalies in the error test cases to verify whether the modeling function in the geometric modeling engine can work as predicted.
[0038] It should be noted that the parameter parsing error script can be used to test the modeling function of the service geometry modeling engine. Users can define error record structures, parameter parsing list classes, and error message categories in the script to perform functional tests on the geometry modeling engine.
[0039] The error log structure PyErrorInfo, defined in the parameter parsing error script, records the following error information:
[0040] (1) Error code message m_ErrorCode provides a diagnostic conclusion for the parameter error type.
[0041] PY_ARGUMENT_NO_ERROR indicates that the parameters are normal.
[0042] PY_ARGUMENT_NUM_ERROR (abnormal number of arguments) indicates that the number of arguments is inconsistent. PY_ARGUMENT_TYPE_ERROR (abnormal argument type) indicates that the argument type is incorrect.
[0043] (2) Error location index m_ErrorIndex, an Int type, is used to indicate the index position where the error parameter exists. The default value is -1, which changes as the parameter is parsed and read.
[0044] (3) The correct number of parameters m_CorrectNumber, an Int vector type, is used to display the correct number of parameters of the function. Since the function may be overloaded, it is stored using an Int vector type.
[0045] (4) Correct parameter type m_correctType, an Int vector type, is used to indicate how to correct an incorrect parameter type to the correct parameter type, and is stored as the parameter parsing and reading process progresses.
[0046] In addition, in the parameter parsing error script, a parameter parsing list class and an error message category can be defined. Let PyArgList be the parameter parsing list class, which contains two member variables and several error checking function declarations.
[0047] Member variables include:
[0048] PyObject* m_PyObject, an object pointer to the entity model, used to point to the entity model object.
[0049] PyErrorInfo*m_ErrorInfo, an error code pointer used to record relevant error information.
[0050] Function declarations include:
[0051] Size(): Gets the number of parameters.
[0052] IsNull(): Determines whether the object pointer of the entity model is null.
[0053] ClearErrorInfo(): Resets the error code pointer.
[0054] `GetDouble`: Compares the corresponding parameter to whether it is of type `NUMBER` (i.e., checks if the parameter is a numeric type) (either `double` or `int`). If the type is incorrect, the error code pointer `m_ErrorInfo`'s `m_ErrorCode` points to `PY_ARGUMENT_TYPE_ERROR`, `m_ErrorIndex` corresponds to the position of the erroneous parameter, and `m_correctType` corresponds to the correct parameter type. Furthermore, similar error checking functions exist for `GetBoolean` (checking if the parameter is a boolean), `GetLong` (checking if the parameter is a long integer), `GetStr` (checking if the parameter is a string), and `GetPosition` (checking if the parameter is a user-defined type). These error checking functions can be extended to reflect specific functionalities.
[0055] After configuring the script for handling parameter parsing errors, users can also develop the `doc.CheckPython` function to check the Python parameter parsing of commands. Specifically, it returns 1 if correct and 0 if incorrect. The `CheckPython` function has the following three overloaded types:
[0056] (1) Parameter parsing is correct
[0057] doc.CheckPython(PY_ARGUMENT_NO_ERROR).
[0058] (2) Check the number of parameters
[0059] doc.CheckPython(PY_ARGUMENT_TYPE_ERROR,[PY_DATA_NUMBER],num).
[0060] The first parameter, PY_ARGUMENT_TYPE_ERROR, indicates parameter error checking; the second parameter, [PY_DATA_NUMBER], indicates the number of parameters to be checked; and the third parameter, num, indicates the number of parameters to be checked.
[0061] For example, check if the number of parameters is 5:
[0062] doc.CheckPython(PY_ARGUMENT_TYPE_ERROR,[PY_DATA_NUMBER],5).
[0063] (3) Check parameter type
[0064] doc.CheckPython(PY_ARGUMENT_TYPE_ERROR,[PY_DATA_Type],index).
[0065] The first parameter, PY_ARGUMENT_TYPE_ERROR, indicates parameter error checking. The second parameter, PY_DATA_Type, indicates that the parameter type should be checked accordingly. The third parameter, index, indicates the index of the parameter to be checked. For example, to check if the third parameter (since array indices start from 0, the index of the third parameter should be 2) is a point coordinate type, use `doc.CheckPython(PY_ARGUMENT_TYPE_ERROR,[PY_DATA_POINT],2)`.
[0066] By handling the anomalies that occur during parameter parsing as described above, different parameter anomalies can be assigned corresponding error codes, thus creating a parameter parsing error reporting mechanism for the geometric modeling engine. Based on this mechanism, efficient and stable technical support can be provided for the parameter parsing testing and verification of the geometric modeling engine's modeling function through unified standards, standardized triggering conditions, and clear error messages.
[0067] Furthermore, error test cases can be user-configured geometric modeling test cases. Error test cases can be configured according to the actual exceptions to be tested. For example, error test cases can be configured as test cases with incorrect parameter quantity, test cases with incorrect parameter type, or test cases with both incorrect parameter quantity and incorrect parameter type, etc., so as to verify the error reporting mechanism of the geometric modeling engine by executing error test cases and testing whether the geometric modeling engine will report the corresponding exceptions. This invention does not impose any limitations on this.
[0068] Step 102: parse the error test cases to obtain the model parameters corresponding to the error test cases and the number of parameters corresponding to the model parameters;
[0069] In practical implementation, once the erroneous test cases are identified, they can be imported into the geometric modeling engine for functional testing. The parameter parsing error script can parse the erroneous test cases to obtain the model parameters corresponding to the erroneous test cases, as well as the number of parameters corresponding to the model parameters. This allows for the detection of model parameters and the number of parameters, and the identification of parameter anomalies corresponding to the erroneous test cases.
[0070] Step 103: Extract at least one target error detection function from the error detection function according to the number of parameters;
[0071] Once the number of parameters is determined, since different numbers of parameters can correspond to different error detection functions, at least one target error detection function can be extracted from the error detection functions based on the number of parameters. This allows for the extraction of targeted error detection functions to detect erroneous test cases, thereby improving the accuracy of functional testing. The error detection function can include functions for detecting whether a model parameter is a numeric type, a Boolean type, a long integer type, a string type, or a user-defined type, etc., and this invention does not impose any limitations on this.
[0072] In some feasible implementations, the target error detection function extracted based on the number of parameters can include at least one of a numerical error detection function and a custom error detection function. Specifically, if the number of parameters is a first number, a numerical error detection function is extracted from the error detection functions; if the number of parameters is a second number, both a numerical error detection function and a custom error detection function are extracted from the error detection functions. Furthermore, the parameter anomaly information includes parameter quantity anomaly information, and the parameter correction information includes at least quantity correction information. If the number of parameters is not the first or second number, parameter quantity anomaly information for the erroneous test case, along with the corresponding quantity correction information, is output. Thus, by using the number of parameters corresponding to the model parameters, the error checking function can be accurately extracted. Detecting the model parameters in the erroneous test cases based on the extracted error checking function can effectively improve the accuracy of functional testing.
[0073] Optionally, the first quantity and the second quantity can be different values to distinguish that different quantities of model parameters require different error checking functions for detection to ensure the accuracy of detection. For example, the first quantity can be 5, the second quantity can be 6, etc. That is, when the model parameters corresponding to the erroneous test case are 5, they can be detected by a numerical error detection function; when the model parameters corresponding to the erroneous test case are 6, they can be detected by a numerical error detection function and a custom error detection function, etc. This invention does not impose any restrictions on this.
[0074] It should be noted that the embodiments of the present invention include, but are not limited to, the examples described above. It is understood that, under the guidance of the ideas in the embodiments of the present invention, those skilled in the art can also set other error detection functions and the corresponding number of parameters according to actual needs, and the present invention does not limit this.
[0075] Step 104: Detect parameter anomalies in the model parameters using the target error detection function, and output parameter anomaly information and parameter correction information for the error test cases.
[0076] Once the target error detection function is determined, it can be used to detect model parameters in erroneous test cases, identify parameter anomalies corresponding to the erroneous test cases, and output parameter anomaly information and parameter correction information for the erroneous test cases. By constructing corresponding parameter parsing error scripts, the error reporting mechanism of the geometric modeling engine can be improved, enhancing its fault tolerance. This allows users to efficiently and intuitively perceive the anomalies during testing of geometric modeling functions using the engine, identify potential risks in parameter parsing, and ensure consistency and scalability of processing standards through the error detection function, ultimately meeting users' actual needs.
[0077] In some feasible implementations, such as the above embodiment, the parameter parsing error script may include an error record structure. The parameter anomaly information includes at least one of parameter quantity anomaly information and parameter type anomaly information. The parameter correction information includes quantity correction information and type correction information. If the target error detection function detects that the model parameters have an abnormal parameter quantity, the error record structure outputs the parameter quantity anomaly information and quantity correction information for the error test case. If the target error detection function detects that the model parameters have an abnormal parameter type, the error record structure outputs the parameter type anomaly information and type correction information for the error test case. If the target error detection function detects that the model parameters have both an abnormal parameter quantity and an abnormal parameter type, the error record structure outputs the parameter quantity anomaly information and parameter type anomaly information for the error test case, as well as the quantity correction information and type correction information corresponding to the error test case.
[0078] In the specific implementation, the parameter parsing error script also includes an error code pointer. The error record structure includes at least error code prompt information and correct parameter information. The correct parameter information includes at least standard quantity information. Therefore, in the process of identifying parameter quantity anomalies, the error code pointer can be used to determine the first error code prompt information used to present the parameter quantity anomaly of the erroneous test case from the error code prompt information in the error record structure. The first error code prompt information is used as the parameter quantity anomaly information for the erroneous test case; and the standard quantity information is used as the quantity correction information for the erroneous test case.
[0079] In addition, the correct parameter information also includes standard type information. Therefore, during the identification of parameter type anomalies, the second error code prompt information used to present the parameter type anomaly of the erroneous test case can be determined from the error code prompt information in the error record structure through the error code pointer. The second error code prompt information is used as the parameter type anomaly information for the erroneous test case, and the standard type information is used as the type correction information for the erroneous test case.
[0080] In addition, the error record structure can also include an error location index. Then, whether it is an abnormality in the number of parameters or an abnormality in the parameter type, the target model parameter where the abnormality in the number of parameters and / or the abnormality in the parameter type can be located by the error code pointer, the parameter position corresponding to the target model parameter can be determined, and then the parameter position can be assigned to the error location index.
[0081] Through the above process, the parameter anomalies corresponding to the erroneous test cases can be accurately recorded by the error record structure in the parameter parsing error script. This effectively verifies the modeling function and error reporting mechanism of the geometric modeling engine, enhances the fault tolerance of the error reporting mechanism, and verifies whether the geometric modeling engine can execute as expected by the user. At the same time, based on parameter anomaly information, correction information, and position index, the corresponding parameter anomalies can be presented efficiently and intuitively, which helps users discover potential risks in parameter parsing. Furthermore, the error detection function can ensure the consistency and scalability of the processing standard, which helps meet the actual needs of users.
[0082] In some examples, if the number of parameters is normal and is the first number, the parameter sequence corresponding to each model parameter is determined. According to the sorting order of the parameter sequence, the numerical error detection function is used to determine whether each first model parameter after the nth model parameter is a numerical type. If there is at least one first model parameter that is not a numerical type, the parameter type exception information and type correction information for the erroneous test case are output.
[0083] In other examples, if the number of parameters is normal and the number of parameters is the second largest, then the parameter sequence corresponding to each model parameter is determined; according to the sorting order of the parameter sequence, a custom detection function is used to determine whether the m-th model parameter in the model parameters is a custom type, and a numerical error detection function is used to determine whether each second model parameter after the m-th model parameter in the model parameters is a numerical type; if the m-th model parameter is not a custom type, and / or there is at least one second model parameter that is not a numerical type, then parameter type anomaly information and type correction information for the erroneous test case are output.
[0084] For example, assuming the first quantity is 5 and n is 2, then if the number of parameters is normal, and the number of parameters in the model parameter corresponding to the erroneous test case is 5, then according to the sorting order of the model parameters in the erroneous test case, the numerical error detection function can be used to determine whether the 3rd, 4th, and 5th model parameters are of numerical type. If at least one of the 3rd, 4th, and 5th model parameters is not of numerical type, then the parameter type anomaly information and type correction information for the erroneous test case will be output.
[0085] Assuming the second quantity is 6 and m is 3, under normal parameter quantity conditions, if the model parameter quantity corresponding to the erroneous test case is 6, then according to the sorting order of the model parameters in the erroneous test case, a custom detection function can be used to determine whether the third model parameter is a coordinate type, and a numerical error detection function can be used to determine whether the fourth, fifth, and sixth model parameters are numerical types. If the third model parameter is not a coordinate type, and / or at least one of the fourth, fifth, and sixth model parameters is not a numerical type, then parameter type anomaly information and type correction information for the erroneous test case are output. This effectively verifies the modeling function and error reporting mechanism of the geometric modeling engine, enhances the fault tolerance of the error reporting mechanism, and verifies whether the geometric modeling engine can execute as expected by the user. At the same time, based on parameter anomaly information, correction information, and position index, the corresponding parameter anomalies can be presented efficiently and intuitively, which helps users discover potential risks in parameter parsing. Furthermore, the error detection function can ensure the consistency and scalability of the processing standard, which is beneficial to meeting the actual needs of users.
[0086] It should be noted that the embodiments of the present invention include, but are not limited to, the examples described above. It is understood that those skilled in the art can make further settings according to actual needs under the guidance of the ideas in the embodiments of the present invention, and the present invention does not limit such settings.
[0087] In this embodiment of the invention, users can deploy corresponding parameter parsing error scripts in the geometric modeling engine. These scripts include a parameter parsing list class, which contains at least an error detection function. During testing of geometric modeling functions using the geometric modeling engine, the engine can obtain error test cases for execution within the engine through these scripts. The error test cases are then parsed to obtain the corresponding model parameters and their quantity. Based on the parameter quantity, at least one target error detection function is extracted from the error detection function. If the target error detection function detects parameter anomalies, it outputs parameter anomaly information and parameter correction information for the error test cases. By constructing these scripts, the error reporting mechanism of the geometric modeling engine is improved, enhancing its fault tolerance. This allows the scripts to detect corresponding error test cases during testing and output parameter anomaly information and correction information when anomalies are detected. This enables users to efficiently and intuitively perceive anomalies, facilitating the discovery of potential risks in parameter parsing. Furthermore, the error detection function ensures consistency and scalability of processing standards, ultimately meeting the user's actual needs.
[0088] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the following examples are provided for illustrative purposes:
[0089] In one example, refer to Figure 2 The illustration shows a schematic diagram of an application scenario provided in an embodiment of the present invention, using the parameter parsing error code for creating a cuboid model as an example for explanation. Specifically:
[0090] (1) There are two overloaded examples of the function to create a cuboid model. One is to pass in the command name, shape name, length of the cuboid, width of the cuboid, and height of the cuboid, a total of 5 parameters; the other is to pass in the command name, shape name, point coordinates, length of the cuboid, width of the cuboid, and height of the cuboid, a total of 6 parameters.
[0091] First, we need to determine the number of parameters. We extract all parameters into an array and store them. If the number of parameters is not 5 or 6, then errorInfo->m_ErrorCode = PY_ARGUMENT_NUM_ERROR; and the error code will indicate the correct number of parameters: errorInfo->m_CorrectNumber.push_back(5); errorInfo->m_CorrectNumber.push_back(6).
[0092] (2) Use the GetStr function to determine whether the shape name of the second parameter is a string type.
[0093] (3) For heavy load situations, the following situations apply:
[0094] If the number of parameters is 5, use the GetDouble function to check if the 3rd, 4th, and 5th parameters are of type NUMBER. If they are not of type NUMBER (double or int), then retrieve the value.
[0095] m_ErrorInfo->m_ErrorCode=PY_ARGUMENT_TYPE_ERROR;
[0096] m_ErrorInfo->m_ErrorIndex points to the index of the error parameter.
[0097] m_ErrorInfo->m_correctType.push_back(PY_DATA_NUMBER); obtains the correct parameter type.
[0098] If the number of parameters is 6, first use the GetPosition function to determine if the 3rd parameter is a point coordinate type, and then use the GetDouble function to determine if the 4th, 5th, and 6th parameters are of type NUMBER.
[0099] (4) If the number and type of parameters are correct, the error code pointer should be at the initial default value, i.e.
[0100] m_ErrorInfo->m_ErrorCode=PY_ARGUMENT_NO_ERROR;
[0101] m_ErrorInfo->m_ErrorIndex=-1;
[0102] (5) The doc.CheckPython function can be used to check the Python parameter parsing of commands. Through specific use cases, it is possible to test and verify whether the function works as expected.
[0103] In another example, refer to Figure 3 The diagram illustrates an application scenario provided in an embodiment of the present invention, using the parameter parsing error code of a rotation model as an example for explanation. Specifically:
[0104] The rotation operation rotates based on a rotation center, rotation axis, and rotation angle. It supports rotating multiple shapes simultaneously. The shape to be rotated can be a solid, vertex, line, or face. Its input parameters are the command name, shape name, rotation center, rotation axis, and rotation angle. The shape name can be a single shape or multiple shapes.
[0105] First, the number of parameters needs to be checked. If the number of parameters is not 5, the error code pointer will be...
[0106] errorInfo->m_ErrorCode=PY_ARGUMENT_NUM_ERROR;
[0107] The error code will also display the correct number of parameters: errorInfo->m_CorrectNumber.push_back(5);
[0108] For the second parameter, the shape name, if it is a single shape name, the GetStr function is used; if it is multiple shape names, the GetStrList function is used.
[0109] The GetPosition function is used to determine the coordinates of the rotation center point, which is the third parameter.
[0110] To determine the fourth parameter, the rotation axis, use the GetVector function.
[0111] The GetDouble function is used to determine the value of the fifth parameter, the rotation angle.
[0112] The `doc.CheckPython` function can be used to check the Python parameter parsing of commands. Through specific test cases, it can be used to test and verify whether the functions are running as expected.
[0113] In the above process, by constructing corresponding parameter parsing error scripts, the error reporting mechanism of the geometric modeling engine is improved, enhancing the fault tolerance of the error reporting mechanism. This allows the parameter parsing error scripts to detect corresponding error test cases during the testing of geometric modeling functions by users through the geometric modeling engine. When anomalies are detected, the scripts output corresponding parameter anomaly information and parameter correction information, enabling users to efficiently and intuitively perceive the corresponding anomalies. This is beneficial for discovering potential risks in parameter parsing, and the error detection function can ensure the consistency and scalability of processing standards, thus meeting the actual needs of users.
[0114] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0115] Reference Figure 4 This diagram illustrates a structural block diagram of an error detection device for a geometric modeling engine provided in an embodiment of the present invention. The device is applied to a geometric modeling engine, which deploys a parameter parsing error script. The parameter parsing error script includes a parameter parsing list class, which at least includes an error detection function. Specifically, it may include the following modules:
[0116] The use case acquisition module 401 is used to acquire erroneous use cases for execution in the geometric modeling engine.
[0117] The parameter determination module 402 is used to parse the error test cases to obtain the model parameters corresponding to the error test cases and the number of parameters corresponding to the model parameters;
[0118] Function extraction module 403 is used to extract at least one target error detection function from the error detection function according to the number of parameters;
[0119] The detection module 404 is used to detect parameter anomalies in the model parameters through the target error detection function, and output parameter anomaly information and parameter correction information for the error test cases.
[0120] In some feasible implementations, the parameter parsing error script further includes an error record structure, the parameter anomaly information includes at least one of parameter quantity anomaly information and parameter type anomaly information, the parameter correction information includes quantity correction information and type correction information, and the detection module 404 is specifically used for:
[0121] If the target error detection function detects that there is an abnormal number of parameters in the model parameters, the error record structure outputs the abnormal number of parameters and the number correction information for the error test case.
[0122] If the target error detection function detects that the model parameters have abnormal parameter types, the error record structure outputs the abnormal parameter type information and type correction information for the error test case.
[0123] If the target error detection function detects that the model parameters have an abnormal number of parameters and an abnormal parameter type, then the error record structure outputs the abnormal parameter number information and abnormal parameter type information for the error test case, as well as the quantity correction information and type correction information corresponding to the error test case.
[0124] In some feasible implementations, the parameter parsing error script further includes an error code pointer, and the error record structure includes at least error code prompt information and correct parameter information. The correct parameter information includes at least standard quantity information. The detection module 404 is specifically used for:
[0125] The error code pointer is used to determine the first error code message used to present the abnormal number of parameters for the error test case from the error code message information in the error record structure, and the first error code message is used as the abnormal number of parameters for the error test case.
[0126] The standard quantity information is used as quantity correction information for the erroneous test cases.
[0127] In some feasible implementations, the correct parameter information also includes standard type information, and the detection module 404 is specifically used for:
[0128] The error code pointer is used to determine the second error code message used to present the parameter type anomaly of the error test case from the error code message information in the error record structure, and the second error code message is used as the parameter type anomaly information for the error test case;
[0129] The standard type information is used as type correction information for the error use case.
[0130] In some feasible implementations, the error record structure further includes an error location index, and the device further includes:
[0131] The positioning module is used to locate the target model parameters that have abnormal parameter quantity and / or abnormal parameter type by using the error code pointer, and to determine the parameter position corresponding to the target model parameters;
[0132] An indexing module is used to assign the parameter position to the error position index.
[0133] In some feasible implementations, the target error detection function includes at least one of a numerical error detection function and a custom error detection function, and the function extraction module 403 is specifically used for:
[0134] If the number of parameters is the first number, then extract the numerical error detection function from the error detection function;
[0135] If the number of parameters is the second number, then extract the numerical error detection function and the custom error detection function from the error detection function.
[0136] In some feasible implementations, the parameter anomaly information includes parameter quantity anomaly information, the parameter correction information includes at least quantity correction information, and the detection module 404 is specifically used for:
[0137] If the number of parameters is not the first number or the second number, then output parameter number anomaly information for the erroneous use case, and quantity correction information corresponding to the parameter number anomaly information.
[0138] In some feasible implementations, the parameter anomaly information includes parameter type anomaly information, the parameter correction information includes at least type correction information, and the detection module 404 is further used for:
[0139] If the number of parameters is a first number, then determine the parameter sequence corresponding to each of the model parameters;
[0140] According to the sorting order corresponding to the parameter sequence, the numerical error detection function is used to determine whether each first model parameter after the nth model parameter in the model parameters is a numerical type;
[0141] If at least one of the first model parameters is not a numerical type, then output parameter type exception information and type correction information for the error test case.
[0142] In some feasible implementations, the parameter anomaly information includes parameter type anomaly information, the parameter correction information includes at least type correction information, and the detection module 404 is further used for:
[0143] If the number of parameters is the second number, then determine the parameter sequence corresponding to each of the model parameters;
[0144] According to the sorting order corresponding to the parameter sequence, the custom detection function is used to determine whether the m-th model parameter in the model parameters is a custom type, and the numerical error detection function is used to determine whether each second model parameter after the m-th model parameter in the model parameters is a numerical type.
[0145] If the m-th model parameter is not of the custom type, and / or at least one of the second model parameters is not of the numeric type, then output parameter type exception information and type correction information for the error test case.
[0146] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0147] In addition, this invention also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described error detection method embodiment for a geometric modeling engine and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0148] This invention also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the various processes of the above-described error detection method embodiment for a geometric modeling engine, achieving the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0149] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0150] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, EEPROM, Flash, and eMMC, etc.) containing computer-usable program code.
[0151] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0152] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0153] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0154] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.
[0155] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0156] The above provides a detailed description of an error detection method and an error detection device for a geometric modeling engine provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. An error detection method for a geometric modeling engine, characterized in that, An error parsing script is applied to a geometric modeling engine, wherein the geometric modeling engine deploys a parameter parsing error script. The parameter parsing error script includes a parameter parsing list class and an error record structure for recording error information. The parameter parsing list class includes at least an error detection function. The parameter parsing error script is used to detect the modeling function of the geometric modeling engine. The error record structure includes at least an error code message and an error location index. The error code message provides a diagnostic conclusion for the parameter error type, and the error location index indicates the index position where the erroneous parameter exists. The method includes: Obtain error test cases for execution in the geometry modeling engine; The erroneous test cases are parsed to obtain the model parameters corresponding to the erroneous test cases, and the number of parameters corresponding to the model parameters; Extract at least one target error detection function from the error detection function based on the number of parameters; The target error detection function detects parameter anomalies in the model parameters and outputs parameter anomaly information and parameter correction information for the error test cases through the error record structure; the parameter anomaly information includes at least one of parameter quantity anomaly information and parameter type anomaly information, and the parameter correction information includes at least one of quantity correction information and type correction information. The target error detection function includes at least one of a numerical error detection function and a custom error detection function. The step of detecting parameter anomalies in the model parameters using the target error detection function and outputting parameter anomaly information and parameter correction information for the error test cases further includes: If the number of parameters is a first number, then determine the parameter sequence corresponding to each of the model parameters; According to the sorting order corresponding to the parameter sequence, the numerical error detection function is used to determine whether each first model parameter after the nth model parameter in the model parameters is a numerical type; If at least one of the first model parameters is not of a numerical type, then output parameter type exception information and type correction information for the error test case. If the number of parameters is the second number, then determine the parameter sequence corresponding to each of the model parameters; According to the sorting order corresponding to the parameter sequence, the custom error detection function is used to determine whether the m-th model parameter in the model parameters is a custom type, and the numerical error detection function is used to determine whether each second model parameter after the m-th model parameter in the model parameters is a numerical type. If the m-th model parameter is not of the custom type, and / or at least one of the second model parameters is not of the numeric type, then output parameter type exception information and type correction information for the error test case.
2. The method according to claim 1, characterized in that, The step of detecting parameter anomalies in the model parameters using the target error detection function and outputting parameter anomaly information and parameter correction information for the error test cases through the error record structure includes: If the target error detection function detects that there is an abnormal number of parameters in the model parameters, the error record structure outputs the abnormal number of parameters and the number correction information for the error test case. If the target error detection function detects that the model parameters have abnormal parameter types, the error record structure outputs the abnormal parameter type information and type correction information for the error test case. If the target error detection function detects that the model parameters have an abnormal number of parameters and an abnormal parameter type, then the error record structure outputs the abnormal parameter number information and abnormal parameter type information for the error test case, as well as the quantity correction information and type correction information corresponding to the error test case.
3. The method according to claim 2, characterized in that, The parameter parsing error script also includes an error code pointer. The error record structure includes at least error code prompt information and correct parameter information. The correct parameter information includes at least standard quantity information. The step of outputting parameter quantity anomaly information and quantity correction information for the error test case through the error record structure includes: The error code pointer is used to determine the first error code message used to present the abnormal number of parameters of the error test case from the error code message information in the error record structure, and the first error code message is used as the abnormal number of parameters for the error test case; The standard quantity information is used as quantity correction information for the erroneous test cases.
4. The method according to claim 3, characterized in that, The correct parameter information also includes standard type information. The step of outputting parameter type anomaly information and type correction information for the error test case through the error record structure includes: The error code pointer is used to determine the second error code message used to present the parameter type anomaly of the error test case from the error code message information in the error record structure, and the second error code message is used as the parameter type anomaly information for the error test case; The standard type information is used as type correction information for the error use case.
5. The method according to claim 3 or 4, characterized in that, The error record structure also includes an error location index, and the method further includes: The error code pointer is used to locate the target model parameter that has an abnormal number of parameters and / or an abnormal parameter type, and the parameter position corresponding to the target model parameter is determined. Assign the parameter position to the error position index.
6. The method according to claim 1, characterized in that, The step of extracting at least one target error detection function from the error detection function based on the number of parameters includes: If the number of parameters is the first number, then extract the numerical error detection function from the error detection function; If the number of parameters is the second number, then extract the numerical error detection function and the custom error detection function from the error detection function.
7. The method according to claim 6, characterized in that, The parameter anomaly information includes parameter quantity anomaly information, and the parameter correction information includes at least quantity correction information. The step of detecting parameter anomalies in the model parameters through the target error detection function and outputting parameter anomaly information and parameter correction information for the erroneous test cases includes: If the number of parameters is not the first number and the second number, then output parameter number anomaly information for the erroneous use case, and quantity correction information corresponding to the parameter number anomaly information.
8. An error detection device for a geometric modeling engine, characterized in that, An apparatus is applied to a geometric modeling engine, wherein a parameter parsing error script is deployed in the geometric modeling engine. The parameter parsing error script includes a parameter parsing list class and an error record structure for recording error information. The parameter parsing list class includes at least an error detection function. The parameter parsing error script is used to detect the modeling function of the geometric modeling engine. The error record structure includes at least an error code message and an error location index. The error code message provides a diagnostic conclusion for the parameter error type, and the error location index indicates the index position where the erroneous parameter exists. The apparatus includes: A use case acquisition module is used to acquire erroneous use cases for execution in the geometric modeling engine. The parameter determination module is used to parse the error test cases, obtain the model parameters corresponding to the error test cases, and the number of parameters corresponding to the model parameters; The function extraction module is used to extract at least one target error detection function from the error detection function according to the number of parameters; The detection module is used to detect parameter anomalies in the model parameters through the target error detection function, and output parameter anomaly information and parameter correction information for the error test cases through the error record structure; the parameter anomaly information includes at least one of parameter quantity anomaly information and parameter type anomaly information, and the parameter correction information includes at least one of quantity correction information and type correction information. The target error detection function includes at least one of a numerical error detection function and a custom error detection function, and the detection module is specifically used for: If the number of parameters is a first number, then determine the parameter sequence corresponding to each of the model parameters; According to the sorting order corresponding to the parameter sequence, the numerical error detection function is used to determine whether each first model parameter after the nth model parameter in the model parameters is a numerical type; If at least one of the first model parameters is not of a numerical type, then output parameter type exception information and type correction information for the error test case. If the number of parameters is the second number, then determine the parameter sequence corresponding to each of the model parameters; According to the sorting order corresponding to the parameter sequence, the custom error detection function is used to determine whether the m-th model parameter in the model parameters is a custom type, and the numerical error detection function is used to determine whether each second model parameter after the m-th model parameter in the model parameters is a numerical type. If the m-th model parameter is not of the custom type, and / or at least one of the second model parameters is not of the numeric type, then output parameter type exception information and type correction information for the error test case.
9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store computer programs; When the processor executes a program stored in the memory, it implements the method as described in any one of claims 1-7.
10. A computer-readable storage medium having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method as described in any one of claims 1-7.
Citation Information
Patent Citations
Method and system for performing parametric testing of a functional programming interface
US5495571A