Values for volume, area and length in Autodesk Forge Model Derivative API - autodesk-forge

I'm using Forge to extract data from Revit models (transformed to .nwc). I call
GET /modelderivative/v2/designdata/{urn}/metadata/{guid}/properties
to get all properties of my model. The problem is that for some reason values for volume, area and length for all Revit objects are now in the format "0.009 ft^3", while before they all were just numbers. What can be the reason for this? Is this an API change or the model is saved with some special parameters, etc.?

Yes, this is a change because previously you could not tell the unit of any of the values. Now it's showing the values as you find them in the Viewer as well.

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.

dbIds from the Forge Viewer and the Model Derivative API are different

I'm working on creating a forge viewer-based web system linking with my client's BIM360 environment. For the model data extraction part, I refered to the examples below.
(1) https://github.com/xiaodongliang/forgeviewer_embed_in_powerbi_report/tree/master/forge-model-properties-excel
(2) https://github.com/Autodesk-Forge/bim360appstore-model.derivative-nodejs-xls.exporter
However, I realized that the dbIds from the Forge Viewer and the sample codes are different. Is this the reason because of the SVF version discrepancies (i.e., SVF1 vs. SVF2)? If yes, any suggestion to resolve it?
Moreover, some models were not correctly processed when I tried to extract model data using the second example code (i.e., ForgeXLS.js example). The code was not processed after calling "prepareTables" function. It seems like it has issues to conduct "getMetadata", "getHierarchy", and "getProperties" functions. Could you let me know some possible reasons?
SVF version discrepancies
yes, the dbId of SVF is not consistent in all versions of the model. SVF2 dbId can be same in different versions, but the ideal is to take advantage of external id of the object. i.e. build a map from the first version of the model with external id. When you want to use dbId, search the dbId by external id
extract model data using the second example code (i.e., ForgeXLS.js example)
I'd believe it is just because the metadata / properties of the model version sis too large. you may try to add the header forceget when fetching the properties
https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-guid-properties-GET/

Is it possible to load only one specific object from the model(document) when initializing the document in the Forge viewer?

We would like to know if it possible to initialize the viewer to only render an specific object id.
There is a tutorial to extract geometry from a model, but it involves using the derivative to convert geometry to OBJ.
https://forge.autodesk.com/en/docs/model-derivative/v2/tutorials/extract-geometry-from-source-file/
The idea is to create a catalog of objects based on the elements in a model (document). We usually work with Revit files.
Viewer works with dbIds (or nodeIds which are equivalent to objectIds) and may load bubbles (geometry constructs) selectively based on - see live sample here
viewer.loadModel(svfUrl,{ids:[dbIds...]})

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);

DerivativesApi.GetModelviewProperties for subset of properties

The model viewer has the ability to get properties by passing a filter: viewer.model.getBulkProperties(dbIds, ['externalId', 'Category'], function) where we can limit the results to just the two properties 'externalId' and 'Category'.
It would be a huge benefit for us to have this same filtering capability from the model derivative api:
https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-guid-properties-GET/
We have Revit files with 40,000+ parts, and it can take over 15 minutes to query for properties, but we are getting far more data than we need.
it is a reasonable enhancement. I logged it as an internal ticket DERI-4610.
If you have used Extractor to download the whole SVF dataset to local , you could try with extract the properties from properties.db (the other post tells more). This is a lite sql database which is actually used by Derivative API on Forge cloud. I'd think there is some smart ways to filter the specific properties by the db file.