Get PropertyDb for SVF2 - autodesk-forge

I have been trying to get the PropertyDb for the new SVF2 format.
Currently it seems that the data in the PropertyDb and when getting properties through endpoint is different, or am I missing something?
If it correct that the endpoint gives the data from the new SVF2, but the downloadable PropertyDb is still SVF data? If yes, is there a way to download the SVF2 propertyDb?

SVF2 has no propertyDB file per say, so it is different from SVF. At least the way way SVF2 creates its properties files is different from SVF, and highly more difficult to d/l and interpret.
However, if you read the model manifest, whether it is SVF or SVF2, you'll find an entry which tells you where is the SVF Property DB file, and that did not change. But that sounds not what you are asking.
Next, the endpoint you mentioned should be working like before (no change) - the only difference is that if you requested a SVF translation, that endpoint will use SVF db ID, and if you requested a SVF2 translation, that endpoint will use SVF2 db ID.

Related

directly get svf from BIM360 hub/project/model

instead of using Model Derivative, is it possible to get file in SVF format directly from BIM360 model which has already been converted to SVF or SVF2 format? I mean not using MD service at all, thanks.
To download SVF dataset (no matter from your own bucket, or from BIM360), you need to use Forge Derivative API to get manifest (GET:manifest) info and metadata (GET:Metadata) info. The info will tell the relative cloud path of the *.svf, while *.svf stores the index of the dataset. Then download them one by one.
We have a few code that demo how to download SVF data to local. The most updated one I would recommend is my colleague Petr composed:
https://github.com/petrbroz/forge-convert-utils
It targets to convert SVF to glTF, but it has quite a few granule modules, one of which can download SVF data.
you could perform a simple test:
download the source code of the tool
run npm install
run npm run-script build
export your Forge client id and secret to env
run node samples/download-svf.js <your model urn of BIM360> <local path>
It will start the process to get manifest and download the SVF data one by one to local. This is a screenshot with my test. If you work with js, typescript, you could merge the module to your workflow.
In the context of BIM360, the uploaded models will be translated to SVF(s) automatically. So you can get the metadata, properties or load in Forge Viewer directly. This is a tutorial on how to work with BIM360 hub/project/folders/item/versions, in which no specific step to translate models.
https://learnforge.autodesk.io/#/tutorials/viewhubmodels
Pease note: this encourages the programmers, solution builders to provide extensible abilities for the end users of BIM360, adding more values for them. It does not mean to be an alterative to bypass model derivative when the solution is not for BIM360 users.

Model Derivative API object ids don't match PropertyDatabase object ids

I have developed an application that gets the JSON object tree of a BIM 360 revit model's view, using the Forge Model Derivative endpoint, then downloads the SQLite PropertyDatabase to query properties of several object tree entities. That was working fine until now. Recently, I am having trouble with some models where the object tree derivative object ids don't match the PropertyDatabase object ids.
I have seen this post Temporary workaround for mapping between SVF1 and SVF2 IDs but this method is not valid in my case because my app works on the server side and not uses viewer API at all.
My question is: if there is a workaround using APIs from the server side, and if there are plans to solve this inconsistency between APIs shortly.
Unfortunately, this behaviour is expected with your approach. SVF and SVF2 do not share the same IDs, SVF2 IDs are optimised to process data faster and to try keeping them identical across versions. The article you make reference to is only working in the context of the Viewer, for server side processing you need to get the dbid.idx file to map IDs. This utility has a command to help you downloading the file. Try:
./forge.js version-svf2-idmap project_id version_id output_dbid.idx
This file is a gzip compressed file of a uint32 array.
What happened is that you did download the SVF SQLlite db using SVF ids. But when using the MD endpoints, you actually using the SVF2 ids because the target format is SVF2. If you did request a SVF target format, the MD endpoint would work with SVF ids. Unfortunately, you do not control BIM360 target format which could either be SVF or SVF2 depending of the source file format. For example, IFC, RVT, NWD, DWG are SVF2, but others are not. You can determine which format is used by reading the outputType and overrideOutputType. If overrideOutputType says 'svf2', then you should do the mapping.
The relevant code for the version-svf2-idmap is here
On the other hand, if you got the SQLite database, why do you need to call the MD endpoints, you got everything you need, and can extract the information much faster from there. See my example here. It has functions for properties extraction, and/or building the hierarchy tree.

