0

I am trying to use forge-rcdb to display my own models from Revit. Currently, i can display one model and its properties. The next step is to display 2 models in the same viewer. The ModelLoader panel is well displayed, but when I click "+" to add another model, my list of models appear in the model list. But when I actually choose one... Nothing.

I put some of my models in rcdb.models.json and rcdb.gallery.json (i only have their paths). They do appear in the 'choose a model' panel

I tried to analyse the files Viewing.Extension.ModelLoader.js and ModelSvc.js. Some of the functions inside call the models urn and something called: "apiUrl".

In my case, since I use my own models, I only have a path, no urn.

In the console panel, the following error appears :

Uncaught (in promise) DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.

Whatever the model I choose, I have this error. Two of the models I use are mine, and two are from autodesk default models (so they have a urn).

So my first question is: do I need an urn for my models since the functions seem to work with it (i'm not sure), and how do I get an urn when I only have a path?

Second question: what is "apiUrl", what does it describe and how do I use it?

Third question: I tried this example and when I display the console, it seems it calls some API/gallery folder with strange things inside. What does it contain, and is it linked to "apiUrl" and what is displayed inside ModelLoade-choose a model panel?

Fred Coud
  • 127
  • 1
  • 1
  • 13

1 Answers1

1

You need to take a look at this article to understand how the application is using path vs urn for your model info stored in the database:

Working seamlessly online/offline when developing your Web applications with the Forge Viewer

The apiUrl is a parameter that is passed to some services and that defines on which url are going to be performed the calls to the api, if you don't change any settings it should be /api but you may pass another value, for example /myapi if for some reason you want to run the api server on a different route.

So in the current implementation the modelLoader extension is using the parameter database which is passed in the options to build the url on which to request the models list. Supposing you are running the sample locally and have the same setup in your mongoDB with a collection named gallery, you should be able to type in your browser http://localhost:3000/api/models/gallery and see something like below. This is the list of models that will be displayed in the modelLoader panel.

enter image description here

Felipe
  • 4,325
  • 1
  • 14
  • 19
  • Ok, now i understand the apiUrl thing. Thanks. – Fred Coud Feb 13 '18 at 11:01
  • However, and i think my gallery and URN are right, i get this error when i try to load a model : "DOMException : Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.". So I tried to just write my URN in the file and it was decoded successfully. It seems that in fact, the URN that is taken in the function 'atob' is "undefined"... So no, it can't be decoded. But why is it undefined ? I did set them in my gallery and models ! And I do see my own gallery with the link you gave. – Fred Coud Feb 13 '18 at 11:06