Loading error in Rhino3dm.js

Hi @fraguada,

I get this error with the rhino3dmjs loader with 8.0.1 update as shown in the image.
Have also attached the github repo link just in case.

Uncaught (in promise) TypeError: onError is not a function
at main.js:170239:18

https://github.com/keshavanarayan/Digital-Twin/tree/debug


That error means you haven’t defined an error function for your loader reference. There is an error, but the 3dmloader doesn’t know what to do with it because you haven’t defined an error function.

From looking at your repo, you have something like this:

loader.load( 'path/to/model.3dm', function ( object ) {

       //...
    
    } );

it should be something like this:

loader.load( 'path/to/model.3dm', function ( object ) {

       // onLoad: object has loaded, do something with it
    
    }, function( progress ) {

       // onProgress: do something with progress info if you want

    }, function( error ) {

       // onError: do something with error. Good idea to have this, cause there is an error and the loader doesn't know how to tell you.
    
    }  );

Hi @fraguada @will

So I made the changes as you suggested and I got this error as attached.
Seems like a rhino3dm issue to me. Kindly guide me :sweat_smile:

The code is still up at this repo if you’d like to check.

GitHub - keshavanarayan/Digital-Twin at debug 1

@fraguada bumping this up. Just in case :sweat_smile:

Hi @fraguada,

This is the error that I get. I’m guessing this is a rhino3dm issue.

doc.instanceDefinitions(…).count is not a function at decodeObjects

Do you have a sample file or data where this error shows up?

Any news about this issue? It is happening to me also! :slight_smile:

@rafadelmolino. That instanceDefinitions().count is not a function error inside decodeObjects is almost always a version mismatch between the three.js 3DMLoader.js and the rhino3dm library it loads, rather than a bug in rhino3dm itself (the current API exposes count as a property, which is what the loader expects).

Could you share:

  1. Your rhino3dm version and your three.js / 3DMLoader.js version (the mismatch is my leading suspect).
  2. How you load the library, e.g. your setLibraryPath(...) value or the CDN URL.
  3. A sample .3dm file that triggers the error, if possible.

Make sure the rhino3dm version matches the one the 3DMLoader in your three.js release was built against. If a matched pair still fails on a specific file, then it is a bug.

I recently released 8.32.1 and updated the loader as well.