An automatic optimization method for solving geometric constraint parameters
Through the automatic optimization method, the priority weight of geometric constraints is calculated and solution parameters are generated, which solves the over-constraint and under-constraint problems in the CAD system and improves the user experience.
Patent Information
- Application Number
- CN202410460716.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-17
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-04-17
AI Technical Summary
The existing technology cannot effectively solve the over-constraint and under-constraint problems in CAD systems, and cannot provide geometric solution parameters, which affects the user experience.
An automatic optimization method for geometric constraint solution parameters is proposed. By collecting the initial outline data and geometric constraint conditions of the design project, the priority weight is calculated, the solvability is judged, and the corresponding solution is generated based on the well-constrained, over-constrained and under-constrained conditions. Parameter, display the geometry with the highest priority.
It solves the problem that traditional graphics systems cannot provide geometric figures for over-constrained and under-constrained problems, improves user experience, and displays the solution parameters with the highest priority by calculating the priorities of different solution parameters.
Smart Images

Figure CN118296676B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of engineering drawing optimization, in particular to an automatic optimization method for solving geometric constraint parameters. Background Art
[0002] In the field of industrial design, especially in mechanical design and architectural design, CAD (computer-aided design) systems are indispensable design systems. In CAD systems, solving geometric constraints is a core issue. Designers often need to create graphics and models that satisfy specific geometric relationships. These relationships may include:
[0003] Geometric constraints: length, angle, radius, etc.;
[0004] Position constraints: relative positions between points, between points and lines, and between lines;
[0005] Shape constraints: symmetry, parallelism, equidistance, fixed proportion, etc.;
[0006] When solving geometric constraints in a CAD system, if a problem has a finite number of solutions, then the problem is called well-constrained, and if there are infinite solutions, it is called under-constrained. If one of the geometric constraints is deleted and the problem still has a finite number of solutions, it is called over-constrained.
[0007] At present, the judgment of the solvability of a set of geometric constraints is a conventional technical problem in this field. There are many feasible judgment methods, which are also integrated in some two-dimensional or three-dimensional modeling software. There are also many studies in academic literature, such as "Over-constraint and Under-constraint Check Strategy and Implementation in Two-dimensional Parametric CAD" (Journal of Dalian University of Technology, Vol. 038, No. 005, pp. 539-543, 1998), which adopts constraint-driven geometric reasoning and degree of freedom calculation methods, designs constraint checking strategies and algorithms, and solves the problem of over-constraint and under-constraint checking.
[0008] Most current solutions only prompt users to modify the constraints for under-constrained and over-constrained problems, but do not provide users with possible solution parameters, which affects the user experience.
[0009] To this end, the present invention proposes an automatic optimization method for solving geometric constraint parameters. Summary of the invention
[0010] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes an automatic optimization method for geometric constraint solution parameters, which solves the problem that in traditional mapping systems, geometric figures cannot be provided for over-constrained and under-constrained problems, thereby affecting the user experience.
[0011] To achieve the above purpose, an automatic optimization method for solving geometric constraint parameters is proposed, which includes the following steps:
[0012] Step 1: Collect the initial outline data, geometric constraint condition set and condition priority data of the relevant drawings of the design project;
[0013] Step 2: Based on the condition priority data, calculate the priority weight of each geometric constraint condition;
[0014] Step 3: Determine the solvability of the set of geometric constraints. If the solvability is well-constrained, proceed to step 4. If the solvability is over-constrained, proceed to step 5 to step 8. If the solvability is under-constrained, proceed to step 9.
[0015] Step 4: Solve the set of geometric constraints to obtain a first set of solution parameters, calculate the first initial contour deviation weight between each first solution parameter and the initial contour data, and display the geometric figure corresponding to the first solution parameter with the smallest first initial contour deviation weight;
[0016] Step 5: Perform consistency screening on the geometric constraint condition set to obtain the screened condition set, and traverse the screened condition set to obtain all good constraint condition combinations;
[0017] Step 6: For each combination of good constraints, generate a set of second solution parameters;
[0018] Step 7: For each good constraint condition combination: based on the priority weights of each geometric constraint condition in the good constraint condition combination, calculate the constraint comprehensive weight, and obtain the second contour deviation weight of each good constraint condition combination;
[0019] Step 8: Based on the constraint comprehensive weight of each group of good constraint conditions and the second contour deviation weight, an over-constrained display solution is obtained;
[0020] Step nine: construct a third solution parameter set of the geometric constraint condition set, and obtain an under-constrained display solution based on each set of third solution parameters and initial contour data;
[0021] The condition priority data includes the time sequence and priority label when the user selects each geometric constraint condition. The method of calculating the priority weight of each geometric constraint condition based on the condition priority data is as follows:
[0022] The geometric constraints marked with priority set by the user among all geometric constraints are divided into the marked condition group, and the geometric constraints marked with no priority set by the user are divided into the unmarked condition group;
[0023] Sort the geometric constraints in the annotation condition group from largest to smallest according to the annotation priority;
[0024] Sort the geometric constraints in the unlabeled condition group from earliest to latest according to the set time;
[0025] The number of geometric constraints in the geometric constraint set is marked as N, the number of geometric constraints in the labeled condition group is marked as N1, and the number of geometric constraints in the unlabeled condition group is marked as N2, then N=N1+N2;
[0026] The geometric constraints in the labeling condition group are prioritized and weighted in order, starting from N and decreasing by 1.
[0027] The geometric constraints in the unlabeled condition group are prioritized and weighted in order, starting from N-N1 and decreasing by 1.
[0028] The solvability includes well-constrained, over-constrained and under-constrained;
[0029] The step of calculating the first initial contour deviation weight between each first solution parameter and the initial contour data comprises:
[0030] Step 11: using a feature point extraction algorithm to extract feature points of the geometric figures corresponding to the initial contour data and the geometric figures corresponding to the first solution parameter, respectively forming a contour feature point set and a first feature point set;
[0031] Step 12: extract the coordinates of each feature point in the contour feature point set and the first feature point set respectively; the coordinates of each feature point constitute a feature vector;
[0032] Step 13: for each contour feature point in the contour feature point set, calculate the Euclidean distance between its feature vector and the feature vector of each first feature point in the first feature point set, and take the first feature point with the smallest Euclidean distance in the first feature point set as the closest feature point to the contour feature point;
[0033] Step 14: mark the number of the contour feature point as i, mark the Euclidean distance between the i-th contour feature point and its closest feature point as di; mark the first initial contour deviation weight as W1, then the calculation formula of W1 is W1=∑ i di;
[0034] The consistency screening of the geometric constraint condition set to obtain the screened condition set includes:
[0035] Step 21: Convert the geometric constraints into a matrix form. Each row represents a constraint and each column represents a geometric variable.
[0036] Step 22: Perform singular value decomposition on the constructed constraint matrix to obtain the singular value of each geometric constraint condition;
[0037] Step 23: Preset a singular value screening threshold, screen out the geometric constraint conditions whose singular values are less than the singular value screening threshold, and use the remaining geometric constraint conditions after screening as a post-screening condition set;
[0038] The method of traversing the filtered condition set to obtain all good constraint condition combinations is:
[0039] The number of all variables in the set of geometric constraints is marked as M;
[0040] From all the geometric constraints in the filtered condition set, M geometric constraints are selected without duplication to form a set of good constraint condition combinations, and all feasible good constraint condition combinations are traversed to generate;
[0041] The method of generating a set of second solution parameters for each set of good constraint condition combinations is:
[0042] Solve each group of good constraint condition combinations to obtain a corresponding second feasible solution parameter set;
[0043] Calculating a second initial contour deviation weight for each set of second feasible solution parameters and initial contour data, wherein the second initial contour deviation weight is calculated in the same manner as the first initial contour deviation weight;
[0044] Selecting a second feasible solution parameter with the smallest second initial contour deviation weight from all second feasible solution parameters as the second solution parameter;
[0045] For each good constraint condition combination: based on the priority weight of each geometric constraint condition in the good constraint condition combination, the constraint comprehensive weight is calculated as follows:
[0046] The priority weights of each geometric constraint condition in each group of good constraint condition combinations are accumulated and summed to obtain the constraint comprehensive weight of each group of good constraint condition combinations;
[0047] The method of obtaining the second contour deviation weight of each group of good constraint condition combinations is:
[0048] The second initial contour deviation weight corresponding to the second solution parameter of each group of good constraint condition combination is used as the second contour deviation weight;
[0049] The method of obtaining the over-constrained display solution based on the constraint comprehensive weight of each group of good constraint conditions and the initial contour deviation weight is:
[0050] For each combination of good constraints, calculate the corresponding comprehensive evaluation weight Z;
[0051] The calculation method of the comprehensive evaluation weight is Z=e1×Y-e2×W2; wherein Y and W2 are the constraint comprehensive weight of the group of good constraint conditions and the second contour deviation weight, respectively, and e1 and e2 are preset proportional coefficients greater than 0, respectively;
[0052] The geometric figure corresponding to the second solution parameter corresponding to the good constraint condition combination with the largest comprehensive evaluation weight Z is used as the over-constrained display solution;
[0053] The method of constructing the third solution parameter set of the geometric constraint condition set is:
[0054] A reference solution quantity threshold is preset, and the set of geometric constraint conditions is solved until the number of feasible solution parameters obtained reaches the reference solution quantity threshold, and all the obtained feasible solution parameters are combined into a third solution parameter set;
[0055] The method of obtaining the under-constrained display solution based on each set of third solution parameters and initial contour data is:
[0056] calculating a third initial contour deviation weight between each set of third solution parameters and the initial contour data;
[0057] The geometry corresponding to the third solution parameter with the smallest deviation weight from the third initial contour is displayed as an under-constrained solution.
[0058] Compared with the prior art, the present invention has the following beneficial effects:
[0059] The present invention collects initial contour data, geometric constraint condition sets and condition priority data of drawings related to the design project, calculates the priority weight of each geometric constraint condition based on the condition priority data, and determines the solvability of the geometric constraint condition set. If the solvability is a good constraint, the geometric constraint condition set is solved to obtain a first solution parameter set, and the first initial contour deviation weight of each first solution parameter from the initial contour data is calculated, and the geometric figure corresponding to the first solution parameter with the smallest first initial contour deviation weight is displayed; if the solvability is an over-constraint, the geometric constraint condition set is screened for consistency to obtain a screened condition set, the screened condition set is traversed to obtain all good constraint condition combinations, and a set of second solution parameters is generated for each group of good constraint condition combinations. For each group of good constraint condition combinations: based on the priority weights of each geometric constraint condition in the good constraint condition combination, the constraint comprehensive weight is calculated, and the second contour deviation weight of each group of good constraint condition combination is obtained; based on the constraint comprehensive weight and the second contour deviation weight of each group of good constraint condition combination, an over-constrained display solution is obtained; if the solvability is under-constrained, a third solution parameter set of the geometric constraint condition set is constructed, and an under-constrained display solution is obtained based on each set of third solution parameters and initial contour data; by calculating the priorities of different solution parameters for over-constrained problems and under-constrained problems, and displaying the geometric figures corresponding to the solution parameters with the highest priority, the problem that geometric figures cannot be provided for over-constrained problems and under-constrained problems in traditional mapping systems, thereby affecting user experience, is solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 It is a flow chart of the automatic optimization method for solving geometric constraint parameters in Embodiment 1 of the present invention;
[0061] Figure 2 This is a specific example diagram of initial contour data in Example 1 of the present invention;
[0062] Figure 3 An example diagram of the corresponding geometric figures of the solution parameters generated based on the initial contour data and the set geometric constraints;
[0063] Figure 4 Graphs showing three feasible solutions to the problem of making a circle tangent to the three sides of a triangle;
[0064] Figure 5 This is a schematic diagram of the structure of an electronic device in Embodiment 2 of the present invention;
[0065] Figure 6 This is a schematic diagram of the computer-readable storage medium structure in Example 3 of the present invention. DETAILED DESCRIPTION
[0066] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0067] Example 1
[0068] like Figure 1 As shown, a method for automatically optimizing parameters for solving geometric constraints includes the following steps:
[0069] Step 1: Collect the initial outline data, geometric constraint condition set and condition priority data of the relevant drawings of the design project;
[0070] Step 2: Based on the condition priority data, calculate the priority weight of each geometric constraint condition;
[0071] Step 3: Determine the solvability of the geometric constraint set. If the solvability is well-constrained, go to step 4; if the solvability is over-constrained, execute steps 5 to 8; if the solvability is under-constrained, execute step 9;
[0072] Step 4: Solve the set of geometric constraints to obtain a first set of solution parameters, calculate the first initial contour deviation weight between each first solution parameter and the initial contour data, and display the geometric figure corresponding to the first solution parameter with the smallest first initial contour deviation weight;
[0073] Step 5: Perform consistency screening on the geometric constraint condition set to obtain the screened condition set, and traverse the screened condition set to obtain all good constraint condition combinations;
[0074] Step 6: For each combination of good constraints, generate a set of second solution parameters;
[0075] Step 7: For each good constraint condition combination: based on the priority weights of each geometric constraint condition in the good constraint condition combination, calculate the constraint comprehensive weight, and obtain the second contour deviation weight of each good constraint condition combination;
[0076] Step 8: Based on the constraint comprehensive weight of each group of good constraint conditions and the second contour deviation weight, an over-constrained display solution is obtained;
[0077] Step nine: construct a third solution parameter set of the geometric constraint condition set, and obtain an under-constrained display solution based on each set of third solution parameters and initial contour data;
[0078] The initial contour data is a geometric atlas drawn by the user through an interactive interface;
[0079] like Figure 2 The figure shows a specific example of initial contour data. In this example, the user provides two circles of different sizes and a straight line based on the actual needs of the architectural design field. However, due to the user's unprofessionalism and inaccuracy, the example needs to be adjusted through the drawing software, and this process is often achieved by setting geometric constraints.
[0080] For example, in this example, the geometric constraint selected is symmetry, and the solution set obtained shows the results as follows Figure 3 As shown, in this example, the circles on both sides of the vertical line are symmetrical to each other;
[0081] Furthermore, the set of geometric constraints is the geometric constraints selected by the user through the interactive interface, for example Figure 2 As shown in , it can be understood that the conditions of geometric constraints can be selected in multiple ways, thereby forming a set of geometric constraint conditions;
[0082] It should be noted that existing two-dimensional or three-dimensional modeling software all integrate strategies for converting geometric constraints into mathematical problems, including but not limited to numerical algebra methods, symbolic algebra methods, etc., which will not be elaborated in the present invention;
[0083] Furthermore, the condition priority data includes the time sequence and priority label when the user selects each geometric constraint condition, wherein the priority label is the priority level manually selected by the user through the interactive interface. It is understandable that the user can selectively select several geometric constraint conditions to set the priority label;
[0084] Furthermore, the method of calculating the priority weight of each geometric constraint condition based on the condition priority data is as follows:
[0085] The geometric constraints marked with priority set by the user among all geometric constraints are divided into the marked condition group, and the geometric constraints marked with no priority set by the user are divided into the unmarked condition group;
[0086] Sort the geometric constraints in the annotation condition group from largest to smallest according to the annotation priority;
[0087] Sort the geometric constraints in the unlabeled condition group from earliest to latest according to the set time;
[0088] The number of geometric constraints in the geometric constraint set is marked as N, the number of geometric constraints in the labeled condition group is marked as N1, and the number of geometric constraints in the unlabeled condition group is marked as N2, then N=N1+N2;
[0089] The geometric constraints in the annotation condition group are prioritized in order, starting from N and decreasing by 1. For example, the priority weight of the geometric constraint ranked first in the annotation condition group is N, the priority weight of the geometric constraint ranked second is N-1, and so on.
[0090] The geometric constraints in the unlabeled condition group are prioritized and weighted in order, starting from N-N1 and decreasing by 1.
[0091] It can be understood that such a priority weight setting method ensures that the user-defined geometric constraints are satisfied first, and once again ensures that the geometric constraints set by the user first are regarded as priority, thereby ensuring the user's application experience;
[0092] The solvability includes well-constrained, over-constrained and under-constrained;
[0093] It can be further understood that, when the geometric constraint set is a well-constrained one, solving the geometric constraint set and obtaining the first solution parameter set is a conventional technical means; however, it should be noted that the number of feasible solutions of a well-constrained one may be greater than 1, such as Figure 4 As shown in FIG. 1 , there are three feasible solutions to the problem of making a circle tangent to the three sides of a triangle. Therefore, it is necessary to obtain the solution parameters that are closest to the initial contour data provided by the user from a finite number of solutions.
[0094] Further, the calculating of the first initial contour deviation weight between each first solution parameter and the initial contour data includes:
[0095] Step 11: Use a feature point extraction algorithm to extract feature points of the geometric figures corresponding to the initial contour data and the geometric figures corresponding to the first solution parameter, respectively, to form a contour feature point set and a first feature point set; specifically, the feature point extraction algorithm includes but is not limited to SIFT, SURF, ORB, etc.;
[0096] Step 12: extract the coordinates of each feature point in the contour feature point set and the first feature point set respectively; the coordinates of each feature point constitute a feature vector;
[0097] Step 13: for each contour feature point in the contour feature point set, calculate the Euclidean distance between its feature vector and the feature vector of each first feature point in the first feature point set, and take the first feature point with the smallest Euclidean distance in the first feature point set as the closest feature point to the contour feature point;
[0098] Step 14: mark the number of the contour feature point as i, mark the Euclidean distance between the i-th contour feature point and its closest feature point as di; mark the first initial contour deviation weight as W1, then the calculation formula of W1 is W1=∑i di; It can be understood that the smaller the first initial contour deviation weight is, the closer the initial contour data is to the geometric figure corresponding to the first solution parameter;
[0099] Furthermore, the consistency screening of the geometric constraint condition set to obtain the screened condition set includes:
[0100] Step 21: Convert the geometric constraints into a matrix form. Each row represents a constraint and each column represents a geometric variable.
[0101] Step 22: Perform singular value decomposition on the constructed constraint matrix to obtain the singular value of each geometric constraint condition;
[0102] Step 23: Preset a singular value screening threshold, screen out the geometric constraints whose singular values are less than the singular value screening threshold, and use the remaining geometric constraints after screening as the filtered condition set; it can be understood that the number and size of the singular values reflect the rank of the constraint matrix. A matrix with a complete rank has non-zero singular values, while the redundant or over-constrained matrix singular values contain some values close to zero, which indicates that the geometric constraint corresponding to the singular value has a linear relationship with other geometric constraints, and thus is a redundant geometric constraint;
[0103] Furthermore, the method of traversing the filtered condition set to obtain all good constraint condition combinations is:
[0104] The number of all variables in the set of geometric constraints is marked as M;
[0105] From all the geometric constraints in the filtered condition set, M geometric constraints are selected without duplication to form a set of good constraint condition combinations, and all feasible good constraint condition combinations are traversed to generate; it can be understood that this problem is a combinatorial problem in statistics, and the number of good condition sets is M1 is the number of all geometric constraints in the condition set after screening;
[0106] Furthermore, the method of generating a set of second solution parameters for each set of good constraint condition combinations is:
[0107] Solve each group of good constraint condition combinations to obtain a corresponding second feasible solution parameter set;
[0108] Calculating a second initial contour deviation weight for each set of second feasible solution parameters and initial contour data, wherein the second initial contour deviation weight is calculated in the same manner as the first initial contour deviation weight;
[0109] Selecting a second feasible solution parameter with the smallest second initial contour deviation weight from all second feasible solution parameters as the second solution parameter;
[0110] Furthermore, for each good constraint condition combination, based on the priority weights of the geometric constraints in the good constraint condition combination, the constraint comprehensive weight is calculated as follows:
[0111] The priority weights of each geometric constraint in each good constraint combination are accumulated and summed to obtain the constraint comprehensive weight of each good constraint combination. It can be understood that the constraint comprehensive weight measures the degree of satisfaction of the priority of the geometric constraint.
[0112] Furthermore, the method of obtaining the second contour deviation weight of each group of good constraint condition combinations is:
[0113] The second initial contour deviation weight corresponding to the second solution parameter of each group of good constraint condition combination is used as the second contour deviation weight;
[0114] Furthermore, the method of obtaining the over-constrained display solution based on the constraint comprehensive weight of each group of good constraint conditions and the initial contour deviation weight is:
[0115] For each combination of good constraints, calculate the corresponding comprehensive evaluation weight Z;
[0116] The calculation method of the comprehensive evaluation weight is Z=e1×Y-e2×W2; wherein Y and W2 are the constraint comprehensive weight of the good constraint condition combination and the second contour deviation weight, respectively, and e1 and e2 are preset proportional coefficients greater than 0, respectively;
[0117] The geometric figure corresponding to the second solution parameter corresponding to the good constraint condition combination with the largest comprehensive evaluation weight Z is used as the over-constrained display solution;
[0118] Furthermore, the method of constructing the third solution parameter set of the geometric constraint condition set is:
[0119] A reference solution quantity threshold is preset, and the set of geometric constraint conditions is solved until the number of feasible solution parameters obtained reaches the reference solution quantity threshold, and all the obtained feasible solution parameters are combined into a third solution parameter set;
[0120] Furthermore, the method of obtaining the under-constrained display solution based on each set of third solution parameters and initial contour data is:
[0121] Calculating a third initial contour deviation weight between each set of third solution parameters and the initial contour data, wherein the calculation method of the third initial contour deviation weight is consistent with the calculation method of the first initial contour deviation weight;
[0122] The geometry corresponding to the third solution parameter with the smallest deviation weight from the third initial contour is displayed as an under-constrained solution.
[0123] Example 2
[0124] Figure 5 1 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Figure 5 As shown, according to another aspect of the present application, an electronic device 100 is also provided. The electronic device 100 may include one or more processors and one or more memories. The memories store computer readable codes, and when the computer readable codes are executed by one or more processors, the automatic optimization method for solving geometric constraint parameters as described above can be executed.
[0125] The method or system according to the embodiment of the present application can also be used by Figure 5 The electronic device architecture shown in FIG. Figure 5 As shown, the electronic device 100 may include a bus 101, one or more CPUs 102, a read-only memory (ROM) 103, a random access memory (RAM) 104, a communication port 105 connected to a network, an input / output component 106, a hard disk 107, etc. The storage device in the electronic device 100, such as the ROM 103 or the hard disk 107, may store the automatic optimization method for solving geometric constraint parameters provided in the present application. The automatic optimization method for geometric constraint solution parameters may, for example, include the following steps: Step 1: Collect initial contour data, geometric constraint condition sets and condition priority data of relevant drawings of the design project; Step 2: Based on the condition priority data, calculate the priority weight of each geometric constraint condition; Step 3: Determine the solvability of the geometric constraint condition set. If the solvability is a well-constrained constraint, go to step 4; if the solvability is an over-constraint, execute steps 5 to 8; if the solvability is an under-constraint, execute step 9; Step 4: Solve the geometric constraint condition set to obtain a first solution parameter set, calculate the first initial contour deviation weight of each first solution parameter from the initial contour data, and display the first solution parameter with the smallest first initial contour deviation weight corresponding to the geometry. Graphics; Step 5: Consistency screening of the geometric constraint condition set to obtain the screened condition set, traverse the screened condition set to obtain all good constraint condition combinations; Step 6: For each group of good constraint condition combinations, generate a set of second solution parameters; Step 7: For each group of good constraint condition combinations, based on the priority weights of each geometric constraint condition in the good constraint condition combination, calculate the constraint comprehensive weight, and obtain the second contour deviation weight of each group of good constraint condition combination; Step 8: Based on the constraint comprehensive weight and the second contour deviation weight of each group of good constraint condition combination, obtain the over-constrained display solution; Step 9: Construct the third solution parameter set of the geometric constraint condition set, and obtain the under-constrained display solution based on each group of third solution parameters and initial contour data;
[0126] Furthermore, the electronic device 100 may further include a user interface 108. Figure 5 The architecture shown is only exemplary and can be omitted according to actual needs when implementing different devices. Figure 5 One or more components of an electronic device are shown.
[0127] Example 3
[0128] Figure 6 Schematic diagram of a computer-readable storage medium structure provided by an embodiment of the present application. Figure 6 As shown, a computer-readable storage medium 200 according to an embodiment of the present application is shown. Computer-readable instructions are stored on the computer-readable storage medium 200. When the computer-readable instructions are executed by the processor, the automatic optimization method for geometric constraint solving parameters according to the embodiment of the present application described with reference to the above figures can be executed. The computer-readable storage medium 200 includes, but is not limited to, for example, volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc.
[0129] In addition, according to the implementation of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the present application provides a non-transitory machine-readable storage medium, the non-transitory machine-readable storage medium stores machine-readable instructions, the machine-readable instructions can be run by a processor to execute instructions corresponding to the method steps provided by the present application, and when the computer program is executed by a central processing unit (CPU), the above functions defined in the method of the present application are executed.
[0130] The methods, apparatuses, and devices of the present application may be implemented in many ways. For example, the methods, apparatuses, and devices of the present application may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of steps for the method is for illustration only, and the steps of the method of the present application are not limited to the order specifically described above unless otherwise specified. In addition, in some embodiments, the present application may also be implemented as programs recorded in a recording medium, which include machine-readable instructions for implementing the method according to the present application. Therefore, the present application also covers recording media storing programs for executing the method according to the present application.
[0131] In addition, the parts of the above-mentioned technical solutions provided in the embodiments of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive redundancy.
[0132] The above preset parameters or preset thresholds are all set by technicians in this field according to actual conditions or obtained through large-scale data simulation.
[0133] The above embodiments are only used to illustrate the technical method of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.
Claims
1. A method for automatically optimizing parameters for solving geometric constraints, characterized in that: The following steps are involved: Step 1: Collect the initial outline data, geometric constraint condition set and condition priority data of the relevant drawings of the design project; Step 2: Based on the condition priority data, calculate the priority weight of each geometric constraint condition; Step 3: Determine the solvability of the geometric constraint set. If the solvability is well-constrained, go to step 4; if the solvability is over-constrained, execute steps 5 to 8; if the solvability is under-constrained, execute step 9; Step 4: Solve the set of geometric constraints to obtain a first set of solution parameters, calculate the first initial contour deviation weight between each first solution parameter and the initial contour data, and display the geometric figure corresponding to the first solution parameter with the smallest first initial contour deviation weight; Step 5: Perform consistency screening on the geometric constraint condition set to obtain the screened condition set, and traverse the screened condition set to obtain all good constraint condition combinations; Step 6: For each combination of good constraints, generate a set of second solution parameters; Step 7: For each good constraint condition combination, based on the priority weights of each geometric constraint condition in the good constraint condition combination, the constraint comprehensive weight is calculated, and the second contour deviation weight of each good constraint condition combination is obtained; Step 8: Based on the constraint comprehensive weight of each group of good constraint conditions and the second contour deviation weight, an over-constrained display solution is obtained; Step nine: construct a third solution parameter set of the geometric constraint condition set, and obtain an under-constrained display solution based on each set of third solution parameters and initial contour data; The step of calculating the first initial contour deviation weight between each first solution parameter and the initial contour data comprises: Step 11: using a feature point extraction algorithm to extract feature points of the geometric figures corresponding to the initial contour data and the geometric figures corresponding to the first solution parameter, respectively forming a contour feature point set and a first feature point set; Step 12: extract the coordinates of each feature point in the contour feature point set and the first feature point set respectively; the coordinates of each feature point constitute a feature vector; Step 13: for each contour feature point in the contour feature point set, calculate the Euclidean distance between its feature vector and the feature vector of each first feature point in the first feature point set, and take the first feature point with the smallest Euclidean distance in the first feature point set as the closest feature point to the contour feature point; Step 14: Mark the number of the contour feature point as i, mark the Euclidean distance between the i-th contour feature point and its closest feature point as di; mark the first initial contour deviation weight as W1, and the calculation formula of W1 is ; The method of generating a set of second solution parameters for each set of good constraint condition combinations is: Solve each group of good constraint condition combinations to obtain a corresponding second feasible solution parameter set; Calculating a second initial contour deviation weight for each set of second feasible solution parameters and initial contour data, wherein the second initial contour deviation weight is calculated in the same manner as the first initial contour deviation weight; Selecting a second feasible solution parameter with the smallest second initial contour deviation weight from all second feasible solution parameters as the second solution parameter; The method of constructing the third solution parameter set of the geometric constraint condition set is: A reference solution quantity threshold is preset, and the set of geometric constraint conditions is solved until the number of feasible solution parameters obtained reaches the reference solution quantity threshold, and all the obtained feasible solution parameters are combined into a third solution parameter set; The method of obtaining the under-constrained display solution based on each set of third solution parameters and initial contour data is: calculating a third initial contour deviation weight between each set of third solution parameters and the initial contour data; The geometry corresponding to the third solution parameter with the smallest deviation weight from the third initial contour is displayed as an under-constrained solution.
2. The automatic optimization method for solving geometric constraint parameters according to claim 1, characterized in that: The condition priority data includes the time sequence and priority label when the user selects each geometric constraint condition.
3. The automatic optimization method for solving geometric constraint parameters according to claim 2, characterized in that: The method of calculating the priority weight of each geometric constraint condition based on the condition priority data is as follows: The geometric constraints marked with priority set by the user among all geometric constraints are divided into the marked condition group, and the geometric constraints marked with no priority set by the user are divided into the unmarked condition group; Sort the geometric constraints in the annotation condition group from largest to smallest according to the annotation priority; Sort the geometric constraints in the unlabeled condition group from earliest to latest according to the set time; The number of geometric constraints in the geometric constraint set is marked as N, the number of geometric constraints in the labeled condition group is marked as N1, and the number of geometric constraints in the unlabeled condition group is marked as N2, then N=N1+N2; The geometric constraints in the labeling condition group are prioritized and weighted in order, starting from N and decreasing by 1. The priority weights of the geometric constraints in the unlabeled condition group are set in order, starting from N-N1 and decreasing by 1.
4. The method for automatically optimizing geometric constraint solving parameters according to claim 3, characterized in that: The consistency screening of the geometric constraint condition set to obtain the screened condition set includes: Step 21: Convert the geometric constraints into a matrix form; each row represents a constraint and each column represents a geometric variable; Step 22: Perform singular value decomposition on the constructed constraint matrix to obtain the singular value of each geometric constraint condition; Step 23: Preset a singular value screening threshold, screen out the geometric constraints whose singular values are less than the singular value screening threshold, and use the remaining geometric constraints after screening as the post-screening condition set.
5. The method for automatically optimizing geometric constraint solving parameters according to claim 4, characterized in that: The method of traversing the filtered condition set to obtain all good constraint condition combinations is: The number of all variables in the set of geometric constraints is marked as M; From all the geometric constraints in the filtered condition set, M geometric constraints are selected without duplication to form a set of good constraint condition combinations, and all feasible good constraint condition combinations are traversed to generate.
6. The method for automatically optimizing geometric constraint solving parameters according to claim 5, characterized in that: For each good constraint condition combination, based on the priority weight of each geometric constraint condition in the good constraint condition combination, the constraint comprehensive weight is calculated as follows: The priority weights of each geometric constraint in each good constraint combination are accumulated and summed to obtain the constraint comprehensive weight of each good constraint combination.
7. The method for automatically optimizing geometric constraint solving parameters according to claim 6, characterized in that: The method of obtaining the over-constrained display solution based on the constraint comprehensive weight of each group of good constraint conditions and the initial contour deviation weight is: For each combination of good constraints, calculate the corresponding comprehensive evaluation weight Z; The calculation method of the comprehensive evaluation weight is as follows: ; Wherein, Y and W2 are the constraint comprehensive weight and the second contour deviation weight of the good constraint condition combination, respectively, and e1 and e2 are preset proportional coefficients greater than 0, respectively; The geometric figure corresponding to the second solution parameter corresponding to the good constraint condition combination with the largest comprehensive evaluation weight Z is displayed as an over-constrained solution.
Citation Information
Patent Citations
Geometric constraint automatic solution design method
CN117875192A
User interface for creation and editing of variable data documents
CN1607522A
