A BIM model lightweight method for building space analysis
By building simplified door and window family files in the BIM model and replacing objects using the Revit API, the system lag problem caused by the large amount of BIM model data was solved, achieving lightweight operation without data loss and improving system operating efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NANTONG UNIV
- Filing Date
- 2022-10-08
- Publication Date
- 2026-04-10
AI Technical Summary
When loading BIM models in city-level scenarios, the large amount of data causes system lag, and existing lightweight methods may lead to data loss or model deviation.
By manually creating simplified door and window family files and mapping files, and using the Revit API for model manipulation, door and window objects can be directly replaced with simplified types in the BIM model, avoiding data loss caused by exporting IFC files.
This achieves lightweighting of the BIM model, ensures consistency between the model and the original model, improves system operating efficiency, and avoids data loss and deviation.
Smart Images

Figure CN115640630B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to a BIM model lightweight method, in particular to a BIM model lightweight method for building space analysis. BACKGROUND
[0002] At present, BIM technology has been widely applied to the fields of architecture, environmental protection, fire fighting, transportation, surveying and mapping, geographic information and digital city. In these applications, building models play a crucial role. However, the BIM model carries a large amount of data information, such as the layout of pipeline lines, the detailed structure of door and window structures and the like, and the data amount of a single building model often reaches the level of hundreds of megabytes. If thousands of such models are loaded in a city-level scene, the system will become extremely laggy.
[0003] In a single building BIM model, the door and window objects contain a large amount of details, and thus occupy a large part of the storage space (for example, a door can contain a door frame, a door leaf, a lock hole, a door handle and the like, which need to occupy a large amount of storage space for modeling). In most actual application scenarios (such as indoor evacuation path planning, sunshine analysis, air flow movement and the like), the complex geometric details of building components such as doors and windows are not needed to be concerned, and only the position and simple geometric contour of the building component are needed to be concerned. Therefore, it is urgent to take some method to perform lightweight processing on the BIM model to improve the running efficiency under the condition of ensuring the smooth progress of calculation and analysis. SUMMARY
[0004] In view of the problems existing in the prior art, the application provides a BIM model lightweight method for building space analysis, thereby solving the above technical problems.
[0005] In order to achieve the above purpose, the technical scheme adopted by the application is as follows: a BIM model lightweight method for building space analysis, comprising the following steps:
[0006] Step S1: according to the door and window sizes in the BIM model, a simplified door and window family file F and a mapping file are manually constructed, and the constructed family file F is loaded into the model.
[0007] Step S2: a method named Execute is defined, and system environment initialization is performed.
[0008] Step S3: an elevation object of a certain floor is obtained, and an elevation filter is created by taking the object as a parameter to filter the building components belonging to the floor.
[0009] Step S4: all door objects of the floor are extracted and saved in an element collector doorsOfLevels.
[0010] Step S5: Extract all window objects of the level and save them in the element collector windowsOfLevels.
[0011] Step S6: Call the TreatElements method to iterate over all door objects in doorsOfLevels and replace them with a simplified door family type.
[0012] Step S7: Call the TreatElements method to iterate over all window objects in windowsOfLevels and replace them with a simplified window family type.
[0013] Further, the Execute method in step S2 contains three parameters, an object commandData of type ExternalCommandData, an object message of type string, and an object elements of type ElementSet.
[0014] Further, the system environment initialization method in step S2 is as follows:
[0015] Step S21: Obtain an object uiApp of type UIApplication from the commandData object;
[0016] Step S22: Obtain an object doc of type Document from the uiApp object;
[0017] Step S23: Initialize an object collection of type ICollection <elementid>the object selectedElement, an object level1 of type Level, and an object collectorDoor of type FilteredElementCollector.
[0018] Further, the TreatElements method called in the steps S6 and S7 is specifically:
[0019] S61: define a transaction T;
[0020] S62: read the mapping file reflect.txt (which stores the family type names to be replaced and the family type names to be replaced into) and store the mapping data in an object doorRef of type Dictionary<string, string>;
[0021] S63: define an object doorNameMap of type Dictionary<string, FamilySymbol> to store the door and window family type names already existing in the system and their corresponding family type objects;
[0022] S64: traverse each object openingelement in elementsofLevels and replace openingelement with the simplified object.
[0023] Further, the specific steps in the step S64 include:
[0024] S641: get the position pt of the object openingelement;
[0025] S642: get the host wall object host of the object openingelement;
[0026] S643: get the family type name eleName to be replaced for the object openingelement from doorRef;
[0027] S644: call the method FamilySymbol GetElementType(string doorName, Document doc, string eleType) to find the corresponding family type object doorType from the BIM model according to the obtained family type name eleName;
[0028] S645: start the transaction T;
[0029] S646: delete the object openingelement;
[0030] S647: Call the method CreatElementInstance(Document doc0, Wall host0, XYZ pt0, FamilySymbol doorType0) to create a new object. The value of the parameter doc0 in the method is derived from the object doc in step S22; the value of the parameter host0 is derived from the object host in step S642; the value of the parameter pt0 is derived from the object pt in step S641; and the value of the parameter doorType0 is derived from the family type object doorType found in step S644.
[0031] S648: Commit the transaction T.
[0032] Further, the method GetElementType(string symbolName, Document doc, string eleType) in step S644 contains three parameters, namely the object symbolName of the type string, which is the family type name to be found and is derived from the object eleName in step S643; the object doc of the type Document, which is derived from the object doc in step S22; and the object eleType of the type string, which indicates whether the door type or the window type is to be simplified (the parameter value "door" represents a door, and the parameter value "window" represents a window).
[0033] Further, the specific method for finding the corresponding family type object from the BIM model in step S644 is as follows:
[0034] S6441: Define a temporary variable bCategory of the type BuiltInCategory;
[0035] S6444: Set the value of bCategory according to the parameter eleType. If the value is "door", set bCategory to BuiltInCategory.OST_Doors, otherwise set bCategory to BuiltInCategory.OST_Windows;
[0036] S6443: Obtain all family types of the type bCategory from the BIM model and store them in the set doorSymbols;
[0037] S6444: traversing each object elementSymbol of type FamilySymbol in doorSymbols, if the attribute Name of elementSymbol is equal to the parameter symbolName, then return the elementSymbol.
[0038] The beneficial effect of the present application is that, compared with other lightweight methods (such as BIM model lightweight based on IFC file), the method can operate the model based on the software interface, avoid the data loss caused by exporting the model into IFC and other intermediate files, so that the model after operation does not produce corresponding deviation from the original model. BRIEF DESCRIPTION OF DRAWINGS
[0039] Figure 1 The algorithm flowchart of the present application is shown in the figure;
[0040] Figure 2 The building floor component simplification mapping file based on Revit API of the present application is shown in the figure;
[0041] Figure 3 The simplified family file three-dimensional geometry used in the present application is shown in the figure;
[0042] Figure 4 The simplified door and window family type loaded into the BIM model of the present application is shown in the figure;
[0043] Figure 5 The comparison of door and window details before and after the method in the present application is shown in the figure. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical scheme and advantages of the present application more clear and obvious, the present application is further described in detail below by means of the figures and examples. However, it should be understood that the specific examples described herein are only used to explain the present application, and are not used to limit the scope of the present application.
[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs, and the terms used herein in the specification are only for the purpose of describing specific embodiments of the present application, and are not intended to limit the present application.
[0046] As shown in Figure 1 , Figure 2 , Figure 3 , Figure 4 and Figure 5 , a BIM model lightweight method for building space analysis includes the following steps:
[0047] Step 1: Based on the door and window dimensions in the BIM model, manually construct a simplified door and window family file F and a mapping file, and load the constructed family file F into the model.
[0048] Step 2: Define a method named Execute and initialize the system environment.
[0049] The relevant code is as follows:
[0050]
[0051] Step 3: Obtain the elevation object of a certain floor, and use this object as a parameter to create an elevation filter to filter the building components belonging to that floor.
[0052] In this embodiment, floor 1 (floor name: elevation 1) is selected as the operation object, and the relevant code is as follows:
[0053] / / Select 3 floors
[0054] Level level1 = new
[0055] FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels).OfCl
[0056] ass(typeof(Level)).WhereElementIsNotElementType().ToElements().Where(m=>
[0057] m.Name=="Level 1").ToList().FirstOrDefault()as Level;
[0058] Step 4: Extract all door objects for this floor and store them in the element collector doorsOfLevels.
[0059] ICollection <element>doorsOfLevels = new ElementCollector(Levels).OfClass(typeof(Door)).WherePasses(levelFilter).ToElements();
[0060] collectorDoor.WherePasses(levelFilter).OfClass(typeof(FamilyInstance)).Of
[0061] Category(BuiltInCategory.OST_Doors).ToElements();
[0062] Step 5: Extract all the window objects of this level and save them in the element collector windowsOfLevels.
[0063] / / 5 Extract windows
[0064] ICollection <element>windowsOfLevels =
[0065] collectorDoor.WherePasses(levelFilter).OfClass(typeof(FamilyInstance)).Of
[0066] Category(BuiltInCategory.OST_Windows).ToElements();
[0067] Step 6: Call the TreatElements method to iterate through all the door objects in doorsOfLevels and replace them with simplified door objects. The relevant code is as follows:
[0068] / / 6 Replace doors
[0069] TreatElements(doorsOfLevels, doc, "door");
[0070] Step 7: Call the TreatElements method to iterate through all the window objects in windowsOfLevels and replace them with simplified window objects. The relevant code is as follows:
[0071] / / 7 Replace windows
[0072] TreatElements(windowsOfLevels, doc, "window");
[0073] In the preferred embodiment of the present example, the TreatElements method called in steps 6 and 7 is specifically defined as: TreatElements(ICollection <element>Levels, Document doc, string eleType); this method takes three parameters, an ICollection of Levels, a Document, and a string eleType <element>The object set elementsofLevels stores the door and window objects to be simplified; the object doc of type Document, the object eleType of type string, which indicates whether the door type or the window type is to be simplified (the parameter value "door" represents the door, and the parameter value "window" represents the window). The relevant code is as follows:
[0074]
[0075]
[0076] The configuration file used in the embodiment is as shown in Figure 2 Each line represents a set of family type mapping. The left side of the symbol "|" represents the family type to be replaced, and the right side represents the family instance to be replaced (i.e. the simplified family instance). For example, according to the first line mapping, the door with the family type name M0921 is replaced by the door with the family type name JYM_900x2100mm.
[0077] The custom method FamilySymbol GetElementType(string symbolName, Document doc, string eleType) mainly finds the corresponding family type from the BIM model, and contains three parameters, which are: the object symbolName of type string, which is the family type name to be found; the object doc of type Document; and the object eleType of type string, which indicates whether the door type or the window type is to be simplified (the parameter value "door" represents the door, and the parameter value "window" represents the window). The specific implementation is as follows:
[0078]
[0079] Compared with other lightweight methods (such as the BIM model lightweight method based on the IFC file), the method can operate the model based on the software interface, avoids the data loss caused by exporting the model into the intermediate file such as IFC, and makes the operated model not deviate from the original model.
[0080] The above only describes the preferred embodiments of the present application and is not used to limit the present application. Any modification, equivalent replacement or improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.< / element> < / element> < / element> < / element> < / elementid>
Claims
1.A method for lightweighting a BIM model for building space analysis, characterized in that, The method comprises the following steps: Step S1: Manually constructing a simplified door and window family file F and a mapping file according to the door and window sizes in the BIM model, and loading the constructed family file F into the model; Step S2: Defining a method named Execute and initializing the system environment; Step S3: Obtaining an elevation object of a certain floor, and creating an elevation filter with the object as a parameter to filter the building components belonging to the floor; Step S4: Extracting all door objects of the floor and saving them in an element collector doorsOfLevels; Step S5: Extracting all window objects of the floor and saving them in an element collector windowsOfLevels; Step S6: Calling the TreatElements method to traverse all door objects in doorsOfLevels and replacing the door objects with a simplified door family type; Step S7: Calling the TreatElements method to traverse all window objects in windowsOfLevels and replacing the window objects with a simplified window family type; The Execute method in step S2 comprises three parameters, namely an object commandData of the type ExternalCommandData, an object message of the type string, and an object elements of the type ElementSet; The system environment initialization method in step S2 is specifically as follows: Step S21: Obtaining an object uiApp of the type UIApplication from the commandData object; Step S22: Obtaining an object doc of the type Document from the uiApp object; Step S23: initialize the type as ICollection <elementid>An object selectedElement of the type Level, an object level1 of the type Level, and an object collectorDoor of the type FilteredElementCollector;< / elementid> The TreatElements method called in steps S6 and S7 is specifically as follows: S61: Defining a transaction T; S62: Reading a mapping file reflect.txt, which stores the family type names to be replaced and the family type names to be replaced, and storing the mapping data in an object doorRef of the type Dictionary<string, string>; S63: Defining an object doorNameMap of the type Dictionary<string, FamilySymbol> for storing the names of the existing door and window family types in the system and the corresponding family type objects; S64: Traversing each object openingelement in elementsofLevels and replacing openingelement with a simplified object; The specific steps in S64 comprise: S641: Obtain the position pt of the object openingelement; S642: Obtain the host wall object host of the object openingelement; S643: Obtain the family type name eleName to be replaced by the object openingelement from doorRef; S644: Call the method FamilySymbol GetElementType(string doorName, Document doc, string eleType) according to the obtained family type name eleName to find the corresponding family type object doorType from the BIM model; S645: Start the transaction T; S646: Delete the object openingelement; S647: Call the method CreatElementInstance(Document doc0, Wall host0, XYZ pt0, FamilySymbol doorType0) to create a new object; wherein the value of the parameter doc0 in the method is derived from the object doc in step S22; the value of the parameter host0 is derived from the object host in step S642; the value of the parameter pt0 is derived from the object pt in step S641, and the value of the parameter doorType0 is derived from the family type object doorType found in step S644; S648: Commit the transaction T; The method GetElementType(string symbolName, Document doc, string eleType) in step S644 contains three parameters, namely the object symbolName of type string, which is the family type name to be found, derived from the object eleName in step S643; the object doc of type Document, which is derived from the object doc in step S22; and the object eleType of type string, which indicates whether the door type or the window type is to be simplified, taking the value "door" or "window", with the parameter value "door" representing a door and the parameter value "window" representing a window; Further, the specific method for finding the corresponding family type object from the BIM model in step S644 is as follows: S6441: Define a temporary variable bCategory of type BuiltInCategory; S6444: Set the value of bCategory according to the parameter eleType, if the value is "door", then set bCategory to BuiltInCategory.OST_Doors, otherwise set it to BuiltInCategory.OST_Windows; S6443: Get all family types with type bCategory from the BIM model, stored in the set doorSymbols; S6444: Traverse each object elementSymbol with type FamilySymbol in doorSymbols, if the attribute Name of elementSymbol is equal to the parameter symbolName, return the elementSymbol.
Citation Information
Patent Citations
Information model geometric lightweight method based on component reuse and reassembly
CN113158288A
Door generation method and device based on Revit platform
CN113722804A