You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When it comes to deal with BIM models there are two important aspects: geometry and information. The latter is so important we have developed a dedicated component to help you in the process of creating, deleting, and editing information in your BIM models. Let's dive in!
5
+
6
+
### 🏗️ Scaffolding the Project
7
+
---
8
+
Before we even do something with the properties in your IFC file, let's import the necessary dependencies and programatically load a file in memory using `@thatopen/components` IfcLoader as follows:
You have two ways to create a new IfcPropertySet: by using the IfcPropertiesManager or using WebIFC. The properties manager component includes some methods that acts as wrappers around instancing IFC entities with WebIFC, which makes easier to create them. Those wrapper method were made for the most common entities you probably want to create, which are IfcPropertySet and IfcPropertySingleValue. However, if you want to have full control over which entities do you create, then is better to stick with WebIFC as a preferred solution. Let's see how to use it in conjunction with the IfcPropertiesManager:
The most important thing to know when creating a new entity using WebIFC is that it comes without an expressID. Well, it comes with an expressID but its -1, which is not a valid expressID. So, why it comes with an invalid expressID? Easy, because it doesn't know the IFC where the entity will be added, so its our job to determine the expressID to be applied to it. Typically, the expressID will be the next number of the latest expressID found in the file. Appart of that, the entity must be added to the corresponding model information. To help you with the process so you don't have to do it all by yourself, the IfcPropertiesManager comes with a handy method as follows:
59
+
*/
60
+
61
+
// This not only adds the entity to the model, but it also determines a valid expressID
62
+
awaitpropsManager.setData(model,newPset);
63
+
64
+
/* MD
65
+
:::tip
66
+
67
+
You should always use the method above immediately after a new entity has been created as most information operations are based on expressIDs!
68
+
69
+
:::
70
+
71
+
Let's now create a property and add it to the property set:
As the property set has been created with a valid property, the next logical step is to add the set to the elements we want. Surprisingly, this job doesn't belong to the IfcPropertiesManager, but to the IfcRelationsIndexer! The reason is because when it comes to add a property set to another entity, what happens behind the scenes is a new IfcRelation has to be created. Everything that has to be with IfcRelations is managed by the IfcRelationsIndexer, and you can do it as follows:
When you relate entities with the IfcRelationsIndexer, the corresponding IfcRelations are not created directly in the IFC file but in its relations maps; in other words, the only thing created is the definition of how both entities relates to each other. That means, you can't expect to have the IfcRelation in the file right away; the IfcRelation is only created when you export the file (see down below the tutorial). If you're new to the IfcRelationsIndexer, check the corresponding tutorial!
108
+
109
+
:::
110
+
111
+
### ⚠️ Modifying Existing Entity Attributes
112
+
---
113
+
Usually we not only have to create new data in the model, but also to modify existing. This process is extremely simple, and can be done as follows:
Just as adding data to the model, sometimes you need to delete information. Just as before, this process is really straightforward and you can go as follows:
132
+
*/
133
+
134
+
awaitmodel.setProperties(243,null);
135
+
propsManager.registerChange(model,243);
61
136
62
-
awaitpropertiesManager.setData(model,ifcTask);
137
+
/* MD
138
+
:::info
139
+
140
+
Deleting data is not just removing the entity from the IFC file; for example, if you want to delete a wall, then you should also remove all the entities that defines its shape, its properties, etc, as they are no longer needed. So, many times, deleting one single entity should lead to deleting many others. Right now the engine doesn't have the tools to do it, but we're working on it! Stay tuned 😉
141
+
142
+
:::
143
+
144
+
### ⏬ Exporting the Modified Model
145
+
---
146
+
Lastly, you can use the IfcPropertiesManager to export the modified file! You can proceed as follows:
0 commit comments