0

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!

1 Answers1

2

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.

denis-grigor
  • 505
  • 5
  • 9
  • Thank you for the response. What still remains unclear to me is the script you talked about. Would you please clarify where this script is going to perform grouping operation? Is that going to be a script developed via Autodesk Forge API or a JavaScript one? If yes, How to identify associated objects? It seems metadata is still required. – user3166544 Nov 28 '16 at 20:30
  • Just to mention that since our goal is developing a web application to which users will upload CAD files, show it in Forge Viewer, calculate given information and get the outputs, it seems there must be some standard criteria that enforce the users to primarily follow before uploading to our website (i. e. some metadata rules that users must observe the time they are producing the file in AutoCAD environment). So, do we need to push our users to follow those rules or we can just make it simple via a fully automated script without concerning about the uploaded files? Thanks. – user3166544 Nov 28 '16 at 20:30