user3166544
user3166544

Reputation: 1

Get Data from Autodesk Foge Viewer (View & Data Api)

I want to do some calculations on the DWG files uploaded into Forge Viewer. I am trying to let the user select favorite objects on the shape and get for example the area of that object (e. g. wall or door). But the problem is that CAD files are not in a standard format so the end user must pay much of care to select right elements (e.g. segments making a given wall) to have them as a single object. Is there any way to make it simple and extract the area or other geometric characteristics directly? Which API must be used? —Thanks!

Upvotes: 0

Views: 393

Answers (1)

denis-grigor
denis-grigor

Reputation: 515

The Forge Viewer will just display the available information and the metadata (properties) associated to selected component. Thus, if there are no associated data on a selection, it will not infer it.

From this perspective, your main approach would be to group the need segments/parts, compute data you need (g.e. the total area of grouped components) and associate the computed data to that group. Then in Forge Viewer, when clicking a segment, it will select the associated group and display the added geometric characteristic.

In this context, providing that you have a script that performs the grouping, computing and data association for a given DWG file,the Forge API could be used as follows:

  1. use Design Automation API to automatically run the "consolidation" script on needed DWG files;
  2. use Data Management API to store and manage the resulted files;
  3. use Model Derivative API to convert the resulted files into a "view-able" format;
  4. use the Forge Viewer to display them.

We have many samples illustrating use of these APIs, but I suggest you to look at https://github.com/Developer-Autodesk/design.automation-custom-data-viewer, which might be the closest to your use-case.

I hope it helps.

Upvotes: 2

Related Questions