CN117828701A - Engineering drawing layout optimization method, system, equipment and medium - Google Patents

Engineering drawing layout optimization method, system, equipment and medium Download PDF

Info

Publication number
CN117828701A
CN117828701A CN202410245570.0A CN202410245570A CN117828701A CN 117828701 A CN117828701 A CN 117828701A CN 202410245570 A CN202410245570 A CN 202410245570A CN 117828701 A CN117828701 A CN 117828701A
Authority
CN
China
Prior art keywords
layout
elements
constraint
laid out
optimized
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202410245570.0A
Other languages
Chinese (zh)
Other versions
CN117828701B (en
Inventor
孙运雷
代鹏
邵兆通
齐丹宁
吴天乐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Zhongshida Science And Technology Education Group Co ltd
China University of Petroleum East China
Original Assignee
Qingdao Zhongshida Science And Technology Education Group Co ltd
China University of Petroleum East China
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Zhongshida Science And Technology Education Group Co ltd, China University of Petroleum East China filed Critical Qingdao Zhongshida Science And Technology Education Group Co ltd
Priority to CN202410245570.0A priority Critical patent/CN117828701B/en
Publication of CN117828701A publication Critical patent/CN117828701A/en
Application granted granted Critical
Publication of CN117828701B publication Critical patent/CN117828701B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Design And Manufacture Of Integrated Circuits (AREA)

Abstract

The application discloses an engineering drawing layout optimization method, an engineering drawing layout optimization system, engineering drawing layout optimization equipment and engineering drawing layout optimization media, which relate to the technical field of drawing layout and comprise the following steps: acquiring elements to be laid out of an engineering drawing and layout constraints of the elements to be laid out; converting the elements to be laid out into two-dimensional layout data to generate a drawing layout to be optimized based on the two-dimensional layout data; determining the number of violations of the violating to-be-laid elements generated in the to-be-optimized drawing layout based on each layout constraint, and performing iterative selection on the to-be-optimized drawing layout by using a preset genetic algorithm to obtain a target drawing layout corresponding to the minimum number of violations of the violating to-be-laid elements. The automatic engineering drawing generation method can realize layout optimization of the two-dimensional engineering drawing without a large number of drawing templates, can greatly reduce manual intervention, saves time and manpower resources, and greatly improves the intelligent level of CAD software.

Description

Engineering drawing layout optimization method, system, equipment and medium
Technical Field
The invention relates to the technical field of drawing layout, in particular to an engineering drawing layout optimization method, an engineering drawing layout optimization system, engineering drawing layout optimization equipment and engineering drawing layout optimization media.
Background
The engineering drawing of CAD (Computer Aided Design ) is a schematic document of product design and manufacture, and contains a series of information such as two-dimensional representation of parts, dimensional annotations, material details, and the like. In recent years, although three-dimensional CAD has been developed to a great extent, the inability to automatically generate a standard-compliant two-dimensional engineering drawing from a three-dimensional model has been a key pain point that plagues the popularization of three-dimensional design software. The manual drawing is complex in operation, and a large number of designers with industry experience are needed, so that a large amount of manpower and time resources are wasted.
At present, although a plurality of CAD software has the function of automatically generating two-dimensional engineering drawings, a template generating mode is mostly used, when a large number of nonstandard drawings in specific industries are faced, a large number of drawing templates are required to be manufactured, the operation is complex, the universality is poor, and the man-machine interaction cost is greatly increased.
In summary, how to automatically generate a non-templated two-dimensional engineering drawing layout simply and conveniently when facing a large number of non-standard drawings, and improving the design efficiency are technical problems to be solved in the field.
Disclosure of Invention
In view of the above, the present invention aims to provide an engineering drawing layout optimization method, system, device and medium, which can simply and conveniently realize automatic generation of non-templated two-dimensional engineering drawing layout when facing a large number of non-standard drawings, and improve design efficiency. The specific scheme is as follows:
In a first aspect, the present application discloses an engineering drawing layout optimization method, including:
acquiring elements to be laid out of an engineering drawing and layout constraints of the elements to be laid out;
converting the elements to be laid out into two-dimensional layout data to generate a drawing layout to be optimized based on the two-dimensional layout data;
determining the number of violations of the violating to-be-laid elements generated in the to-be-optimized drawing layout based on each layout constraint, and performing iterative selection on the to-be-optimized drawing layout by using a preset genetic algorithm to obtain a target drawing layout corresponding to the minimum number of violations of the violating to-be-laid elements.
Optionally, the obtaining the element to be laid out of the engineering drawing and the layout constraint of the element to be laid out includes:
acquiring layout mode information corresponding to a view, a detail table, a pipe orifice table, a node diagram, a standard title bar, a technical requirement and a technical characteristic table of an engineering drawing, and generating elements to be laid out of the engineering drawing based on the layout mode information;
acquiring industry layout rule constraints, layout element overlapping constraints, horizontal alignment constraints, layout space utilization constraints and layout equilibrium constraints.
Optionally, after the obtaining the element to be laid out of the engineering drawing and the layout constraint of the element to be laid out, the method further includes:
classifying the layout constraint of the element to be laid out according to whether the constraint condition can be violated or not so as to obtain a first classification result that the industry layout rule constraint and the layout element overlapping constraint are non-violated constraint and a second classification result that the horizontal alignment constraint, the layout space utilization constraint and the layout equilibrium constraint are violated constraint.
Optionally, the converting the element to be laid out into two-dimensional layout data to generate the drawing layout to be optimized based on the two-dimensional layout data includes:
obtaining elements to be laid out, which comprise the types of the pictures, the space range capable of being laid out, the sizes of the elements to be laid out and the layout mode information, from the intermediate file;
and converting the elements to be laid out into two-dimensional layout data in a target data format, initializing the two-dimensional layout data, and creating a population of the initialized two-dimensional layout data to generate the drawing layout to be optimized.
Optionally, the determining, based on each layout constraint, the number of violations of the violating to-be-laid elements generated in the to-be-optimized drawing layout, and performing iterative selection on the to-be-optimized drawing layout by using a preset genetic algorithm, so as to obtain a target drawing layout corresponding to the minimum number of violations of the to-be-laid elements, where the method includes:
Calculating the fitness value of each individual in the drawing layout to be optimized based on each layout constraint, and carrying out iterative selection on the drawing layout to be optimized based on the fitness value of each individual and through a preset genetic algorithm to obtain a target drawing layout with the minimum number of violations of the elements to be subjected to the violations; and taking the negative value of the violation number of the violation to-be-laid-out elements as the fitness value of the individual.
Optionally, the iterative selection is performed on the to-be-optimized drawing layout based on the fitness value of each individual and through a preset genetic algorithm, so as to obtain a target drawing layout corresponding to the minimum number of violations of the to-be-laid elements, including:
according to the set celebrity hall size rule, selecting an individual with a fitness value larger than a target fitness value to be added into the celebrity hall; the celebrity hall is used for reserving individuals appearing in the population in the evolution process;
selecting a next generation of individuals from the current population by adopting a tournament method;
executing crossing and mutation steps on the next generation of individuals according to the preset probability;
and skipping to execute the step of selecting individuals larger than the target fitness value to join in the celebrity hall according to the set celebrity hall size rule, and selecting the optimized layout constructed by the individuals with the smallest violations in the celebrity hall as the target drawing layout.
Optionally, the calculating the fitness value of each individual in the to-be-optimized drawing layout based on each layout constraint includes:
initializing the number of violations of each individual to be zero, and calculating the number of violations which violate each layout constraint according to each layout constraint and the corresponding penalty coefficient;
calculating the total violation number corresponding to each individual in the drawing layout to be optimized according to the total violation number = violation number corresponding to the non-violating constraint × penalty coefficient + violation number corresponding to the violating constraint;
and respectively taking the negative value of the total violation number as the fitness value of each individual.
In a second aspect, the present application discloses an engineering drawing layout optimization system, comprising:
the data acquisition module is used for acquiring elements to be laid out of the engineering drawing and layout constraints of the elements to be laid out;
the layout generation module is used for converting the elements to be laid out into two-dimensional layout data so as to generate a drawing layout to be optimized based on the two-dimensional layout data;
the layout optimization module is used for determining the violation quantity of the violation to-be-laid elements generated in the to-be-optimized drawing layout based on each layout constraint, and carrying out iterative selection on the to-be-optimized drawing layout by utilizing a preset genetic algorithm so as to obtain a target drawing layout corresponding to the minimum violation quantity of the violation to-be-laid elements.
In a third aspect, the present application discloses an electronic device comprising:
a memory for storing a computer program;
and the processor is used for executing the computer program to realize the steps of the engineering drawing layout optimization method disclosed in the prior art.
In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; the method comprises the steps of realizing the disclosed engineering drawing layout optimization method when the computer program is executed by a processor.
As can be seen, the present application discloses an engineering drawing layout optimization method, including: acquiring elements to be laid out of an engineering drawing and layout constraints of the elements to be laid out; converting the elements to be laid out into two-dimensional layout data to generate a drawing layout to be optimized based on the two-dimensional layout data; determining the number of violations of the violating to-be-laid elements generated in the to-be-optimized drawing layout based on each layout constraint, and performing iterative selection on the to-be-optimized drawing layout by using a preset genetic algorithm to obtain a target drawing layout corresponding to the minimum number of violations of the violating to-be-laid elements. Therefore, by introducing layout constraint and genetic algorithm, iterative selection is carried out on the to-be-optimized drawing layout through the genetic algorithm, the number of violations appearing in the drawing layout is determined, and the optimized target engineering drawing is selected based on iteration, so that the automatic engineering drawing generation method is provided, a large number of drawing templates are not needed, manual intervention can be greatly reduced, time and manpower resources are saved, and the intelligent level of CAD software is greatly improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an engineering drawing layout optimization method disclosed in the present application;
FIG. 2 is a flowchart of a specific engineering drawing layout optimization method disclosed in the present application;
FIG. 3 is a flowchart of an engineering drawing for optimizing and selecting targets by genetic algorithm disclosed in the present application;
FIG. 4 is a schematic structural diagram of an engineering drawing layout optimizing device disclosed in the present application;
fig. 5 is a block diagram of an electronic device disclosed in the present application.
Detailed Description
The following description of the technical solutions in the embodiments of the present application will be made clearly and completely with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The CAD engineering drawing is a schematic file for product design and manufacture, and contains a series of information such as two-dimensional expression, dimension annotation, material detail and the like of the parts. In recent years, although three-dimensional CAD has been developed to a great extent, the inability to automatically generate a standard-compliant two-dimensional engineering drawing from a three-dimensional model has been a key pain point that plagues the popularization of three-dimensional design software. The manual drawing is complex in operation, and a large number of designers with industry experience are needed, so that a large amount of manpower and time resources are wasted.
At present, although a plurality of CAD software has the function of automatically generating two-dimensional engineering drawings, a template generating mode is mostly used, when a large number of nonstandard drawings in specific industries are faced, a large number of drawing templates are required to be manufactured, the operation is complex, the universality is poor, and the man-machine interaction cost is greatly increased.
Therefore, the invention provides an engineering drawing layout optimization scheme, which can simply and conveniently realize the automatic generation of the non-templated two-dimensional engineering drawing layout when facing a large number of non-standard drawings, and improves the design efficiency.
Referring to fig. 1, the embodiment of the invention discloses an engineering drawing layout optimization method, which comprises the following steps:
Step S11: and obtaining the elements to be laid out of the engineering drawing and the layout constraints of the elements to be laid out.
In the embodiment, obtaining layout mode information corresponding to a view, a detail table, a pipe orifice table, a node diagram, a standard title bar, a technical requirement and a technical characteristic table of an engineering drawing, and generating elements to be laid out of the engineering drawing based on the layout mode information; it will be appreciated that engineering drawing elements include views, node diagrams, standard title bars, technical requirements, detail tables, orifice tables, technical characteristics tables.
The following is the layout pattern information of the engineering drawing elements to be laid out. View of engineering drawing: the main body part of the engineering drawing is a graph obtained by projecting equipment to a projection surface, and the invention classifies the layout mode information of the view into the following categories: single view layout: front view layout, top view layout, left view layout. Multi-view layout: front view and top view (up-down layout), front view and top view (left-right layout), front view and left view (up-down layout), front view and left view (left-right layout), tower front view (middle split and up-down layout). Detail table of engineering drawing: the detail list comprises the contents of the part number, the drawing number or the standard number, the name, the number, the materials and the like of each different part, and the layout mode information of the detail list is divided into the following categories: detail table (right layout), detail table (left layout). Orifice table of engineering drawing: the invention classifies layout mode information of the orifice table into the following categories: orifice table (combined layout with detail table), orifice table (individual layout). Node diagram of engineering drawing: the intersection point of more than two decorative surfaces is a specific structure which is formed by singly taking out a part which cannot be clearly shown in the whole figure, and a figure showing the detail of the building structure. Typically, each device contains one or more node maps. The layout pattern information of the node map in the present disclosure is unique. Standard title bar: the standard title bar contains information such as equipment name, material, scale, drawing number, construction unit, etc. The layout mode information of the standard title bar is unique in this disclosure. The technical requirements are as follows: technical requirements mainly include design, manufacturing, inspection, acceptance requirements of the equipment and detailed design data. The invention classifies the layout modes of technical requirements into the following categories: technical requirements (assembly drawing), technical requirements (non-assembly drawing). Technical characteristics table: the technical characteristics table is a list of important technical characteristics and design basis for the device. The technical characteristic table has unique layout mode.
In this embodiment, an industry layout rule constraint, a layout element overlapping constraint, a horizontal alignment constraint, a layout space utilization constraint, and a layout equilibrium constraint are obtained. It can be understood that the layout constraints of the elements to be laid out of the engineering drawing are divided into five categories, namely, layout element overlapping constraints, horizontal alignment constraints, layout space utilization constraints and layout equilibrium constraints. Then, after obtaining the elements to be laid out of the engineering drawing and the layout constraints of the elements to be laid out, the method further comprises the following steps: classifying the layout constraint of the element to be laid out according to whether the constraint condition can be violated or not so as to obtain a first classification result that the industry layout rule constraint and the layout element overlapping constraint are non-violated constraint and a second classification result that the horizontal alignment constraint, the layout space utilization constraint and the layout equilibrium constraint are violated constraint. It can be appreciated that classifying industry layout rule constraints and overlapping constraints of layout elements as hard constraints, i.e., a first classification result that cannot violate the constraints; the horizontal alignment constraint, the layout space utilization constraint, and the layout equalization constraint are classified as soft constraints, i.e., a second classification result that can violate the constraints, but is desirably satisfied as much as possible.
Wherein each layout constraint is specifically as follows:
(1) Industry layout rule constraints: the constraint of the industry layout rule set in the invention aims to ensure that the engineering drawing layout meets the basic industry layout requirement, and comprises the following points.
1. The drawing elements are to be laid out within a layout-capable range.
2. For layout constraints of views, the present invention generalizes them to the following classes:
single view layout: and placing the view according to the previously obtained distance threshold value, so that the view is positioned at the center of the drawing, namely, in the constraint of the industrial layout rule, the elements of the engineering drawing are required to be laid out in the layout range, and the single-view layout places the view according to the set distance threshold value, wherein the view is positioned at the center of the drawing.
Front view and top view (top-bottom layout): the layout position of the front view is constrained according to the single-view layout constraint, the top view is arranged below the front view, and the vertical center lines of the two views are on the same straight line.
Front view and top view (left-right layout): the layout position of the main view is constrained according to the single-view layout constraint, the top view layout is arranged on the right side of the main view, and the upper boundaries of the two views are on the same straight line.
Front view and left view (top-bottom layout): the layout position of the main view is constrained according to the single-view layout constraint, the left-view layout is arranged below the main view, and the left boundaries of the two views are on a straight line.
Front view and left view (left-right layout): the layout position of the main view is constrained according to the single-view layout constraint, the left-view layout is arranged on the right side of the main view, and the horizontal center lines of the two views are on the same straight line.
Front view of the tower (split middle and up-down layout): the layout position of the front view (left part) of the tower is constrained according to the single-view layout constraint, the front view (right part) of the tower is arranged below the front view (left part) of the tower, and the two views are required to be aligned up and down.
3. The node map can only be laid out below and to the right of the view.
4. The lower edge of the standard title bar needs to coincide with the lower boundary of the placeable space, and the right edge of the standard title bar needs to coincide with the right boundary of the placeable space.
5. For the layout constraint of the technical requirements, the invention classifies them into two categories:
layout right above standard title bar (assembly drawing); layout is in the upper right corner of the drawing (non-assembled drawing).
6. In the assembly drawing, the technical characteristics table is laid out directly above the technical requirements.
7. The lower edge of the detail table needs to coincide with the lower boundary of the placeable space. The invention classifies the layout mode of the detail table into a left side layout or a right side layout. If the list is laid out from the right side, it is necessary to determine whether the right line of the list coincides with the left boundary of the standard title bar. If the list is laid out from the left side, it is necessary to determine whether the left line of the list coincides with the left boundary or abuts against the right boundary of the view element. If there are multiple columns of lists, each column of lists needs to be kept at a small horizontal interval.
8. For layout constraints of the orifice table, the present disclosure generalizes it to the following two categories: the orifice table can be arranged right above the detail table and keeps a small interval with the detail table; the orifice table may also be de-laid in accordance with the layout constraints of the detail table.
(2) Layout element overlap constraint:
the overlapping constraint in the present invention aims to prevent elements in the engineering drawing layout from overlapping each other. The drawing elements must be laid out in the drawing space in a non-overlapping manner.
(3) Horizontal alignment constraint:
the horizontal alignment constraint of the present invention is primarily used to ensure that the node map remains as centered as possible in the horizontal direction.
In the invention, the node diagram is divided into different groups in the layout process, and the horizontal central lines of the node diagrams of the same group are required to be in a straight line.
(4) Layout space utilization constraint:
the layout space utilization constraint in the invention aims to ensure that the space of the drawing is fully utilized so as to accommodate the layout of the drawing elements to the greatest extent.
After the node diagrams are ordered according to the height, whether the node diagrams are arranged row by row according to the height is needed to be judged.
(5) Layout equalization constraints:
the equilibrium constraint set by the invention is mainly used for maintaining the equilibrium of the engineering drawing layout, and comprises the following points.
The distances between the drawing elements and the drawing elements on the left and upper sides must be equal to a predetermined distance threshold.
The invention divides the layout into six areas, including the left, middle, right and up and down in the horizontal direction, and then calculates the layout rate in each area, i.e. the ratio of the total area of the layout elements to the area of the area, respectively. The variance of these layout rates is then calculated, and the constraint aims to minimize the variance to ensure that the layout is distributed as evenly as possible within the individual regions.
Step S12: and converting the elements to be laid out into two-dimensional layout data so as to generate a drawing layout to be optimized based on the two-dimensional layout data.
In this embodiment, elements to be laid out are converted into corresponding two-dimensional layout data, the two-dimensional layout data are initialized by using an automatic local algorithm, and then a drawing layout to be optimized is generated based on the two-dimensional layout data. Specifically, obtaining an element to be laid out, which comprises the type of the picture, the space range capable of being laid out, the size of the element to be laid out and the layout mode information, from an intermediate file; and converting the elements to be laid out into two-dimensional layout data in a target data format, initializing the two-dimensional layout data, and creating a population of the initialized two-dimensional layout data to generate the drawing layout to be optimized. It will be appreciated that the data required for a two-dimensional layout, i.e., two-dimensional layout data, is obtained from an intermediate file, including the type of the drawing, the extent of the space that can be laid out, the size of the elements to be laid out, the view layout pattern, the table layout pattern, etc. And converting the acquired two-dimensional layout data into a data format required by a genetic algorithm. Initializing two-dimensional layout data required in an algorithm flow, and creating an initial population according to a set population scale, namely, establishing a drawing layout constructed by individuals in the initial population as the drawing layout to be optimized. The genetic algorithm is a calculation model for simulating the natural selection of the Darwin theory and the biological evolution process of genetic mechanism, and is an algorithm for continuously selecting excellent individuals.
Step S13: determining the number of violations of the violating to-be-laid elements generated in the to-be-optimized drawing layout based on each layout constraint, and performing iterative selection on the to-be-optimized drawing layout by using a preset genetic algorithm to obtain a target drawing layout corresponding to the minimum number of violations of the violating to-be-laid elements.
In this embodiment, the number of violations of the violating elements to be laid out generated in the drawing layout to be optimized based on the layout constraint is calculated and determined, the calculation process is performed by using a genetic algorithm, and then the drawing layout to be optimized is iteratively selected by using the genetic algorithm, that is, a target individual is continuously and iteratively selected based on the calculation result of the number of violations of each individual in the population by using the genetic algorithm, in other words, the individual corresponding to the minimum number of violations is continuously and iteratively selected, and then the target drawing layout is generated based on the selected individual.
As can be seen, the present application discloses an engineering drawing layout optimization method, including: acquiring elements to be laid out of an engineering drawing and layout constraints of the elements to be laid out; converting the elements to be laid out into two-dimensional layout data to generate a drawing layout to be optimized based on the two-dimensional layout data; determining the number of violations of the violating to-be-laid elements generated in the to-be-optimized drawing layout based on each layout constraint, and performing iterative selection on the to-be-optimized drawing layout by using a preset genetic algorithm to obtain a target drawing layout corresponding to the minimum number of violations of the violating to-be-laid elements. Therefore, by introducing layout constraint and genetic algorithm, iterative selection is carried out on the to-be-optimized drawing layout through the genetic algorithm, the number of violations appearing in the drawing layout is determined, and the optimized target engineering drawing is selected based on iteration, so that the automatic engineering drawing generation method is provided, a large number of drawing templates are not needed, manual intervention can be greatly reduced, time and manpower resources are saved, and the intelligent level of CAD software is greatly improved.
Referring to fig. 2, an embodiment of the present invention discloses a specific engineering drawing layout optimization method, and compared with the previous embodiment, the present embodiment further describes and optimizes a technical solution. Specific:
step S21: and obtaining the elements to be laid out of the engineering drawing and the layout constraints of the elements to be laid out.
Step S22: and converting the elements to be laid out into two-dimensional layout data so as to generate a drawing layout to be optimized based on the two-dimensional layout data.
The more detailed processing procedures in steps S21 and S22 refer to the content of the foregoing disclosed embodiments, and are not described herein.
Step S23: calculating the fitness value of each individual in the drawing layout to be optimized based on each layout constraint, and carrying out iterative selection on the drawing layout to be optimized based on the fitness value of each individual and through a preset genetic algorithm to obtain a target drawing layout with the minimum number of violations of the elements to be subjected to the violations; and taking the negative value of the violation number of the violation to-be-laid-out elements as the fitness value of the individual.
In the embodiment, according to the set celebrity hall size rule, selecting an individual with a fitness value larger than a target fitness value to be added into the celebrity hall; the celebrity hall is used for reserving individuals appearing in the population in the evolution process; selecting a next generation of individuals from the current population by adopting a tournament method; executing crossing and mutation steps on the next generation of individuals according to the preset probability; and skipping to execute the step of selecting individuals larger than the target fitness value to join in the celebrity hall according to the set celebrity hall size rule, and selecting the optimized layout constructed by the individuals with the smallest violations in the celebrity hall as the target drawing layout. It can be understood that, calculating the fitness value of each individual in the population based on each layout constraint, then performing iterative selection, adding the individual after iterative selection to the celebrity hall, specifically, 1, selecting the individual with high fitness value to the celebrity hall according to the set celebrity hall size; 2. selecting a next generation of individuals from the current population by adopting a tournament method; 3. and crossing and mutating the new generation of individuals (except the individuals entering the celebrity hall) according to the set probability. And circularly executing 1, 2 and 3, selecting individuals with high fitness values to be added into the celebrity hall according to the set celebrity hall size, and selecting the individuals with the least violations in the celebrity hall as the optimal layout until the algorithm stopping condition is met. And taking the negative value of the violation number calculated in the drawing layout to be optimized as the fitness value of the individual, wherein the larger the fitness value of the individual is, the better the violation number of the drawing layout to be optimized is represented, and the better the corresponding drawing layout effect is.
In this embodiment, the number of violations of each individual is initialized to zero, and the number of violations violating each layout constraint is calculated according to each layout constraint and the corresponding penalty coefficient; calculating the total violation number corresponding to each individual in the drawing layout to be optimized according to the total violation number = violation number corresponding to the non-violating constraint × penalty coefficient + violation number corresponding to the violating constraint; and respectively taking the negative value of the total violation number as the fitness value of each individual. It will be appreciated that, in calculating the number of individual violations of the rule constraint, the specific calculation process is as follows, depending on the different graph types, view layout modes, table layout modes, etc:
the first step, initializing the number of individual violations to zero;
and secondly, judging whether the layout positions of the layout elements exceed the layout-capable range according to the industry layout rule constraint, and if so, calculating the number of violations of the constraint according to the corresponding penalty coefficients.
And thirdly, judging whether the layout position of the view is illegal or not according to a specific view layout mode and industry layout rule constraints, and if so, calculating the illegal quantity of the constraints according to the corresponding punishment coefficients.
And fourthly, judging whether the layout position of the node diagram is illegal according to the industry layout rule constraint, and if so, calculating the number of violations of the constraint according to the corresponding punishment coefficient.
And fifthly, judging whether the layout position of the standard title bar is illegal according to the industry layout rule constraint, and if so, calculating the illegal quantity of the constraint according to the corresponding punishment coefficient.
And sixthly, judging whether the layout position of the technical requirement is illegal according to the industry layout rule constraint, and if so, calculating the illegal quantity of the constraint according to the corresponding punishment coefficient.
And seventhly, judging whether the layout position of the technical characteristic table is illegal according to the industry layout rule constraint, and if so, calculating the illegal quantity of the constraint according to the corresponding punishment coefficient.
And eighth step, judging whether the layout position of the detail table is illegal according to the industry layout rule constraint, if so, calculating the illegal quantity of the constraint according to the corresponding punishment coefficient.
And ninth, judging whether the layout position of the pipe orifice table is illegal according to the industry layout rule constraint, and if so, calculating the illegal quantity of the constraint according to the corresponding punishment coefficient.
And tenth, judging whether the layout position of the node diagram is illegal according to the layout space utilization constraint, and if so, calculating the number of violations of the constraint according to the corresponding punishment coefficient. So far, the total number of violations under the constraint of the industry layout rules is obtained.
Eleventh, judging whether the layout position of the node diagram is illegal according to the horizontal alignment constraint, if so, calculating the illegal quantity of the constraint according to the corresponding punishment coefficient.
And twelfth, judging whether the layout position of the drawing element is illegal according to the layout equilibrium constraint, and if so, calculating the illegal quantity of the constraint according to the corresponding punishment coefficient.
And thirteenth, calculating the violation number of the constraint according to the variance among six layout rates and the corresponding penalty coefficient according to the layout equilibrium constraint.
And fourteenth step, judging whether the layout position of the drawing element is illegal according to the overlapping constraint of the layout element, and if so, calculating the illegal quantity of the constraint according to the corresponding punishment coefficient.
And fifteenth, calculating the total violation number of the whole drawing layout to be optimized, and taking the negative value of the total violation number as the fitness value of the individual.
Total number of violations = total number of hard constraint violations x total number of hard constraint penalty coefficient + total number of soft constraint violations.
Referring to fig. 3, a layout algorithm is started to obtain element information to be laid out, the obtained element information to be laid out is then converted into two-dimensional layout data, the two-dimensional layout data is converted into a data format required by the algorithm, an initial population is created according to a set population scale, the fitness of each individual in the population is calculated, the negative value of the number of violations appearing in a drawing layout is used as the fitness value of the individual, the individual with high fitness is selected to be added to the celebrity hall according to the set celebrity hall size, next generation individuals are selected from the current population by adopting a tournament method, the new generation individuals are sequentially crossed and mutated according to the set probability, the cyclic execution is performed until the algorithm stopping condition is met, and the individual with the minimum violations in the celebrity hall is selected to be displayed as the optimal layout.
Therefore, the optimal layout scheme, namely the target drawing layout, can be output by further selecting the iterative optimization drawing layout in a mode of continuously screening the negative values with less violations.
Referring to fig. 4, the invention also correspondingly discloses an engineering drawing layout optimization system, which comprises:
the data acquisition module 11 is used for acquiring elements to be laid out of the engineering drawing and layout constraints of the elements to be laid out;
a layout generation module 12, configured to convert the element to be laid out into two-dimensional layout data, so as to generate a drawing layout to be optimized based on the two-dimensional layout data;
the layout optimization module 13 is configured to determine, based on each layout constraint, the number of violations of the violating elements to be laid out in the to-be-optimized drawing layout, and perform iterative selection on the to-be-optimized drawing layout by using a preset genetic algorithm, so as to obtain a target drawing layout corresponding to the case where the number of violations of the violating elements to be laid out is minimum.
The method comprises the steps of obtaining elements to be laid out of an engineering drawing and layout constraints of the elements to be laid out; converting the elements to be laid out into two-dimensional layout data to generate a drawing layout to be optimized based on the two-dimensional layout data; determining the number of violations of the violating to-be-laid elements generated in the to-be-optimized drawing layout based on each layout constraint, and performing iterative selection on the to-be-optimized drawing layout by using a preset genetic algorithm to obtain a target drawing layout corresponding to the minimum number of violations of the violating to-be-laid elements. Therefore, by introducing layout constraint and genetic algorithm, iterative selection is carried out on the to-be-optimized drawing layout through the genetic algorithm, the number of violations appearing in the drawing layout is determined, and the optimized target engineering drawing is selected based on iteration, so that the automatic engineering drawing generation method is provided, a large number of drawing templates are not needed, manual intervention can be greatly reduced, time and manpower resources are saved, and the intelligent level of CAD software is greatly improved.
Further, the embodiment of the present application further discloses an electronic device, and fig. 5 is a block diagram of the electronic device 20 according to an exemplary embodiment, where the content of the figure is not to be considered as any limitation on the scope of use of the present application.
Fig. 5 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. The memory 22 is used for storing a computer program, and the computer program is loaded and executed by the processor 21 to implement relevant steps in the engineering drawing layout optimization method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 25 is used for acquiring external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
Processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 may be implemented in at least one hardware form of DSP (Digital Signal Processing ), FPGA (Field-Programmable Gate Array, field programmable gate array), PLA (Programmable Logic Array ). The processor 21 may also comprise a main processor, which is a processor for processing data in an awake state, also called CPU (Central Processing Unit ); a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 may integrate a GPU (Graphics Processing Unit, image processor) for rendering and drawing of content required to be displayed by the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence ) processor for processing computing operations related to machine learning.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon may include an operating system 221, a computer program 222, and the like, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and the computer program 222, so as to implement the operation and processing of the processor 21 on the mass data 223 in the memory 22, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the engineering drawing layout optimization method performed by the electronic device 20 disclosed in any of the previous embodiments. The data 223 may include, in addition to data received by the electronic device and transmitted by the external device, data collected by the input/output interface 25 itself, and so on.
Further, the application also discloses a computer readable storage medium for storing a computer program; the method comprises the steps of executing a computer program by a processor, wherein the computer program realizes the engineering drawing layout optimization method disclosed by the prior art. For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application. The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in random access Memory RAM (Random Access Memory), memory, read-Only Memory ROM (Read Only Memory), electrically programmable EPROM (Electrically Programmable Read Only Memory), electrically erasable programmable EEPROM (Electric Erasable Programmable Read Only Memory), registers, hard disk, a removable disk, a CD-ROM (Compact Disc-Read Only Memory), or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The engineering drawing layout optimization method, system, equipment and medium provided by the invention are described in detail, and specific examples are applied to illustrate the principle and implementation of the invention, and the description of the examples is only used for helping to understand the method and core idea of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (10)

