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:
Creating a new
BIMWHAlEobject
Calling the method
parseIfcFile()
Please note that the config object is missing at this moment.
Final result
The final result should look like this:
Please note that this code doesn't output the result. You won't see anything on your screen.
Simply log the IFC Entities like this:
Congratulations, you are now ready for the Simple Example.
Last updated