how to calculate area and volume using svf file in forge viewer

最后都变了- 提交于 2019-12-24 07:28:36

问题


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.


回答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.



来源:https://stackoverflow.com/questions/45034093/how-to-calculate-area-and-volume-using-svf-file-in-forge-viewer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!