0

I am trying to load a custom model with a texture into Forge Autodesk viewer, using the function loadModel(), that I found here. The other day, the model was loading, but without its texture, and no error appeared... As usual, strange things happened during the night, and today, the model does not even appear in the viewer. This time, I get the following error :

Uncaught TypeError: Cannot read property 'proteinType' of undefined

At first, my model was a zip folder, containing an .obj, a .mtl and a .png (for the texture). I translated it into svf using Forge extractor. So I am using, locally, in a 'Resources/3Dmodel' folder, ths resulting svf folder. It contains the .tif.png texture, the .svf file, a Materials.json.gz archive and other usual files in a svf folder (properties, camera definitions...).

There is no ProteinMaterials.json.gz archive. So I can suppose the issue may come from the Materials.json file... I opened it, but I don't see anthing unusual inside...

So if anyone has an idea...

EDIT !

I had written in my code :

window.NOP_VIEWER.loadModel(svfPath_test, options), (myobj) => {
        myobj.id = id;
        myobj.name=name;
        myobj.path=svfPath_test;
    })

and nothing was loading.

After writing only this :

window.NOP_VIEWER.loadModel(svfPath_test, options)

the object appears, but completely gray, the texture is still not applied... and now I have this new error :

Texture load error 404 (NotFound)

It does not find the texture in the folder, but IT IS in the folder, with the right name ! So : I am starting to wonder if the image really is on the server... or not. I don't know how to check this or insert the image in the server.

Fred Coud
  • 127
  • 1
  • 1
  • 13

1 Answers1

0

Keep in mind that there is Autodesk Forge Viewer Usage Limitations Disclaimer stating that "The Autodesk Forge viewer can only be used to view files generated by Autodesk Forge services. The Autodesk Forge Viewer JavaScript must be delivered from an Autodesk hosted URL".

Nevertheless, from engineering perspective, the reasons of your troubles could vary. Could be the version of the viewer you use is not compatible with translation viewer.

From what I remember, the Forge extractor sample creates self contained (locally downloaded all dependencies) project, but for conversion it uses the Forge servers.

There might me a "misalignment" between version of the Model Derivative API and the version of Forge Viewer you use. I would suggest, to convert your model using the official way, serve your model from the server and put it into a created from scratch basic Viewer. Then gradually add/replace/integrate/"migrate" to the "airplane mode" and identify at which step it breaks your model.

Or just change the locally served viewer3D.js, three.js and style.css to remote src and you can even try to play with Viewer version you use in your project by changing/adding the versioning. For example the lates one is:

<script src="https://developer.api.autodesk.com/derivativeservice/v2/viewers/viewer3D.min.js?v=v4.1"></script>

Now, if I put back the legal hat, be careful with legal aspect of your use-case.

denis-grigor
  • 505
  • 5
  • 9