I want to be able to count the number of enclosed line sequences in a given autocad file. For example there are 4 enclosed objects inside the larger circle below:
When I upload a very intricate 2d design in .dxf format, I can successfully retrieve all the number of lines and arcs, but I don't see any way to retrieve the number of enclosed objects. Is this possible with the Model Derivative API, or any of autodesk's APIs for that matter?
Unfortunately, Model Derivative (MD) API does not provide the information on which are closure curves. While if you have loaded the drawing in Forge Viewer (in the browser), you can get all geometries data: https://forge.autodesk.com/blog/dump-geometries-2d-curve And check if they are closure by some other algorithms: Check if a curve is closed If it is a block with some closed curves, it may be challenge to sort them out because after MD translates, the geometries are not a kind of entities of DXF/DWG anymore. They are primitives only.
The other way would be take advantage of Design Automation of Forge if you are familiar with AutoCAD plugin development. Then on the cloud, run the plugin to check if a polyline is closed (by AutoCAD API), or it is a region (so it is closed by default) or other possibilities (just by AutoCAD API).Finally, map the entities by their entity handle, if you want to highlight them in Forge Viewer. We do not have an exact sample, but to get started with Design Automation of Forge, the documents may be of help: https://forge.autodesk.com/en/docs/design-automation/v3/developers_guide/overview/ https://forge.autodesk.com/en/docs/design-automation/v3/tutorials/autocad/