1

I need to calculate volume and area of surfaces of 3D file. Since forge api can convert all kinds of 3D file to svf format, so If I can calculate area and volume from svf format file , then my program can handle all format 3D file that forge api support. But forge viewer doesn't have the api to calculate area and volume. Because forge viewer is based on THREE.js, so I guess if I can use THREE.js's api to calculate volume and area. I read the api of forge viewer, but there is no api to get geometry of THREE.js from forge view.

var viewables = Autodesk.Viewing.Document.getSubItemsWithProperties(doc.getRootItem(), {'type':'geometry'}, true);

I try this one, It's not geometry of THREE.js , but forge viewer's. It can't be used to calculate.

john.le
  • 25
  • 3
  • THREE.js doesn't have an API to calculate volume and area either (AFAIK), so I'm not quite sure what your approach is here. Any code for that purpose that is readily available from other SO answers should apply to any triangle-based geometry, so if you can figure out the Forge geometry format that should be doable. – Paul-Jan Jul 11 '17 at 14:08

1 Answers1

1

Apologizing for the bad news, there is no API available for calculating area or volume in the Forge Viewer as I know, but you make some workaround by yourself.

For converting Forge fragment into THREE.Mesh, you can check here, here and here. For area calculation, you can refer some codes of the Forge Viewer in the Autodesk.Viewing.Extensions.Measure.Snapper.prototype.snapping3D and Autodesk.Viewing.Extensions.Measure.MeasureTool.prototype.getFaceArea.

Hope this help.

Eason Kang
  • 6,155
  • 1
  • 7
  • 24