CN114092952A - dXF format-based house type graph information extraction and vectorization method and device - Google Patents

dXF format-based house type graph information extraction and vectorization method and device Download PDF

Info

Publication number
CN114092952A
CN114092952A CN202111396607.2A CN202111396607A CN114092952A CN 114092952 A CN114092952 A CN 114092952A CN 202111396607 A CN202111396607 A CN 202111396607A CN 114092952 A CN114092952 A CN 114092952A
Authority
CN
China
Prior art keywords
entity
type graph
file
house
dxf
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.)
Pending
Application number
CN202111396607.2A
Other languages
Chinese (zh)
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.)
Foshan Oushennuo Yunshang Technology Co ltd
South China Normal University
Original Assignee
Foshan Oushennuo Yunshang Technology Co ltd
South China Normal University
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 Foshan Oushennuo Yunshang Technology Co ltd, South China Normal University filed Critical Foshan Oushennuo Yunshang Technology Co ltd
Priority to CN202111396607.2A priority Critical patent/CN114092952A/en
Publication of CN114092952A publication Critical patent/CN114092952A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention relates to a method and a device for extracting and vectorizing house type graph information based on a DXF format. The invention discloses a method for extracting and vectorizing house type graph information based on a DXF format, which comprises the following steps: acquiring a house type graph file in a DXF format to be processed; preprocessing a house type graph file in a DXF format; extracting coordinate information of an entity across layers aiming at the preprocessed house type graph files in the DXF format; obtaining a wall body outline and a door and window outline in the house type graph file according to the coordinate information of the entity; and outputting a vectorized house-type graph according to the wall profile and the door and window profile. The method and the device for extracting and vectorizing the information of the house type graph based on the DXF format can automatically extract the structure and the size information of the house type from the house type graph in the DXF format, transfer the information into a specific JSON file format, and present the vectorized house type graph on a platform through rendering so as to provide personalized decoration for a user.

Description

dXF format-based house type graph information extraction and vectorization method and device
Technical Field
The invention relates to the technical field of image recognition and image processing, in particular to a method and a device for extracting and vectorizing house type graph information based on a DXF format.
Background
The drawing design is all required to carry out before concrete construction in traditional architectural decoration construction, will be under construction according to designer's design theory, design cycle is longer with construction cycle, design work load is big, work efficiency is low for holistic architectural decoration speed is slow, can take place great deviation often moreover in actual construction, has to carry out the secondary and does over again, not only can increase construction cost, still can delay the time limit for a project, is unfavorable for the rational allocation of resource. Therefore, the computer-aided design of the custom-type drawing is of great significance to the field of building decoration.
Although the design of a user-type drawing by using a computer-aided tool can help a construction team, the home decoration market urgently needs an automatic/semi-automatic home decoration design system with simple operation because the existing computer-aided tool has high use threshold and is not beneficial to the hands of common users. The user transmits the house type graph in the DXF format into the system, the system can automatically extract the house type structure and the size information from the house type graph, and then the reconstructed house type graph is presented to the user, so that the user can independently select different decoration schemes.
The DWG format is a special format of AutoCAD, has certain confidentiality and is convenient for file calling of external programs, so that the DXF file is introduced into the AutoCAD. DXF is an open vector data format that can be divided into two categories: ASCII format and binary format; the ASCII has the characteristic of good readability, but occupies a large space; the binary format occupies small space and has high reading speed. DXF files are constructed from a number of "data pairs" consisting of "code" and "value", where the code is called "group code", which is a non-negative integer no more than three bits, corresponding to code specifying the type of data, and is used to specify the type and purpose of the value to follow. Each group code sum value must be a separate row. The DXF file is organized into a plurality of "segments," each beginning with a group code of "0" and a string of characters "separation," followed by a group code of "2" and a string of characters representing the name of the segment (e.g., HEADER). In the middle of a segment, elements in the segment may be defined using group codes and values. The end of the segment is defined using the group code "0" and the string "ENDSEC". Each segment of the DXF file is essentially identical in structure, with specific functional differences.
From the above, the structure of the DXF file is quite complex, and it is also an extremely tedious project to completely read the DXF file. In practical applications, many entries in the DXF file may be omitted in order to extract entity information of a graph, and the description of a corresponding geometric figure may be completed as long as a layer table, a block segment and an entity segment in a table segment are obtained.
The color and line type of each layer are described in the layer table, the layer where the block is located, the attribute and the position of the block in the graph are described in the block section, and the geometric information such as the starting point and the end point of the straight line, the circle center and the radius of the circle and the layer where each entity is located are described in the entity section. And searching the color and the line type of each layer in the layer table according to the layer where the entity is positioned, and adding the color and the line type into the entity object. And the DXF file format takes the design requirements of the interface program into full consideration, so that the DXF file format can easily skip unnecessary concerned information and can conveniently extract the concerned information. This provides conditions for extracting the geometric data of the model from the DXF file and for reprocessing the data.
Disclosure of Invention
Based on this, the present invention aims to provide a DXF format-based user type graph information extraction and vectorization method and apparatus, which automatically extract user type structure and size information from a DXF format user type graph, transfer the information into a specific JSON file format, and render the information to present a vectorized user type graph on a platform for a user to perform personalized decoration.
In a first aspect, the present invention provides a method for extracting and vectorizing house pattern information based on DXF format, the method comprising the following steps:
acquiring a user type graph file in a DXF format to be processed;
preprocessing the house type graph file in the DXF format, and removing axes, characters and scales in the file;
extracting coordinate information of an entity across layers aiming at the preprocessed house type graph files in the DXF format;
obtaining a wall body outline in the house type graph file according to the coordinate information of the entity;
obtaining a door and window outline in the house type graph file according to the insertion point coordinate of the insert entity in the house type graph file in the DXF format and the wall coordinate;
and outputting a vectorized house-type graph according to the wall body outline and the door and window outline.
Further, the extracting coordinate information of the entity across the image layers includes:
traversing the preprocessed entity segment of the user type graph file in the DXF format to obtain the entity; wherein the entities include a LINE entity, a POLYLINE entity and LWPOLYLINE;
extracting coordinates of all points of each entity aiming at each entity, and storing the coordinates into an entity list;
removing the duplication of the entity list, and distributing nodes according to the length of the list after the duplication removal;
numbering each node, establishing a mapping relation between the node number and the coordinate, and adding the node into the drawing board;
obtaining the serial numbers of the nodes through the coordinate values, and storing the serial numbers of the two points on each edge into a nested list edges;
lines are drawn by drawing _ network _ edges () connecting points on the graph.
Further, obtaining a wall contour in the house type graph file according to the coordinate information of the entity, including:
storing the extracted coordinate information of the entity into a drawing board of NetworkX;
finding a closed region by using a findcycle () function provided by a NetworkX library;
deleting the points and edges of the closed area in the drawing board every time one closed area is obtained;
repeatedly searching for a closed area and deleting points and edges of the closed area until no closed area exists in the drawing board;
and obtaining the wall body outline according to all the closed areas.
Further, obtaining a door and window profile in the house type graph file according to the insertion point coordinates and the wall coordinates of the insert entity in the house type graph file in the DXF format, including:
traversing all insert entities in the user type graph file in the DXF format to obtain the coordinates of the insertion point of each insert entity, and placing the coordinates of all the insertion points in a door and window list;
traversing the door and window list and the entity list, and calculating Euclidean distance between the coordinate of the insertion point and each point in the entity list aiming at the coordinate of each insertion point;
and sequencing all the distances according to the sizes, and connecting the four points with the minimum distance to obtain the door and window profile corresponding to the insertion point.
Further, connecting four points with the minimum distance comprises:
setting connection conditions, wherein the connection conditions are as follows: there is one identity between the two points, either the abscissa or the ordinate.
Further, preprocessing the user type graph file in the DXF format to remove axes, characters and scales in the file, and the method comprises the following steps:
traversing the user type graph file in the DXF format, and deleting lines of which the line type is not the default line type BYLAYER to obtain the user type graph file with the axis removed;
deleting the TEXT entity and the MTEXT entity to obtain a user type graph file with characters removed;
deleting the DIMENSION entity to obtain the house type graph file with the scale removed.
Further, the method also comprises the following steps:
traversing DXFATTRIBS dictionaries of LINE entities, POLYLINE entities and LWPOLYLINE entities in the DXF-formatted house graph file using a method provided by ezdxf;
and adjusting the values of const _ width, thickness and lineweight to be preset unified values.
In a second aspect, the present invention further provides a device for extracting and vectorizing house type graph information based on DXF format, including:
the family type graph file acquisition module is used for acquiring a family type graph file in a DXF format to be processed;
the preprocessing module is used for preprocessing the house type graph file in the DXF format and removing axes, characters and a scale in the graph file;
the entity coordinate information extraction module is used for extracting entity coordinate information across layers aiming at the preprocessed house type graph files in the DXF format;
the wall contour acquisition module is used for acquiring a wall contour in the house type graph file according to the coordinate information of the entity;
the door and window outline acquisition module is used for acquiring a door and window outline in the house type graph file according to the insertion point coordinate of the insert entity in the house type graph file in the DXF format and the wall coordinate;
and the house-type graph output module is used for outputting the vectorized house-type graph according to the wall outline and the door and window outline.
In a third aspect, the present invention provides an intelligent device, comprising:
at least one memory and at least one processor;
the memory for storing one or more programs;
when executed by the at least one processor, cause the at least one processor to implement the steps of any DXF format-based family graph information extraction and vectorization method according to the first aspect of the present invention.
In a fourth aspect, the present invention provides a computer-readable storage medium, which stores a computer program, which when executed by a processor implements the steps of any DXF format-based family graph information extraction and vectorization method according to the first aspect of the present invention.
The invention provides a method and a device for extracting and vectorizing house type graph information based on a DXF format.
For a better understanding and practice, the invention is described in detail below with reference to the accompanying drawings.
Drawings
Fig. 1 is a schematic flow chart of a DXF format-based house layout information extraction and vectorization method according to the present invention;
FIG. 2 is a diagram illustrating the rendering effect of user-type artwork in CAD software used in one embodiment;
FIG. 3 is a schematic diagram of a wall profile extracted from a floor plan in one embodiment;
FIG. 4 is a schematic diagram illustrating wall profiles and door and window insertion points extracted from a floor plan in accordance with an embodiment;
FIG. 5 is a schematic view of a wall profile and a window profile extracted from a layout drawing in one embodiment;
FIG. 6 is a schematic structural diagram of a device for extracting and vectorizing house layout information based on DXF format according to the present invention;
fig. 7 is a schematic structural diagram of an intelligent device provided in the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
It should be understood that the embodiments described are only some embodiments of the present application, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without any creative effort belong to the protection scope of the embodiments in the present application.
The terminology used in the embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the embodiments of the present application. As used in the examples of this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the application, as detailed in the appended claims. In the description of the present application, it is to be understood that the terms "first," "second," "third," and the like are used solely to distinguish one from another and are not necessarily used to describe a particular order or sequence, nor are they to be construed as indicating or implying relative importance. The specific meaning of the above terms in the present application can be understood by those of ordinary skill in the art as appropriate.
In addition, in the description of the present application, "a plurality" means two or more unless otherwise specified. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
In a specific embodiment, a programming language used in the DXF format-based family graph information extraction and vectorization method provided by the present invention is Python, an Integrated Development Environment (IDE) is PyCharm, and a development environment (SDE) is Python 3.8.
The python library is mainly related to ezdxf and NetworkX:
ezdxf is a Python interface in DXF (drawing exchange file) format developed by Autodesk, which allows developers to read and modify existing DXF drawings or create new DXF drawings. The main goal of ezdxf development is to hide the complex DXF details from the programmer, but still support the programmer to reach most DXF file content by calling the library, but this also requires the programmer to have basic knowledge of the DXF format and to know which tasks and goals can be accomplished using the DXF format.
NetworkX is a python package used to create, manipulate and study the structure, dynamics and functionality of a complex network. NetworkX is a tool for researching social, biological and infrastructure network structures and dynamics, is a tool suitable for standard programming interfaces and graphic realization of various applications and can provide a rapid development environment for collaborative and multidisciplinary projects; using NetworkX, networks can be loaded and stored in standard and non-standard data formats, generating various types of random and classical networks, analyzing network structures, constructing network models, designing new network algorithms, drawing networks, and the like.
To solve the problems in the background art, in a first aspect, the present invention provides a DXF format-based family graph information extraction and vectorization method, as shown in fig. 1, the method includes the following steps:
s01: and acquiring a user type graph file in a DXF format to be processed.
DXF is an open vector data format that can be divided into two categories: ASCII format and binary format; the ASCII has the characteristic of good readability, but occupies a large space; the binary format occupies small space and has high reading speed. DXF files are constructed from a plurality of "data pairs" of "code" and "values," where the code is referred to as a "group code," which is a non-negative integer not exceeding three bits, and corresponds to code specifying the type of data, and the type and purpose of the values to be followed. Each group code sum value must be a separate row. The DXF file is organized into a plurality of "segments," each beginning with a group code of "0" and a string of characters "separation," followed by a group code of "2" and a string of characters representing the name of the segment (e.g., HEADER). In the middle of a segment, elements in the segment may be defined using group codes and values. The end of the segment is defined using the group code "0" and the string "enddec". Each segment of the DXF file is essentially identical in structure, with specific functional differences.
S02: and preprocessing the house type graph file in the DXF format, and removing axes, characters and scales in the file.
As shown in FIG. 2, FIG. 2 is an exemplary embodiment in which a DXF formatted user graph file is viewed in CAD software. Including original axes, text, rulers, etc.
From an observation of a large number of DXF files, it was found that the line type that makes up the axis is generally not the default line type BYLAYER, while the line type that makes up the required walls and windows is generally BYLAYER, so the method in ezdxf can be invoked to delete the axis in the DXF file. The removal of the text and scale is also achieved by finding the corresponding entity type using a function in ezdxf. There are two types of text: TEXT and MTEXT. The scale is not composed of LINE entities, but is stored as a reference entity.
In a preferred embodiment, step S02 includes:
s021: traversing the user type graph file in the DXF format, and deleting lines of which the line type is not the default line type BYLAYER to obtain the user type graph file with the axis removed;
s022: deleting the TEXT entity and the MTEXT entity to obtain a user type graph file with characters removed;
s023: deleting the DIMENSION entity therein to obtain the house type graph file without the scale
S03: and aiming at the preprocessed house type graph files in the DXF format, extracting coordinate information of an entity across layers.
In CAD drawings, each component has a different layer, but in practical applications, different designers have personal naming methods for the layers, such as: some designers will name the layer storing the Wall information as Wall, and some will name the Wall, so when the method extracts information from DXF, a cross-layer extraction strategy is adopted.
The existing algorithms are used for vectorizing DXF house type graphs according to the concept of a graph layer, the concept of a cross-graph layer is adopted in the method, and the vectorization difficulty is increased linearly, because the method mainly adopts the concept of the cross-graph layer according to wall body identification. Through research, the LINE segment of the wall body mainly comprises three entities, namely LINE, POLYLINE and LWPOLYLINE, and a closed area can be formed, so that coordinate information of corresponding entities can be extracted by utilizing ezdxf and stored according to a format required by NetworkX, and a findcycle () function is called to find coordinate information of each point forming the closed area, namely coordinate information of each point of the wall body. In a specific embodiment, the process of extracting the LINE entity includes: .
S0311: and traversing the preprocessed entity segment of the house type graph file in the DXF format to obtain a LINE entity. In a further step, a POLYLINE entity and LWPOLYLINE are obtained.
S0312: and extracting the coordinates of the starting point and the end point of each entity, and storing the coordinates into an entity list.
S0313: and removing the duplicate of the entity list, and distributing nodes according to the length of the list after the duplicate removal.
S0314: and numbering each node, establishing a mapping relation between the node number and the coordinate, and adding the node into the drawing board.
S0315: the numbers of the nodes are obtained through the coordinate values, and the numbers of the two points on each edge are stored in a nested list edges.
S0316: lines are drawn by drawing _ network _ edges () connecting points on the graph.
In another specific embodiment, the extracting of the lwpoinline entity (similar to the polyline) comprises:
s0321: traversing the entity segment of the DXF file to find an LWPOLYLINE entity;
s0322: extracting coordinates of all points forming LWPOLYLINE by using an ezdxf library and storing the coordinates into a list;
s0323: calculating the length of the list, distributing nodes according to the length of the list, and adding points into the drawing board;
s0324: numbering each point, and establishing a mapping relation between the node number and the coordinate;
s0325: and setting for circulation, traversing the list of node numbers, combining the node numbers in pairs before and after, decomposing the LWPOLYLINE entity into edges of one strip, and storing the node numbers forming each edge into a nested list edges. (if the node number list is (0, 1, 2, 3), the combination of two in front and two in back means the combination of (0, 1) (1, 2) (2, 3);
s0326: lines are drawn by drawing _ network _ edges () connecting points on the graph.
In another embodiment, the extracting of the POLYLINE entity comprises:
s0331: traversing the entity section of the DXF file to find a POLYLINE entity;
s0332: extracting coordinates of all points forming POLYLINE by using an ezdxf library and storing the coordinates into a list;
s0333: calculating the length of the list, distributing nodes according to the length of the list, and adding points into the drawing board;
s0334: numbering each point, and establishing a mapping relation between the node number and the coordinate;
s0335: and setting for circulation, traversing the list of the node numbers, combining the node numbers in pairs before and after, decomposing the POLYLINE entity into edges of one strip, and storing the node numbers forming each edge into a nested list edges. (if the node number list is (0, 1, 2, 3), the combination of two in front and two in back means the combination of (0, 1) (1, 2) (2, 3);
s0336: the lines are connected in the drawing board by draw _ network _ edges ().
S04: and obtaining the wall body outline in the house type graph file according to the coordinate information of the entity.
The drawing method of the building components is specified in the building charting standard, wherein the wall body has the following characteristics: any section of wall is a closed area. Therefore, an algorithm can be used to find the closed area in the map, which is regarded as a wall.
In a particular embodiment, obtaining the wall profile comprises the steps of:
s041: and storing the extracted coordinate information of the entity into a drawing board of NetworkX.
S042: the close region is found using the findcycle () function provided by the NetworkX library.
S043: and deleting the points and edges of the closed area in the drawing board every time one closed area is obtained.
S044: and repeatedly searching for the closed region and deleting the point and the edge of the closed region until no closed region exists in the drawing board.
S045: and obtaining the wall body outline according to all the closed areas.
And storing the extracted coordinate information of the LINE, the POLYLINE and the LWPOLYLINE into a drawing board of NetworkX, and then finding a closed region by using a findcycle () function provided by a NetworkX library. Since the findcycle () function only returns one closed region at a time, each time a closed region is obtained, the points and edges of the closed region need to be deleted in the palette until there is no closed region in the palette.
And combining all the closed areas according to the coordinate positions in the original figure to obtain the wall body outline in the original house-type figure.
In an exemplary embodiment, the wall contour obtained by finding the closed area is shown in FIG. 3.
S05: and obtaining the door and window outline in the house type graph file according to the insertion point coordinate of the insert entity in the house type graph file in the DXF format and the wall coordinate.
Because the doors and windows are common components in the house type design, the door and window drawing method commonly used by designers at present is to draw the shapes of the doors and windows in advance and guide the shapes of the doors and windows into a block, the block is directly inserted when the doors and windows are required to be drawn next time, and the operation can lead the doors and windows to be stored into an insert entity in a DXF file.
In a particular embodiment, obtaining the door and window profile comprises the following steps:
s051: traversing all insert entities in the user type graph file in the DXF format to obtain the coordinates of the insertion point of each insert entity, and placing the coordinates of all the insertion points in a door and window list.
S052: and traversing the door and window list and the entity list, and calculating the Euclidean distance between the coordinate of the insertion point and each point in the entity list aiming at the coordinate of each insertion point.
In an exemplary embodiment, the positional relationship of the insertion point coordinates and the wall contour is shown in FIG. 4.
S053: and sequencing all the distances according to the sizes, and connecting the four points with the minimum distance to obtain the door and window profile corresponding to the insertion point.
Preferably, when four points are connected, connection conditions are preset, and the connection conditions are as follows: there is one identity between the two points, either the abscissa or the ordinate. Under the limitation of the condition, 4 points can be connected into a closed rectangle without the condition of diagonal connection.
S06: and outputting a vectorized house-type graph according to the wall body outline and the door and window outline.
Preferably, the user type structure and the size information extracted in the previous steps are transferred and stored into a specific JSON file format, and a vectorized user type graph can be presented on a platform through subsequent rendering, so that the user can carry out personalized decoration.
As shown in fig. 5, fig. 5 is a vectorized house type diagram obtained by combining the extracted wall profile and the window and door profile in an exemplary embodiment.
In order to convert the DXF format file into the image and output uniform line width, the invention also provides a method for adjusting the default line width of BYLAYER through researching the DXF file. In a preferred embodiment, the method for extracting and vectorizing house type graph information based on DXF format further includes:
s07: traversing DXFATTRIBS dictionaries of LINE entities, POLYLINE entities and LWPOLYLINE entities in the DXF-formatted house graph file using a method provided by ezdxf;
s08: and adjusting the values of const _ width, thickness and lineweight to be preset unified values.
Corresponding to the aforementioned method for extracting and vectorizing house pattern information based on DXF format, the present invention further provides an apparatus for extracting and vectorizing house pattern information based on DXF format, as shown in fig. 6, the apparatus 400 includes:
a house type graph file obtaining module 401, configured to obtain a house type graph file in a DXF format to be processed;
a preprocessing module 402, configured to preprocess the DXF formatted house type graph file, and remove axes, characters, and scales from the file;
an entity coordinate information extraction module 403, configured to extract, across layers, coordinate information of an entity for the preprocessed house type graph file in the DXF format;
a wall contour obtaining module 404, configured to obtain a wall contour in the house type graph file according to the coordinate information of the entity;
a door and window profile obtaining module 405, configured to obtain a door and window profile in the house type graph file according to the insertion point coordinate of the insert entity in the house type graph file in the DXF format and the wall coordinate;
and the house type graph output module 406 is configured to output a vectorized house type graph according to the wall profile and the door and window profile.
In other embodiments, the present invention further provides an intelligent device, as shown in fig. 7, including:
at least one memory and at least one processor;
the memory 920 for storing one or more programs;
when executed by the at least one processor 910, the one or more programs cause the at least one processor to perform the steps of any of the methods for extracting and vectorizing house pattern information based on DXF format as previously described.
In other embodiments, the present invention further provides a computer-readable storage medium storing a computer program, which when executed by a processor implements any of the steps of the DXF format-based house pattern information extraction and vectorization method described above.
Compared with the prior art, the DXF format-based house type graph information extraction and vectorization method and device automatically extract the house type structure and size information from the DXF format house type graph, transfer the information into a specific JSON file format, and render the vectorized house type graph on a platform for the user to perform personalized decoration. Meanwhile, the problem of disordered layers in the actual design is solved, the method of extracting the DXF file across the layers is adopted, the ezdxf library provided by python is used for extracting coordinate information required by vectorization in the DXF file, the extracted information is stored by the NetworkX, the house type structure is redrawn in the drawing board, and the vectorization of the DXF house type diagram is completed.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is specific and detailed, but not to be understood as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention.

Claims (10)

1. A method for extracting and vectorizing house type graph information based on DXF format is characterized by comprising the following steps:
acquiring a user type graph file in a DXF format to be processed;
preprocessing the house type graph file in the DXF format, and removing axes, characters and scales in the file;
extracting coordinate information of an entity across layers aiming at the preprocessed house type graph files in the DXF format;
obtaining a wall body outline in the house type graph file according to the coordinate information of the entity;
according to the coordinates of the insertion point of the insert entity in the DXF format house type graph file and the coordinates of the wall body, obtaining a door and window outline in the house type graph file;
and outputting a vectorized house-type graph according to the wall body outline and the door and window outline.
2. The DXF format-based house pattern information extraction and vectorization method of claim 1, wherein the extracting the coordinate information of the entity across layers comprises:
traversing the preprocessed entity segment of the user type graph file in the DXF format to obtain the entity; wherein the entities include a LINE entity, a POLYLINE entity and LWPOLYLINE;
extracting coordinates of all points of each entity aiming at each entity, and storing the coordinates into an entity list;
removing the duplicate of the entity list, and distributing nodes according to the length of the list after the duplicate removal;
numbering each node, establishing a mapping relation between the node number and the coordinate, and adding the node into the drawing board;
obtaining the serial numbers of the nodes through the coordinate values, and storing the serial numbers of the two points on each edge into a nested list edges;
lines are drawn by drawing _ network _ edges () connecting points on the graph.
3. The method of claim 2, wherein obtaining the wall contour in the house layout file according to the coordinate information of the entity comprises:
storing the extracted coordinate information of the entity into a drawing board of NetworkX;
finding a closed region by using a findcycle () function provided by a NetworkX library;
deleting the points and edges of the closed area in the drawing board every time one closed area is obtained;
repeatedly searching for a closed area and deleting points and edges of the closed area until no closed area exists in the drawing board;
and obtaining the wall body outline according to all the closed areas.
4. The method of claim 2, wherein obtaining the door and window profile of the house type graph file according to the insertion point coordinates and the wall coordinates of an insert entity in the house type graph file in the DXF format comprises:
traversing all insert entities in the user type graph file in the DXF format to obtain the coordinates of the insertion point of each insert entity, and placing the coordinates of all the insertion points in a door and window list;
traversing the door and window list and the entity list, and calculating Euclidean distance between the coordinate of the insertion point and each point in the entity list aiming at the coordinate of each insertion point;
and sequencing all the distances according to the sizes, and connecting the four points with the minimum distance to obtain the door and window profile corresponding to the insertion point.
5. The DXF format-based family graph information extraction and vectorization method of claim 4, wherein the minimum distance of four points is connected, comprising:
setting connection conditions, wherein the connection conditions are as follows: between two points, there is one in the abscissa or ordinate.
6. The method of claim 1, wherein preprocessing the DXF layout file to remove axes, text and scales from the file comprises:
traversing the user type graph file in the DXF format, and deleting lines of which the line type is not the default line type BYLAYER to obtain the user type graph file with the axis removed;
deleting the TEXT entity and the MTEXT entity to obtain a user type graph file with characters removed;
deleting the DIMENSION entity to obtain the house type graph file with the scale removed.
7. The DXF format-based family graph information extraction and vectorization method of claim 1, further comprising the steps of:
traversing DXFATTRIBS dictionaries of LINE entities, POLYLINE entities and LWPOLYLINE entities in the DXF-formatted house graph file using a method provided by ezdxf;
and adjusting the values of const _ width, thickness and lineweight to be preset unified values.
8. A device for extracting and vectorizing house pattern information based on DXF format is characterized by comprising:
the family type graph file acquisition module is used for acquiring a family type graph file in a DXF format to be processed;
the preprocessing module is used for preprocessing the house type graph file in the DXF format and removing axes, characters and scales in the file;
the entity coordinate information extraction module is used for extracting entity coordinate information across layers aiming at the preprocessed house type graph files in the DXF format;
the wall contour acquisition module is used for acquiring a wall contour in the house type graph file according to the coordinate information of the entity;
the door and window contour acquisition module is used for acquiring a door and window contour in the house type graph file according to the coordinates of the insertion point of the insert entity in the house type graph file in the DXF format and the coordinates of the wall body;
and the house-type graph output module is used for outputting the vectorized house-type graph according to the wall outline and the door and window outline.
9. A smart device, comprising:
at least one memory and at least one processor;
the memory for storing one or more programs;
when executed by the at least one processor, the one or more programs cause the at least one processor to perform the steps of a DXF format based user profile information extraction and vectorization method of any of claims 1-7.
10. A computer-readable storage medium characterized by:
the computer readable storage medium stores a computer program which, when executed by a processor, implements the steps of a DXF format based user pattern information extraction and vectorization method of any of claims 1-7.
CN202111396607.2A 2021-11-23 2021-11-23 dXF format-based house type graph information extraction and vectorization method and device Pending CN114092952A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111396607.2A CN114092952A (en) 2021-11-23 2021-11-23 dXF format-based house type graph information extraction and vectorization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111396607.2A CN114092952A (en) 2021-11-23 2021-11-23 dXF format-based house type graph information extraction and vectorization method and device

Publications (1)

Publication Number Publication Date
CN114092952A true CN114092952A (en) 2022-02-25

Family

ID=80303409

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111396607.2A Pending CN114092952A (en) 2021-11-23 2021-11-23 dXF format-based house type graph information extraction and vectorization method and device

Country Status (1)

Country Link
CN (1) CN114092952A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114820873A (en) * 2022-05-13 2022-07-29 南京大学 Sketch regularization method, device and medium based on coloring

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114820873A (en) * 2022-05-13 2022-07-29 南京大学 Sketch regularization method, device and medium based on coloring
CN114820873B (en) * 2022-05-13 2023-04-07 南京大学 Sketch regularization method, device and medium based on painting

Similar Documents

Publication Publication Date Title
WO2012071688A1 (en) Method for analyzing 3d model shape based on perceptual information
CN110443239A (en) The recognition methods of character image and its device
CN115661374B (en) Rapid retrieval method based on space division and model voxelization
CN106844610A (en) A kind of distributed structured three-dimensional point cloud image processing method and system
CN114092952A (en) dXF format-based house type graph information extraction and vectorization method and device
CN111178083A (en) Semantic matching method and device for BIM and GIS
Shin et al. Data enhancement for sharing of ship design models
CN114399784A (en) Automatic identification method and device based on CAD drawing
CN111008429B (en) Heterogeneous CAD geometric consistency comparison method based on point cloud
CN115330971B (en) Geometric model lightweight method oriented to rendering performance optimization
CN111915720A (en) Automatic conversion method from building Mesh model to CityGML model
CN116798028A (en) Automatic dimension marking method for three-dimensional part
CN116152451A (en) Multidimensional parameterized city information model construction method, system and computer equipment
CN115481268A (en) Parallel line wall data identification method, device, equipment and storage medium
CN111199086A (en) Three-dimensional geometric discretization processing system
Cao et al. Gaussian-curvature-derived invariants for isometry
CN113901540A (en) Door and window surface building drawing type and door and window automatic identification method
CN112991529B (en) Partition algorithm for meshing map by utilizing triangle
CN111125825B (en) Ancient wood building heritage intelligent modeling method and device
CN114491841A (en) Machining feature recognition method based on NX secondary development and graph neural network
Vasin et al. Geometric modeling of raster images of documents with weakly formalized description of objects
CN112395834A (en) Brain graph generation method, device and equipment based on picture input and storage medium
KR102596257B1 (en) Method for recognizing machining feature and computing device for executing the method
Lu et al. Knowledge extraction from structured engineering drawings
CN113986232A (en) River channel section data automatic identification conversion and cleaning method based on computer

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