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

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

Related

How can I download the svf file in the forge api?

How can I convert the file I uploaded to Forge to svf format and then download it to my own server?
I wanted to do these operations using your project "https://github.com/Autodesk-Forge/forge-bucketsmanager-desktop/tree/master/bucket.manager". As a result, I downloaded it, but there are files in it that I will not use. The reason for this is that the load on the download process increases. I just want the "3d views" folder. Can you help with this?
As Alex said, the structure of an SVF asset can vary depending on the input file format. For more details on how to download the SVF (or just some of its parts), take a look at the forge-convert-utils library, specifically the SvfDownloader. It parses the actual SVF file to identify all the additional assets (e.g., geometry files, textures, property database files, etc.) that need to be downloaded as well.

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.

How can I export a .dwg file from the Forge Viewer that also includes MarkupsCore markups?

I'm working on a javascript application that uses the MarkupsCore extension to create markups on a floor plan in the Autodesk Forge Viewer. I want to export a .dwg file from the viewer, but I also want the file to contain those markups. I basically know how to export the .dwg file, but I don't know how to combine the svg markups with the file before exporting. Is this even possible? If so, how?
The markups as stored/saved as SVG files, which is a XML-based format to describe geometry. And I believe you know that :-) I did a quick search and found a few articles about SVG to DXF conversion, where DXF can be imported and converted into DWG via AutoCAD engine (or Design Automation API).
So a route would be: show DWG model, add markups, save as SVG, convert to DXF, convert again to DWG, merge into original DWG. I don't have such a sample nor can guarantee it will work and be accurate, sorry.

How properties.db is used in Forge Viewer?

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

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