1. An engineering drawing layout optimization method is characterized by comprising the following steps:
acquiring elements to be laid out of an engineering drawing and layout constraints of the elements to be laid out;
converting the elements to be laid out into two-dimensional layout data to generate a drawing layout to be optimized based on the two-dimensional layout data;
determining the number of violations of the violating to-be-laid elements generated in the to-be-optimized drawing layout based on each layout constraint, and performing iterative selection on the to-be-optimized drawing layout by using a preset genetic algorithm to obtain a target drawing layout corresponding to the minimum number of violations of the violating to-be-laid elements.
2. The engineering drawing layout optimization method according to claim 1, wherein the obtaining the layout element of the engineering drawing and the layout constraint of the layout element comprises:
acquiring layout mode information corresponding to a view, a detail table, a pipe orifice table, a node diagram, a standard title bar, a technical requirement and a technical characteristic table of an engineering drawing, and generating elements to be laid out of the engineering drawing based on the layout mode information;
acquiring industry layout rule constraints, layout element overlapping constraints, horizontal alignment constraints, layout space utilization constraints and layout equilibrium constraints.
3. The engineering drawing layout optimization method according to claim 2, wherein after the obtaining the layout elements of the engineering drawing and the layout constraints of the layout elements, the method further comprises:
classifying the layout constraint of the element to be laid out according to whether the constraint condition can be violated or not so as to obtain a first classification result that the industry layout rule constraint and the layout element overlapping constraint are non-violated constraint and a second classification result that the horizontal alignment constraint, the layout space utilization constraint and the layout equilibrium constraint are violated constraint.
4. The engineering drawing layout optimization method according to claim 1, wherein the converting the element to be laid out into two-dimensional layout data to generate the drawing layout to be optimized based on the two-dimensional layout data includes:
obtaining elements to be laid out, which comprise the types of the pictures, the space range capable of being laid out, the sizes of the elements to be laid out and the layout mode information, from the intermediate file;
and converting the elements to be laid out into two-dimensional layout data in a target data format, initializing the two-dimensional layout data, and creating a population of the initialized two-dimensional layout data to generate the drawing layout to be optimized.
5. The engineering drawing layout optimization method according to claim 1, wherein determining, based on each layout constraint, a number of violations of the violating elements to be laid out generated in the drawing layout to be optimized, and iteratively selecting the drawing layout to be optimized by using a preset genetic algorithm, so as to obtain a target drawing layout corresponding to a case where the number of violations of the violating elements to be laid out is minimum, includes:
calculating the fitness value of each individual in the drawing layout to be optimized based on each layout constraint, and carrying out iterative selection on the drawing layout to be optimized based on the fitness value of each individual and through a preset genetic algorithm to obtain a target drawing layout with the minimum number of violations of the elements to be subjected to the violations; and taking the negative value of the violation number of the violation to-be-laid-out elements as the fitness value of the individual.
6. The engineering drawing layout optimization method according to claim 5, wherein the iterative selection of the drawing layout to be optimized based on the fitness value of each individual and through a preset genetic algorithm is performed to obtain a target drawing layout with the minimum number of violations of the elements to be laid out, and the method comprises the following steps:
According to the set celebrity hall size rule, selecting an individual with a fitness value larger than a target fitness value to be added into the celebrity hall; the celebrity hall is used for reserving individuals appearing in the population in the evolution process;
selecting a next generation of individuals from the current population by adopting a tournament method;
executing crossing and mutation steps on the next generation of individuals according to the preset probability;
and skipping to execute the step of selecting individuals larger than the target fitness value to join in the celebrity hall according to the set celebrity hall size rule, and selecting the optimized layout constructed by the individuals with the smallest violations in the celebrity hall as the target drawing layout.
7. The engineering drawing layout optimization method according to claim 5, wherein the calculating the fitness value of each individual in the drawing layout to be optimized based on each layout constraint comprises:
initializing the number of violations of each individual to be zero, and calculating the number of violations which violate each layout constraint according to each layout constraint and the corresponding penalty coefficient;
calculating the total violation number corresponding to each individual in the drawing layout to be optimized according to the total violation number = violation number corresponding to the non-violating constraint × penalty coefficient + violation number corresponding to the violating constraint;
And respectively taking the negative value of the total violation number as the fitness value of each individual.
8. An engineering drawing layout optimization system, comprising:
the data acquisition module is used for acquiring elements to be laid out of the engineering drawing and layout constraints of the elements to be laid out;
the layout generation module is used for converting the elements to be laid out into two-dimensional layout data so as to generate a drawing layout to be optimized based on the two-dimensional layout data;
the layout optimization module is used for determining the violation quantity of the violation to-be-laid elements generated in the to-be-optimized drawing layout based on each layout constraint, and carrying out iterative selection on the to-be-optimized drawing layout by utilizing a preset genetic algorithm so as to obtain a target drawing layout corresponding to the minimum violation quantity of the violation to-be-laid elements.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the steps of the engineering drawing layout optimization method of any of claims 1 to 7.
10. A computer-readable storage medium storing a computer program; wherein the computer program when executed by a processor implements the steps of the engineering drawing layout optimization method of any of claims 1 to 7.
CN202410245570.0A 2024-03-05 2024-03-05 Engineering drawing layout optimization method, system, equipment and medium Active CN117828701B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410245570.0A CN117828701B (en) 2024-03-05 2024-03-05 Engineering drawing layout optimization method, system, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410245570.0A CN117828701B (en) 2024-03-05 2024-03-05 Engineering drawing layout optimization method, system, equipment and medium

