A DSL-based programmatic method and system for generating building roofs
By leveraging the collaborative constraint mechanism of DSL and FSM, a structured roof description conforming to building codes is generated directly from point cloud data, solving the problems of semantic gaps and insufficient code dependency in existing technologies, and achieving efficient and accurate roof model generation.
Patent Information
- Application Number
- CN202510975608.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-15
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2045-07-15
AI Technical Summary
Existing technologies cannot directly generate structured semantic descriptions that conform to building codes from point cloud data, and the output of deep learning models cannot be directly associated with the semantic attributes of roof components, resulting in low automation and a high susceptibility to errors.
A procedural building roof generation method based on DSL is adopted. By constructing a domain-specific language and finite state machine rule system, combined with a 3DCNN-Transformer-FSM architecture, a structured procedural description containing roof type, attached floors and parameter constraints is directly generated from point cloud data. The FSM module is used to force the learning of legal DSL paths and the parameter legality is optimized by loss function.
It achieves direct mapping from point cloud data to structured DSL programs, reducing annotation costs, increasing generation speed by 10 times, improving syntax accuracy to 98%, reducing parameter out-of-bounds error rate to less than 2%, improving geometric accuracy compared to traditional methods, and improving design iteration efficiency by 40%.
Smart Images

Figure CN120493382B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of Building Information Modeling (BIM) and procedural generation technology, and relates to a procedural building roof generation method and system based on DSL. Background Technology
[0002] Existing methods for generating 3D models of building roofs based on UAV images have the following drawbacks:
[0003] 1. Semantic gaps: Traditional 3D reconstruction technologies (such as multi-view stereo vision and SLAM) can only output unstructured geometric data (point clouds or meshes), lacking the ability to explicitly semantically model building roof types (such as double-slope and quad-slope), hierarchical relationships (such as attached floors) and parameter constraints (such as slope range). This leads to the need for manual parsing of geometric data and supplementation with procedural descriptions such as DSL, which is inefficient and prone to errors.
[0004] 2. Insufficient reliance on standards: Although the method of directly predicting the geometry through deep learning models is highly automated, the output results cannot be directly associated with the semantic attributes of the roof components (such as materials and functional levels), and the generated procedural descriptions (such as DSLs) have syntax errors or parameter out-of-bounds issues, which require manual verification and correction. Summary of the Invention
[0005] This invention provides a programmatic building roof generation method based on DSL, which solves the technical problem that existing technologies cannot directly generate structured semantic descriptions (such as DSL programs) that conform to building codes from point cloud data, and realizes automated parsing and code constraints of roof parameters, types and hierarchical relationships.
[0006] The present invention also provides a programmatic building roof generation system based on DSL.
[0007] The method for generating building roofs in this invention is implemented using the following technical solution:
[0008] A DSL-based procedural method for generating building roofs includes:
[0009] Constructing domain-specific language and finite state machine rule systems;
[0010] Construct a pairing dataset of "point cloud-DSL program" as a training dataset for the DSL building program generation model;
[0011] Based on the encoder-decoder model, a finite state machine is introduced to construct an encoder-decoder-finite state machine model, which serves as the DSL building program generation model.
[0012] The DSL building program generation model is trained by introducing a finite state machine masking mechanism to force the model to learn legal DSL paths during training, thus obtaining a well-trained DSL building program generation model.
[0013] Based on the model generated by the trained DSL building program, and combined with 3D modeling software, a roof BIM model is generated.
[0014] Preferably, the training dataset generation process includes:
[0015] Generate a rooftop program that conforms to specifications using traditional procedural modeling tools;
[0016] After rendering the roof program into a 3D model using 3D modeling software, point cloud data was sampled.
[0017] Construct a pairing dataset of "point cloud-DSL program".
[0018] Preferably, the DSL building program generation model is designed as a three-level architecture of 3DCNN-Transformer-FSM.
[0019] Furthermore, 3DCNN is used to parse the global features of the point cloud, Transformer is used to generate a roof program word sequence that conforms to the grammar rules based on a predefined DSL, and FSM is used to ensure that the generated roof program conforms to the DSL grammar and building rules.
[0020] Preferably, the process of training the DSL building program generation model includes:
[0021] Loss function design: Calculate the difference between predicted and actual word segments word by word through autoregressive prediction;
[0022] FSM blocking mechanism: During training, segmentation options that violate syntax are dynamically blocked.
[0023] Preferably, the process for generating a rooftop BIM model includes:
[0024] COLMAP point cloud standardization processing;
[0025] Model reasoning and legality verification, outputting a verified DSL building program;
[0026] A roof BIM model is generated based on a validated DSL building program.
[0027] Preferably, the procedural building roof generation method further includes:
[0028] By modifying the parameters of the DSL building program, the roof BIM model can be dynamically adjusted and generated.
[0029] The building roof generation system of the present invention is implemented using the following technical solution:
[0030] A DSL-based programmatic building roof generation system includes:
[0031] DSL and FSM rule modules: used to build domain-specific language and finite state machine rule systems;
[0032] Training Dataset Building Module: Used to build a "point cloud-DSL program" paired dataset, which serves as the training dataset for the DSL building program generation model;
[0033] DSL Building Program Generation Module: This module is used to introduce a finite state machine into the encoder-decoder model and construct an encoder-decoder-finite state machine model as the DSL building program generation model.
[0034] Model training module: Used to train the DSL building program generation model. It introduces a finite state machine masking mechanism to force the model to learn legal DSL paths during training, so as to obtain a trained DSL building program generation model.
[0035] Roof BIM Model Generation Module: Used to generate a model based on a trained DSL building program, combined with 3D modeling software, to generate a roof BIM model.
[0036] Preferably, the training dataset construction module includes:
[0037] Roofing program training set generation module: used to generate roofing programs that conform to specifications using traditional procedural modeling tools;
[0038] Point cloud data training set generation module: used to sample point cloud data after rendering the roof program into a 3D model using 3D modeling software;
[0039] Paired Dataset Training Set Generation Module: Used to build the "Point Cloud-DSL Program" paired dataset.
[0040] Preferably, the rooftop BIM model generation module includes:
[0041] Point cloud processing module: used for COLMAP point cloud standardization processing;
[0042] Reasoning and Verification Module: Used for model reasoning and legality verification, outputting a verified DSL building program;
[0043] BIM Model Generation Module: Used to generate roof BIM models based on validated DSL building programs.
[0044] The summary section is provided to present the chosen concepts in a simplified form, which will be further described in the detailed description below. The summary section is not intended to identify essential or necessary features of this disclosure, nor is it intended to limit the scope of this disclosure.
[0045] This invention utilizes the semantic modeling capabilities of Domain-Specific Language (DSL) and 3DCNN-
[0046] The constraint mechanism of the Transformer-FSM architecture addresses the shortcomings of existing technologies, namely "semantic gaps" and "insufficient specification dependencies," and achieves the following technical effects:
[0047] 1. Solve the semantic missing problem and realize the direct mapping from geometric data to structured DSL programs.
[0048] This invention utilizes a predefined Domain-Specific Language (DSL) rule base, combined with a 3DCNN-Transformer-FSM architecture, to directly generate structured, procedural descriptions containing roof type, attached floors, and parameter constraints from UAV point cloud data. Compared to traditional 3D reconstruction techniques (such as multi-view stereo vision and SLAM), this invention eliminates the need for manual parsing of geometric data and supplementation of semantic information, reducing annotation costs to 0%, achieving a generation speed of 1000+ samples / hour, and with end-to-end generation time ≤20 minutes / building, resulting in an efficiency improvement of over 10 times.
[0049] 2. To address the issue of insufficient specification dependency, ensure the validity of syntax and parameters through the collaborative constraints of DSL and FSM.
[0050] This invention designs a collaborative constraint mechanism between a Domain-Specific Language (DSL) rule base and a Finite State Machine (FSM) module, forcing the generated roof program to comply with the semantic and parameter requirements of building codes. Regarding syntactic constraints, the FSM module filters out illegal word segmentation options in real time, improving the syntactic accuracy to 98% (only 2 errors in 1000 test samples), while the baseline model without FSM has a syntactic error rate as high as 30%-50%. Regarding parameter constraints, the DSL rule base pre-sets parameter boundaries, and combined with numerical verification by FSM, the parameter out-of-bounds error rate is less than 2% (average error ±0.02), significantly better than traditional deep learning models (parameter out-of-bounds error rate 35%). Furthermore, the generated DSL program directly associates with the semantic attributes of roof components (such as materials and functional levels), seamlessly mapping to structured data in the BIM model, avoiding the secondary development requirements caused by unstructured output in existing technologies.
[0051] 3. Dual improvement in geometric matching accuracy and semantic standardization.
[0052] This invention achieves significant optimization in geometric accuracy: the Chamfer Distance (CD) error between the generated roof model and the point cloud is ≤0.12 meters (Intersection over Union, IoU ≥0.85), which is 57% higher than the traditional Procedural Building Generation (PBG) method (CD error >0.3 meters) and also outperforms unconstrained deep learning models (CD error 0.28 meters). More importantly, through the explicit semantic rules of DSL and the constraints of FSM, the generated program and geometric model are completely consistent in roof type, parameter range, and hierarchical relationship, solving the semantic-geometric consistency error caused by the lack of semantic constraints in the prior art.
[0053] 4. Flexibility and standardization assurance of dynamic design iteration
[0054] This invention achieves high efficiency and standardization in design iteration by leveraging the editability of the DSL program and the real-time verification mechanism of the FSM module. Users can directly modify parameters in the DSL program and quickly render the updated model via the Rhino API, improving design iteration efficiency by 40% (traditional methods require 1 hour per adjustment, while this invention requires only 6 seconds per adjustment). Simultaneously, the FSM module automatically verifies the legality of parameter adjustments, ensuring that the modified program can directly generate a roof BIM model compliant with building codes without manual verification, avoiding rework costs caused by parameter out-of-bounds errors or syntax errors in existing technologies. Attached Figure Description
[0055] The above and other objects, features and advantages of this disclosure will become more apparent from the accompanying drawings, in which like reference numerals generally denote like parts.
[0056] Figure 1 This is an overview diagram of a procedural building roof generation method in one embodiment;
[0057] Figure 2 This is one of the flowcharts for a procedural building roof generation method in one embodiment;
[0058] Figure 3 This is the second flowchart of a procedural building roof generation method in one embodiment;
[0059] Figure 4 This is a diagram of a 3DCNN-Transformer-FSM network architecture in one embodiment. Detailed Implementation
[0060] Embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be thorough and complete, and will fully convey the scope of the present disclosure to those skilled in the art.
[0061] The term "comprising" and its variations as used herein signify open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "at least partially based on". The terms "one example embodiment" and "one embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0062] Figure 1 This demonstrates a DSL defined using the Backus-Naur form, and a method for generating structured 3D abstractions from UAV imagery. The procedural generation technique synthesizes paired procedures and 3D meshes, creating input-output pairs by sampling point clouds. The network, consisting of a 3DCNN encoder and a Transformer decoder, is trained to autoregressively predict a labeled building procedure.
[0063] A procedural roof generation method based on DSL includes: constructing a structured DSL and FSM rule system, combining it with traditional procedural modeling (PBG) tools to generate a roof program that conforms to specifications, and rendering it as a 3D model followed by sampling point clouds to form a "point cloud-DSL program" paired dataset. A 3DCNN-Transformer encoder-decoder model is employed, along with a finite state machine (FSM) module to force learning of syntax and parameter constraints (such as slope range and hierarchical relationships). The generation accuracy is improved through autoregressive loss function and hyperparameter optimization. Finally, COLMAP is used to process the point cloud from UAV images, and the model outputs an executable DSL building program (such as a Rhino script) to generate a parametric BIM model. Users can dynamically adjust the design by modifying the DSL building program parameters, achieving efficient and standardized automated modeling.
[0064] In a preferred embodiment, a procedural roof generation method based on a domain-specific language, such as... Figure 2 , Figure 3 As shown, it includes:
[0065] S1. Construct a domain-specific language (DSL) and finite state machine (FSM) rule system.
[0066] DSL definition rules: The roof type, parameter order, parameter boundaries, and hierarchical relationships are clearly defined using the BNF paradigm, ensuring that the syntax covers all building code requirements. (For detailed syntax definitions and parameter constraints, please refer to Tables 1 and 2).
[0067] DSL code example:
[0068] Create the main statement "Roof Creation" and add parameters and constraints to it.
[0069] <roof>::= "CreateRoof" "(" "parent" "=" <layerindex>"," "type" "=" "gable" "," "slope_min" "=" <float>"," "slope_max" "=" <float> ")"
[0070] <layerindex>::= Integer (e.g., 2, 3, indicating the floor index)
[0071] <float>::= Floating-point number (range 0.1-0.6, and "slope_min < slope_max")
[0072] The FSM divides the FSM state according to the syntax rules of the DSL and transforms the constraints of the DSL into the state transition conditions of the FSM (see Tables 3 and 4 for details).
[0073] FSM has two core functions: during model training, it forces the model to learn valid DSL paths to avoid generating invalid word segmentation sequences and optimizes parameter validity through the loss function; during the model inference stage, when the Transformer generates the building program, it forces the generated result to conform to the DSL rules.
[0074] FSM code example:
[0075] Define the roof generation state, state rules, and transition rules.
[0076] In the RoofParamState state, the parent parameter must be generated first, and then the type parameter must be generated.
[0077] If type="gable", then the slope_min and slope_max parameters must be included, and the values must satisfy 0.1 ≤ slope_min < slope_max ≤ 0.6.
[0078] Table 1 Core Parts of Domain-Specific Language (DSL) Syntax Definition
[0079]
[0080] Table 2 Detailed constraints of DSL syntax parameters
[0081]
[0082] Table 3 FSM Core State Definition Table
[0083]
[0084] Table 4 FSM Core State Transition Rules
[0085]
[0086] S2. Construct a "point cloud-DSL program" paired dataset and use it as the training dataset for the DSL building program generation model. This includes:
[0087] S2.1 Use traditional procedural modeling tools (PBG) to generate a roof program that conforms to the specifications.
[0088] In one embodiment, procedural modeling tools (such as Python scripts) are used to randomly generate double-roof programs that conform to the DSL rules. 10,000 roof programs conforming to the rules are generated, covering types such as double-slope and quad-slope roofs, with diverse parameter combinations.
[0089] Code example: Create a double roof (attached to the second floor, with a slope ranging from 0.2 to 0.35).
[0090] CreateRoof(parent=2, type="gable", slope_min=0.2, slope_max=0.35)
[0091] Random parameter range: parent: 1-5 floors (top floor); slope_min: 0.1-0.5; slope_max: slope_min+0.05 to 0.6.
[0092] S2.2 After rendering the roof program into a 3D model using 3D modeling software, sample point cloud data.
[0093] The generated roof application is input into the Rhino modeling tool, rendered as a 3D mesh model, and then point cloud data is generated using a point cloud sampling algorithm. The point cloud density is 500 points per square meter; the sampling range includes the roof, attached floors, and surrounding walls. The point cloud data generated by each application includes the geometric features of the roof area (such as normal vector distribution and span), and corresponds one-to-one with the DSL building application.
[0094] S2.3 Construct a paired dataset of "point cloud-DSL program".
[0095] The point cloud data generated by S2.2 is paired with the original DSL program to form a "point cloud-DSL program" paired dataset, which includes: point cloud (NumPy array, dimension N×3, where N is the number of points); word segmentation sequence (e.g., ["CreateRoof", "(", "parent", "=", "2", ",", ...]). A dataset of 10,000+ "point cloud-DSL program" paired datasets is constructed as training samples, with double roofs accounting for 60%, quad roofs accounting for 30%, and other types accounting for 10%.
[0096] S3. Based on the encoder-decoder model, a finite state machine is introduced to ensure that the generated DSL building program conforms to the DSL syntax and building rules, and a DSL building program generation model is constructed as the DSL building program generation model.
[0097] In one embodiment, the DSL building program generation model is designed as a 3DCNN-Transformer.
[0098] The mer-FSM three-level architecture consists of: 3DCNN parsing the global features of the point cloud, Transformer generating a roof program segmentation sequence that conforms to the grammatical rules based on a predefined DSL, and FSM ensuring that the generated roof program conforms to the DSL syntax and building rules.
[0099] In detail, the 3DCNN encoder takes point cloud data as input and converts it into a 32×32×32 3D tensor through voxelization; it uses a 5-layer 3D convolutional network to extract global features (such as the main direction of the roof tilt angle and the span length), and outputs a 256-dimensional feature vector. The Transformer decoder takes the 256-dimensional feature vector as input and generates a DSL segmentation sequence through a self-attention mechanism; it adopts a decoder-only Transformer architecture with a hidden layer dimension of 512, 8 heads, and 6 layers. At each step of the decoder's output, the FSM module dynamically generates a valid segmentation mask based on the current state and the generated segments. The DSL architectural program generation model successfully maps point cloud features to DSL segmentation sequences, and the FSM module constrains the generation path in real time during the training phase.
[0100] In a specific embodiment, such as Figure 4 As shown, the 3DCNN encoder sequentially processes the UAV point cloud through convolutional layers (Conv3-32×4, Conv3-64×2, Conv3-128), max pooling (Maxpool (2×2)), and fully connected layers (FC-512) to output a feature vector. The FSM finite state machine defines state names, identifiers, transition rules, and triggering conditions to control the generation process. The Transformer decoder combines positional encoding with layers such as Masked Multi-Head Attention, Multi-Head Attention, and Feed Forward, and then outputs the DSL building program through linear transformation and softmax normalization.
[0101] It should be noted that, in addition to choosing a hybrid encoder-decoder such as CNN-Transformer, other encoder-decoder pairing structures in deep learning can be selected as needed, such as Transformer encoder-Transformer decoder, CNN encoder-RNN decoder (usually LSTM / GRU), and CNN encoder-CNN decoder.
[0102] The S4 and DSL building program generation model training introduces the FSM shielding mechanism to force the model to learn legal DSL paths during training, avoid generating invalid word segmentation sequences, and optimize parameter legality through loss function.
[0103] S4.1 Loss Function Design: Through autoregressive prediction, the difference between predicted word segmentation and actual word segmentation is calculated word by word.
[0104] The DSL building program generation model was trained under supervision using point clouds and DSL word segments from the "point cloud-DSL program" pairing dataset. The overall loss function of the model is L. total =LCE + λLFSM. Where λ = 0.3 (balancing language modeling and constraint penalty). The model penalty coefficient α = 0.5. Cross-entropy loss calculates the difference between the predicted probability and the true label per word segment; FSM constraint loss penalizes word segments that violate the rules. After training for 100 epochs, the model's grammatical accuracy on the validation set improved from the initial 70% to 98%, while the parameter matching accuracy (MAE) decreased to 0.02.
[0105] S4.2, FSM blocking mechanism: During training, segmentation options that violate syntax are dynamically blocked.
[0106] During model training, the FSM module blocks illegal word segmentation in real time. In the generated DSL building program, 99.8% of the parameter values conform to the predefined range, while the baseline model without FSM only reaches 65%.
[0107] S4.3 Input and Output Specifications.
[0108] The input point cloud data was standardized to a 32×32×32 voxel grid, and the coordinates were normalized to [-1,1]. 3 The output DSL building program segmentation sequence must strictly adhere to DSL syntax. The model achieves a 98.5% success rate in parsing the input point cloud (i.e., outputting a complete DSL program), while traditional methods require manual parameter annotation.
[0109] S4.4 Optimizer and Model Parameter Updates.
[0110] Using the Adam optimizer (learning rate 1e) -4 Weight decay 1e -5 The gradient clipping threshold is set to 1.0 to prevent explosion; a cosine annealing strategy is used, and the learning rate is reduced to 1e after 30 epochs. -6 The model convergence speed is improved by 30%, and the training loss stabilizes after 20 epochs (L). total ≤0.15).
[0111] S4.5, Hyperparameter Search.
[0112] The optimal hyperparameter combination was determined through grid search: λ was selected from {0.1, 0.2, 0.3}; α was selected from {0.3, 0.5}; and the Transformer hidden layer dimension was 512 vs. 768. The optimal combination was λ=0.3, α=0.5, and 512-dimensional hidden layer, with a syntax accuracy of 98.2%; parameter matching accuracy (MAE) of 0.021; and Chamfer Distance (CD) error of 0.12 meters (IoU=0.85).
[0113] S5. Generate a roof BIM model based on the trained DSL building program and combine it with 3D modeling software.
[0114] S5.1, COLMAP point cloud standardization processing.
[0115] Input images of a building taken by a drone (50 multi-view photos in total), and perform 3D reconstruction using COLMAP: generate point cloud data, which takes about 15 minutes; use statistical outlier detection to remove 2% of outliers for noise suppression; extract a subset of the roof point cloud using the Random Area Synthesis (RANSAC) algorithm and label its boundaries.
[0116] S5.2 Model reasoning and legality verification, outputting the verified DSL building program.
[0117] The point cloud data obtained from the image processing by S5.1 is input into the trained DSL building program generation model. The encoder-decoder in the model generates the DSL building program. The finite state machine (FSM) verifies and adjusts the legality of the output DSL building program and outputs the verified DSL building program.
[0118] S5.3 Generate a roof BIM model based on the validated DSL building program.
[0119] The validated DSL building program is input into the Rhino API. Based on the roof type, the predefined Rhino modeling function template is called and the parameters are filled in. The parametric model of the roof is generated through Rhino's Geometry class, and material properties are associated. After execution, the roof BIM model is generated.
[0120] In a preferred embodiment, it further includes:
[0121] S6. By modifying the DSL building program parameters, dynamically adjust and generate the roof BIM model.
[0122] Users can re-render the model by modifying parameters in the DSL building program. After the DSL program verifies the validity of the parameters via FSM, the roof BIM model can be directly updated by inputting the changes into Rhino.
[0123] A DSL-based programmatic building roof generation system includes:
[0124] DSL and FSM rule modules: used to build domain-specific language and finite state machine rule systems;
[0125] Training Dataset Building Module: Used to build a "point cloud-DSL program" paired dataset, which serves as the training dataset for the DSL building program generation model;
[0126] DSL Building Program Generation Module: This module is used to introduce a finite state machine into the encoder-decoder model and construct an encoder-decoder-finite state machine model as the DSL building program generation model.
[0127] Model training module: Used to train the DSL building program generation model. It introduces a finite state machine masking mechanism to force the model to learn legal DSL paths during training, so as to obtain a trained DSL building program generation model.
[0128] Roof BIM Model Generation Module: Used to generate a model based on a trained DSL building program, combined with 3D modeling software, to generate a roof BIM model.
[0129] The training dataset building module includes:
[0130] Roofing program training set generation module: used to generate roofing programs that conform to specifications using traditional procedural modeling tools;
[0131] Point cloud data training set generation module: used to sample point cloud data after rendering the roof program into a 3D model using 3D modeling software;
[0132] Paired Dataset Training Set Generation Module: Used to build the "Point Cloud-DSL Program" paired dataset.
[0133] The rooftop BIM model generation module includes:
[0134] Point cloud processing module: used for COLMAP point cloud standardization processing;
[0135] Reasoning and Verification Module: Used for model reasoning and legality verification, outputting a verified DSL building program;
[0136] BIM Model Generation Module: Used to generate roof BIM models based on validated DSL building programs.
[0137] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, and are not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical applications, or technical improvements to the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.< / float> < / layerindex> < / float> < / float> < / layerindex> < / roof>
Claims
1. A programmatic building roof generation method based on DSL, characterized in that, include: Construct a domain-specific language and finite state machine rule system to describe roof types, parameter order, parameter boundaries, and hierarchical relationships; The finite state machine rule system divides the finite state machine state according to the syntax rules of the domain-specific language, and transforms the domain-specific language constraints into the state transition conditions of the finite state machine. Construct a "point cloud-DSL program" paired dataset as a training dataset for the DSL building program generation model; Based on the encoder-decoder model, a finite state machine is introduced to construct an encoder-decoder-finite state machine model, which serves as the DSL building program generation model. A finite state machine (FSM) masking mechanism is introduced to train the DSL building program generation model. At each step of the decoder's output, the FSM dynamically generates a legal word segmentation mask based on the current state and the generated words. This forces the model to learn legal DSL paths during training, resulting in a well-trained DSL building program generation model. The total loss function of the DSL building program generation model includes cross-entropy loss and FSM constraint loss. Cross-entropy loss is used to calculate the difference between the predicted probability and the true label for each word segmentation. FSM constraint loss is used to penalize word segments that violate the rules, optimizing parameter legality. Based on the model generated by the trained DSL building program, and combined with 3D modeling software, a roof BIM model is generated.
2. The method for generating programmed building roofs according to claim 1, characterized in that, The training dataset generation process includes: Generate a rooftop program that conforms to specifications using traditional procedural modeling tools; After rendering the roof program into a 3D model using 3D modeling software, point cloud data was sampled. Construct a paired dataset of "point cloud-DSL program".
3. The method for generating a programmed building roof according to claim 1, characterized in that, The DSL building program generates a model using a three-tier architecture: 3DCNN-Transformer-FSM.
4. The method for generating programmed building roofs according to claim 3, characterized in that, 3DCNN is used to parse the global features of the point cloud, Transformer is used to generate a roof program word sequence that conforms to the grammar rules based on a predefined DSL, and FSM is used to ensure that the generated roof program conforms to the DSL grammar and building rules.
5. The method for generating programmed building roofs according to claim 1, characterized in that, The process of training the DSL building program generation model includes: Loss function design: Calculate the difference between predicted and actual word segments word by word through autoregressive prediction; FSM blocking mechanism: During training, segmentation options that violate syntax are dynamically blocked.
6. The method for generating programmed building roofs according to claim 1, characterized in that, The process of generating a rooftop BIM model includes: COLMAP point cloud standardization processing; Model reasoning and legality verification, outputting a verified DSL building program; A roof BIM model is generated based on a validated DSL building program.
7. The method for generating a programmed building roof according to claim 1, characterized in that, Procedural methods for generating building roofs also include: By modifying the parameters of the DSL building program, the roof BIM model can be dynamically adjusted and generated.
8. A programmatic building roof generation system based on DSL, characterized in that, include: DSL and FSM rule modules: used to construct domain-specific language and finite state machine rule systems to describe roof type, parameter order, parameter boundaries and hierarchical relationships; the finite state machine rule system divides the finite state machine state according to the syntax rules of the domain-specific language and transforms the constraints of the domain-specific language into the state transition conditions of the finite state machine. Training Dataset Building Module: Used to build a "point cloud-DSL program" paired dataset, which serves as the training dataset for the DSL building program generation model; DSL Building Program Generation Module: This module is used to introduce a finite state machine into the encoder-decoder model and construct an encoder-decoder-finite state machine model as the DSL building program generation model. The model training module is used to train the DSL building program generation model. It introduces a finite state machine masking mechanism. At each step of the decoder's output, the finite state machine dynamically generates a legal word segmentation mask based on the current state and the generated words. This forces the model to learn legal DSL paths during training, resulting in a well-trained DSL building program generation model. The total loss function of the DSL building program generation model includes cross-entropy loss and FSM constraint loss. Cross-entropy loss is used to calculate the difference between the predicted probability and the true label for each word segmentation. FSM constraint loss is used to penalize word segments that violate the rules, optimizing parameter legality. Roof BIM Model Generation Module: Used to generate a model based on a trained DSL building program, combined with 3D modeling software, to generate a roof BIM model.
9. The programmed building roof generation system according to claim 8, characterized in that, The training dataset building module includes: Roofing program training set generation module: used to generate roofing programs that conform to specifications using traditional procedural modeling tools; Point cloud data training set generation module: used to sample point cloud data after rendering the roof program into a 3D model using 3D modeling software; Paired Dataset Training Set Generation Module: Used to build the "Point Cloud-DSL Program" paired dataset.
10. The programmed building roof generation system according to claim 8, characterized in that, The rooftop BIM model generation module includes: Point cloud processing module: used for COLMAP point cloud standardization processing; Reasoning and Verification Module: Used for model reasoning and legality verification, outputting a verified DSL building program; BIM Model Generation Module: Used to generate roof BIM models based on validated DSL building programs.
Citation Information
Patent Citations
Building structure programmed reconstruction method, system and device and computer equipment
CN119720363A