Autodesk Forge API - How can I convert DWG files? - autodesk-forge

I am an App developer with no experience with AutoCAD at all, and for my current project I need to convert DWG files into Spatial Data - ESRI Shapefile / GeoJSON, etc.
Given that DWG is a proprietary format owned by Autodesk, the Autodesk Forge API becomes my only option to interpret such file. I have been evaluating the Model Derivative API for a week now, and what I found is that it won't work for my purposes. It has only 3 output formats (f2d, f3d, rvt) for DWG files and none of them fits my purpose.
For this reason, I started to look at others API's in the platform and ended up finding the Design Automation API which might be helpful, however it lacks documentation.
One of the examples in the API is the PlotToPdf activity that exports a DWG into a PDF. I wonder if there is a way to export other formats other than PDF.
I tried to find the possible "commands" in the interface by listing all the activities, workItems and AppPackages but none of these end-points returned me any useful information.
So here are my questions?
How can I can convert a DWG into a non Autodesk format? Being more specifically, the output must be an open format that I can interpret without using proprietary tools.
If the answer for the first question is Autodesk Forge API, which one should I use?
In case I should be using Design Automation API for that, where can I find complementary documentation once the one provided is lacking details?

I would say that Design Automation API is the best option if you don't have (or don't want) AutoCAD running (or any other DWG compatible desktop app).
To be complete: Design Automation includes an instance of AutoCAD running on the cloud, where you can upload a .DWG with a sequence of commands (script) and a .NET custom app to execute more advanced routines. Then download the results. By default, neither AutoCAD nor Design Automation can export to GIS formats (like those you mentioned), only some verticals, like Civil 3D or Map 3D, but these are not available on Design Automation. As you mentioned, Model Derivative API (via REST calls) don't have what you need, it's focused on metadata, not the specifications of the geometry.
Design Automation API supports the same commands AutoCAD Console does. For DXF creation, you can use DXFOUT command, your script would be something like (not tested):
FILEDIA
0
DXFOUT
outputfilename.dxf
QUIT
As per comment, it's a huge effort to just convert to .DXF. I'm not familiar with other libraries do perform the same task.
Now I'm not an expert on GIS data formats, but you may consider move from .DWG to .DXF then an approach like described here.

I don't quite understand this point that you are making in the comments:
I would only use the API to convert DWG to DXF, which means a huge waste of resources considering the monthly cost of the API and the time to develop and maintain the interface.
Can you clarify? Are you saying that transaction cost for Design Automation is too high? Or are you saying that development cost associated with deploying the script that Augusto gave you is too high?
Thanks

