mcneel / rhino3dm

Libraries based on OpenNURBS with a RhinoCommon style
MIT License
616 stars 139 forks source link

3DMLoader.js error when attempting to load a 3DM model in Vue #359

Closed alfarok closed 3 years ago

alfarok commented 3 years ago

Hello!

I am attempting to use the out-of-the-box 3DM loader provided with three (three/examples/jsm/loaders/3DMLoader) but keep getting the following error:

image

which I believe occurs here.

I tested other loaders and several different approaches to loading the rhino3dm dependencies but no luck so far. I verified I can load my 3D model using the three editor so it could be a vue/webpack configuration issue?

Here is the basic logic I was following from the three example:

import { Rhino3dmLoader } from 'three/examples/jsm/loaders/3DMLoader';

const rhinoLoader = new Rhino3dmLoader(),

rhinoLoader.setLibraryPath('https://cdn.jsdelivr.net/npm/rhino3dm@0.15.0-beta/');

rhinoLoader.load(
    'mesh.3dm',

        // main callback
        function ( object: any ) {
          console.log(object)
        },
        // onProgress callback
        function ( xhr: { loaded: number; total: number; } ) {
          console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
        },
        // onError callback
        function ( err: any ) {
          console.error( err );
        }
);

Any feedback or hints would be greatly appreciated, thanks!

alfarok commented 3 years ago

Issue resolved!