The automatic structured data for calculating product is realized by interconnection constraint multiaxis simulation figure
Technical field
The present invention relates to computer programs and industrial design field, and in particular to the method for Design of Industrial Product, algorithm, packet
It includes and realizes the automatic structured data for calculating product using the two-dimentional interconnection constraint multiaxis simulation figure based on digraph.
Background technique
It is provided on the market for being designed to object, engineering, multiple system and programs of manufacture.CAD is computer
The abbreviation of Computer Aided Design, for example, it is related to the software solution for design object, conventional CAD systems generally require user
Input by sentence geometric figure is constructed, but the constructivity description of some figures is not easy to, in order to make up conventional CAD systems not
Foot preferably meets the requirement of conceptual design, improves design efficiency, is attempted to introduce the thought of artificial intelligence and method
Intelligent CAD is formed into CAD system.The main feature and mark of intelligent CAD are parametrization and variable design.
Later period occur parametric technology be firstly introduced constraint concept, parametric technology by one group of parameter and control zero
One group of structure size sequence of component geometry figure is corresponding, when assigning different parameter values, so that it may generate a series of tools
There are the components of similar geometry figure.Parameterize Solid Modelling the characteristics of be: design based on features, it is full-scale constraint,
Totally according to the modification of related Dimension Drive design.
Variation technology is the primary leap of parametric technology.Variation technology is complete as one by entire designing draft
System consider, it is unrelated with the sequence of construction process, by sketch control size and topological relation all indicated with constraint,
It is fully defining that this can not be the sketch at design initial stage, and not fully defining control size and topological relation are become
Amount stores, temporarily with current drafting size assignment.Designer can any stage in sketch any size and
Topological relation is redefined, while this redefining the change that need not also involve all geometry entities in sketch.Variable
The mode for the flexible more model that change technology provides effectively supports the conceptual design of CAD, can make the creation of designer
Power and imagination are more fully played.
The core of parametric technology and Variation technology is several sizes and topological relation once given designing draft,
System can automatically generate corresponding design drawing, and the process of this Geometric Constraint Solving can be understood as the automatic of geometric construction
Change process.
Summary of the invention
It is pushed away automatically the technical problem to be solved in the present invention is that providing a kind of realize by interconnection constraint multiaxis simulation figure
The structured data for calculating product is solved, vertex representation geometric element using the two-dimensional constrains based on digraph, and side indicates constraint, about
Beam figure is by the geometry for being mutually related all together with constraint relationship.
In order to solve the above-mentioned technical problem, the present invention is accomplished by the following way:
The automatic structured data for calculating product is realized by interconnection constraint multiaxis simulation figure, specifically includes following step
It is rapid:
1) constraints graph that product is made of vertex and binding side is established in selection;
2) Planar Mechanisms judgement is carried out according to any constraint direction chosen in constraints graph;
3) confined equilibrium is carried out to the constraints graph of construction;
4) constraint solving sequence is carried out according to the constraints graph after adjustment confined equilibrium.
In order to improve the interaction design ability of system, and the appearance of Planar Mechanisms situation is avoided, it is complete that the invention proposes geometry
Full definition status (state when shape of geometry and position determine completely), the judgement for meeting following all conditions is that geometry is complete
Definition status:
(1) Planar Mechanisms are not present in the preceding commitments beam of geometric object;
(2) the remaining freedom degree of geometric object is 0;
(3) in constraints graph, any one preceding commitments beam of the reversed geometry is reversely lost using confined equilibrium method
It loses, i.e. all preceding commitments beams of the geometric object can not be reversed.
For above-mentioned steps 2) in Planar Mechanisms judgement for, specific judgment method is as follows:
(21) confined equilibrium fails, then there are Planar Mechanisms;Otherwise Planar Mechanisms are not present;
(22) after confined equilibrium failure, all constraints reversely to fail are all Planar Mechanisms in constraints graph;
(23) geometric object that Planar Mechanisms are directed toward is the geometric object where Planar Mechanisms.
For above-mentioned steps 3) in confined equilibrium, specific confined equilibrium method and step is as follows:
(31) found definition vertex first (remaining freedom degree is less than 0 vertex or conflicting constraint tramsfer vertex);
(32) it selects a constraint in crossing the preceding commitments beam for defining vertex to carry out reversely, it is desirable that cross definition vertex after reversed
No longer it was definition vertex, (33) is entered step after inverted constraint, if can be reversed without suitable preceding commitments beam, divided following
Two kinds of situations:
(321) if cross definition vertex be because inverted constraint caused by cross definition vertex, then restore constraint direction, weight
Constraint direction is held before new selection one is suitable, is carried out step (32);
(322) if crossing definition vertex is that initial crosses definition vertex, there are Planar Mechanisms, confined equilibriums for the constraints graph
Failure;
(33) the constraint tramsfer vertex being reversed, if transmitting vertex was not the vertex of definition, confined equilibrium is successful, i.e.,
Constraints graph adjusts successfully, and Planar Mechanisms are not present in constraints graph;If transmitting vertex was definition vertex, definition was treated as on transmitting vertex
Vertex continues step (32).
For above-mentioned steps 4) in constraint solving sequence the specific method is as follows:
(41) the transmitting vertex I of a new addition or new modification constraint is selected;
(42) vertex I will be transmitted as a solution queue element (QE) and be put at the tail of the queue for solving queue;
(43) the transmitting constraint of traversal transmitting vertex I goes to step if transmitting constraint all traversals of transmitting vertex I finish
Suddenly (48) otherwise choose the transmitting not traversed a constraint I, obtain the transmitting vertex II of transmitting constraint I;
(44) if transmitting vertex II records the father vertex of transmitting vertex II not in solving queue, vertex II will be transmitted
As new transmitting vertex I, step (42) are gone to;If transmitting vertex II in solving queue, the father vertex of transmitting vertex I is obtained
To transmit vertex III, then transit shed is emptied, transmitting vertex I is pressed into transit shed;
(45) transmitting vertex III is pressed into transit shed, if transmitting vertex III is exactly vertex transmitting vertex II, or transmitting
Vertex III, transmitting vertex II belong to the same solution queue element (QE) and (illustrate to solve in queue from transmitting vertex II to transmitting vertex
The vertex of I constitutes loop), step (46) are gone to, otherwise, the father vertex for transmitting vertex III are treated as into new transmitting vertex
III goes to step (45), if transmitting vertex III does not have father vertex (i.e. transmitting vertex III is starting point), goes to step (47);
(46) adjustment solves queue, the queue element (QE) where transit shed inner vertex is merged into one, new queue element (QE)
Element is placed in the position for solving queue element (QE) where transmitting vertex II in queue, goes to step (43);
(47) if solving in queue, after queue element (QE) where queue element (QE) where transmitting vertex II comes transmitting vertex I, turn
It otherwise adjusts to step (43) and solves queue, vertex II place queue element (QE) will be transmitted and transmitted about along transmitting vertex II
After queue element (QE) where all vertex that Shu Fangxiang is traversed comes the queue element (QE) where transmitting vertex I, step is gone to
(43);
(48) if transmitting vertex I does not have father vertex (i.e. transmitting vertex I is starting point), algorithm is ended here;If transmitting
Vertex I has father vertex, then returns to the father vertex of transmitting vertex I, and the father vertex for transmitting vertex I is treated as new transmitting vertex I, is turned
To step (43).
Compared with prior art, the present invention possessed by the utility model has the advantages that
It is proposed by the invention to be associated together geometric element and constraint based on constraints graph, it is constrained by balancing,
The judgement for carrying out Planar Mechanisms avoids geometry from crossing caused by definition and calculates without solving equations;Carry out the fully defining state of geometry
Determine, provides foundation for the design work of designer, improve Human-computer Interactive Design efficiency;It, will be complicated by solving Queue Algorithm
Constraints graph is decomposed, and solving speed, efficiency are improved, and realizes constraint solving, solves the problem of management of Complex Constraints information.
Detailed description of the invention
Fig. 1 a is geometric representation constructed by the present invention;
Fig. 1 b is the constraint schematic diagram of Fig. 1 a;
Fig. 2 a is that fully defining state judges geometric representation;
Fig. 2 b is the constraint schematic diagram of Fig. 2 a;
Fig. 3 a is that Planar Mechanisms judge geometric representation;
Fig. 3 b is the constraint schematic diagram of Fig. 3 a;
Fig. 4 a is the confined equilibrium schematic diagram I of constraints graph in the present invention;
Fig. 4 b is the confined equilibrium schematic diagram II of constraints graph in the present invention;
Fig. 4 c is the confined equilibrium schematic diagram III of constraints graph in the present invention;
Fig. 4 d is the confined equilibrium schematic diagram IV of constraints graph in the present invention;
Fig. 4 e is the confined equilibrium schematic diagram V of constraints graph in the present invention;
Fig. 4 f is the confined equilibrium schematic diagram VI of constraints graph in the present invention;
Fig. 5 is the geometric representation in the present invention after the confined equilibrium of constraints graph.
Specific embodiment
Specific embodiments of the present invention will be described in further detail in the following with reference to the drawings and specific embodiments.
The establishment process of constraints graph is exactly to create new vertex and binding side, and the process that they are linked together.Top
Point indicates a certain geometric elements such as point, straight line or circle, and vertex and transmitting vertex are held in vertex can be divided into again before, the arrow of constraint refers to
To vertex be known as the transmitting vertex of the constraint, vertex is held before being known as the constraint in the vertex of the arrow starting of constraint.
Binding side is indicated with directive side with the arrow, and commitments beam and transmitting constraint, are directed toward before being divided into
The binding side on vertex is known as the preceding commitments beam on the vertex, and the binding side originated from the vertex is known as the transmitting constraint on the vertex.
As shown in Figure 1a, 6 geometric element vertex being made of 3 point P1, P2, P3 and 3 straight lines L1, L2, L3 are created
Triangle;Then constraint e1, e2, e3, e4, e5, the e6 of this 6 vertex on straight line are created, wherein e1 is that point P1 is directed toward directly
Line L1, e2~e6 are processed similarly, and how shown in 1b, then add the distance restraint of 10mm between P1 and P2 on its basis
P2 is directed toward by P1 in e9, the direction for constraining e9, indicates the position of P1 by the distance of 10mm come the position of obligatory point P2;Then it adds
30 between the horizontal restraint e8 and straight line L1 and L3 of the fixed constraint e7 and straight line L1 of P10Constrain e10.
As shown in Fig. 2 a, 2b, point P1 " has fixed constraint e1 ", and there is also points to constrain on straight line between point P1 " and straight line L1 "
E2 ", straight line L2 " have horizontal restraint e3 ", while there are Parallel Constraint e4 between straight line L1 " and L2 " ".Therefore use it is above-mentioned rule into
The judgement of the fully defining state of row geometry:
P1 " preceding commitments beam e1 " is not that the remaining freedom degree of Planar Mechanisms, P1 " is that 0, e1 " cannot be reversed, therefore P1 " is complete
Definition status;
Straight line L1 " preceding commitments beam e2 ", e4 " are not Planar Mechanisms, and the remaining freedom degree of straight line L1 " is 0, reversed e2 " and
E4 " fail (e3 " and e4 " constraint conflict each other, while, there is definition in while being directed toward straight line L2 "), therefore straight line L1 " is complete
Definition status;
Straight line L2 " preceding commitments beam e3 " is not Planar Mechanisms, but the remaining freedom degree of straight line L2 " is 1, therefore straight line L2 is " no
It is fully defining state, and in deficient definition status.
Since the constraint redundancy of geometry causes the geometry that is known as of constraint solving failure to cross definition, and leads to constraints graph there are several
The constraint what crosses definition is known as Planar Mechanisms, when geometry freedom degree and its preceding commitments beam all constraint degrees and difference be known as geometry
Remaining freedom degree, and the reason of causing geometry to cross definition be: geometry remaining freedom degree is less than zero or there are constraint conflicts.
How shown in 3a, 3b, e1'~e4' is that constraint and e5' are that the horizontal restraint of straight line L1', e6' are to point on straight line
The vertical constraint of straight line L2', e7' are the tangent constraint of round C1 Yu straight line L2'.Addition straight line L1' is parallel with straight line L2''s again
E8' is constrained, carries out confined equilibrium according to algorithm, as a result confined equilibrium unsuccessfully has Planar Mechanisms;E5', e6' and e8' in constraints graph
Reversed failure (due to the mechanism of constraint conflict, other constraints are not reversed), is determined as Planar Mechanisms;Straight line pointed by them
L1' and L2' is geometry where Planar Mechanisms, i.e., it is horizontal, erect it is perpendicular and parallel be constrained to Planar Mechanisms, straight line L1' and L2' is Planar Mechanisms institute
Geometry.
The vertical constraint e11 of L2 and L1 is newly added in Figure 1b, and as shown in fig. 4 a, it may be newly added for crossing definition vertex
Constrain the transmitting vertex L1 of e11;Since L1 was definition vertex, preceding commitments beam e11 and e8 constraint conflict, and the residue of L1 is certainly
It, can only inverted constraint e8 or the e11 (mistake of other reversed preceding commitments Shu Wufa releasing L1 since there are constraint conflicts by spending less than 0
Definition status), L1 was still definition status after inverted constraint e8, restored the direction of constraint e8, and inverted constraint e11 makes L1 no longer be
Definition vertex is crossed, as shown in Figure 4 b.
As illustrated in fig. 4 c, the transmitting vertex L2 for constraining e11 became definition vertex, and remaining freedom degree is less than 0, reversed L2
Preceding commitments beam e3, making L2 no longer was definition vertex;After inverted constraint e3, the transmitting vertex P2 for constraining e3 became definition top
Point, remaining freedom degree is less than 0, and the preceding commitments beam e9 of reversed P2, making P2 not had been definition vertex, as shown in figure 4d.Then
After inverted constraint e9, the transmitting vertex P1 for constraining e9 became definition vertex, and P1 can be reversed without suitable preceding commitments beam,
Restore the direction of e9;A preceding commitments beam e2 for reselecting P2 is carried out reversely, and making P2 no longer was definition vertex such as Fig. 4 e institute
Show, inverted constraint e2 failure is obtained according to analysis method section before, restores the direction of e2, and then P2 is without suitable preceding commitments
Beam can be reversed, therefore restore the direction of constraint e3.
Further, a preceding commitments beam e4 of L2 is selected to carry out reversed, making L2 no longer was definition vertex such as Fig. 4 f institute
Show, after reversed e4, the transmitting vertex P3 of e4 was also not definition vertex, i.e. constraints graph adjusts successfully.
By carrying out constraint solving queue order to being adjusted to the constraints graph after function, as shown in fig. 4f.
The transmitting vertex L2 indentation of new addition vertical constraint e11 is solved into queue, solving queue at this time is L2;Then just time
The transmitting constraint e4 for going through L2, must play transmitting vertex P3, P3 not in solving queue, by P3 indentation solution queue, asking at this time
Dequeue is classified as P3;Since P3 does not transmit constraint, finished back to the father vertex L2 of P3, then to the transmitting constraint traversal of L2, L2
It is starting point, algorithm terminates.Solution queue: L2 → P3 is finally obtained, that is, first passes through geometry L1, P2 and constraint e11, e3 is calculated
L2, then P3 is calculated by geometry L2, L3 and constraint e4, e5.Finally obtained figure be exactly one be filled foot institute it is constrained as scheme
Geometric figure shown in 5.
The above is only embodiments of the present invention, is stated again, and those skilled in the art are come
It says, without departing from the principle of the present invention, several improvement can also be carried out to the present invention, these improvement are also included in the present invention
In scope of protection of the claims.