Publications (2)

Publication Number Publication Date
CN117828701A true CN117828701A (en) 2024-04-05
CN117828701B CN117828701B (en) 2024-05-24

Family

ID=90504353

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410245570.0A Active CN117828701B (en) 2024-03-05 2024-03-05 Engineering drawing layout optimization method, system, equipment and medium

Country Status (1)

Country Link
CN (1) CN117828701B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040019851A1 (en) * 2002-07-23 2004-01-29 Xerox Corporation Constraint-optimization system and method for document component layout generation
US20130132042A1 (en) * 2011-11-16 2013-05-23 Luen Shing Tools Limited Method and System for Combinatorial Layout Design
CN113486446A (en) * 2021-07-06 2021-10-08 沈阳航空航天大学 Single-pipeline multi-objective optimization layout method in aircraft fuel tank
CN115017367A (en) * 2022-03-28 2022-09-06 北京大学 Universal interactive constraint graph layout system and method
CN115130760A (en) * 2022-07-04 2022-09-30 西南交通大学 Horizontal cylinder facility layout method based on improved wild horse algorithm
CN115202661A (en) * 2022-09-15 2022-10-18 深圳大学 Hybrid generation method with hierarchical structure layout and related equipment
CN115203767A (en) * 2022-09-16 2022-10-18 青岛艾德软件有限公司 Automatic layout method and system for engineering drawings
WO2023097990A1 (en) * 2021-11-30 2023-06-08 华为云计算技术有限公司 Element layout method and related device
CN116451291A (en) * 2023-04-20 2023-07-18 中国石油大学(华东) Quantitative evaluation method and system for layout quality of engineering drawing
CN116738923A (en) * 2023-04-04 2023-09-12 暨南大学 Chip layout optimization method based on reinforcement learning with constraint
CN117272476A (en) * 2023-09-25 2023-12-22 西门子(中国)有限公司 Layout planning method, device, electronic equipment and storage medium
CN117291364A (en) * 2023-09-18 2023-12-26 西门子(中国)有限公司 Layout planning method, device, equipment and storage medium

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040019851A1 (en) * 2002-07-23 2004-01-29 Xerox Corporation Constraint-optimization system and method for document component layout generation
US20130132042A1 (en) * 2011-11-16 2013-05-23 Luen Shing Tools Limited Method and System for Combinatorial Layout Design
CN113486446A (en) * 2021-07-06 2021-10-08 沈阳航空航天大学 Single-pipeline multi-objective optimization layout method in aircraft fuel tank
WO2023097990A1 (en) * 2021-11-30 2023-06-08 华为云计算技术有限公司 Element layout method and related device
CN115017367A (en) * 2022-03-28 2022-09-06 北京大学 Universal interactive constraint graph layout system and method
CN115130760A (en) * 2022-07-04 2022-09-30 西南交通大学 Horizontal cylinder facility layout method based on improved wild horse algorithm
CN115202661A (en) * 2022-09-15 2022-10-18 深圳大学 Hybrid generation method with hierarchical structure layout and related equipment
CN115203767A (en) * 2022-09-16 2022-10-18 青岛艾德软件有限公司 Automatic layout method and system for engineering drawings
CN116738923A (en) * 2023-04-04 2023-09-12 暨南大学 Chip layout optimization method based on reinforcement learning with constraint
CN116451291A (en) * 2023-04-20 2023-07-18 中国石油大学(华东) Quantitative evaluation method and system for layout quality of engineering drawing
CN117291364A (en) * 2023-09-18 2023-12-26 西门子(中国)有限公司 Layout planning method, device, equipment and storage medium
CN117272476A (en) * 2023-09-25 2023-12-22 西门子(中国)有限公司 Layout planning method, device, electronic equipment and storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
ARUN KUMAR ET AL.: "Assisting an architect with alternative automated space layout designs using order crossover Genetic Algorithm in AutoCAD", 《 2017 INTERNATIONAL CONFERENCE ON ADVANCES IN MECHANICAL, INDUSTRIAL, AUTOMATION AND MANAGEMENT SYSTEMS (AMIAMS)》, 19 October 2017 (2017-10-19), pages 275 - 280 *
YUNLEI SUN ET AL.: "Towards an Open-Source Industry CAD: A Review of System Development Methods", 《TECHNICAL GAZETTE 》, 31 December 2022 (2022-12-31), pages 2127 - 2136 *
何涛: "工程图纸自动生成优化算法研究", 《中国博士学位论文全文数据库》, 15 February 2007 (2007-02-15), pages 1 - 145 *
李江涛 等: "进化策略在无比例工程图布局优化中的应用", 《北京航空航天大学学报》, vol. 33, no. 3, 31 March 2007 (2007-03-31), pages 366 - 369 *

