How properties.db is used in Forge Viewer? - autodesk-forge

The sqlite database file properties.db is usually the biggest file in the output from https://extract.autodesk.io/.
What is it used for in Forge Viewer, and if it's not used, why is it available in the ZIP file?

The reason this example is copying both is that the purpose of the sample is to demo how to extract the 'bubble' from the Autodesk server. The Design File' properties are extracted in 2 formats: aka json (json.gz) and sqlLite (sdb/db).
The Autodesk Viewer only uses the json format, but other systems may prefer using sqlLite. The json approach makes it easier when you code executes in client browsers.
It is fairly easier to modify the sample to exclude the sqlLite database if you are not interested to get this file. I can point you which code you need to modify if that's something you want to do.

That file contains the components properties as a sqlite database, which are also contained in objects_xxx.json.gz. The viewer only uses the json format.
That article shows how you can easily run the extraction code your your side, it doesn't extract the .db file:
Forge SVF Extractor in Node.js

Related

Exporting single OBJ out of multiple model URNs

I have implemented multiple models viewer using Autodesk forge. We are trying to achieve a functionality where users could select entities from different models from multi-model viewer and export a single obj file out of it.
but it seems, Translate a Source File API allows just a single model URN to be passed.
I'm looking for a way where I could create a single Obj from more than one model URN.
I think there is not built-in way to do that actually.
If you are working with NodeJS you can use glTF file format and follow this method :
Convert your different models with Forge-Convert-Utils
Merge with glTF-Transform following this answer : Multiple gltf loading and merging on server side
glTF is well supported now on many platforms and pretty efficient but if you really need OBJ you can use assimpJS (which is the JS port of assimp) to convert your files.

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.

CNC Manufacturability Analysis Autodesk Forge

I would like to build a CNC manufacturability analysis app using Autodesk Forge.
Setting the computational geometry algorithms aside, what kind of geometrical data can I extract from CAD files using this platform? also, is there an existing app I am unaware of?
Thanks
Depending on the input file format you can convert to different other formats:
Supported Translations
Though it's not obvious from the above list, all input formats support conversion to OBJ format, which can also be done at subcomponent level - so you don't have to export the whole model to OBJ.
Here is a sample that lets you access your files from A360 and convert them into whatever format is currently supported for them:
Model Derivative API sample
Source code: https://github.com/Autodesk-Forge/model.derivative-nodejs-sample

MarkLogic Java API batch upload files (.csv)

Im trying out the MarkLogic Java API and would want to bulk upload some files with the extension .csv
I'm not sure what to use, since the Java API only supports JSON, XML, and TXT files.
How do I batch upload files using the MarkLogic Java api? Do i convert everything to JSON?
Do i convert everything to JSON?
Yes, that is a common way to do it.
If you would like additional examples of how you can wrangle CSV with the Java Client API, check out OpenCSVBatcherExample and JacksonDatabindTest.testDatabindingThirdPartyPojoWithMixinAnnotations. The first demonstrates converting the csv to XML and using a custom REST extension. The second example (well, unit test...) demonstrates converting the csv to JSON and using the batch upload (Bulk Writes) capabilities Justin linked to.
If you have CSV files on your filesystem, I’d start with mlcp, as suggested above. It will handle all of the parsing and splitting into multiple transactions/batches for you. Take a look at the mlcp documentation for more details and some example configurations.
If you’d like more control over the parsing and splitting logic than mlcp gives you out-of-the-box or you’re getting CSV from some other source (i.e. not files on the filesystem), you can use the Java Client API. The Java Client API allows you to efficiently write batches using a WriteSet. Take a look at the “Bulk Writes” example.
According to your reply to Justin, you cannot use MLCP because it is command line and you need to integrate it into a web portal.
Well, MLCP is released as open cource software under the Apache2 licence. So if you are happy with this licence, then you have the source to integrate.
But what I see as your main problem statement is more specific:
How can I create miltiple XML OR JSON documents from a CSV file [allowing the use of the java API to then upload them as documents in MarkLogic]
With that specific problem statement:
1) have a look at SplitDelimitedTextReader.java from the mlcp source
2) try some java libraries for this purpose such as http://jsefa.sourceforge.net/quick-tutorial.html

Convert autodesk .dwg and .dwf files to three.js json format

I want to render 3D graphics files of autodesk (.dwg and .dwf) using three.js but three.js requires 3D data to be in json format. So, I need to convert these files to three.js readable json format. I tried searching on the internet but couldn't find any solution. Can anyone tell me a good converter for these files?
Thanks in advance.
In fact Autodesk already have a converter & wegbl viewer. Go to http://developer.autodesk.com and get a key for View & Data API. There is a server side REST API that allow you to upload a CAD file and convert to a JSON stream. You can hook to it and get the output. Or, even easier, just use the JavaScript client side API to embed the viewer on your website/app
Update
The API was renamed to Model Derivative + Viewer, the first translates the source file (e.g. DWG, RVT and many others) to a web-friendly format that can be viewed on the second, which is based on Three.js (and can be customized).