# Config

The `config` object consist of four **required** properties:

1. Required Entities
2. Selected Entities
3. Selected Property Sets
4. All Entities

The `config` object is passed into **BIMWHALE.js**'s constructor function as a paramter:

```javascript
new BIMWHALE.file(lines, config);
```

The [example](https://bimwhale.gitbook.io/bim-whale/getting-started/example/config) showed us the easiest way to pass in this object:

```javascript
var config = {
    requiredEntities:{
        IFCPROPERTYSINGLEVALUE: "IfcPropertySingleValue",
        IFCRELDEFINESBYPROPERTIES: "IfcRelDefinesByProperties",
        IFCPROPERTYSET: "IfcPropertySet",
    },
    selectedEntities:{
        IFCDOOR: "IfcDoor",
        IFCWALLSTANDARDCASE: "IfcWallStandardCase",
    },
    selectedPropertySets: ["Custom_Pset"],
    allEntities:{
          ...requiredEntities,
          ...selectedEntities,
    },
};
var file = document.getElementById('myFile').files[0];
var reader = new FileReader();
reader.onload = function(e) {
    var lines = e.target.result.split(/\r\n|\n/);
    var ifcFile = new BIMWHALE.file(lines, config);
    var ifcEntites = file.parseIfcFile();
};
reader.readAsText(file);
  
```

Notice that some properties are JavaScript objects as well.\
Here's a summary of the properties within the `Config` object:

| Property Name        | Type                       | Description                                                    |
| -------------------- | -------------------------- | -------------------------------------------------------------- |
| requiredEntities     | { \[key: string]: string } | Required IFC entites                                           |
| selectedEntities     | { \[key: string]: string } | Selected IFC entites                                           |
| selectedPropertySets | string\[ ]                 | Selected Property Sets                                         |
| allEntities          | { \[key: string]: string } | <p>All entities<br>( requiredEntities + selectedEntities )</p> |

### Required Entities

These are the required `IFC Entities`. **BIMWHALE.js** will not work without these.\
They are hardcoded into the logic. You should NOT change these.

```javascript
var requiredEntities = {
    IFCPROPERTYSINGLEVALUE: "IfcPropertySingleValue",
    IFCRELDEFINESBYPROPERTIES: "IfcRelDefinesByProperties",
    IFCPROPERTYSET: "IfcPropertySet",
};
```

### Selected Entities

These are the selected `IFC Entities`. There's no need to get all `IFC Entities`.\
For example, an architect may not be intrested in HVAC components.&#x20;

```javascript
var selectedEntities = {
    IFCDOOR: "IfcDoor",
    IFCWALLSTANDARDCASE: "IfcWallStandardCase",
};
```

This requires that you to have a basic understanding of the IFC schema and its entities.\
Here are two major categories:

* [Building Elements](https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcsharedbldgelements/entities.htm)
* [HVAC, Plumbing, Electrical, Fire](https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcsharedbldgserviceelements/entities.htm)

{% hint style="danger" %}
**Notice how the object is structured.**\
\
The **key** must be in uppercase. The **value** can have any form.
{% endhint %}

### Selected Property Sets

These are the selected `Property Sets`. Again, there's no need to get all `Property Sets`.\
Please notice that the logic is case senstive. The name must match exactly.

```javascript
var selectedPropertySets = ["Custom_Pset"];
```

Leave the array empty to include all `Property Sets`

```javascript
var selectedPropertySets = [];
```

### All Entities

All entites are simply `requiredEntities` and `selectedEntities` combined. The [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) is used to join these objects.

```javascript
var allEntities = {
    ...requiredEntities,
    ...selectedEntities,
};
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bimwhale.gitbook.io/bim-whale/configuration/options.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
