Detailed instructions

Step by step

Step 1

Create a HTML page with an Input FileUpload Object. We'll call our input myFile.

<!DOCTYPE html>
<html>
<body>
  <h3>Example</h3>
  <input type="file" id="myIfcFile">
  <button onclick="myFile()">Click me</button>
  <script>
    function myFunction() {
      // TODO
    }
  </script>
</body>
</html>

Step 2

Make sure you include TBW before your main function.

Step 3

Get the selected file using a classical DOM selector. See Using files from web applications for more information.

Step 4

Use the FileReader API to read the content of the IFC file. We will assume that the input is a correct IFC file. In other words, we will assume that the file contains text. That's why we call reader.readAsText(file).

Step 5

The onload property will handle the actual reading of the file. See FileReader.onload for more info. Notice that we split each line.

Step 6

Use BIMWHALE.js. by:

  1. Creating a new BIMWHAlE object

  1. Calling the method parseIfcFile()

Final result

The final result should look like this:

Simply log the IFC Entities like this:

Last updated