Right now the derivativeApi is the way to go for this: You can convert any input format from this list (https://developer.autodesk.com/en/docs/model-derivative/v2/overview/supported-translations/) to the "intermediate format" svf and the convert the svf file to obj for example. This will also create a material file which can be downloaded seperately. I am evaluation the forge api right now and can produce obj from dwg files right now.

Related

What input file types does the Forge Design Automation API (AutoCAD) accept?

I cannot find any resource similar to the Model Derivative API that has a list of supported file translations.
can the autocad Design Automation API take in .dxf, pdfs, etc., or is there a list somewhere?
Design Automation for AutoCAD can process DWG,DXF,DWT and DWS, unlike Model Derivative which has translation capabilities, Design Automation is a service to run automated jobs.
At the moment, importing PDF in Design Automation for AutoCAD is not possible.

How can I use the Design Automation API to extract metadata from an uploaded AutoCAD file?

Per my meeting with Denis Grigor, I was informed that the the Design Automation API has the same capabilities as Model Derivative API to extract metadata from an uploaded AutoCAD file. Model Derivative has a fixed-job pricing structure which is more cost-effective for large files, since it's charged per job, whereas Design Automation is charged per processing hour.
My client will only be extracting data from smaller files, so it doesn't make sense to use Model Derivative API if Design Automation can do the same.
I don't know where to start however. Which specific APIs do I need to use if I want to upload an autocad file such as .dxf or .dwg and retrieve geometric results using Design Automation API?
Whether you are setting up a Design Automation pipeline for AutoCAD, Inventor, Revit, or any other "engine", the process is pretty much the same
develop and debug a plugin/script (in your case an AutoCAD plug-in) locally
upload the plugin/script to Design Automation service as an app bundle
create a Design Automation activity - a reusable template for tasks you will want to execute later, specifying the engine, app bundle, inputs, outputs, etc.
create a Design Automation work item, executing a task based on an activity with specific inputs/outputs (usually just URLs where input files can be downloaded from and output files uploaded to)
Here's a blog post with a simple example using Design Automation for Inventor - it takes an Inventor plugin that generates custom screenshots, and turns it into a Design Automation activity that is later executed with different input Inventor models: https://forge.autodesk.com/blog/simple-introduction-design-automation-inventor.
The same process is also explained in this tutorial: https://learnforge.autodesk.io/#/tutorials/modifymodels.

Export Schedules from Revit Model using Design Automation API

I have found a plug-in to manually export schedules (rebar, production bom, material lists) from Revit models. However, our company is looking to automate this and take out the human required element of exporting these schedules.
I have not, so far, found a way in the Forge API (Revit Design Automation API) to access these schedules like a can with a custom plug in.
Is this support coming or is there a place to vote on this capability?
Thanks,
Chris
The Forge Design Automation API for Revit enables you to run the same .NET Revit API code as the Revit.exe executable on the Windows desktop. Therefore, you can probably convert the existing desktop add-in to run within the Forge environment. There is no missing capability, not additional support needed, and no need to vote for anything. The Building Coder has explored and documented how to migrate and convert existing desktop Revit API add-in code to run in the Forge design automation environment in the topic group on DA4R – Design Automation for Revit.

Getting the list of all the views in a model on Forge

I am working on a Revit plugin to run on Forge (Design Automation app) that exports a 3D view through a custom exporter. As an input argument, it requires the name (or ElementID) of one of the 3D views from the Revit model. Is there a way to query the name of the views of a Revit model through other Forge solutions (like Data Management API)?
I couldn't find anything, if there is not an http api for that I assume I have to do it as part of my plugin run. What's the best to do that then?
Should I have a separate plugin that extracts the view names?
Thank you so much!
From your description, it appears that you have very little experience with Revit API add-ins. Maybe you should take a look at the getting started material first and work through the video tutorial. It explains a lot of important fundamentals, including covering this current question of yours.
The (almost) one and only way to retrieve elements from the Revit database is to use a filtered element collector. That would be the method of choice to find the element id of the 3D view you are looking for.
You cannot have searched very exhaustively, because many discussions by The Building Coder on the custom exporter and other topics include a code snippet showing how to pick a 3D view suitable for exporting.
To ensure you really have a 3D view set up just as you need it, you might prefer creating a new one from scratch.
Out of curiosity, is your task associated with the discussion thread on Revit API vs. ReCap API for historic project?

Is there a specification available for the Autodesk SVF format?

I'm building a cross platform 3D viewing application in C#/C++ and would like to add support for Autodesk SVF files.
I looked at Autodesk Forge but it has limited support for exporting to open formats such as OBJ, and Autodesk SVF does not appear to be the same format as the similarly named Simple Vector Format (http://www.svf.org/) as was stated here: https://forge.autodesk.com/blog/updated-little-more-detail-behind-autodesk-forge-apis-0
Is there a schema or specification available somewhere that details the structure of Autodesk's SVF format?
The short answer: no there isn't as it's a proprietary format (that has been breached in some country already and legal actions were needed to resolve the issue...)
The long answer and please view this as my personal rambling w/o any real authority or credibility:
I'd recommend to stay tuned to the official Forge website and see if they'd choke up more info on SVF(aka the Streaming Viewing Format) for public knowledge.