Load model from local data

Hey there :slight_smile:

I want to add the functionality to my web-app to load a model (in my case a .3dm file).
For that, I took a look into the Three.js code editor (three.js/Loader.js at b524f4bca95169a2b197f8a68058e6c28abf416d · mrdoob/three.js · GitHub) and came up with this.

var fileInput = document.querySelector("#file-input");
var uploadedFile = "";
fileInput.addEventListener("change", function() {
    var reader = new FileReader();
    reader.addEventListener("load", function(event) {
        var contents = event.target.result;
	    const loader = new Rhino3dmLoader();
	    var object = loader.parse( contents );

But as it seems, that I am not even entering the reader.addEventListener.

The whole snippet is in this fiddle: Edit fiddle - JSFiddle - Code Playground

Could someone help me out what to do?

All the best!

There are a couple of issue in your code. Try it like so: Edit fiddle - JSFiddle - Code Playground

1 Like

Awesome, thank you very much for taking the time! :pray: