An automated construction method and system based on CAD data
Patent Information
- Application Number
- CN202611273354.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-21
- Publication Date
- 2026-09-25
AI Technical Summary
[0008]本发明的目的在于提供一种基于CAD数据的自动化构建方法及系统,解决的问题:解决轮廓失真、坐标漂移、视觉同质化及网格不可用的问题,显著提高城市级三维建筑模型的自动化生成效率与真实感;具体方案如下:
本发明在解析精度、空间对齐、视觉逻辑、网格可用性及工程效率方面具有显著进步:
Smart Images

Figure CN122821050A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer graphics processing, and specifically discloses an automated construction method and system based on CAD data. Background Technology
[0002] City Information Modeling (CIM) and digital twin systems rely on high-precision 3D building data. CAD drawings, as the standard carrier for architectural design delivery, contain accurate planar contours and elevation information. 3D engines, with their powerful real-time rendering, physical calculation, and cross-platform deployment capabilities, have become the mainstream carrier for visualizing 3D city scenes. Automating the conversion of CAD data into 3D meshes usable by 3D engines is a core step in shortening the digital city construction cycle and reducing the cost of manual modeling.
[0003] One existing technique involves manually reading CAD drawings, reconstructing them in 3D software, and then importing them into a 3D engine. While this manual import method is precise, it is extremely inefficient and cannot handle large-scale data.
[0004] Another existing technology utilizes GIS or BIM data for import via intermediate formats (e.g., FBX, IFC). However, conversion using GIS or BIM typically requires expensive middleware and is not suitable for scenarios where only CAD drawings are available.
[0005] Another existing technology attempts to directly read CAD wireframes and stretch them. However, simple procedural generation techniques typically only generate simple geometry and assign the same materials to all buildings, resulting in the final scene looking like a collection of replicas, lacking realism.
[0006] The aforementioned existing technologies have at least the following drawbacks: First, CAD geometric analysis lacks a topology reconstruction mechanism, and the curvature continuity is lost after the discretization of polylines and spline curves, resulting in jagged or misaligned building outlines; Second, the conversion from geographic coordinates to 3D engine world coordinates lacks a scale and offset compensation model, and floating-point precision loss and position drift are prone to occur in long-distance scenes; Third, the classification of building types and texture allocation are highly random, and no height-style probability mapping model has been established, resulting in chaotic visual logic of urban skylines and a lack of regional adaptability; Fourth, mesh generation lacks manifold verification and automatic bottom sealing and normal correction logic, and manual repair is often required after export, resulting in low engineering conversion efficiency.
[0007] In view of this, the present invention provides an automated construction method and system based on CAD data. By performing topological normalization analysis of CAD data, lossless coordinate mapping between geospatial data and 3D engine scene, intelligent style selection based on building height, and parametric extrusion and closed-loop verification within the 3D engine, it can directly parse CAD data to generate urban building models, achieving efficient, low-cost, and visually rich urban 3D scene construction. Summary of the Invention
[0008] The purpose of this invention is to provide an automated construction method and system based on CAD data, addressing issues such as contour distortion, coordinate drift, visual homogenization, and unusable meshes, thereby significantly improving the efficiency and realism of automated generation of city-level 3D building models. The specific solution is as follows: An automated construction method based on CAD data includes: Step 1: Performing geometric entity analysis and topological reconstruction on the CAD file to obtain a normalized building base polygon, and extracting elevation data from the CAD file; Step 2: Mapping the normalized building base polygon to the local world coordinate system of a 3D engine to obtain a located building base; Step 3: Determining the building height based on the elevation data, and layering the building height according to a height threshold to obtain a building type; Step 4: Assigning materials to different parts of the building based on the building height and the building type using a height-style conditional probability model to obtain material combinations; the material combinations include top material, middle material, and bottom material; Step 5: Extruding the located building base along the height direction in segments according to the building height, and binding materials to each segment according to the material combinations to obtain a segmented extruded mesh; Step 6: Stitching and sealing the segmented extruded mesh to obtain a 3D mesh; Step 7: Performing manifold closure verification on the 3D mesh, and correcting the 3D mesh if the verification fails to pass, to obtain a closed 3D mesh model.
[0009] Further, step 1 includes: Step 11: Parsing the binary stream of the CAD file, traversing the entity tree, and extracting geometric elements; the geometric elements include point sets, line segments, polylines, arcs, and spline curves; Step 12: Constructing a graph topology based on the geometric elements, determining closed loops through closed-loop search, and performing curve fitting and resampling on the closed loops to obtain the building outline polygon; Step 13: Calculating the centroid of the building outline polygon, and translating the building outline polygon to the local coordinate origin based on the centroid to obtain the normalized building base polygon.
[0010] Furthermore, step 2 includes: step 21: converting the geographic coordinates corresponding to the normalized building base polygon into planar coordinates through projection transformation and local tangent plane transformation; step 22: mapping the planar coordinates into the local world coordinates of the 3D engine to obtain the located building base.
[0011] Furthermore, the transformation matrix that maps the planar coordinates to the local world coordinates of the 3D engine is: ; in, S represents local world coordinates; S is the scaling factor. This is the rotation matrix for axial correction; These are the planar coordinates obtained through projection transformation and local tangent plane transformation; The origin of the projection; Offset the scene anchor point; These are the geospatial coordinates from the GIS side. These are the scene coordinates on the 3D engine side.
[0012] Furthermore, determining the building height based on the elevation data includes: when the elevation data is valid, using the elevation data as the building height; when the elevation data is missing or abnormal, generating the building height based on the planned average height, height standard deviation, and random factor of the land where the building is located. ; in, The height of the generated building; The planned average height of the plot where the building is located; The standard deviation of the building's height; It follows a standard normal distribution; It is a random factor.
[0013] Furthermore, the building types include high-rise, multi-story, and low-rise; the step of stratifying the building height according to a height threshold includes: when the building height is greater than or equal to a first height threshold, the building type is determined to be high-rise; when the building height is greater than or equal to a second height threshold and less than the first height threshold, the building type is determined to be multi-story; when the first height threshold is greater than the second height threshold and the building height is less than the second height threshold, the building type is determined to be low-rise.
[0014] Further, step 4 includes: Step 41: Constructing a style library; the style library includes three sets of material identifiers corresponding to the top material, the middle material, and the bottom material respectively; Step 42: Calculating the allocation weights of the top material, the middle material, and the bottom material based on the height-style conditional probability model; the allocation weights are related to the building height and the plot density of the building site; Step 43: Performing probability sampling according to the allocation weights, selecting materials from the three sets of material identifiers respectively, and combining them to obtain the material combination.
[0015] Furthermore, step 5 includes: dividing the positioned building base into three segments—bottom, middle, and top—along the height direction according to a first ratio, a second ratio, and a third ratio, and binding the bottom material, middle material, and top material from the material combination to the bottom, middle, and top segments respectively, to obtain a segmented extruded mesh.
[0016] Furthermore, step 7 includes: Step 71: Calculating the Eulerian characteristic number of the three-dimensional mesh: ;in, |V| is the Euler characteristic number; |E| is the number of vertices in the 3D mesh; |F| is the number of edges in the 3D mesh; Step 72: When the Euler characteristic number is not equal to 2, or when the 3D mesh has a normal flip, the 3D mesh is triangulated and recalculated to obtain a closed 3D mesh model.
[0017] An automated construction system based on CAD data, employing any of the aforementioned automated construction methods based on CAD data, includes a geometry analysis module, a coordinate mapping module, a height classification module, a style assignment module, a mesh generation module, and a verification output module. The geometry analysis module performs geometric entity analysis and topological reconstruction on the CAD file to obtain a normalized building base polygon and extracts elevation data from the CAD file. The coordinate mapping module maps the normalized building base polygon to the local world coordinate system of the 3D engine to obtain the located building base. The height classification module determines the building height based on the elevation data and classifies the building height according to a height threshold. The building is layered to obtain the building type. The style assignment module is used to assign materials to different parts of the building based on the building height and the building type, using a height-style conditional probability model, to obtain material combinations. The material combinations include top material, middle material, and bottom material. The mesh generation module is used to extrude the positioned building base along the height direction in segments according to the building height, and bind materials to each segment according to the material combinations to obtain a segmented extruded mesh. The segmented extruded mesh is stitched and sealed to obtain a three-dimensional mesh. The verification output module is used to perform manifold closure verification on the three-dimensional mesh, and correct the three-dimensional mesh if the verification fails to pass, to obtain a closed three-dimensional mesh model.
[0018] The present invention has the following advantages and beneficial effects: This invention represents a significant improvement in resolution accuracy, spatial alignment, visual logic, mesh availability, and engineering efficiency. In terms of geometric analysis, traditional methods rely on manual cleaning or simple wireframe reading, which can easily lead to breakage and distortion of complex drawings. This invention achieves automated high-precision restoration through topology reconstruction and curve fitting algorithms, ensuring the geometric fidelity of the model from the source and significantly reducing data cleaning costs.
[0019] In terms of spatial alignment, existing cross-coordinate transformations accumulate significant errors in large-scale scenarios, often leading to building misalignment. This invention employs a dynamic compensation mapping model to avoid floating-point drift, achieving sub-meter level precise alignment in kilometer-level digital city scenarios and providing a reliable spatial benchmark for multi-source data fusion.
[0020] In terms of visual construction, existing procedural generation methods mostly use random textures, resulting in homogeneous appearances and violating architectural principles. The style decision-making mechanism of this invention, which links height and density, ensures that the building facade strictly follows the logic of urban typology, significantly enhancing the realism of the scene and visual diversity.
[0021] In engineering applications, this invention reduces the construction time of a single building from several hours to seconds, supports strong data correlation and one-click hot updates, completely replaces manual modeling and expensive commercial middleware, significantly reduces the construction cost and manpower dependence of digital city and digital twin projects, and has the value of large-scale implementation. Attached Figure Description
[0022] Figure 1 An exemplary flowchart of an automated construction method based on CAD data provided by the present invention; Figure 2 These are renderings of three-dimensional architectural models generated from input CAD raw data samples in some embodiments of the present invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0024] The present invention provides an automated construction method and system based on CAD data that can directly parse CAD data to generate urban building models, and achieve efficient, low-cost and visually rich urban 3D scene construction through intelligent building classification and random mapping technology.
[0025] In the embodiments of this application, a 3D engine refers to a software engine used for real-time rendering, physical calculation, and deployment of 3D scenes. For example, the Unity engine, Unreal Engine, or other engines that support mesh rendering and material mapping; in urban scene visualization, the Unity engine is preferred. A local world coordinate system refers to the coordinate system used within the 3D engine to organize scene objects. For example, a left-handed coordinate system in the Unity engine where the X-axis is to the right, the Y-axis is up, and the Z-axis is forward.
[0026] Figure 1 This is an exemplary flowchart of an automated construction method based on CAD data provided by the present invention. Figure 1 As shown, the automated construction method based on CAD data provided by this invention includes, in sequence, CAD file import, geometric entity analysis and topology reconstruction, spatial coordinate mapping, height determination and type classification, intelligent style map allocation, 3D mesh extrusion and stitching, and closure verification and output, specifically including the following steps: Step 1: Perform geometric entity analysis and topological reconstruction on the CAD file to obtain the normalized building base polygon, and extract the elevation data from the CAD file. The normalized building base polygon refers to the building base outline polygon with the local coordinate origin as its centroid. Elevation data is used to represent the building elevation. For example, the elevation field in the CAD layer properties.
[0027] For CAD data parsing and topology reconstruction. In some embodiments, step 1 includes steps 11 to 13. Step 11: Parse the binary stream of the CAD file (e.g., DWG or DXF file) using a low-level graphics library (e.g., OpenDesign Alliance Teigha), traverse the entity tree, and extract geometric elements. The entity tree refers to the data structure of geometric entities organized hierarchically in the CAD file. Geometric elements refer to the basic geometric primitives extracted from the CAD file, including point sets, line segments, polylines, arcs, and spline curves. For example, point sets... straight line segment Polyline arc spline curve .
[0028] Step 12: Construct a graph topology based on the geometric elements, determine closed loops through closed-loop search, and perform curve fitting and resampling on the closed loops to obtain the building outline polygon. Graph topology refers to a graph constructed using the endpoints and curve control points of geometric elements as vertices V and the original geometric connections as edges E. Loop closure search refers to the operation of searching for all possible closed loops in the graph topology. For example, the depth-first search (DFS) algorithm is used to find closed loops. A closed loop is a sequence of edges that are connected end-to-end and form a closed region. Curve fitting and resampling refers to the operation of converting a closed loop into a continuous parametric curve and resampling it into a vertex sequence at uniform intervals. For example, B-spline fitting is used to convert a closed loop into a continuous parametric curve and then resampling it into a uniform vertex sequence. Building outline polygons are polygons used to represent the outer contour of a building's base. .
[0029] Step 13: Calculate the centroid of the building outline polygon, and translate the building outline polygon to the local coordinate origin based on the centroid to obtain the normalized building base polygon. In some embodiments, the normalized building base polygon is obtained through outline normalization; the outline normalization is as follows: ; ; in, N represents the normalized building base polygon; N is the total number of vertices of the building outline polygon; i is the vertex index, ranging from 1 to N. Let be the coordinates of the i-th vertex of the building outline polygon; The centroid is the center of gravity of the building outline polygon; Centroid() is a function to find the centroid of the polygon. The building outline is a polygon.
[0030] In some embodiments, step 1 further includes: for a building with holes (e.g., a ring-shaped building), detecting the inner loop corresponding to the hole based on the inclusion relationship of the bounding box, and storing the inner loop as a sub-polygon of the building's outline polygon. A bounding box is the smallest rectangular frame that exactly contains a loop; an inclusion relationship is the relationship where the bounding box of one loop completely falls inside the bounding box of another loop; an inner loop is a closed loop located inside the outer contour that defines the boundary of the hole.
[0031] At the same time, the elevation field is read from the extended attributes or layers of CAD as elevation data. If it is missing or abnormal, the height supplementation logic in step 3 is then performed.
[0032] Step 2: Map the normalized building base polygon to the local world coordinate system of the 3D engine to obtain the located building base. The located building base refers to the building base polygon located at the corresponding geographical location in the local world coordinate system after coordinate mapping.
[0033] For spatial coordinate mapping, in some embodiments, step 2 includes steps 21 and 22. Step 21: Convert the geographic coordinates corresponding to the normalized building base polygon into planar coordinates through projection transformation and local tangent plane transformation. Geographic coordinates refer to the collected latitude and longitude or projected coordinates. Planar coordinates refer to the northeast-sky coordinates (E, N, U) obtained after projection transformation and local tangent plane transformation. For example, by using the Gauss-Kruger projection to project the original geographic coordinates (λ, φ, h) into planar coordinates (E, N), with the elevation h as the U-axis, the local tangent plane coordinates of the northeast-sky (ENU) are obtained.
[0034] Step 22: Based on the scaling factor, axial correction rotation matrix, projection origin, and scene anchor point offset, map the planar coordinates to the local world coordinates of the 3D engine to obtain the positioned building base. The scaling factor is a scaling coefficient used to unify coordinate units; the axial correction rotation matrix is a rotation matrix used to align the axis of the N / A coordinate system to the axis of the 3D engine's local world coordinate system; the projection origin is the reference point of the planar coordinates. The scene anchor point offset is the offset used to translate the global position in the 3D engine scene. Local world coordinates are the coordinates in the 3D engine's local world coordinate system. In some embodiments, the transformation matrix for mapping the planar coordinates to the 3D engine's local world coordinates is: ; in, S represents local world coordinates; S is the scaling factor. This is the rotation matrix for axial correction; These are the planar coordinates obtained through projection transformation and local tangent plane transformation; The origin of the projection; Offset the scene anchor point; These are the geospatial coordinates from the GIS side. This refers to the scene coordinates on the 3D engine side. This mapping can control geographic coordinate errors to within 0.1m. In some embodiments, the axial correction rotation matrix... This is used to align the X (East), Y (North), and Z (Sky) coordinates of the Northeast-North-South coordinate system to the X (Right), Z (Front), and Y (Top) axes of the 3D engine, i.e.: ; The scale factor S defaults to 1.0. If the projected coordinate system unit is detected to be decimeter or other non-meter system, it will be dynamically adjusted.
[0035] In some embodiments, the method further includes: subtracting the projection origin from the planar coordinates to perform dynamic origin compensation on the geographic coordinates, eliminating floating-point precision drift in long-distance scenes. Dynamic origin compensation refers to converting large absolute geographic coordinates into smaller coordinates relative to the scene origin, using the projection origin as a reference, thereby avoiding position drift caused by insufficient effective bits in floating-point numbers in long-distance scenes. After this conversion, the cumulative positioning error for the entire urban scene is measured to be less than 0.8 meters, achieving sub-meter level spatial alignment.
[0036] Step 3: Determine the building height based on the elevation data, and stratify the building height according to height thresholds to obtain the building type. A height threshold refers to the building height limit value used to classify building types. For example, a first height threshold of 75m is used to classify high-rise buildings from multi-story buildings, and a second height threshold of 15m is used to classify multi-story buildings from low-rise buildings. Building type refers to the category obtained by classifying building height. For example, high-rise, multi-story, and low-rise.
[0037] Regarding height acquisition and building type determination: In some embodiments, step 3, determining the building height based on the elevation data, includes: when the elevation data is valid, using the elevation data as the building height; when the elevation data is missing or abnormal, generating the building height based on the planned average height, height standard deviation, and random factor of the land where the building is located. Valid elevation data refers to the elevation data provided by the CAD file. It exists and is a normal value (e.g., >0); missing or abnormal elevation data indicates that the elevation field is missing or has an abnormal value (e.g., the elevation field is missing or has an abnormal value). ≤0). The planned average height refers to the average building height in the planning data of the land parcel where the building is located. Height standard deviation refers to the standard deviation of the building height on the plot. e; The random factor refers to the random coefficient ξ used to perturb the generated height and ensure a natural transition in the height of the building complex. For example, the value of ξ ranges from (0.5 to 1.5).
[0038] In some embodiments, the building height generated when the elevation data is missing or abnormal is: ; in, The height of the generated building; σ_zone represents the planned average height of the plot where the building is located; σ_zone represents the standard deviation of the height of the plot where the building is located. It follows a standard normal distribution; The random factor is used. This continuous random generation mechanism generates reasonable heights based on regional planning statistical characteristics when CAD elevation data is missing, ensuring a natural transition in building heights.
[0039] In some embodiments, the building type includes high-rise, multi-story, and low-rise; the stratification of the building height based on a height threshold includes: when the building height is greater than or equal to a first height threshold, the building type is determined to be high-rise; when the building height is greater than or equal to a second height threshold and less than the first height threshold, the building type is determined to be multi-story; when the building height is less than the second height threshold, the building type is determined to be low-rise; the first height threshold is greater than the second height threshold. The first height threshold is a height limit used to distinguish between high-rise and multi-story buildings. For example, 75m; the second height threshold is a height limit used to distinguish between multi-story and low-rise buildings. For example, 15m. That is, a stepped classification function is established: ; in, This is a step-type classification function. This classification directly drives the subsequent building volume segmentation logic (base, main body, roof).
[0040] Step 4: Based on the building height and building type, assign materials to different parts of the building using a height-style conditional probability model to obtain material combinations. The height-style conditional probability model is a conditional probability distribution model that uses building height and plot density as independent variables and outputs the weights of material allocation for each part. Material combinations refer to the combinations of materials selected for the top, middle, and bottom of the building, including top material, middle material, and bottom material.
[0041] For highly driven smart building style selection, in some embodiments, step 4 includes steps 41 to 43. Step 41: Construct a style library; the style library includes three sets of material identifiers corresponding to the top material, the middle material, and the bottom material, respectively. Here, the style library refers to a collection storing the selectable materials for each part, which can be represented as a style library matrix: ; in, Style library matrix; This is a collection of material identifiers at the top. This is a collection of material identifiers for the central section. This is a collection of material identifiers at the bottom. Each collection contains candidate material identifiers corresponding to different building types.
[0042] For example, for high-rise buildings: It may include glass curtain walls, metal panels, etc.; It may include glass curtain walls, aluminum panels, etc. It may include materials such as stone and metal. For multi-story buildings: It may include flat roofs, gray tiles, etc.; It may include facing bricks, paint, etc.; It may include granite, antique-style bricks, etc. For low-rise buildings: It may include sloping tile roofs, red tiles, etc.; It may include red bricks, plaster, etc.; It can include cultural stone, rubble, etc. The material identifier set refers to the collection of identifiers (IDs) of selectable materials for a certain part, divided into three groups: top, middle and bottom. For example, predefined low-level material library (red brick, stucco, sloping tile roof), multi-level material library (facing brick, flat roof, simple molding), and high-level material library (glass curtain wall, metal panel, modern roof).
[0043] Step 42: Based on the height-style conditional probability model, calculate the allocation weights for the top material, the middle material, and the bottom material; these allocation weights are related to the building height and the land density of the site. Allocation weight refers to the probability weight of selecting a particular material for a specific location; land density refers to the building density of the site, used to characterize the congestion level of the land. For example, a land density of Density=0.6 indicates medium density.
[0044] Step 43: Perform probability sampling according to the assigned weights, selecting materials from the three sets of material identifiers respectively, and combining them to obtain the material combination. Probability sampling refers to the operation of randomly selecting materials from the set of material identifiers according to the assigned weights of each material. The system combines the top, middle, and bottom materials according to probability sampling, thereby achieving an adaptive appearance that conforms to architectural typology, such as high-rise modern glass curtain walls and low-rise pitched roof brick and stone, and abandoning the homogenization of urban landscapes caused by traditional uniform random mapping.
[0045] In some embodiments, different building types correspond to different sets of material identifiers; wherein, the set of material identifiers corresponding to high-rise buildings includes glass curtain wall material and metal plate material, and the set of material identifiers corresponding to low-rise buildings includes pitched roof material and brick and stone material.
[0046] In some embodiments, the weighting assignment follows a height-style conditional probability model: ; in, Materials are assigned to the parts under the building type Type. The allocation weights; The material assigned to the part; Type is the building type; part is the top, middle, or bottom; exp is the exponential function; H represents the height sensitivity coefficient of a part under the building type (Type), used to control the sensitivity of the material distribution of that part to the building height; H is the building height. is the plot density interference coefficient for part, used to control the degree of interference of plot density on the material allocation of part; Density is the plot density of the plot where the building is located; j is the material variable in the material identifier set corresponding to this part, used to sum all candidate materials for this part for normalization.
[0047] Step 5: Extrude the positioned building base along its height in segments according to the building height, and bind each segment with the specified material combination to obtain a segmented extruded mesh. Segmented extrusion refers to the operation of cutting the building base into multiple segments along its height according to a preset ratio and extruding them separately; the segmented extruded mesh refers to the mesh on the unsealed side of the building.
[0048] For mesh generation within a 3D engine, in some embodiments, step 5 includes: extruding the positioned building base along the height direction into three segments—bottom, middle, and top—according to a first ratio, a second ratio, and a third ratio; and binding the bottom material, middle material, and top material from the material combination to the bottom, middle, and top segments respectively, to obtain a segmented extruded mesh. The first ratio, second ratio, and third ratio refer to the height proportions of the bottom, middle, and top segments along the building height direction, and their sum is 1. For example, the first ratio is 0.15, the second ratio is 0.65, and the third ratio is 0.20, meaning the normalized profile is cut along the height direction into three segments—bottom (base, podium), middle (standard floor), and top (roof, terrace)—according to ratios of 0.15H, 0.65H, and 0.2H.
[0049] In some embodiments, step 5, which involves binding materials to each segment, includes: binding physically based rendering (PBR) materials to each segment and generating UV coordinates for each segment; wherein, the side surfaces of the segment generate UV coordinates using a height-based linear mapping, and the top surface of the segment generates UV coordinates using a planar projection. Physically based rendering (PBR) refers to a rendering method that follows physically based lighting principles, supporting PBR texture mapping and normal mapping; UV coordinates refer to the two-dimensional coordinates on the texture image during texture mapping; height-based linear mapping refers to the method of generating UV coordinates along the height direction of the segment's side surface in a linear relationship; planar projection refers to the method of mapping the top surface of the segment onto a plane along the projection direction to generate UV coordinates. For example, based on the materials output in step 42, a Standard or URP material sphere from the 3D engine is dynamically bound, and the UVs are adaptively unfolded.
[0050] Step 6: Stitch and seal the segmented extruded mesh to obtain a 3D mesh. Stitching and sealing refer to the operation of splicing the vertices and indices of each segmented extruded surface and performing capping and filling on the bottom surface of the opening to form a closed surface of the mesh; the 3D mesh refers to the architectural 3D mesh obtained after stitching and sealing. In some embodiments, step 6 includes: extracting the vertices V and indices I of each segmented extruded surface, performing the bottom surface Cap fill algorithm, and stitching and sealing each segmented extruded surface and the bottom surface to obtain a 3D mesh.
[0051] Step 7: Perform manifold closure verification on the 3D mesh, and correct the 3D mesh if the verification fails, to obtain a closed 3D mesh model. Manifold closure verification refers to the verification of whether the 3D mesh constitutes a closed manifold without boundaries and without self-intersections; correction refers to the operation of re-subdividing and recalculating normals on the 3D mesh that fails the verification; a closed 3D mesh model refers to a closed architectural 3D mesh model with outward normals.
[0052] For closure verification and output. In some embodiments, step 7 includes steps 71 and 72. Step 71: Calculate the Euler characteristic number of the 3D mesh: ; Where χ is the Euler characteristic number; |V| is the number of vertices in the 3D mesh; |E| is the number of edges in the 3D mesh; and |F| is the number of faces in the 3D mesh. When χ=2, it indicates that the 3D mesh forms a closed manifold.
[0053] Step 72: When the Euler characteristic number is not equal to 2, or when the 3D mesh exhibits normal flipping, the 3D mesh is triangulated and recalculated to obtain a closed 3D mesh model. Normal flipping refers to the phenomenon where the normal direction of some faces in the mesh is inconsistent with the overall direction. Triangulation refers to the operation of re-triangulating the local mesh with anomalies. For example, Delaunay triangulation is used to re-triangulate the abnormal region; normal recalculation refers to the operation of recalculating the normal direction of each face of the mesh and unifying it to face outwards. The system automatically locates the abnormal region, and through triangulation and reverse normal recalculation, until χ=2, finally outputs a closed 3D mesh model with outward-facing normals, which can be directly used for 3D engine scene rendering.
[0054] For performance optimization, in some embodiments, the method further includes: merging closed 3D mesh models of multiple buildings with the same material combination into a batch, and enabling GPU instantiation rendering for the batch. GPU instantiation rendering refers to a rendering method that uses a graphics processing unit (GPU) to draw multiple mesh instances using the same material at once, thereby reducing the number of draw calls. For example, merging meshes of buildings in a scene that all use the same material combination (e.g., all light-colored bricks, granite bases, and gray flat roofs) into a batch and enabling GPU instantiation rendering reduces draw calls and achieves seamless deployment from individual buildings to city scenes.
[0055] Example 1: Automated Construction of Multi-Story Buildings This embodiment provides a method for constructing urban buildings based on CAD data, and the specific steps are as follows: First, CAD data parsing and topology reconstruction: A graphics parsing kernel independent of the CAD version is used to read the binary stream of DWG / DXF files. The entire entity tree is traversed to extract the following geometric elements: point sets. straight line segment polylines arc spline curve .
[0056] For the aforementioned discrete geometric elements, an undirected graph is constructed: ; Among them, vertex For the endpoints of the line segment and the control points of the curve, the edges This represents the original geometric connection relationship.
[0057] A depth-first search (DFS) algorithm is used to find all possible closed loops. For each closed loop, it is transformed into a continuous parametric curve using B-spline fitting and resampled into a uniform vertex sequence. For buildings with holes (e.g., ring-shaped buildings), inner loops are detected using bounding box-based containment relationships and stored independently as sub-polygons of the outer contour.
[0058] Calculate the centroid of each building profile And press: ; Translate the outline to the local coordinate origin. Simultaneously, read the elevation field from the CAD extended properties or layer; if it is missing or abnormal, proceed to the supplementary logic in step 2.
[0059] Next, coordinate mapping is performed: This embodiment uses the Gauss-Kruger projection and the ENU local tangent plane model as an example. The original geographic coordinates... Projection to planar coordinates Elevation Use it as the U-axis. Define the origin of the projection. These are the coordinates of the scene center point. Unity scene anchor point offset. Usually taken Or user-specified. Rotation matrix This is used to align the X (East), Y (North), and Z (Sky) axes of the Northeast-Northeast coordinate system to the X (Right), Z (Front), and Y (Top) axes of Unity, i.e.: ; Scale factor The default value is 1.0. If the projected coordinate system unit is detected to be decimeter or other non-meter system, it will be dynamically adjusted. After this conversion, the cumulative positioning error in the entire urban scene is measured to be less than 0.8 meters.
[0060] Then, height acquisition and building type determination: If CAD provides If the value is missing or ≤0, the average height is obtained based on the planning data of the plot where the building is located. Standard deviation Generate random factors Call the height generator: ; get It belongs to a multi-story building ( ).
[0061] Then, adaptive material assignment: This embodiment predefines three material libraries: a low-rise material library (red brick, stucco, pitched tile roof), a multi-story material library (facing brick, flat roof, simple molding), and a high-rise material library (glass curtain wall, metal panel, modern roof). This is for current multi-story buildings, with varying heights... Local density (Medium density). Using a conditional probability model: ; Through probability sampling, light-colored brick material was selected for the middle wall, granite base for the bottom, and gray flat roof for the top.
[0062] Then, mesh generation and verification within Unity: In the Unity editor, dynamically create a Mesh object. First, extrude the outline vertices upwards along the Y-axis, with segment proportions of: bottom 0.15H (approximately 4.3m), middle 0.65H (approximately 18.5m), and top 0.20H (approximately 5.7m). Apply the material obtained in step 4 to each segment and automatically generate UVs (using height-based linear mapping for the sides and planar projection for the top).
[0063] After generating the mesh, extract the number of vertices. Number of sides Number of faces Calculate the Euler characteristic: ; Verification passed.
[0064] If a certain building grid (For example, due to self-intersection), the system automatically locates the abnormal region, re-subdivides it using Delaunay triangulation, and flips the inconsistent normals until... The final output is a closed mesh with outward-facing normals, which is directly used for Unity scene rendering.
[0065] Finally, performance optimization: For all buildings in the scene using the same material combination—for example, all with light-colored brickwork, granite bases, and gray flat roofs—merge their meshes into a single batch and enable GPU instancing. Testing showed that the number of single-frame render draw calls for 1000 buildings decreased from approximately 2000 to less than 50.
[0066] Figure 2 This is a rendering of a 3D architectural model generated from the input original CAD data sample in this embodiment. Figure 2 It showcases the differences in height and material variations among different building types.
[0067] This invention also provides an automated construction system based on CAD data, including a geometry analysis module, a coordinate mapping module, a height classification module, a style assignment module, a mesh generation module, and a verification output module. The geometry analysis module performs geometric entity analysis and topological reconstruction on the CAD file to obtain normalized building base polygons and extracts elevation data from the CAD file. The coordinate mapping module maps the normalized building base polygons to the local world coordinate system of the 3D engine to obtain the located building base. The height classification module determines the building height based on the elevation data and layers the building height according to a height threshold to obtain the building type. The style allocation module is used to allocate materials to different parts of the building based on the building height and the building type using a height-style conditional probability model, resulting in material combinations. The material combinations include top material, middle material, and bottom material. The mesh generation module is used to extrude the positioned building base along the height direction in segments according to the building height, and bind materials to each segment according to the material combinations, resulting in a segmented extruded mesh. The segmented extruded mesh is then stitched and sealed to obtain a three-dimensional mesh. The verification output module is used to perform manifold closure verification on the three-dimensional mesh, and correct the three-dimensional mesh if the verification fails, resulting in a closed three-dimensional mesh model.
[0068] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. An automated construction method based on CAD data, characterized in that, include: Step 1: Perform geometric entity analysis and topology reconstruction on the CAD file to obtain the normalized building base polygon, and extract the elevation data from the CAD file; Step 2: Map the normalized building base polygon to the local world coordinate system of the 3D engine to obtain the located building base; Step 3: Determine the building height based on the elevation data, and classify the building height into layers according to the height threshold to obtain the building type; Step 4: Based on the building height and building type, assign materials to different parts of the building using a height-style conditional probability model to obtain material combinations; the material combinations include top material, middle material, and bottom material; Step 5: Extrude the positioned building base along the height direction in segments according to the building height, and bind the materials of each segment according to the material combination to obtain a segmented extrusion mesh; Step 6: Stitch and seal the segmented extruded mesh to obtain a three-dimensional mesh; Step 7: Perform manifold closure verification on the three-dimensional mesh, and correct the three-dimensional mesh if the verification fails to obtain a closed three-dimensional mesh model.
2. The automated construction method based on CAD data according to claim 1, characterized in that, Step 1 includes: Step 11: Parse the binary stream of the CAD file, traverse the entity tree, and extract geometric elements; the geometric elements include point sets, line segments, polylines, circular arcs, and spline curves; Step 12: Based on the geometric elements, construct the graph topology, determine the closed loop through closed loop search, and perform curve fitting and resampling on the closed loop to obtain the building outline polygon; Step 13: Calculate the centroid of the building outline polygon, and translate the building outline polygon to the local coordinate origin based on the centroid to obtain the normalized building base polygon.
3. The automated construction method based on CAD data according to claim 1, characterized in that, Step 2 includes: Step 21: Convert the geographic coordinates corresponding to the normalized building base polygon into planar coordinates through projection transformation and local tangent plane transformation; Step 22: Map the planar coordinates to the local world coordinates of the 3D engine to obtain the located building base.
4. The automated construction method based on CAD data according to claim 3, characterized in that, The transformation matrix that maps the planar coordinates to the local world coordinates of the 3D engine is: ; in, S represents local world coordinates; S is the scaling factor. This is the rotation matrix for axial correction; These are the planar coordinates obtained through projection transformation and local tangent plane transformation; The origin of the projection; Offset the scene anchor point; These are the geospatial coordinates from the GIS side. These are the scene coordinates on the 3D engine side.
5. The automated construction method based on CAD data according to claim 1, characterized in that, Determining the building height based on the elevation data includes: When the elevation data is valid, the elevation data shall be used as the building height; When the elevation data is missing or abnormal, the building height is generated based on the planned average height, standard deviation of height, and random factor of the plot where the building is located: ; in, The height of the generated building; The planned average height of the plot where the building is located; The standard deviation of the building's height; It follows a standard normal distribution; It is a random factor.
6. The automated construction method based on CAD data according to claim 1, characterized in that, The building types include high-rise, multi-story, and low-rise; The step of stratifying the building height based on a height threshold includes: When the building height is greater than or equal to a first height threshold, the building type is determined to be high-rise. When the building height is greater than or equal to the second height threshold and less than the first height threshold, the building type is determined to be multi-story; the first height threshold is greater than the second height threshold. When the building height is less than the second height threshold, the building type is determined to be low-rise.
7. The automated construction method based on CAD data according to claim 1, characterized in that, Step 4 includes: Step 41: Construct a style library; the style library includes three sets of material identifiers corresponding to the top material, the middle material, and the bottom material, respectively; Step 42: Based on the height-style conditional probability model, calculate the allocation weights of the top material, the middle material, and the bottom material; the allocation weights are related to the building height and the plot density of the building site; Step 43: Perform probability sampling according to the allocated weights, select materials from the three sets of material identifiers respectively, and combine them to obtain the material combination.
8. The automated construction method based on CAD data according to claim 1, characterized in that, Step 5 includes: The positioned building base is divided and extruded into three segments—bottom, middle, and top—along the height direction according to a first ratio, a second ratio, and a third ratio. The bottom material, middle material, and top material from the material combination are then bound to the bottom, middle, and top segments respectively to obtain a segmented extruded mesh.
9. The automated construction method based on CAD data according to claim 1, characterized in that, Step 7 includes: Step 71: Calculate the Euler characteristic number of the three-dimensional mesh: ; in, Let |V| be the Euler characteristic; |V| be the number of vertices in the 3D mesh; |E| be the number of edges in the 3D mesh; and |F| be the number of faces in the 3D mesh. Step 72: When the Euler characteristic number is not equal to 2, or when the three-dimensional mesh has a normal flip, the three-dimensional mesh is triangulated and recalculated to obtain a closed three-dimensional mesh model.
10. An automated construction system based on CAD data, characterized in that, The automated construction method based on CAD data as described in any one of claims 1 to 9 includes a geometry analysis module, a coordinate mapping module, a height classification module, a style assignment module, a mesh generation module, and a verification output module; The geometric analysis module is used to perform geometric entity analysis and topological reconstruction on the CAD file to obtain normalized building base polygons and extract elevation data from the CAD file. The coordinate mapping module is used to map the normalized building base polygon to the local world coordinate system of the 3D engine to obtain the located building base; The height classification module is used to determine the building height based on the elevation data, and to classify the building height into layers according to the height threshold to obtain the building type; The style allocation module is used to allocate materials to different parts of the building based on the building height and the building type, using a height-style conditional probability model, to obtain material combinations; the material combinations include top material, middle material, and bottom material; The mesh generation module is used to extrude the positioned building base along the height direction into segments according to the building height, and combine the materials into binding materials for each segment to obtain a segmented extruded mesh; the segmented extruded mesh is stitched and sealed to obtain a three-dimensional mesh; The verification output module is used to perform manifold closure verification on the three-dimensional mesh, and to correct the three-dimensional mesh when the verification fails, so as to obtain a closed three-dimensional mesh model.