xeokit / xeokit-sdk

Open source JavaScript SDK for viewing high-detail, full-precision 3D BIM and AEC models in the Web browser.
https://xeokit.io
Other
728 stars 288 forks source link

Fix XML3DLoaderPlugin error logging for unsupported 3DXML version #661

Closed Fillo22 closed 3 years ago

Fillo22 commented 3 years ago

Describe the bug Changing the default 3dxml file with a new one cause in some cases an error that prevents the model from loading. Not all files create this behavior. I have attached both the working and the non working file

To Reproduce

  1. Change the default file with another (attached in the issue).

Expected behavior The 3dxml model is loaded and visible

Screenshots image

Desktop (please complete the following information):

Additional context This is the code that is facing the problem:

const viewer = new Viewer({
    canvasId: "myCanvas",
    transparent: true
});

var plugin = new XML3DLoaderPlugin(viewer, {
    id: "XML3DLoader",
    workerScriptsPath : "/javascripts/zipjs/"
});

var model = plugin.load({ // Model is an Entity
    id: "myModel",
    src: "/models/caster.3dxml",
    scale: [0.1, 0.1, 0.1],
    rotate: [90, 0, 0],
    translate: [100,0,0],
    edges: true,
    createMetaModel: true
});

And the files: models.zip

xeolabs commented 3 years ago

Hi, this was a bug with how XKT3DPlugin reports an unsupported 3DXML format verson. The plugin is supposed to build an error message that lists the supported versions, but while doing that referenced an undefined variable.

This is now fixed in master and @xeokit/xeokit-sdk 2.0.1 on npm.

So, for the motor_notWorking.3dxml file we now correctly see this in the JS console:

xeokit-sdk.es.js:1032 [xeokit plugin XML3DLoader]: Schema version not supported: 4.3 - supported versions are: 4.2

We just support 3DXML 4.2 at the moment.