Loading a BIM360 model from a deployed site returns 9: BAD_DATA_NO_VIEWABLE_CONTENT - autodesk-forge

I have some JavaScript that calls the function Autodesk.Viewing.Document.load(...). When I run this locally, I am able to successfully load a model, but when the code is deployed the exact same model returns the error
9: BAD_DATA_NO_VIEWABLE_CONTENT
Any ideas what the issue would be?

There are various reasons why loading a model from Forge could return the error code 9, for example:
you are loading a model that has not been processed using the POST job endpoint yet
the model has already been processed but the translation failed for some reason (use the GET :urn/manifest endpoint to check if you see "status": "success")
the model was translated successfully but there is no actual viewable content in it (e.g. a Revit model with no 2D sheets and no 3D views specified)
the model was translated successfully, but the output derivatives have been removed, either manually (using the DELETE :urn/manifest endpoint) or perhaps automatically after the original file was removed from a Forge OSS bucket

Related

Forge Viewer shows different data from Model Derivative data on IFC file

This is a process that I've always used. First I call the bulk data from model derivative for further structuring. But this time the derivative data is confusing. Because when I use getProperties from viewer it shows external id with expected format(0/0/0/145/79) but when the same element is called from derivative api, on the field of external id, ifcGUID (11h5ts$FhghhDGbOs) is written.
In short I can not get external id of element from derivative Api but it can be found from viewer.
What could cause to such confusion ?
Today I have uploaded the model with SVF format instead of SVF2 and it looks like everything is working fine and as expected. But I think this topic needs further investigation.

Creating scene definition against beta server gets 422 error

I'm trying to use the Unity AR/VR Toolkit with a SVF file I've created by following the test-2legged script. My understanding from this answer is that the script needs to be updated to use the new server (https://developer-api-beta.autodesk.io) and a URL-safe encoded URN everywhere. I've done that, but when I try to create the scene definition (PUT /arkit/v1/${urn}/scenes/${scene}) I get a 422 with a msg of "must be a valid Bearer token for the requested resource (TK1-003)" (I've tried giving the token all scopes listed in the Forge docs).
This works fine with the server in the non-modified test-2legged script. I'm operating on a file that's already in Forge so I'm not including the bucket, and I've experimented with including and not including the object ID; the default server (https://developer-api.autodesk.io) works fine with just an urn; the beta server I can't get to work no matter what I try.
I don't see any documentation for this endpoint so I'm not sure if it's use changed between the servers. As far as I can tell, in the toolkit I can't get SVF files created against the non-beta server (I get 404's for the meshes), so I'm assuming I should be on the beta server, but I can't get it to work.
I took a look into the source code and TK1-003 means that the Bearer token was either invalid, expired, and the token was missing the data:create data:write scoped for this operation. Note that in case, you call and API with an invalid token, the server bans you for couple of minutes.
If you still having issues, please let me know and I'll remote assist you.

ARVR Toolkit Fragment Payload

I'm trying to get fragment data using the VRAR Toolkit API so that we can make some optimizations to the mesh data. We can create a scene, process the SVF into toolkit scene, and scene process finishes, but we're having issues when we actually have to get the fragment data.
Using the following endpoint:
https://developer-api.autodesk.io/modelderivative/v2/arkit/MODEL_URN/mesh/MESH_ID/FRAG_ID
Returns a 200 with an octet-stream, but I can't find any documentation as to what the contents of the octet-stream are. According to the documentation (https://app.swaggerhub.com/apis/cyrillef/forge-ar_kit/1.2.1#/ARVR-Toolkit/get_asset_fragment) we can specify whether to use legacy or openctm.
1) What is the legacy format? How can verts, normals, uv, etc. be extracted?
2) I tried the openctm option and saved the returned octet-stream to a .ctm file and tried opening in the OpenCTM Viewer available from (http://openctm.sourceforge.net/) but always get CTM_BAD_FORMAT error when trying to open the file for viewing. How can I confirm my openctm payload is correct?
The SVF format (including the mesh data format) isn't publicly documented but you can get some idea about its structure from the AR/VR Toolkit's Unity package source code: https://github.com/wallabyway/ARVRToolkit/blob/master/unity-src/ARVRToolkit/Assets/Forge/ARKit/MeshRequest.cs#L54-L89.

Not able to completely hide model in forge viewer

I am trying to hide the complete model in forge-viewer, for that I am calling forge visibility API as follows:
viewer.impl.visibilityManager.setNodeOff(viewer.model.getModelId(),true)
where viewer is a object of GUIViewer3D.
But this is not hidding the complete model, some components in the model are still visible.
I think it is a bug in forge-viewer because if I pass a root node of model to setNodeOff() API it has to hide whole model. I am sure that there is only one model loaded in my viewer session.
Refer this image for the elements which are still visible after calling viewer.impl.visibilityManager.setNodeOff(viewer.model.getModelId(),true)
getModelId() returns model IDs, and the visibility APIs expect node IDs. In order to hide the entire model, consider the following:
viewer.hide(model.getRootId());
Could you try something for me...
Could you try adding the header 'x-ads-force':'true' to the POST job request when you are converting the .RVT file?
Here is the documentation on the API request...
https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/#headers
Then, retrieve the URN and feed it to the Forge Viewer, as before, like this example:
https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-manifest-GET/#example
.
So... What's going on?
When you convert a RVT to a SVF (for the the Forge Viewer), it produces a random set of DBIds.
When you call the GetProperties API, it uses that cached SVF to pull the DBIds and provide you with a result.
Back in August, the GetProperty API engine, was updated. It produces a different order of DBIds compared to the old converted SVF.
Since the old SVF is cached, even if you submit a new job, it will use the old SVF.
To avoid the old SVF, we need to 'force convert' the RVT to SVF conversion, to flush that cache, so that the new SVF is visible and the Forge Viewer can retrieve it.
Once the Forge Viewer can see the new SVF, it should match the DBIds of the GetProperties API.
Complicated huh?
Let me know if that fixes the problem.
As my goal is to completely hide model from viewer, I achieved this by following:
viewer.clearSelection();
viewer.model.setAllVisibility(0);
viewer.impl.toggleGhosting(false);
viewer.impl.toggleGroundShadow(false);
This gives me the required behavior. The elements which I was not able to hide are now hidden through this approach.
to completely hide the model you can isolate an empty list, which will show the whole model ghosted, then you can turn off ghosting globally
viewer.isolate([]);
viewer.setGhosting(false);

GET :urn/metadata returns an empty list

I tried the method in the object with this RVT urn: dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLk1HQm5UX2MtVFhteHRzZzJZY2NXR3c_dmVyc2lvbj0x
I get this response with status code 200 {"data":{"type":"metadata","metadata":[]}}
I cannot extract properties using the model derivative API.
Hi we had a similar error where meta was empty.
This was because the upload had succeeded (we got a urn) but the translation had failed and getting the meta information on failed translation just returned an empty meta repsonse. This was specifically with revit files.
If you check the manifest endpoint with that urn do you see and revit file translation error?