Also Published As

Publication number Publication date
CN117828701B (en) 2024-05-24

Similar Documents

Publication Publication Date Title
Guo et al. Evolutionary approach for spatial architecture layout design enhanced by an agent-based topology finding system
CN101142615A (en) Display priority for 2d cad documents
Ibrahim et al. The level of knowledge of CAD objects within the building information model
Granadeiro et al. A general indirect representation for optimization of generative design systems by genetic algorithms: Application to a shape grammar-based design system
CN113987664B (en) Building layout scheme generation method, system, device, terminal and storage medium
CN115202661B (en) Hybrid generation method with hierarchical structure layout and related equipment
CN112733246B (en) Automatic building design method, device, terminal, storage medium and processor
CN117828701B (en) Engineering drawing layout optimization method, system, equipment and medium
Shoaib Khan et al. Methodology for voxel-based earthwork modeling
CN116152451A (en) Multidimensional parameterized city information model construction method, system and computer equipment
Chan Optimal design of building structures using genetic algorithms
CN113742804B (en) Furniture layout diagram generation method, device, equipment and storage medium
CN113065321B (en) User behavior prediction method and system based on LSTM model and hypergraph
CN114913300A (en) Automatic modeling method for entity three-dimensional model
CN117972812B (en) Engineering drawing layout optimization method, device, equipment and medium
CN105205263B (en) A kind of power equipment threedimensional model fast construction equipment and its application
Guidera Conceptual design exploration in architecture using parametric generative computing: a case study
US20230297734A1 (en) Voxel-based approach for design models
CN117972812A (en) Engineering drawing layout optimization method, device, equipment and medium
US20230298259A1 (en) Voxel-based approach for design models
US20230298291A1 (en) Voxel-based approach for design models
Gaha Parametric Architectural Design for a New City Identity: Materials, Environments and New Applications
CN117236794B (en) BIM-based engineering supervision information management method, system, medium and equipment
WO2024108580A1 (en) Multi-dimensional parameterized city information model construction method and system, and computer device
CN112989458B (en) Method for converting BIM (building information modeling) model into 3DTiles file

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant