Subspace three-dimensional model generation method and device based on CAD drawing, medium and equipment
By extracting and analyzing the vector information of architectural elements from CAD drawings, conducting connected domain analysis, and generating a three-dimensional model of each subspace, it solves the problem of being unable to independently display architectural subspaces in the existing technology, and achieves a more flexible and sophisticated architecture. Model display.
Patent Information
- Application Number
- CN202411920068.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-12-25
AI Technical Summary
The prior art is difficult to extract and generate three-dimensional models of a single room or subspace from CAD drawings of a whole floor or a whole building, and cannot meet the independent display needs of a three-dimensional model of a subspace.
By obtaining the vector information of the target layer in the CAD drawing, including the straight lines and arc information of the wall, door, window, and structure column, draw images containing all components, and perform connecting domain analysis to obtain the connected domain information of each sub -space , Finally generate the three -dimensional model of each sub -space.
The independent three -dimensional model generation of each sub -space in the building model is realized, and the problem of unable to display the sub -space cannot be displayed independently, making the display of the building model more flexible and fine.
Smart Images

Figure CN119359958A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of three-dimensional model reconstruction, and in particular to a method, device, medium and equipment for generating a subspace three-dimensional model based on a CAD drawing. Background Art
[0002] The 3D model of an entire floor or an entire building can usually be reconstructed based on the CAD drawings. However, for some application scenarios that require a detailed display of a 3D model of a subspace, such as just displaying the 3D model of a certain room, these 3D models of the entire floor or the entire building cannot be realized. Summary of the invention
[0003] The purpose of the present invention is to overcome the deficiencies in the prior art and provide a method, device, medium and equipment for generating a subspace three-dimensional model based on a CAD drawing. To achieve the above purpose, the present invention is implemented by adopting the following technical solutions: In a first aspect, the present invention provides a method for generating a subspace three-dimensional model based on a CAD drawing, comprising: Obtaining vector information of a target layer in a CAD drawing, wherein the target layer includes a wall layer, a door layer, a window layer, and a structural column layer, and the vector information includes straight line information and arc information; Draw an image including all components according to the vector information, wherein the components include walls, doors, windows, and structural columns; Performing a connected domain analysis on the image containing all components to obtain connected domain information corresponding to each subspace; A three-dimensional model of each subspace is generated according to the connected domain information.
[0004] In combination with the first aspect, optionally, the drawing according to the vector information to obtain an image including all components, the components including walls, doors, windows, and structural columns, includes: Initialize a blank image; According to the straight line information in the vector information, a straight line is drawn in the blank image to obtain a straight line image; According to the arc information in the vector information, the radius of the arc is drawn in the straight line image to obtain the image containing all the elements.
[0005] In combination with the first aspect, optionally, drawing a straight line in the blank image according to the straight line information in the vector information includes: Obtaining the maximum rectangular bounding box information of the set composed of all straight lines, wherein the bounding box information includes the minimum x coordinate, the minimum y coordinate, the length in the x direction, and the length in the y direction; Subtract the x-coordinates of all the straight line endpoints from the minimum x-coordinate to obtain the x-coordinates of the endpoints after translation, and subtract the y-coordinates of all the straight line endpoints from the minimum y-coordinate to obtain the y-coordinates of the endpoints after translation; Determine the ratio of the maximum value of the length in the x direction and the length in the y direction to the maximum pixel value of the blank image as the scaling value; According to the scaling ratio value, the coordinates of the two endpoints of the translated straight line are scaled to obtain the scaled straight line endpoint coordinates; A straight line is drawn in the blank image according to the zoomed straight line endpoint coordinates.
[0006] In combination with the first aspect, optionally, the connected domain information includes area information and edge information.
[0007] In combination with the first aspect, optionally, generating a three-dimensional model of each subspace according to the connected domain information includes: Screening the connected domain information, wherein the connected domain information has area information greater than a first threshold, and determining the connected domain as a valid connected domain; Acquire contour coordinate information of each valid connected domain according to edge information in the connected domain information; Convert the outline coordinate information into corresponding outline coordinate information in the CAD drawing; Obtaining all component information in the CAD drawing that is located within the corresponding contour coordinates in the CAD drawing, wherein the components include walls, doors, windows, and structural columns; According to the component information, a three-dimensional model corresponding to each component is generated and combined into a current subspace three-dimensional model.
[0008] In combination with the first aspect, optionally, acquiring contour coordinate information of each valid connected domain according to edge information in the connected domain information includes: Starting from any edge point p0 in the edge, find two edge points p1 and p2 in the clockwise direction; Calculate the first slope of the straight line determined by p1 and p0 and the second slope of the straight line determined by p2 and p1; comparing the first slope and the second slope, and if the absolute value of the difference between the first slope and the second slope is greater than a first threshold, determining the point p1 as a contour point; The above steps are repeated until all edge points are determined as the starting point p0, and all contour points are merged into the contour coordinate information of the effective connected domain.
[0009] In a second aspect, the present invention provides a subspace three-dimensional model generation device based on a CAD drawing, comprising: A vector information acquisition module, which acquires vector information of a target layer in a CAD drawing, wherein the target layer includes a wall layer, a door layer, a window layer, and a structural column layer, and the vector information includes straight line information and arc information; An image drawing module, which draws an image including all components according to the vector information, wherein the components include walls, doors, windows, and structural columns; A connected domain analysis module performs connected domain analysis on the image containing all components to obtain connected domain information corresponding to each subspace; The subspace model generation module generates a three-dimensional model of each subspace according to the connected domain information.
[0010] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for generating a subspace three-dimensional model based on a CAD drawing as described in any one of the first aspects.
[0011] In a fourth aspect, the present invention provides a device, comprising: A memory for storing instructions; A processor is used to execute the instructions so that the device performs operations to implement the subspace three-dimensional model generation method based on CAD drawings as described in any one of the first aspects.
[0012] Compared with the prior art, the method, device, medium and equipment for generating a subspace three-dimensional model based on a CAD drawing provided by the embodiment of the present invention have the following beneficial effects: The present invention obtains vector information of a target layer in a CAD drawing, wherein the target layer includes a wall layer, a door layer, a window layer, and a structural column layer, and the vector information includes straight line information and arc information; an image including all components is drawn according to the vector information, wherein the components include walls, doors, windows, and structural columns; a connected domain analysis is performed on the image including all components to obtain the connected domain information corresponding to each subspace; and a three-dimensional model of each subspace is generated according to the connected domain information. The present invention effectively solves the problem that each subspace cannot be independently displayed in the visualization of the building model, making the display of the building model more flexible. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 A flowchart of a method for generating a subspace three-dimensional model based on a CAD drawing is provided in Example 1 of the present invention. DETAILED DESCRIPTION
[0014] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of this embodiment can be combined with each other. The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0015] Embodiment 1: Figure 1 As shown, an embodiment of the present invention provides a method for generating a subspace three-dimensional model based on a CAD drawing, comprising: S1: Obtaining vector information of a target layer in a CAD drawing, wherein the target layer includes a wall layer, a door layer, a window layer, and a structural column layer, and the vector information includes straight line information and arc information; S2: Draw an image containing all components according to the vector information, wherein the components include walls, doors, windows, and structural columns; Specifically, the drawing according to the vector information obtains an image containing all components, wherein the components include walls, doors, windows, and structural columns, including: S2-1: Initialize a blank image; S2-2: drawing a straight line in the blank image according to the straight line information in the vector information to obtain a straight line image; Specifically, drawing a straight line in the blank image according to the straight line information in the vector information includes: S2-2-1: Obtain the maximum rectangular bounding box information of the set composed of all straight lines, wherein the bounding box information includes the minimum x coordinate, the minimum y coordinate, the length in the x direction, and the length in the y direction; S2-2-2: Subtract the x-coordinates of all the straight line endpoints from the minimum x-coordinate to obtain the x-coordinates of the endpoints after translation, and subtract the y-coordinates of all the straight line endpoints from the minimum y-coordinate to obtain the y-coordinates of the endpoints after translation; S2-2-3: Determine the ratio of the maximum value of the length in the x direction and the length in the y direction to the maximum pixel value of the blank image as the scaling value; S2-2-4: scaling the coordinates of the two endpoints of the translated straight line according to the scaling ratio value to obtain the coordinates of the endpoints of the scaled straight line; S2-2-5: Draw a straight line in the blank image according to the coordinates of the endpoints of the scaled straight line.
[0016] S2-3: According to the arc information in the vector information, draw the radius of the arc in the straight line image to obtain the image containing all the elements.
[0017] S3: Performing a connected domain analysis on the image containing all components to obtain connected domain information corresponding to each subspace; S4: Generate a three-dimensional model of each subspace according to the connected domain information.
[0018] Specifically, generating a three-dimensional model of each subspace according to the connected domain information includes: S4-1: screening the connected domains whose area information is greater than a first threshold in the connected domain information, and determining them as valid connected domains; S4-2: Obtaining contour coordinate information of each valid connected domain according to edge information in the connected domain information; Specifically, the step of acquiring the contour coordinate information of each valid connected domain according to the edge information in the connected domain information includes: S4-2-1: Starting from any edge point p0 in the edge, find two edge points p1 and p2 in the clockwise direction; S4-2-2: Calculate the first slope of the straight line determined by p1 and p0 and the second slope of the straight line determined by p2 and p1; S4-2-3: comparing the first slope and the second slope, and if the absolute value of the difference between the first slope and the second slope is greater than a first threshold, determining point p1 as a contour point; S4-2-4: Repeat the above steps until all edge points are determined as the starting point p0, and merge all contour points into the contour coordinate information of the effective connected domain.
[0019] S4-3: Convert the outline coordinate information into corresponding outline coordinate information in the CAD drawing; S4-4: Acquire all component information in the CAD drawing that is located within the corresponding contour coordinates in the CAD drawing, wherein the components include walls, doors, windows, and structural columns; S4-5: Generate a three-dimensional model corresponding to each component according to the component information, and combine them into a current subspace three-dimensional model.
[0020] The subspace three-dimensional model generation method based on CAD drawings provided by the present invention effectively solves the problem that each subspace cannot be independently displayed in the visualization of the building model, making the display of the building model more flexible.
[0021] Embodiment 2: The embodiment of the present invention provides a subspace three-dimensional model generation device based on a CAD drawing, comprising: A vector information acquisition module, which acquires vector information of a target layer in a CAD drawing, wherein the target layer includes a wall layer, a door layer, a window layer, and a structural column layer, and the vector information includes straight line information and arc information; An image drawing module, which draws an image including all components according to the vector information, wherein the components include walls, doors, windows, and structural columns; A connected domain analysis module performs connected domain analysis on the image containing all components to obtain connected domain information corresponding to each subspace; The subspace model generation module generates a three-dimensional model of each subspace according to the connected domain information.
[0022] The subspace three-dimensional model generating device based on CAD drawings provided by the present invention effectively solves the problem that each subspace cannot be independently displayed in the visualization of the building model, making the display of the building model more flexible.
[0023] Embodiment 3: The embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, a method for generating a subspace three-dimensional model based on a CAD drawing as described in Embodiment 1 is implemented.
[0024] Embodiment 4: The embodiment of the present invention provides a device, including: A memory for storing instructions; The processor is used to execute the instruction so that the device performs the operation of implementing the subspace three-dimensional model generation method based on CAD drawings as described in any one of the embodiments.
[0025] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0026] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0027] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0028] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0029] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for generating a subspace three-dimensional model based on a CAD drawing, characterized in that: include: Obtaining vector information of a target layer in a CAD drawing, wherein the target layer includes a wall layer, a door layer, a window layer, and a structural column layer, and the vector information includes straight line information and arc information; Draw an image including all components according to the vector information, wherein the components include walls, doors, windows, and structural columns; Performing a connected domain analysis on the image containing all components to obtain connected domain information corresponding to each subspace; A three-dimensional model of each subspace is generated according to the connected domain information.
2. The method for generating a subspace three-dimensional model based on a CAD drawing according to claim 1, characterized in that: The step of obtaining an image including all components according to the vector information, wherein the components include walls, doors, windows, and structural columns, includes: Initialize a blank image; According to the straight line information in the vector information, a straight line is drawn in the blank image to obtain a straight line image; According to the arc information in the vector information, the radius of the arc is drawn in the straight line image to obtain the image containing all the elements.
3. The method for generating a subspace three-dimensional model based on a CAD drawing according to claim 2, characterized in that: Drawing a straight line in the blank image according to the straight line information in the vector information includes: Obtaining the maximum rectangular bounding box information of the set composed of all straight lines, wherein the bounding box information includes the minimum x coordinate, the minimum y coordinate, the length in the x direction, and the length in the y direction; Subtract the x-coordinates of all the straight line endpoints from the minimum x-coordinate to obtain the x-coordinates of the endpoints after translation, and subtract the y-coordinates of all the straight line endpoints from the minimum y-coordinate to obtain the y-coordinates of the endpoints after translation; Determine the ratio of the maximum value of the length in the x direction and the length in the y direction to the maximum pixel value of the blank image as the scaling value; According to the scaling ratio value, the coordinates of the two endpoints of the translated straight line are scaled to obtain the scaled straight line endpoint coordinates; A straight line is drawn in the blank image according to the zoomed straight line endpoint coordinates.
4. The method for generating a subspace three-dimensional model based on a CAD drawing according to claim 1, characterized in that: The connected domain information includes area information and edge information.
5. The method for generating a subspace three-dimensional model based on a CAD drawing according to claim 1, characterized in that: Generating a three-dimensional model of each subspace according to the connected domain information includes: Screening the connected domain information, wherein the connected domain information has area information greater than a first threshold, and determining the connected domain as a valid connected domain; Acquire contour coordinate information of each valid connected domain according to edge information in the connected domain information; Convert the outline coordinate information into corresponding outline coordinate information in the CAD drawing; Obtaining all component information in the CAD drawing that is located within the corresponding contour coordinates in the CAD drawing, wherein the components include walls, doors, windows, and structural columns; According to the component information, a three-dimensional model corresponding to each component is generated and combined into a current subspace three-dimensional model.
6. The method for generating a subspace three-dimensional model based on a CAD drawing according to claim 5, characterized in that: The step of obtaining the contour coordinate information of each valid connected domain according to the edge information in the connected domain information includes: Starting from any edge point p0 in the edge, find two edge points p1 and p2 in the clockwise direction; Calculate the first slope of the straight line determined by p1 and p0 and the second slope of the straight line determined by p2 and p1; comparing the first slope and the second slope, and if the absolute value of the difference between the first slope and the second slope is greater than a first threshold, determining the point p1 as a contour point; The above steps are repeated until all edge points are determined as the starting point p0, and all contour points are merged into the contour coordinate information of the effective connected domain.
7. A subspace three-dimensional model generation device based on CAD drawings, characterized in that: include: A vector information acquisition module, which acquires vector information of a target layer in a CAD drawing, wherein the target layer includes a wall layer, a door layer, a window layer, and a structural column layer, and the vector information includes straight line information and arc information; An image drawing module, which draws an image including all components according to the vector information, wherein the components include walls, doors, windows, and structural columns; A connected domain analysis module performs connected domain analysis on the image containing all components to obtain connected domain information corresponding to each subspace; The subspace model generation module generates a three-dimensional model of each subspace according to the connected domain information.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating a subspace three-dimensional model based on a CAD drawing as described in any one of claims 1 to 6 is implemented.
9. A device, characterized in that: include: A memory for storing instructions; A processor is used to execute the instruction so that the device performs the operation of implementing the subspace three-dimensional model generation method based on CAD drawings as described in any one of claims 1-6.
Citation Information
Patent Citations
Method for rapidly generating three-dimensional building model based on two-dimensional CAD drawings
CN108597026A
A three-dimensional rapid modeling system and method based on a building two-dimensional CAD drawing
CN109710963A
Plane space contour skeleton line extraction method
CN113963369A
Model generation method and device, computer equipment and storage medium
CN113971309A
Method for accurately identifying stair anterior chamber in CAD drawing
CN114022894A