Missing Autodesk.AEC.ModelData in model forge viewer

I am trying to access Autodesk.AEC.ModelData data in forge viewer.
I have two revit models.
so while consuming it inside the viewer for the first model have the Autodesk.AEC.ModelData but when I am trying to access Autodesk.AEC.ModelData in 2nd model it returns me empty.
After verifying in postman by calling api I found in the second model
there is no role with the name Autodesk.AEC.ModelData and I could not find any url with AECModelData.json
so I would like to understand where is it going wrong is it problem at translation level or is has to do it with revit software. do we manually need to add AEC data before exporting file to rvt or nwd ?
please let me know any other solution to access this data or the area where I can take a look
Only RVT saved with Revit 2018 and later will generate AecModelData. If you still cannot see it on files of Revit 2018 and later, you can try to translate it again with the x-ads-force: true request header.

How to export XML from Naviswork to Forge Viewer

I following this tutorial
for import and work with viewpoint from Naviswork to Forge Viewer.
Do you know any solution or API on Naviswork to export this viewpoint data and saved it on my Database. Thank you in advance !
It sounds like a Navisworks API question, instead of Forge. Navisworks API does not provide a direct method to export to saved viewpoints like UI does. I happened to answer a similar question in the past. just copied here for your reference:
There is not a direct API, but with SavedViewpoint API, you could dump the data from the objects, and write to the XML yourself.
http://adndevblog.typepad.com/aec/2012/06/navisworks-net-api-2013-new-feature-saved-viewpoint.html
It might be possible not all properties in the standard xml have corresponding object with API, such as terminal_velocity, however it would not impact your workflow, as most properties (especially camera related) are available with API.
About data of redline, activate each saved viewpoint one by one (by DocumentSavedViewpoints.CurrentSavedViewpoint) , call Document.ActiveView.GetRedLines(). It can return all info of the annotations: line, eclipse, text etc in Json format.
About data of clip planes, you could use Document.ActiveView.GetClippingPlanes(). Similarly, in Json format.
Hope it helps.

Autodesk Forge - Post Jobs - Must files be in buckets and proper URN

I am working on doing a post job and I am confused about where files need to be to run the job and the proper urn.
The examples all use a file that the user uploads to a bucket. I am trying to run the post job on a file that a user has created in Fusion 360 and that he has selected through a GUI I created. The urn in question is obtained by letting the user select the hub, project, folder(s), and file. I then use this file urn on the post job.
I keep getting back the response of :
Failed to download the design description for the input design.
My questions are:
Is it possible to do this from a users hub or do all items have to be in buckets?
Where are those translated files stored once created? If I want to get data like volume and mass without storing the translated file, is that possible?
I took the "urn:" off the front of the urn and got a different error, which I believe meant that it couldn't find any file.
Invalid 'design' parameter.
So, it looks like the urn I am using is finding a file but there is an issue somewhere that is preventing that file from being accessed or translated or something.
I keep getting back the response of : Failed to download the design description for the input design.
For Fusion 360 files make sure the extension name of the object is f2d/f3d. BTW Forge Viewer support these two formats directly so you don't have to translate to SVF for Viewer to visualize them.
Is it possible to do this from a users hub or do all items have to be in buckets?
For hub project items use the Data Management API to obtain the object ID - be sure to include the version parameter in your URN - see GET projects/:project_id/folders/:folder_id/contents and use the id of the item as your URN as well as tutorial here to help you understand how project folder items work.
Where are those translated files stored once created? If I want to get data like volume and mass without storing the translated file, is that possible?
The translated derivatives would be stored separately and you can access them through the derivative manifest. Use GET :urn/metadata/:guid/properties to query derivative properties but you will need to translate the model (to any format will do) in order to extract properties - see tutorial here.