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

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.

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.

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.

Directly access Revit DB API to Extract and Update properties without Revit Desktop application

In Design Automation Api for Revit - https://forge.autodesk.com/en/docs/design-automation/v3/developers_guide/overview/ I am very interested in this sentence "By providing access to the full Revit DB API, without the requirement of installing Revit on the desktop" . The examples and tutorials refer to creating a revit plugin on my side, which requires desktop version of Revit. How do I extract and send data to the Revit DB API directly? My use case, is I want to Extract properties from Revit file as csv or json file, enhance it, and push it back directly to Revit DB.
The sentence you quote is absolutely valid.
The application executed by the Forge Design Automation API for Revit (or DA4R for short) requires no installation of anything whatsoever on the desktop.
In fact, it requires no desktop at all.
The examples and tutorial do indeed refer to creating a Revit add-in on the desktop.
This is purely for development and debugging purposes.
If you are 100% certain that your Revit DB API code will execute faultlessly under all conditions, you can skip the desktop add-in and debugging and install it in DA4R right away.

Does command that implements IExternalDBApplication need working instance of Revit application?

Actually, I want to find a way to work with .rvt file without starting Revit Application. I want to create monitoring plugin to track changes in Revit Document Model. I suppose it can be made with Application events DocumentChanged. But it may slow the work with model for users. So I'm trying to find a way to work with .rvt file without starting Revit. So, does command that implements IExternalDBApplication need working instance of Revit application?
Your question is confusing.
I assume you are confused.
There are two ways (and two ways only) to access Revit API functionality:
Install Revit on the desktop and launch an interactive end user session. Within that session, you can set up a .NET Revit add-in to subscribe to certain events and make use of the Revit API functionality within those event handlers.
Make use of the Forge Design Automation API for Revit.
In the latter case, you do not have Revit installed locally.
Instead, you upload your application to the Forge system and make use of the Forge API via HTTP requests to launch a Revit engine in the cloud and process your Revit API functionality.
In both cases, however, there is a running instance of the Revit application somewhere providing the Revit API functionality you make use of. This cannot be avoided.
Some helpful links for you:
Getting started with the Revit desktop .NET API
Forge Design Automation for Revit
The Building Coder discussion on DA4R, Design Automation for Revit
I hope this clarifies.

Autodesk Forge API - How can I convert DWG files?

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.