CN116680768A - Method, equipment and medium for extracting CAD information to generate wall model or door window model - Google Patents

Method, equipment and medium for extracting CAD information to generate wall model or door window model Download PDF

Info

Publication number
CN116680768A
CN116680768A CN202310008828.0A CN202310008828A CN116680768A CN 116680768 A CN116680768 A CN 116680768A CN 202310008828 A CN202310008828 A CN 202310008828A CN 116680768 A CN116680768 A CN 116680768A
Authority
CN
China
Prior art keywords
model
wall
information
door
window
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310008828.0A
Other languages
Chinese (zh)
Inventor
周兴石
黄远强
蔡俊
谢锴炀
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Nanfang Telecommunication Construction Co ltd
Original Assignee
Guangdong Nanfang Telecommunication Construction Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Nanfang Telecommunication Construction Co ltd filed Critical Guangdong Nanfang Telecommunication Construction Co ltd
Priority to CN202310008828.0A priority Critical patent/CN116680768A/en
Publication of CN116680768A publication Critical patent/CN116680768A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/10Geometric CAD
    • G06F30/13Architectural design, e.g. computer-aided architectural design [CAAD] related to design of buildings, bridges, landscapes, production plants or roads

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Geometry (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Theoretical Computer Science (AREA)
  • Civil Engineering (AREA)
  • Structural Engineering (AREA)
  • Computational Mathematics (AREA)
  • Architecture (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

本发明公开了一种提取CAD信息生成墙体模型或门窗模型的方法、设备及介质,包括步骤S1:读取输入的目标模型的信息以及内置模型的信息,选择预设模型的一个墙体图层作为复制模板;步骤S2:获取所述墙体图层内每一线段,并设定一平行线标号变量初始化标识每一处理后的线段;步骤S3:筛选剩余未被标识的线段;步骤S4:判断未被标识的线段中两条线段是否平行,线段之间的距离是否吻合步骤S1中输入的目标模型的信息,若是,则在两条线段之间生成墙体模型,并将该两条线段添加标识处理,若否,则执行步骤S3;步骤S5:判断每条线段是否都经过处理,若是,则根据步骤S1中输入的目标模型的信息修改生成的所述墙体模型,若否,则执行步骤S2。

The invention discloses a method, device and medium for extracting CAD information to generate a wall model or a door and window model, including step S1: reading the information of the input target model and the information of the built-in model, and selecting a wall diagram of the preset model layer as a copy template; step S2: obtain each line segment in the wall layer, and set a parallel line label variable to initialize and identify each processed line segment; step S3: filter the remaining unmarked line segments; step S4 : Judging whether the two line segments in the unmarked line segments are parallel, whether the distance between the line segments matches the information of the target model input in step S1, if so, then generate a wall model between the two line segments, and combine the two line segments Line segment adding identification processing, if no, then execute step S3; step S5: judge whether each line segment has been processed, if yes, then modify the generated wall model according to the information of the target model input in step S1, if not, Then step S2 is executed.

Description

提取CAD信息生成墙体模型或门窗模型的方法、设备及介质Method, device and medium for extracting CAD information to generate wall model or door and window model

技术领域technical field

本发明属于建筑行业计算机建模数据处理技术领域,特别涉及一种提取CAD信息生成墙体模型或门窗模型的方法、设备及介质。The invention belongs to the technical field of computer modeling data processing in the construction industry, and in particular relates to a method, equipment and medium for generating wall models or door and window models by extracting CAD information.

背景技术Background technique

在revit软件中,对于那些结构具有一定规律或者通用的建筑模型,可以通过编程来进行建模,从而减少反复人工操作带来的错误,同时提升建模效率,实现模型信息处理的可视化。为此Autodesk公司提供了Revit软件的API,支持开发人员利用集成开发环境,使用基于.NET框架的所有计算机语言来对Revit进行二次开发,创建程序插件扩展revit软件的功能,然而,在revit软件中,根据CAD图纸生成某些具有相同规则的模型,例如墙体、相同型号的门窗等时,手动生成模型的效率较低,且存在反复操作产生错误的可能性。In Revit software, for those architectural models with certain rules or common structures, they can be modeled through programming, thereby reducing errors caused by repeated manual operations, improving modeling efficiency, and realizing visualization of model information processing. To this end, Autodesk provides the API of Revit software, which supports developers to use the integrated development environment, use all computer languages based on the .NET framework to carry out secondary development of Revit, and create program plug-ins to extend the functions of Revit software. However, in Revit software Among them, when generating certain models with the same rules based on CAD drawings, such as walls, doors and windows of the same model, etc., the efficiency of manually generating models is low, and there is a possibility of errors caused by repeated operations.

因此有必要设计可以利用编程批量自动生成相同规则的模型,提升建模效率与准确率一种新的提取CAD信息生成墙体模型或门窗模型的方法、设备及介质。Therefore, it is necessary to design a new method, equipment and medium for extracting CAD information to generate wall models or door and window models by using programming to automatically generate models with the same rules in batches to improve modeling efficiency and accuracy.

发明内容Contents of the invention

本发明的目的在于提供一种利用编程批量自动生成相同规则的墙体模型或门窗模型,以解决现有技术中的根据CAD图纸生成某些具有相同规则的模型,例如墙体、相同型号的门窗等时,手动生成模型的效率较低,且存在反复操作产生错误的可能性的问题。The object of the present invention is to provide a kind of wall body model or door and window model that utilizes programming to automatically generate the same rules in batches, to solve the problem in the prior art that some models with the same rules are generated according to CAD drawings, such as walls, doors and windows of the same model At the same time, the efficiency of manually generating a model is low, and there is a problem that repeated operations may cause errors.

本申请实施例的第一方面提供了一种提取CAD信息生成墙体模型的方法,包括:步骤S1:读取输入的目标模型的信息以及内置模型的信息,选择预设模型的一个墙体图层作为复制模板;步骤S2:获取所述墙体图层内每一线段,并设定一平行线标号变量初始化标识每一处理后的线段;步骤S3:筛选剩余未被标识的线段;步骤S4:判断未被标识的线段中两条线段是否平行,线段之间的距离是否吻合步骤S1中输入的目标模型的信息,若是,则在两条线段之间生成墙体模型,并将该两条线段添加标识处理,若否,则执行步骤S3;步骤S5:判断每条线段是否都经过处理,若是,则根据步骤S1中输入的目标模型的信息修改生成的所述墙体模型,若否,则执行步骤S2。The first aspect of the embodiment of the present application provides a method for extracting CAD information to generate a wall model, including: Step S1: Read the information of the input target model and the information of the built-in model, and select a wall diagram of the preset model layer as a copy template; step S2: obtain each line segment in the wall layer, and set a parallel line label variable to initialize and identify each processed line segment; step S3: filter the remaining unmarked line segments; step S4 : Judging whether the two line segments in the unmarked line segments are parallel, whether the distance between the line segments matches the information of the target model input in step S1, if so, then generate a wall model between the two line segments, and combine the two line segments Line segment adding identification processing, if not, then execute step S3; step S5: judge whether each line segment has been processed, if yes, then modify the generated wall model according to the information of the target model input in step S1, if not, Then step S2 is executed.

进一步地,步骤S1中目标模型的信息包括墙体模型的厚度和底部、顶部的偏移信息,内置模型的信息包括墙体模型的底部、顶部约束。Further, the information of the target model in step S1 includes the thickness of the wall model and the offset information of the bottom and top, and the information of the built-in model includes the constraints of the bottom and top of the wall model.

进一步地,步骤S1中选择预设模型的一个墙体图层作为复制模板之前包括判断所要生成墙体模型的族类型是否存在,若不存在,则复制一个新的墙体族类型并修改墙体厚度。Further, before selecting a wall layer of the preset model as the copy template in step S1, it includes judging whether the family type of the wall model to be generated exists, if not, copying a new wall family type and modifying the wall thickness.

进一步地,步骤S4中判断未被标识的线段中两条线段是否平行,线段之间的距离是否吻合步骤S1中输入的目标模型的信息具体为先判断两条线段是否平行,再计算两条线段之间的距离,之后判断两条线段之间位置是否交错,如果满足了平行、不交错的条件,且距离值吻合输入目标模型的信息,则将线段的标号代入正确线段标号变量。Further, in step S4, it is judged whether the two line segments in the unmarked line segments are parallel, and whether the distance between the line segments matches the information of the target model input in step S1. Specifically, first determine whether the two line segments are parallel, and then calculate the two line segments Then judge whether the positions of the two line segments are staggered. If the conditions of parallelism and non-staggering are met, and the distance value is consistent with the information input into the target model, then the label of the line segment is substituted into the correct line segment label variable.

进一步地,在两条线段之间生成墙体模型具体为若平行线标号变量值发生改变,则成功匹配,获取匹配的两条线段,复制其中一条线段,并取其在该平面指向另一线段的单位法向量,然后使复制的线段沿着法向量方向移动厚度的一半距离,从而得到两条线段的中间线,以此中间线和墙体族类型生成墙体模型。Further, to generate a wall model between two line segments, if the variable value of the parallel line label changes, the match is successful, obtain the two matched line segments, copy one of the line segments, and take it to point to the other line segment on the plane The unit normal vector of , and then move the copied line segment along the direction of the normal vector for half the distance of the thickness, so as to obtain the middle line of the two line segments, and generate the wall model with the middle line and the wall family type.

本申请实施例的第二方面提供了一种提取CAD信息生成门窗模型的方法,匹配于通过上述提取CAD信息生成墙体模型的方法生成的墙体模型,包括:步骤S10:读取内置的门窗族和所有的门窗族类型,选择一个内置墙类型作为复制模板,获取墙体图层,门窗图层的每一线段和曲线以及门窗信息图层的文字信息,读取输入门窗所在墙体的底部顶部约束、底部顶部偏移,每个门窗型号的离地高度以及族,选择所述门窗族的第一个族类型作为复制模板;步骤S20:获取每一门窗图层的线段;步骤S30:判断其是否同时与所述墙体图层的线段相交,若否,执行步骤S20,若是,则在两条线段的中点连成的线段处生成墙体;步骤S40,判断步骤S30中生成的墙体承载的门或窗的型号是否存在对应的门族类型或者窗族类型,若是,则在所述墙体处对应生成对应的门实例或者对应的窗实例,若否,则根据输入的门族或窗族以及获取的门信息或窗信息复制一个新的门族类型或窗族类型,并添加属性;步骤S50,判断每条门窗图层的线段是否都经过处理,如否,则执行步骤S20。The second aspect of the embodiment of the present application provides a method for extracting CAD information to generate a door and window model, matching the wall model generated by the above-mentioned method for extracting CAD information to generate a wall model, including: Step S10: Read the built-in door and window Family and all door and window family types, select a built-in wall type as a copy template, obtain the wall layer, each line segment and curve of the door and window layer, and the text information of the door and window information layer, and read and input the bottom of the wall where the door and window are located Top constraint, bottom top offset, height from the ground and family of each door and window model, select the first family type of the door and window family as the copy template; step S20: obtain the line segment of each door and window layer; step S30: determine Whether it intersects with the line segment of the wall layer at the same time, if not, execute step S20, if so, generate a wall at the line segment formed by the midpoints of the two line segments; step S40, judge the wall generated in step S30 Whether the model of the door or window carried by the body has a corresponding door family type or window family type, if so, then generate a corresponding door instance or a corresponding window instance at the wall, if not, according to the input door family type Or window family and obtained door information or window information copy a new door family type or window family type, and add attributes; step S50, judge whether the line segments of each door and window layer have been processed, if not, then perform step S20 .

本申请实施例的第三方面提供了一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在计算机设备上运行的计算机程序,所述处理器执行所述计算机程序时实现提取CAD信息生成墙体模型或门窗模型的方法的步骤。A third aspect of the embodiments of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and operable on the computer device. When the processor executes the computer program, extracting Steps in a method for generating a wall model or a door and window model from CAD information.

本申请实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现第一方案或第二方案提供的提取CAD信息生成墙体模型或门窗模型方法的各步骤。The fourth aspect of the embodiments of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the extraction provided by the first solution or the second solution is realized. Each step of the method for generating a wall model or a door and window model from the CAD information.

实施本申请实施例提供的一种提取CAD信息生成墙体模型或门窗模型的方法、设备及介质具有以下有益效果:Implementing a method, device and medium for extracting CAD information to generate a wall model or a door and window model provided by the embodiment of the present application has the following beneficial effects:

本申请实施例利用编程批量自动生成相同规则的墙体模型或门窗模型,提升建模效率与准确率。The embodiment of the present application uses programming to automatically generate wall models or door and window models with the same rules in batches to improve modeling efficiency and accuracy.

附图说明Description of drawings

为了更清楚地说明本发明实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the accompanying drawings that need to be used in the descriptions of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only of the present invention. For some embodiments, those of ordinary skill in the art can also obtain other drawings based on these drawings without paying creative efforts.

图1为本发明实施例提供的一种提取CAD信息生成墙体模型方法的实现流程图;Fig. 1 is the implementation flow diagram of a kind of extraction CAD information generation wall body model method that the embodiment of the present invention provides;

图2为本发明实施例提供的一种提取CAD信息生成门窗模型的方法的实现流程图;Fig. 2 is the implementation flowchart of a kind of method that extracts CAD information and generates door and window model provided by the embodiment of the present invention;

图3为本发明实施例提供的一种计算机设备的结构框图。FIG. 3 is a structural block diagram of a computer device provided by an embodiment of the present invention.

具体实施方式Detailed ways

为了使本发明所要解决的技术问题、技术方案及有益效果更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

参照图1所示,图1示出了本申请实施例提供的一种提取CAD信息生成墙体模型方法的实现流程图。一种提取CAD信息生成墙体模型方法,包括:步骤S1:读取输入的目标模型的信息以及内置模型的信息,选择预设模型的一个墙体图层作为复制模板;步骤S2:获取所述墙体图层内每一线段,并设定一平行线标号变量初始化标识每一处理后的线段;步骤S3:筛选剩余未被标识的线段;步骤S4:判断未被标识的线段中两条线段是否平行,线段之间的距离是否吻合步骤S1中输入的目标模型的信息,若是,则在两条线段之间生成墙体模型,并将该两条线段添加标识处理,若否,则执行步骤S3;步骤S5:判断每条线段是否都经过处理,若是,则根据步骤S1中输入的目标模型的信息修改生成的所述墙体模型,若否,则执行步骤S2。Referring to FIG. 1 , FIG. 1 shows an implementation flow chart of a method for extracting CAD information to generate a wall model provided by an embodiment of the present application. A method for extracting CAD information to generate a wall model, comprising: step S1: read the information of the input target model and the information of the built-in model, and select a wall layer of the preset model as a copy template; step S2: obtain the For each line segment in the wall layer, set a parallel line label variable to initialize and identify each processed line segment; step S3: filter the remaining unmarked line segments; step S4: judge two line segments among the unmarked line segments Whether it is parallel, whether the distance between the line segments matches the information of the target model input in step S1, if so, generate a wall model between the two line segments, and add identification to the two line segments, if not, perform the step S3; Step S5: Determine whether each line segment has been processed, if yes, modify the generated wall model according to the information of the target model input in step S1, if not, execute step S2.

详细的,步骤S1中选择预设模型的一个墙体图层作为复制模板之前包括判断所要生成墙体模型的族类型是否存在,若不存在,则复制一个新的墙体族类型并修改墙体厚度;步骤S4中判断未被标识的线段中两条线段是否平行,线段之间的距离是否吻合步骤S1中输入的目标模型的信息具体为先判断两条线段是否平行,再计算两条线段之间的距离,之后判断两条线段之间位置是否交错,如果满足了平行、不交错的条件,且距离值吻合输入目标模型的信息,则将线段的标号代入正确线段标号变量;在两条线段之间生成墙体模型具体为若平行线标号变量值发生改变,则成功匹配,获取匹配的两条线段,复制其中一条线段,并取其在该平面指向另一线段的单位法向量,然后使复制的线段沿着法向量方向移动厚度的一半距离,从而得到两条线段的中间线,以此中间线和墙体族类型生成墙体模型。In detail, before selecting a wall layer of the preset model as the copy template in step S1, it is necessary to judge whether the family type of the wall model to be generated exists, if not, copy a new wall family type and modify the wall Thickness; in step S4, it is judged whether the two line segments in the unmarked line segment are parallel, and whether the distance between the line segments matches the information of the target model input in step S1. Then judge whether the positions of the two line segments are staggered. If the conditions of parallelism and non-staggering are met, and the distance value matches the information of the input target model, then the label of the line segment is substituted into the correct line segment label variable; Specifically, if the variable value of the parallel line label changes, then the matching is successful, obtain the two matched line segments, copy one of the line segments, and take its unit normal vector pointing to the other line segment on the plane, and then use The copied line segment is moved half the distance along the normal vector direction to obtain the middle line of the two line segments, and the wall model is generated with the middle line and the wall family type.

另外,在本实施例中,通俗的叙述本提取CAD信息生成墙体模型方法如下:In addition, in this embodiment, the popular description of the method for extracting CAD information to generate a wall model is as follows:

首先获取内置的所有标高传递到前端弹窗供用户选择墙体模型的底部、顶部约束,并且同时可以在弹窗输入要生成墙体模型的厚度和底部、顶部偏移信息。再导入的CAD图纸中的墙体图层至系统,系统从导入的CAD图纸中获取墙体图层的所有线段,然后判断所要生成墙体模型的族类型是否存在,若不存在则复制一个新的墙体族类型并修改墙体厚度;然后对墙体图层的所有线段(线段A)进行循环读取,设定一个平行线标号变量初始化,在此循环内对未被处理的线段(线段B)进行循环读取,先判断两条线段是否平行,再计算两条线段之间的距离,之后判断两条线段之间位置是否交错,如果满足了平行、不交错的条件,且距离值等于用户输入的厚度值,则将线段的标号代入正确线段标号变量。子循环结束后,若平行线标号变量值发生改变,则成功匹配,获取匹配的两条线段,复制其中一条线段,并取其在该平面指向另一线段的单位法向量,然后使复制的线段沿着法向量方向移动厚度的一半距离,从而得到两条线段的中间线,以此中间线和墙体族类型生成墙体模型,最后根据最初用户输入的信息对墙体模型进行修改。如此实现批量自动生成相同规则的墙体模型的目的。在其他实施例中, 在生成墙体模块,墙体模型生成依据的中间线,可在绘制CAD图纸时手动绘制添加,再赋予特定的图层供后期识别即可,在此并不为限。Firstly, all the built-in elevations are obtained and passed to the front-end pop-up window for the user to select the bottom and top constraints of the wall model, and at the same time, the thickness and bottom and top offset information of the wall model to be generated can be input in the pop-up window. Then import the wall layer in the CAD drawing to the system, the system will get all the line segments of the wall layer from the imported CAD drawing, and then judge whether the family type of the wall model to be generated exists, if not, copy a new one The type of the wall family and modify the thickness of the wall; then read all the line segments (line segment A) of the wall layer in a loop, set a parallel line label variable initialization, and unprocessed line segments (line segment A) in this loop B) Perform cyclic reading, first determine whether the two line segments are parallel, then calculate the distance between the two line segments, and then determine whether the positions between the two line segments are interlaced, if the conditions of parallel and non-interlacing are met, and the distance value is equal to The thickness value input by the user, then substitute the label of the line segment into the variable of the correct line segment label. After the sub-loop ends, if the variable value of the parallel line label changes, the match is successful. Get the two matched line segments, copy one of the line segments, and take its unit normal vector pointing to the other line segment on the plane, and then make the copied line segment Move half the distance of the thickness along the direction of the normal vector to get the middle line of the two line segments, generate the wall model based on the middle line and the wall family type, and finally modify the wall model according to the initial user input information. In this way, the purpose of automatically generating wall models with the same rules in batches is realized. In other embodiments, in the wall generation module, the middle line based on which the wall model is generated can be manually drawn and added when drawing the CAD drawing, and then assigned a specific layer for later identification, which is not limited here.

详细的,本实施例中所使用的数学模型为:In detail, the mathematical model used in this embodiment is:

①判断两条线段是否平行:取两条线段的单位向量,若一条线段的单位向量等于另一线段的单位向量或其单位向量的反向量,则两条线段平行。① Determine whether two line segments are parallel: take the unit vectors of the two line segments, if the unit vector of one line segment is equal to the unit vector of the other line segment or its inverse, then the two line segments are parallel.

②计算一组平行线之间的距离:利用一条线中的一个点(取中点)到另一条边的距离,,即面积法。取A线段的中点和B线段的两个端点,连接形成两条新线段C、D;B、C、D三线段首尾相连形成一个以B线段为底、高线长度等于AB线段之间距离的三角形,利用三角形面积公式S=sqrt[p(p-a)(p-b)(p-c)],其中a,b,c为三角形三边长,p为三角形周长,sqrt为取平方根,算出面积后,再利用高 = 面积 * 2 / 底 即可得出所求的距离。②Calculate the distance between a set of parallel lines: use the distance from a point in one line (take the midpoint) to the other side, that is, the area method. Take the midpoint of line segment A and the two endpoints of line segment B, and connect them to form two new line segments C, D; the three line segments B, C, and D are connected end to end to form a line with B as the base and the length of the high line equal to the distance between the AB line segments For a triangle, use the triangle area formula S=sqrt[p(p-a)(p-b)(p-c)], where a, b, and c are the lengths of the three sides of the triangle, p is the perimeter of the triangle, and sqrt is the square root. After calculating the area, Then use height = area * 2 / base to get the distance you want.

③判断一组平行线位置是否交错:可取一组平行线中较短的一条线段(若长度相等则任意取其中一条线段)的中点,计算该中点到另一边的距离(若位置交错,则距离等于该中点跟另一线段的一个端点之间的距离),再计算两条平行线之间的距离,若两个距离不相等,则表示两条平行线位置交错。③Judging whether the positions of a group of parallel lines are staggered: You can take the midpoint of the shorter line segment in a group of parallel lines (if the lengths are equal, choose one of the line segments arbitrarily), and calculate the distance from the midpoint to the other side (if the positions are staggered, Then the distance is equal to the distance between the midpoint and an endpoint of another line segment), and then calculate the distance between the two parallel lines, if the two distances are not equal, it means that the two parallel lines are interlaced.

④取一线段在指定平面的指向其一条平行线的法向量:首先获取该线段的单位法向量(X,Y,Z),因为CAD导入生成的线段的Z坐标为0,所以根据法向量的计算公式可得其在平面内的两个法向量其中之一(Y,-X,Z),然后取该线段的一个端点和其平行线的中点,生成端点指向中点的一个向量,计算两个向量的点乘,若结果大于零,则以上求得法向量就是所求的法向量,否则取其反向量。④ Take the normal vector of a line segment pointing to a parallel line on the specified plane: first obtain the unit normal vector (X, Y, Z) of the line segment, because the Z coordinate of the line segment generated by CAD import is 0, so according to the normal vector The calculation formula can get one of its two normal vectors (Y, -X, Z) in the plane, and then take an end point of the line segment and the midpoint of its parallel line to generate a vector whose end point points to the midpoint, and calculate The dot product of two vectors, if the result is greater than zero, then the normal vector obtained above is the normal vector obtained, otherwise take its inverse.

参照图2所示,图2示出了本申请实施例提供的一种提取CAD信息生成门窗模型方法的实现流程图。一种提取CAD信息生成门窗模型方法,包括:步骤S10:读取内置的门窗族和所有的门窗族类型,选择一个内置墙类型作为复制模板,获取墙体图层,门窗图层的每一线段和曲线以及门窗信息图层的文字信息,读取输入门窗所在墙体的底部顶部约束、底部顶部偏移,每个门窗型号的离地高度以及族,选择所述门窗族的第一个族类型作为复制模板;步骤S20:获取每一门窗图层的线段;步骤S30:判断其是否同时与所述墙体图层的线段相交,若否,执行步骤S20,若是,则在两条线段的中点连成的线段处生成墙体;步骤S40,判断步骤S30中生成的墙体承载的门或窗的型号是否存在对应的门族类型或者窗族类型,若是,则在所述墙体处对应生成对应的门实例或者对应的窗实例,若否,则根据输入的门族或窗族以及获取的门信息或窗信息复制一个新的门族类型或窗族类型,并添加属性;步骤S50,判断每条门窗图层的线段是否都经过处理,如否,则执行步骤S20。Referring to FIG. 2 , FIG. 2 shows an implementation flow chart of a method for extracting CAD information to generate a door and window model provided by an embodiment of the present application. A method for extracting CAD information to generate a door and window model, comprising: Step S10: Read built-in door and window families and all door and window family types, select a built-in wall type as a copy template, obtain a wall layer, and each line segment of the door and window layer And the curve and the text information of the door and window information layer, read and input the bottom and top constraints of the wall where the doors and windows are located, the bottom and top offset, the height from the ground and the family of each door and window model, and select the first family type of the door and window family As a copy template; step S20: obtain the line segment of each door and window layer; step S30: judge whether it intersects with the line segment of the wall layer at the same time, if not, perform step S20, if so, in the middle of the two line segments A wall is generated at the line segment formed by the points; step S40, whether there is a corresponding door family type or window family type for the model of the door or window carried by the wall body generated in the judgment step S30, if so, corresponding at the wall Generate a corresponding door instance or a corresponding window instance, if not, copy a new door family type or window family type according to the input door family or window family and the obtained door information or window information, and add attributes; step S50, It is judged whether the line segments of each door and window layer have been processed, and if not, step S20 is executed.

另外,在本实施例中,通俗的叙述本提取CAD信息生成门窗模型方法如下:In addition, in this embodiment, the popular description of the method of extracting CAD information to generate door and window models is as follows:

首先提示用户分别点击导入的CAD图以获得墙体图层、门窗图层的线段曲线和以及门窗信息图层的文本,再获取内置的所有标高、门窗族传递到前端弹窗供用户设置墙体的底部、顶部约束以及各个门窗型号对应的族,同时用户可在弹窗输入墙体的底部、顶部偏移以及各个型号门窗对应的离地高度,然后获取墙体族类型和每一个门窗族的第一个族类型作为复制模板。对门窗图层中的线段进行循环读取,如果该线段同时与墙体图层中的两条线段相交,则该线段A就是门窗生成的大概位置,然后取与线段A相交的两条墙体图层线段的长度作为墙体厚度复制新的墙体族类型,取两中点连成线段B,以线段B和墙体族类型生成门窗所在的墙体模型,再根据用户输入的信息修改墙体模型。根据门窗在CAD图中的形状特点,如果线段A与门窗图层中的任意曲线相交,则线段A所在位置是门模型,反之则是窗模型。确定好门窗类别,再通过循环获取门窗信息图层的文本,计算文本位置与线段A的距离,获取与线段A距离最近的文本,即此处门或窗的型号。判断revit中是否有该型号对应的门或窗族类型,若没有则复制一个新的族类型并根据型号文本设置门窗的宽高尺寸,以该门窗族类型在对应墙体放置门窗模型。Firstly, the user is prompted to click the imported CAD drawing to obtain the wall layer, the line segment curve of the door and window layer, and the text of the door and window information layer, and then obtain all the built-in elevations, door and window families and transfer them to the front-end pop-up window for the user to set the wall At the same time, the user can enter the bottom and top offsets of the wall and the height above the ground corresponding to each type of door and window in the pop-up window, and then obtain the wall family type and each door and window family The first family type acts as a template for cloning. Circularly read the line segment in the door and window layer. If the line segment intersects with two line segments in the wall layer at the same time, then the line segment A is the approximate position where the door and window are generated, and then take the two walls that intersect with line segment A The length of the line segment of the layer is used as the thickness of the wall to copy the new wall family type, take two midpoints to connect line segment B, use line segment B and the wall family type to generate the wall model where the doors and windows are located, and then modify the wall according to the information entered by the user body model. According to the shape characteristics of doors and windows in the CAD drawing, if line segment A intersects any curve in the door and window layer, the position of line segment A is the door model, otherwise it is the window model. Determine the type of door and window, and then obtain the text of the door and window information layer through a loop, calculate the distance between the text position and line segment A, and obtain the text closest to line segment A, that is, the model of the door or window here. Determine whether there is a door or window family type corresponding to the model in Revit, if not, copy a new family type and set the width and height dimensions of the door and window according to the model text, and place the door and window model on the corresponding wall with the door and window family type.

图3是本申请一实施例提供的一种计算机设备的结构框图。该实施例的计算机设备40包括:处理器41、存储器42以及存储在所述存储器42中并可在所述处理器41 上运行的计算机程序43,例如提取CAD信息生成墙体模型或门窗模型的方法的程序。处理器41执行所述计算机程序43时实现上述各个提取CAD信息生成墙体模型或门窗模型的方法各实施例中的步骤。Fig. 3 is a structural block diagram of a computer device provided by an embodiment of the present application. The computer device 40 of this embodiment includes: a processor 41, a memory 42, and a computer program 43 stored in the memory 42 and operable on the processor 41, such as extracting CAD information to generate a wall model or a door and window model method of procedure. When the processor 41 executes the computer program 43, the steps in the above embodiments of the method for extracting CAD information to generate a wall model or a door and window model are realized.

示例性的,所述计算机程序43可以被分割成一个或多个模块,所述一个或者多个模块被存储在所述存储器42中,并由所述处理器41执行,以完成本申请。所述一个或多个模块可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序43在所述计算机设备40中的执行过程。Exemplarily, the computer program 43 can be divided into one or more modules, and the one or more modules are stored in the memory 42 and executed by the processor 41 to complete the present application. The one or more modules may be a series of computer program instruction segments capable of accomplishing specific functions, and the instruction segments are used to describe the execution process of the computer program 43 in the computer device 40 .

转台设备可包括,但不仅限于,处理器41、存储器42。本领域技术人员可以理解,图3仅仅是计算机设备40的示例,并不构成对计算机设备40的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述转台设备还可以包括输入输出设备、网络接入设备、总线等。The turntable device may include, but not limited to, a processor 41 and a memory 42 . Those skilled in the art can understand that FIG. 3 is only an example of the computer device 40, and does not constitute a limitation to the computer device 40. It may include more or less components than those shown in the illustration, or combine certain components, or different components. , for example, the turntable device may also include an input and output device, a network access device, a bus, and the like.

所称处理器41可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-12Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、 分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The so-called processor 41 may be a central processing unit (Central Processing Unit, CPU), and may also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Off-the-shelf programmable gate array (Field-12 Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.

所述存储器42可以是所述计算机设备40的内部存储单元,例如计算机设备40的硬盘或内存。所述存储器42也可以是所述计算机设备40的外部存储设备,例如所述计算机设备40上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(SecureDigital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器42还可以既包括所述计算机设备40的内部存储单元也包括外部存储设备。所述存储器42用于存储所述计算机程序以及所述转台设备所需的其他程序和数据。所述存储器42还可以用于暂时地存储已经输出或者将要输出的数据。The memory 42 may be an internal storage unit of the computer device 40 , such as a hard disk or memory of the computer device 40 . The memory 42 can also be an external storage device of the computer device 40, such as a plug-in hard disk equipped on the computer device 40, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card , Flash Card (Flash Card), etc. Further, the memory 42 may also include both an internal storage unit of the computer device 40 and an external storage device. The memory 42 is used to store the computer program and other programs and data required by the turntable device. The memory 42 can also be used to temporarily store data that has been output or will be output.

在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述实施例中提取CAD信息生成墙体模型或门窗模型的方法。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for extracting CAD information to generate a wall model or a door and window model in the above embodiment is implemented.

本领域普通技术人员可以理解实现上述实施例提取CAD信息生成墙体模型或门窗模型的方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它计算机可读存储介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。Those of ordinary skill in the art can understand that all or part of the flow in the method for extracting CAD information to generate a wall model or a door and window model in the above embodiment can be completed by instructing related hardware through a computer program, and the computer program can be stored In a computer-readable storage medium, the computer program may include the processes of the above-mentioned method embodiments when executed. Wherein, any reference to memory, storage, database or other computer-readable storage medium used in the various embodiments provided in the present application may include non-volatile and/or volatile memory. Nonvolatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Chain Synchlink DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention should be included in the protection of the present invention. within range.

Claims (8)

1.一种提取CAD信息生成墙体模型的方法,其特征在于,包括:1. A method for extracting CAD information to generate a wall model, characterized in that, comprising: 步骤S1:读取输入的目标模型的信息以及内置模型的信息,选择预设模型的一个墙体图层作为复制模板;Step S1: Read the information of the input target model and the information of the built-in model, and select a wall layer of the preset model as a copy template; 步骤S2:获取所述墙体图层内每一线段,并设定一平行线标号变量初始化标识每一处理后的线段;Step S2: Obtain each line segment in the wall layer, and set a parallel line label variable to initialize and identify each processed line segment; 步骤S3:筛选剩余未被标识的线段;Step S3: Screening the remaining unidentified line segments; 步骤S4:判断未被标识的线段中两条线段是否平行,线段之间的距离是否吻合步骤S1中输入的目标模型的信息,若是,则在两条线段之间生成墙体模型,并将该两条线段添加标识处理,若否,则执行步骤S3;Step S4: Determine whether the two line segments in the unidentified line segments are parallel, and whether the distance between the line segments matches the information of the target model input in step S1, if so, generate a wall model between the two line segments, and Two line segments add identification processing, if not, then execute step S3; 步骤S5:判断每条线段是否都经过处理,若是,则根据步骤S1中输入的目标模型的信息修改生成的所述墙体模型,若否,则执行步骤S2。Step S5: Determine whether each line segment has been processed, if yes, modify the generated wall model according to the information of the target model input in step S1, if not, execute step S2. 2.根据权利要求1所述提取CAD信息生成墙体模型的方法,其特征在于,步骤S1中目标模型的信息包括墙体模型的厚度和底部、顶部的偏移信息,内置模型的信息包括墙体模型的底部、顶部约束。2. The method for extracting CAD information according to claim 1 to generate a wall model is characterized in that the information of the target model in step S1 includes the thickness of the wall model and the offset information of the bottom and top, and the information of the built-in model includes wall Bottom and top constraints of the body model. 3.根据权利要求1所述提取CAD信息生成墙体模型的方法,其特征在于,步骤S1中选择预设模型的一个墙体图层作为复制模板之前包括判断所要生成墙体模型的族类型是否存在,若不存在,则复制一个新的墙体族类型并修改墙体厚度。3. The method for extracting CAD information according to claim 1 to generate a wall model is characterized in that, before selecting a wall layer of a preset model as a copy template in step S1, it is characterized in that it is judged whether the family type of the wall model to be generated is Exists, if not, copy a new wall family type and modify the wall thickness. 4.根据权利要求1所述提取CAD信息生成墙体模型的方法,其特征在于,步骤S4中判断未被标识的线段中两条线段是否平行,线段之间的距离是否吻合步骤S1中输入的目标模型的信息具体为先判断两条线段是否平行,再计算两条线段之间的距离,之后判断两条线段之间位置是否交错,如果满足了平行、不交错的条件,且距离值吻合输入目标模型的信息,则将线段的标号代入正确线段标号变量。4. extract the method for CAD information generation wall body model according to claim 1, it is characterized in that, in the step S4, judge whether two line segments in the line segment that is not identified are parallel, whether the distance between the line segments coincides with the input in the step S1 The information of the target model is to first judge whether the two line segments are parallel, then calculate the distance between the two line segments, and then judge whether the positions of the two line segments are staggered. If the conditions of parallel and non-staggered are met, and the distance value matches the input The information of the target model, then substitute the label of the line segment into the variable of the correct line segment label. 5.根据权利要求4所述提取CAD信息生成墙体模型的方法,其特征在于,在两条线段之间生成墙体模型具体为若平行线标号变量值发生改变,则成功匹配,获取匹配的两条线段,复制其中一条线段,并取其在该平面指向另一线段的单位法向量,然后使复制的线段沿着法向量方向移动厚度的一半距离,从而得到两条线段的中间线,以此中间线和墙体族类型生成墙体模型。5. The method for extracting CAD information according to claim 4 to generate a wall model is characterized in that generating the wall model between two line segments is specifically if the parallel line label variable value changes, then successfully matches, and obtains the matched Two line segments, copy one of the line segments, and take the unit normal vector pointing to the other line segment in the plane, and then move the copied line segment along the direction of the normal vector for half the thickness, so as to obtain the middle line of the two line segments, as This midline and wall family type generates a wall model. 6.一种提取CAD信息生成门窗模型的方法,匹配于通过权利要求1至5任一所述提取CAD信息生成墙体模型的方法生成的墙体模型,其特征在于,包括:6. A method for extracting CAD information to generate a door and window model, matching the wall model generated by the method for extracting CAD information to generate a wall model according to any one of claims 1 to 5, characterized in that, comprising: 步骤S10:读取内置的门窗族和所有的门窗族类型,选择一个内置墙类型作为复制模板,获取墙体图层,门窗图层的每一线段和曲线以及门窗信息图层的文字信息,读取输入门窗所在墙体的底部顶部约束、底部顶部偏移,每个门窗型号的离地高度以及族,选择所述门窗族的第一个族类型作为复制模板;Step S10: Read the built-in door and window family and all door and window family types, select a built-in wall type as a copy template, obtain the wall layer, each line segment and curve of the door and window layer, and the text information of the door and window information layer, read Take the bottom and top constraints, bottom and top offsets of the wall where the doors and windows are located, the height from the ground and the family of each door and window model, and select the first family type of the door and window family as the copy template; 步骤S20:获取每一门窗图层的线段;Step S20: Obtain the line segment of each door and window layer; 步骤S30:判断其是否同时与所述墙体图层的线段相交,若否,执行步骤S20,若是,则在两条线段的中点连成的线段处生成墙体;Step S30: judging whether it intersects with the line segment of the wall layer at the same time, if not, execute step S20, if yes, generate a wall at the line segment formed by the midpoints of the two line segments; 步骤S40,判断步骤S30中生成的墙体承载的门或窗的型号是否存在对应的门族类型或者窗族类型,若是,则在所述墙体处对应生成对应的门实例或者对应的窗实例,若否,则根据输入的门族或窗族以及获取的门信息或窗信息复制一个新的门族类型或窗族类型,并添加属性;Step S40, judging whether the model of the door or window carried by the wall generated in step S30 has a corresponding door family type or window family type, and if so, correspondingly generate a corresponding door instance or a corresponding window instance at the wall , if not, copy a new door family type or window family type according to the input door family or window family and the obtained door information or window information, and add attributes; 步骤S50,判断每条门窗图层的线段是否都经过处理,如否,则执行步骤S20。Step S50, judging whether the line segments of each door and window layer have been processed, if not, go to step S20. 7.一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至6任一项所述方法的步骤。7. A computer device, comprising a memory, a processor, and a computer program stored in the memory and operable on the processor, characterized in that, when the processor executes the computer program, the computer program according to claim The step of any one of 1 to 6. 8.一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至6任一项所述方法的步骤。8. A computer-readable storage medium, the computer-readable storage medium storing a computer program, characterized in that, when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are realized .
CN202310008828.0A 2023-01-04 2023-01-04 Method, equipment and medium for extracting CAD information to generate wall model or door window model Pending CN116680768A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310008828.0A CN116680768A (en) 2023-01-04 2023-01-04 Method, equipment and medium for extracting CAD information to generate wall model or door window model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310008828.0A CN116680768A (en) 2023-01-04 2023-01-04 Method, equipment and medium for extracting CAD information to generate wall model or door window model

Publications (1)

Publication Number Publication Date
CN116680768A true CN116680768A (en) 2023-09-01

Family

ID=87789685

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310008828.0A Pending CN116680768A (en) 2023-01-04 2023-01-04 Method, equipment and medium for extracting CAD information to generate wall model or door window model

Country Status (1)

Country Link
CN (1) CN116680768A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117252869A (en) * 2023-11-15 2023-12-19 江西少科智能建造科技有限公司 CAD drawing wall path information extraction method and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117252869A (en) * 2023-11-15 2023-12-19 江西少科智能建造科技有限公司 CAD drawing wall path information extraction method and system
CN117252869B (en) * 2023-11-15 2024-03-12 江西少科智能建造科技有限公司 CAD drawing wall path information extraction method and system

Similar Documents

Publication Publication Date Title
WO2022213515A1 (en) Method and device for simulating circuit
CN110264502A (en) Point cloud registration method and device
CN113793351B (en) Laser filling method and device for multilayer outline pattern based on contour lines
CN112800527B (en) Construction information model-based structural beam steel bar information generation method and related device
CN112507938B (en) A geometric feature calculation method and recognition method and device for text primitives
CN111310254B (en) CAD legend identification method and device, storage medium and electronic equipment
US20240273849A1 (en) Deformation-based generation of curved meshes
WO2020237508A1 (en) Assertion validation code binding method and apparatus
US20240070979A1 (en) Method and apparatus for generating 3d spatial information
TW202113656A (en) Methods and systems to perform automated integrated fan-out wafer level package routing
CN116680768A (en) Method, equipment and medium for extracting CAD information to generate wall model or door window model
US8718382B2 (en) Scalable pattern matching between a pattern clip and a pattern library
CN109448115B (en) Processing method and device of three-dimensional model and computer equipment
CN116071516A (en) Method and system for three-dimensional modeling
CN115272605A (en) Pick-up method, device, equipment and storage medium for three-dimensional model components
Huang et al. Handling orientation and aspect ratio of modules in electrostatics-based large scale fixed-outline floorplanning
CN118331002B (en) SRAF insertion rule construction method and system based on reverse lithography technology
CN110765513B (en) Connection node placement method and products for wall keel model and L-shaped roof guide beam model
CN116817812A (en) Device package detection method, device, equipment and storage medium
CN115270242B (en) BIM-based basic big sample reinforcement map generation method, equipment and readable medium
US7073152B2 (en) System and method for determining a highest level signal name in a hierarchical VLSI design
CN114912401B (en) Method, electronic device and storage medium for improving PCB board design efficiency
CN106528946B (en) A kind of method of batch insertion AutoCAD segment
CN118251676A (en) Multi-instantiation block modeling of circuit element layout in an integrated circuit
US20180203952A1 (en) Non-transitory computer-readable recording medium recording detour wiring check program, detour wiring check method, and information processing apparatus

Legal Events

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